Giter Site home page Giter Site logo

telepathyim / telepathy-qt Goto Github PK

View Code? Open in Web Editor NEW
25.0 17.0 13.0 8.18 MB

Telepathy Qt bindings

Home Page: https://telepathy.freedesktop.org

License: GNU Lesser General Public License v2.1

CMake 2.82% C++ 77.10% C 16.49% Python 3.46% HTML 0.05% CSS 0.01% Shell 0.07%
telepathy qt

telepathy-qt's Introduction

=============
telepathy-qt
=============

This is a library for Qt-based Telepathy clients and services.

Telepathy is a D-Bus framework for unifying real time communication,
including instant messaging, voice calls and video calls. It abstracts
differences between protocols to provide a unified interface for
applications. See the Telepathy website for more information:

  http://telepathy.freedesktop.org/

Telepathy specification
=======================

The copy of the Telepathy specification in the spec/ directory indicates
the specification that this library claims to implement. The HTML documentation for the latest version of the specification can be viewed at:

  http://telepathy.freedesktop.org/spec/

Requirements
============

Building telepathy-qt requires:
  Qt (DBus, Network and Xml for the library; Gui and Widgets are required for some examples) <https://www.qt.io>

  CMake <https://cmake.org/>
  pkg-config <https://pkg-config.freedesktop.org/>
  Python 3 <https://www.python.org/>

For the full set of regression tests to run, you'll also need:
  telepathy-glib <https://telepathy.freedesktop.org/releases/telepathy-glib/>

For building the Farsight convenience library, you'll need:
  telepathy-glib <https://telepathy.freedesktop.org/releases/telepathy-glib/>
  telepathy-farsight <https://telepathy.freedesktop.org/releases/telepathy-farsight/>
  GStreamer <https://gstreamer.freedesktop.org/>

and to build the Farstream convenience library, you'll need:
  telepathy-glib <https://telepathy.freedesktop.org/releases/telepathy-glib/>
  telepathy-farstream <https://telepathy.freedesktop.org/releases/telepathy-farstream/>
  farstream <https://freedesktop.org/software/farstream/releases/>
  GStreamer <https://gstreamer.freedesktop.org/>

See CMakeLists.txt for full details, including versions required.
Of the packages listed above, only Qt libraries are required at runtime.

Bugs, feature requests and to-do list
=====================================

Report all bugs, feature requests and "to-do" items here:
  <https://bugs.freedesktop.org/enter_bug.cgi?product=Telepathy&component=tp-qt>

Running "make check" will produce FIXME.out, which lists all the mentions of
FIXME, TODO or XXX in the source code. Ideally, all of these should be in
Bugzilla, but sometimes they're not.

API stability policy
====================

We use an "odd/even" versioning scheme where the minor version (the y in
x.y.z) determines stability - stable branches have y even, development
branches have y odd.

In a stable (even) branch, we will not make incompatible API or ABI changes
between one release tarball and the next.

In a development (odd) branch, if we make incompatible ABI changes
between one release tarball and the next, we will change the SONAME of the
library; we will attempt to avoid incompatible API or ABI changes.

Unreleased builds straight from git identify themselves as version
"x.y.z.1". We DO NOT make any API guarantees about unreleased builds:
any binary relying on new functionality from an unreleased build is not
guaranteed to work with any subsequent release or unreleased build, and on
platforms with versioned symbols (mainly Linux) it definitely won't work with
subsequent releases (you'll have to at least relink the binary).
We do not increment SONAMEs on the basis of unreleased changes.

Unreleased builds are compiled with -Werror, so they might stop working
if your gcc version issues more warnings than ours. If this is a problem
for you, use a release tarball.

Contact info
============

This library is maintained by the Telepathy project:
  <https://github.com/TelepathyIM>
  <https://telepathy.freedesktop.org>
  <mailto:[email protected]>
  <irc://irc.freenode.net/telepathy>

Telepathy development was supported by Collabora Ltd.
  <http://www.collabora.co.uk/>.

Hacking
=======

See HACKING for version control, coding style and patch submission information.

telepathy-qt's People

Contributors

a-andreyev avatar alban avatar altarbeastiful avatar andrunko avatar asoliverez-ccu avatar barisione avatar davidedmundson avatar detrout avatar drdanz avatar drf avatar dschmidt avatar er-vin avatar gkiagia avatar jbruechert avatar jpwhiting avatar jtojnar avatar kaffeine avatar kenvandine avatar leonhandreke avatar martyone avatar mbatle avatar mck182 avatar mgehre avatar olesalscheider avatar ollisal avatar senko avatar shadeslayer avatar smcv avatar xclaesse avatar xhochy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

telepathy-qt's Issues

Delayed DBus answer

We need to be able to delay DBus answers, but it is not possible with current design.
Some methods need to make a network request before complete the call.

Examples:

Telepathy-Morse also needs to delay Connection.Interface.Requests CreateChannel() to get a native identifier of created group chat.

use GNUInstallDirs

GNUInstallDirs.cmake has correct default for all sorts of directories, it also handles things like lib/lib32/lib64/… automagically. Porting to this module is advisable, it makes things much more portable. It also has a mechanism for users to override these defaults if necessary, which is also one that can be used on all projects using this modules.

Using the CMAKE_INSTALL_FULL_* variables of this module in the generated .pc file is advisable as it is the only way that things will work if e.g. the include dir is placed outside of ${prefix}.

SCRAM-SHA-1(-PLUS) + SCRAM-SHA-256(-PLUS) supports

"When using the SASL SCRAM mechanism, the SCRAM-SHA-256-PLUS variant SHOULD be preferred over the SCRAM-SHA-256 variant, and SHA-256 variants [RFC7677] SHOULD be preferred over SHA-1 variants [RFC5802]".

Can you add support for?

I add SCRAM-SHA-512(-PLUS): https://xmpp.org/extensions/inbox/hash-recommendations.html

Linked to:

Add initializer_list constructors to all generated list types

We need to adjust generator (qt-types-gen.py:302, qt-types-gen.py:563) to add
std::initializer_list<T> args, where T is array_of.

Expected diff in generated files:

struct TP_QT_EXPORT UIntList : public QList<uint>
{
    UIntList() : QList<uint>() {}
    UIntList(const QList<uint>& a) : QList<uint>(a) {}
+   UIntList(std::initializer_list<uint> args) : QList<uint>(args) { }

    UIntList& operator=(const QList<uint>& a)
    {
        *(static_cast<QList<uint>*>(this)) = a;
        return *this;
    }
};

Develop a specification of API to retrieve logs

API description

Use cases

Channel.Type.MessageArchive

Description

A channel type for logs retrieve. Inspired by Channel.Type.RoomList. Can be used to retrieve logs without opening channels for all possible targets.

Methods

GetMessages (a{sv} filter) -> void

Acceptable filter keys listed in FilterKeys property

Signals

MessagesReceived (aaa{sv}: array of Messages)

MessageHeader part:

  • message-sender (u - Contact_Handle) The contact who sent the message. If omitted, clients MUST fall back to looking at message-sender-id.
  • message-sender-id (s) The identifier of the contact who sent the message.
  • scrollback (b) Must be presented and must be true.
  • channel-type (u - Handle_Type) Must be presented.
  • target-id (s) The identifier of the target. Must be presented.

Properties

FilterKeys — as

Possible (optional) keys:

  • with-id - s (string) Identifier of the contact.
  • with-type - (u - Handle_Type) Must be presented, if there is with-id key.
  • start-timestamp - x (Unix timestamp)
  • end-timestamp - x (Unix timestamp)
  • start-message-token - s (Protocol_Message_Token)
  • end-message-token - s (Protocol_Message_Token)
  • limit - u (uint)
  • offset - u (uint)

Channel.Interface.MessageArchive

Objects implementing this interface must also implement: Channel.Type.Text and Channel.Interface.Messages.

Methods

GetMessages (a{sv} filter) -> void

Acceptable filter keys listed in FilterKeys property

Once the method is called, it emits Channel.Interface.Messages MessageReceived (aa{sv}: Message) signals for received scroll-back messages

Properties

FilterKeys — as

Possible (optional) keys:

  • start-timestamp - x (Unix timestamp)
  • end-timestamp - x (Unix timestamp)
  • start-message-token - s (Protocol_Message_Token)
  • end-message-token - s (Protocol_Message_Token)
  • limit - u (uint)
  • offset - u (uint)

Links

Report on FreeDesktop.org

Exists API

XMPP

XEP-0136: Message Archiving
XEP-0313: Message Archive Management

Telegram API

messages.getMessages#4222fa74 id:Vector<int> = messages.Messages;
messages.getDialogs#6b47f94d offset_date:int offset_id:int offset_peer:InputPeer limit:int = messages.Dialogs;
messages.getHistory#8a8ec2da peer:InputPeer offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages;
messages.deleteHistory#b7c13bd9 peer:InputPeer max_id:int = messages.AffectedHistory;
messages.deleteMessages#a5f18925 id:Vector<int> = messages.AffectedMessages;

https://core.telegram.org/method/messages.getHistory
https://core.telegram.org/method/messages.deleteHistory
https://core.telegram.org/method/messages.getDialogs
https://core.telegram.org/method/messages.getMessages
https://core.telegram.org/method/messages.deleteMessages

Add a documentation for Tp::BaseDebug class

Besides of the documentation, it would be good to also add an inline example, such as:

#include <TelepathyQt/BaseDebug>

static QPointer<Tp::BaseDebug> debugInterfacePtr;
static QtMessageHandler defaultMessageHandler = nullptr;

void telepathyDebugHandler(QtMsgType type, const QMessageLogContext &context,
                           const QString &msg)
{
    if (!debugInterfacePtr.isNull()) {
        const QString domain = QStringLiteral("%1:%2, %3")
                .arg(QString::fromLatin1(context.file))
                .arg(context.line)
                .arg(QString::fromLatin1(context.function));

        switch (type) {
        case QtDebugMsg:
            debugInterfacePtr->newDebugMessage(domain, Tp::DebugLevelDebug, msg);
            break;
        case QtInfoMsg:
            debugInterfacePtr->newDebugMessage(domain, Tp::DebugLevelInfo, msg);
            break;
        case QtWarningMsg:
            debugInterfacePtr->newDebugMessage(domain, Tp::DebugLevelWarning, msg);
            break;
        case QtCriticalMsg:
            debugInterfacePtr->newDebugMessage(domain, Tp::DebugLevelCritical, msg);
            break;
        case QtFatalMsg:
            debugInterfacePtr->newDebugMessage(domain, Tp::DebugLevelError, msg);
            break;
        }
    }

    if (defaultMessageHandler) {
        defaultMessageHandler(type, context, msg);
        return;
    }

    const QString logMessage = qFormatLogMessage(type, context, msg);

    if (logMessage.isNull()) {
        return;
    }

    fprintf(stderr, "%s\n", logMessage.toLocal8Bit().constData());
    fflush(stderr);
}

bool enableDebugInterface()
{
    if (!debugInterfacePtr.isNull()) {
        return debugInterfacePtr->isRegistered();
    }

    debugInterfacePtr = new Tp::BaseDebug();
    debugInterfacePtr->setGetMessagesLimit(-1);

    if (!debugInterfacePtr->registerObject(TP_QT_CONNECTION_MANAGER_BUS_NAME_BASE
                                           + QLatin1String("example"))) {
        return false;
    }

    defaultMessageHandler = qInstallMessageHandler(telepathyDebugHandler);
    return true;
}

void disableDebugInterface()
{
    if (debugInterfacePtr.isNull()) {
        return;
    }

    qInstallMessageHandler(defaultMessageHandler);
    debugInterfacePtr->deleteLater();
    debugInterfacePtr.clear();
    defaultMessageHandler = nullptr;
}

Remove Qt4 support

This will let us to fix tests (which are hardly maintainable with qt4) and just clean the code.

Tag new release 0.9.9?

0.9.8 was released four years ago. The commits since then appear to be mostly bug fixes. Would be nice to have them in an official release.

Remove own smart pointers

Remove own smart pointer classes or rationalize their existance.

  • Tp::WeakPtr
  • Tp::SharedPtr
  • Tp::RefCounted

Remove deprecated API

  • remove org.freedesktop.Telepathy.Connection.Interface.Capabilities
  • remove org.freedesktop.Telepathy.Connection.Interface.Presence
    With this done, we will have no difference between connection.xml and svc-connection.xml, so may be it would be the right time to merge xmls (make service lib to rely on the main xml).
  • clean channel-factory.h.

Missing dbus/dbus-glib.h

On NixOS, the build fails with the following error:

[ 62%] Building CXX object TelepathyQt/Farstream/CMakeFiles/telepathy-qt4-farstream.dir/channel.cpp.o
In file included from /nix/store/kjy4n27qjfyrw3ayxh7351hllwvp9g2k-telepathy-glib-0.24.1/include/telepathy-1.0/telepathy-glib/connection.h:33:0,
                 from /nix/store/kjy4n27qjfyrw3ayxh7351hllwvp9g2k-telepathy-glib-0.24.1/include/telepathy-1.0/telepathy-glib/account.h:31,
                 from /nix/store/kjy4n27qjfyrw3ayxh7351hllwvp9g2k-telepathy-glib-0.24.1/include/telepathy-1.0/telepathy-glib/account-channel-request.h:32,
                 from /nix/store/kjy4n27qjfyrw3ayxh7351hllwvp9g2k-telepathy-glib-0.24.1/include/telepathy-1.0/telepathy-glib/telepathy-glib.h:34,
                 from /nix/store/b7s2b8xjvi7gjfx928v7q655a2p3h3as-telepathy-farstream-0.6.2/include/telepathy-1.0/telepathy-farstream/channel.h:6,
                 from /nix/store/b7s2b8xjvi7gjfx928v7q655a2p3h3as-telepathy-farstream-0.6.2/include/telepathy-1.0/telepathy-farstream/telepathy-farstream.h:23,
                 from /tmp/nix-build-telepathy-qt-0.9.7.drv-0/telepathy-qt-0.9.7/TelepathyQt/Farstream/channel.cpp:31:
/nix/store/kjy4n27qjfyrw3ayxh7351hllwvp9g2k-telepathy-glib-0.24.1/include/telepathy-1.0/telepathy-glib/proxy.h:29:28: fatal error: dbus/dbus-glib.h: No such file or directory
 #include <dbus/dbus-glib.h>
                            ^
compilation terminated.
make[2]: *** [TelepathyQt/Farstream/CMakeFiles/telepathy-qt4-farstream.dir/build.make:68: TelepathyQt/Farstream/CMakeFiles/telepathy-qt4-farstream.dir/channel.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:8856: TelepathyQt/Farstream/CMakeFiles/telepathy-qt4-farstream.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

Nix stores each library in a separate directory in the Nix store. If I add the output of pkg-config --cflags dbus-glib-1 to build flags, it builds fine, it probably needs to be listed somewhere in the CMakeLists.

Telepathy-1.0 release

We need to decide if it will be better to add features and polish them (in spec 0.28 and TelepathyQt-0.10) before 1.0 release, or easy the development by dropping all the deprecated stuff and moving to 1.0.

Pros:

  • it would be easier to merge 1.0 branch(es) now, than later.

Cons:

  • We can not just bring TelepathyQt with 1.0 specification: we need telepathy-glib counterparts and we will have to support it. Namely, we need mission-control at the very least. Personally (@Kaffeine) I'm not familiar with glib and would prefer to rewrite everything in Qt, rather than develop glib-based code. About the other components: we also need telepathy-logger and I would like to rewrite it too to support multimedia content of messages. Maybe we can refactor Message class to let a client to operate with messages in a bit more abstract manner (logged/sent/received) with a possibility to subclass? This worth a yet another discussion thread (issue).

Links:
https://github.com/davidedmundson/telepathy-qt/tree/next (190 commits ahead)

Deprecate InspectHandles

InspectHandles removed in Telepathy 1.0 by commit

Remove InspectHandles
Identifiers are always given together with handles, so it must never be needed to inspect an handle.

This makes sense, so we need to:

  1. Mark the method as deprecated in 0.27.x spec
  2. Ensure that the method is deprecated at https://telepathy.freedesktop.org/spec/Connection.html
  3. Deprecate the method in client-side bindings
  4. Deprecate the method in service-side bindings
  5. Maybe even provide default implementation via GetContactAttributes().

fatal error: gst/gstconfig.h: No such file or directory. Compilation terminated

Recently when I tried installing telepathy-qt for Debian without the apt sources packages, I encountered this error. I had to configure telepathy-qt from apt sources in the end. The exact ending of the error log was :

Makefile:141: recipe for target 'all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory '/home/athena/telepathy-qt-stuff/telepathy-qt-0.9.6.1/obj-x86_64-linux-gnu'
dh_auto_build: make -j13 returned exit code 2
debian/rules:20: recipe for target 'override_dh_auto_build-arch' failed
make[1]: *** [override_dh_auto_build-arch] Error 2
make[1]: Leaving directory '/home/athena/telepathy-qt-stuff/telepathy-qt-0.9.6.1'
debian/rules:12: recipe for target 'build' failed
make: *** [build] Error 2
dpkg-buildpackage: error: debian/rules build gave error exit status 2

The entire log for building the code is really long and given here

Add support for One-Time Password authentication

Add Channel.Interface.OTPAuthentication

The interface is inspired by Channel.Interface.SASLAuthentication.

The description is outdated (written for Channel.Interface.PhoneVerification, which would be generalised to One-time password Authentication).

Use case

The interface would be exposed by telepathy-morse (telegram connection manager). Sign in process would be follow:

  • User setups an account. The only required parameter is phone number.
  • User sets presence to online.
  • Morse creates an OTP channel:
    • VerificationStatus (Not_Started)
    • AvailableMethods("sms")
    • CanTryAgain (true)
    • DefaultPhoneNumber (the user phone number)
  • ktp-auth-handler handles the channel:
    • Calls UseMethod("sms", "") and informs user, that verification code would be sent via sms (because it is the only available method)
      or
    • Show a button box with sms and call actions with the last one disabled.
    • Connects via DBus to KDEConnect signal about incoming sms
  • Morse:
    • Makes request for sms.
    • Changes VerificationStatus to In_Progress
    • On server respond, Morse emits PasswordSent signal with details:
      • PasswordRegexp is a five digits after a space
      • SenderRegexp is "Telegram" or "TeleVerify"
      • CallTimeout (received from server. Something like 30 sec)
  • ktp-auth-handler:
    • shows countdown if password details have "Expiration" property.
    • waits for KDEConnect incoming sms signal
    • on KDEConnect signal, ktp-auth-handler match sender with SenderRegexp and then match the message for PasswordRegexp. If both check succeed, then either automatically call Respond with the password, or, at least, insert it to the input line and waits for user action.
  • Morse (optionally):
    • adds "call" method to the available method list.
  • ktp-auth-handler:
    • shows buttons for all available methods ("Request an SMS", "Request a call")
  • Morse (if two-factor authentication is enabled (which the most popular case)):
    • creates a SASLAuthentication channel...

Properties

VerificationStatus - Verification_Status.

Read only.

AvailableMethods - as (array of strings).

Read only, can be changed.

Method list depends on protocol and server. Well-known values would be:

  • "sms" (the server would send a text message with a code to the "phone number")
  • "call" (there would be a voice call to the "phone number" and someone (probably robot) would tell the code)
  • Telegram also have "app" method, which means that the code would be send as a message in application. You can read it, if you have an already authenticated client.

CanTryAgain - b (bool)

Since v2

DefaultPhoneNumber - s (string)

Since v2

Read only, can be empty.
Predefined phone number, which will receive the message or the call.


Signals

VerificationStatusChanged(Verification_Status newStatus)

AvailableMethodsChanged(as newAvailableMethods)

Sometimes you can get a call only if you already tried to get sms and not received it yet (Telegram case).

PasswordSent(a{sv} details)

Possible optional keys:

  • PasswordRegexp
  • SenderRegexp
  • Expiration
  • CallTimeout
  • ResendTimeout

Methods

UseMethod(string method, string phone) -> void

Activate the "method" to get a code on passed phone number.
The phone argument can be not associated with the account, or can be not permanent for some protocol/server/etc.

Probably this argument would be needed by Telegram CM to perform change of the user phone number.
Artificial use case can be phone verification to connect to some room in jabber, or (as we have "Account balance" interface), it is pretty possible to use phone verification to add some money to the balance. You send phone number, server replies you with a code, you send it back and ooop - you just confirmed a transfer of 5$ from the phone number balance.

Respond(string code) -> void

Try to complete verification with the "code".

Types

Verification_Status - u (uint)

  • Not_Started
  • In_Progress
  • Succeeded
  • Failed

XEP-0412: XMPP Compliance Suites 2019

Please add support of https://xmpp.org/extensions/xep-0412.html

Which replaces:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.