[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498

Maximiliano Curia maxy at moszumanska.debian.org
Fri Oct 14 14:29:55 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=e896449

The following commit has been merged in the master branch:
commit e896449e7488da2a88374914f0b955db0c62c62c
Author: Albert Vaca <albertvaka at gmail.com>
Date:   Wed Jun 22 12:44:31 2016 +0200

    Moved telepathy component to its own repo: telepathy-kdeconnect
---
 plugins/CMakeLists.txt                             |   1 -
 plugins/telepathy/telepathy-cm/CMakeLists.txt      |  32 --
 plugins/telepathy/telepathy-cm/README              |   1 -
 plugins/telepathy/telepathy-cm/connection.cpp      | 344 ---------------------
 plugins/telepathy/telepathy-cm/connection.h        |  69 -----
 plugins/telepathy/telepathy-cm/kdeconnect.manager  |   4 -
 .../kdeconnecttelepathyprotocolfactory.cpp         |  71 -----
 .../kdeconnecttelepathyprotocolfactory.h           |  16 -
 plugins/telepathy/telepathy-cm/main.cpp            |  37 ---
 plugins/telepathy/telepathy-cm/protocol.cpp        | 119 -------
 plugins/telepathy/telepathy-cm/protocol.h          |  67 ----
 plugins/telepathy/telepathy-cm/textchannel.cpp     |  73 -----
 plugins/telepathy/telepathy-cm/textchannel.h       |  44 ---
 13 files changed, 878 deletions(-)

diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt
index a443fa7..88965df 100644
--- a/plugins/CMakeLists.txt
+++ b/plugins/CMakeLists.txt
@@ -11,7 +11,6 @@ add_subdirectory(battery)
 add_subdirectory(runcommand)
 add_subdirectory(remotecommands)
 add_subdirectory(findmyphone)
-add_subdirectory(telepathy)
 if(NOT WIN32)
     add_subdirectory(sendnotifications)
     add_subdirectory(pausemusic)
diff --git a/plugins/telepathy/telepathy-cm/CMakeLists.txt b/plugins/telepathy/telepathy-cm/CMakeLists.txt
deleted file mode 100644
index 3d16143..0000000
--- a/plugins/telepathy/telepathy-cm/CMakeLists.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-find_package(TelepathyQt5 0.9.5)
-find_package(TelepathyQt5Service 0.9.7)
-
-project(connectcm)
-
-add_executable(connectcm
-    main.cpp
-    connection.cpp
-    protocol.cpp
-    textchannel.cpp
-    kdeconnecttelepathyprotocolfactory.cpp
-)
-
-target_link_libraries(connectcm
-    Qt5::Core
-    ${TELEPATHY_QT5_LIBRARIES}
-    ${TELEPATHY_QT5_SERVICE_LIBRARIES}
-)
-
-install (TARGETS connectcm DESTINATION ${CMAKE_INSTALL_LIBEXECDIR})
-
-file(WRITE ${CMAKE_BINARY_DIR}/org.freedesktop.Telepathy.ConnectionManager.kdeconnect.service "[D-BUS Service]
-Name=org.freedesktop.Telepathy.ConnectionManager.kdeconnect
-Exec=${KDE_INSTALL_FULL_LIBEXECDIR}/connectcm
-")
-
-install(FILES ${CMAKE_BINARY_DIR}/org.freedesktop.Telepathy.ConnectionManager.kdeconnect.service DESTINATION share/dbus-1/services)
-
-install(
-    FILES kdeconnect.manager
-    DESTINATION share/telepathy/managers
-)
diff --git a/plugins/telepathy/telepathy-cm/README b/plugins/telepathy/telepathy-cm/README
deleted file mode 100644
index 2289e24..0000000
--- a/plugins/telepathy/telepathy-cm/README
+++ /dev/null
@@ -1 +0,0 @@
-Connect TelepathyQt-based Connection Manager.
diff --git a/plugins/telepathy/telepathy-cm/connection.cpp b/plugins/telepathy/telepathy-cm/connection.cpp
deleted file mode 100644
index 12aea6f..0000000
--- a/plugins/telepathy/telepathy-cm/connection.cpp
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
-    Copyright (C) 2014 Alexandr Akulich <akulichalexander at gmail.com>
-
-    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-    LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-    OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-    WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-*/
-
-#include "connection.h"
-
-#include "textchannel.h"
-
-#include <TelepathyQt/Constants>
-#include <TelepathyQt/BaseChannel>
-#include <TelepathyQt/Presence>
-
-#include <QDateTime>
-
-#include <QDebug>
-
-Tp::SimpleStatusSpecMap ConnectConnection::getSimpleStatusSpecMap()
-{
-    //Presence
-    Tp::SimpleStatusSpec spAvailable;
-    spAvailable.type = Tp::ConnectionPresenceTypeAvailable;
-    spAvailable.maySetOnSelf = false;
-    spAvailable.canHaveMessage = true;
-
-    Tp::SimpleStatusSpec spOffline;
-    spOffline.type = Tp::ConnectionPresenceTypeOffline;
-    spOffline.maySetOnSelf = false;
-    spOffline.canHaveMessage = false;
-
-    Tp::SimpleStatusSpecMap specs;
-    specs.insert(QLatin1String("available"), spAvailable);
-    specs.insert(QLatin1String("offline"), spOffline);
-    return specs;
-}
-
-ConnectConnection::ConnectConnection(const QDBusConnection &dbusConnection, const QString &cmName, const QString &protocolName, const QVariantMap &parameters) :
-    Tp::BaseConnection(dbusConnection, cmName, protocolName, parameters)
-{
-    /* Connection.Interface.Contacts */
-    contactsIface = Tp::BaseConnectionContactsInterface::create();
-    contactsIface->setGetContactAttributesCallback(Tp::memFun(this, &ConnectConnection::getContactAttributes));
-    contactsIface->setContactAttributeInterfaces(QStringList()
-                                                 << TP_QT_IFACE_CONNECTION
-                                                 << TP_QT_IFACE_CONNECTION_INTERFACE_CONTACT_LIST
-                                                 << TP_QT_IFACE_CONNECTION_INTERFACE_SIMPLE_PRESENCE);
-    plugInterface(Tp::AbstractConnectionInterfacePtr::dynamicCast(contactsIface));
-
-    /* Connection.Interface.SimplePresence */
-    simplePresenceIface = Tp::BaseConnectionSimplePresenceInterface::create();
-    simplePresenceIface->setSetPresenceCallback(Tp::memFun(this,&ConnectConnection::setPresence));
-    plugInterface(Tp::AbstractConnectionInterfacePtr::dynamicCast(simplePresenceIface));
-
-    /* Connection.Interface.ContactList */
-    contactListIface = Tp::BaseConnectionContactListInterface::create();
-    contactListIface->setGetContactListAttributesCallback(Tp::memFun(this, &ConnectConnection::getContactListAttributes));
-//    contactListIface->setRequestSubscriptionCallback(Tp::memFun(this, &ConnectConnection::requestSubscription));
-    plugInterface(Tp::AbstractConnectionInterfacePtr::dynamicCast(contactListIface));
-
-    /* Connection.Interface.Requests */
-    requestsIface = Tp::BaseConnectionRequestsInterface::create(this);
-    /* Fill requestableChannelClasses */
-    Tp::RequestableChannelClass text;
-    text.fixedProperties[TP_QT_IFACE_CHANNEL+".ChannelType"] = TP_QT_IFACE_CHANNEL_TYPE_TEXT;
-    text.fixedProperties[TP_QT_IFACE_CHANNEL+".TargetHandleType"]  = Tp::HandleTypeContact;
-    text.allowedProperties.append(TP_QT_IFACE_CHANNEL+".TargetHandle");
-    text.allowedProperties.append(TP_QT_IFACE_CHANNEL+".TargetID");
-    requestsIface->requestableChannelClasses << text;
-    plugInterface(Tp::AbstractConnectionInterfacePtr::dynamicCast(requestsIface));
-
-    QString selfName = QLatin1String("SelfContact");
-
-    if (parameters.contains("self_name")) {
-        selfName = parameters.value("self_name").toString();
-    }
-
-    if (parameters.contains("device_id")) {
-        m_deviceId = parameters.value("device_id").toString();
-    }
-
-    setSelfHandle(addContact(selfName + "@kdeconnect_" + m_deviceId));
-
-    setConnectCallback(Tp::memFun(this, &ConnectConnection::connect));
-    setInspectHandlesCallback(Tp::memFun(this, &ConnectConnection::inspectHandles));
-    setCreateChannelCallback(Tp::memFun(this, &ConnectConnection::createChannelCB));
-    setRequestHandlesCallback(Tp::memFun(this, &ConnectConnection::requestHandles));
-}
-
-ConnectConnection::~ConnectConnection()
-{
-}
-
-void ConnectConnection::connect(Tp::DBusError *error)
-{
-    setStatus(Tp::ConnectionStatusConnecting, Tp::ConnectionStatusReasonRequested);
-
-    simplePresenceIface->setStatuses(getSimpleStatusSpecMap());
-
-    Tp::SimpleContactPresences presences;
-    Tp::SimplePresence presence;
-    presence.status = "available";
-    presence.statusMessage = "";
-    presence.type = Tp::ConnectionPresenceTypeAvailable;
-    presences[selfHandle()] = presence;
-    simplePresenceIface->setPresences(presences);
-
-    setStatus(Tp::ConnectionStatusConnected, Tp::ConnectionStatusReasonRequested);
-
-    /* Set ContactList status */
-    contactListIface->setContactListState(Tp::ContactListStateSuccess);
-}
-
-QStringList ConnectConnection::inspectHandles(uint handleType, const Tp::UIntList &handles, Tp::DBusError *error)
-{
-    if (handleType != Tp::HandleTypeContact) {
-        error->set(TP_QT_ERROR_INVALID_ARGUMENT, "Unsupported handle type");
-        return QStringList();
-    }
-
-    QStringList result;
-
-    Q_FOREACH (uint handle, handles) {
-        if (!m_handles.contains(handle)) {
-            return QStringList();
-        }
-
-        result.append(m_handles.value(handle));
-    }
-
-    return result;
-}
-
-Tp::BaseChannelPtr ConnectConnection::createChannelCB(const QVariantMap &request, Tp::DBusError *error)
-{
-    const uint targetHandleType = request.value(TP_QT_IFACE_CHANNEL + QLatin1String(".TargetHandleType")).toUInt();
-    const QString channelType = request.value(TP_QT_IFACE_CHANNEL + QLatin1String(".ChannelType")).toString();
-    
-    //note if we ever have this invoked from external clients we need to look for TargetID too and look it up
-    const uint targetHandle = request.value(TP_QT_IFACE_CHANNEL + QLatin1String(".TargetHandle")).toUInt();
-
-    if ((targetHandleType != Tp::HandleTypeContact) || (targetHandle == 0)) {
-          error->set(TP_QT_ERROR_INVALID_HANDLE, "createChannel error");
-          return Tp::BaseChannelPtr();
-    }
-
-    Tp::BaseChannelPtr baseChannel = Tp::BaseChannel::create(this, channelType, Tp::HandleType(targetHandleType), targetHandle);
-
-    QString identifier = m_handles.value(targetHandle);
-
-    if (channelType == TP_QT_IFACE_CHANNEL_TYPE_TEXT) {
-        ConnectTextChannelPtr textType = ConnectTextChannel::create(this, baseChannel.data(), targetHandle, identifier);
-        baseChannel->plugInterface(Tp::AbstractChannelInterfacePtr::dynamicCast(textType));
-    }
-
-    return baseChannel;
-}
-
-Tp::UIntList ConnectConnection::requestHandles(uint handleType, const QStringList &identifiers, Tp::DBusError *error)
-{
-    Tp::UIntList result;
-
-    if (handleType != Tp::HandleTypeContact) {
-        error->set(TP_QT_ERROR_INVALID_ARGUMENT, "ConnectConnection::requestHandles - Handle Type unknown");
-        return result;
-    }
-
-    Q_FOREACH (const QString &identify, identifiers) {
-         uint handle = m_handles.key(identify, 0);
-         if (handle) {
-             result.append(handle);
-         } else {
-             result.append(addContact(identify));
-         }
-     }
-
-    return result;
-}
-
-Tp::ContactAttributesMap ConnectConnection::getContactListAttributes(const QStringList &interfaces, bool hold, Tp::DBusError *error)
-{
-    Tp::ContactAttributesMap contactAttributes;
-
-    Q_FOREACH (const uint handle, m_handles.keys()) {
-        if (handle == selfHandle()) {
-            continue;
-        }
-        QVariantMap attributes;
-        attributes["org.freedesktop.Telepathy.Connection/contact-id"] = m_handles.value(handle);
-        attributes["org.freedesktop.Telepathy.Connection.Interface.ContactList/subscribe"] = Tp::SubscriptionStateYes;
-        attributes["org.freedesktop.Telepathy.Connection.Interface.ContactList/publish"] = Tp::SubscriptionStateYes;
-        attributes["org.freedesktop.Telepathy.Connection.Interface.ConnectPresence/presence"] = QVariant::fromValue(getPresence(handle));
-        contactAttributes[handle] = attributes;
-    }
-    return contactAttributes;
-}
-
-Tp::ContactAttributesMap ConnectConnection::getContactAttributes(const Tp::UIntList &handles, const QStringList &interfaces, Tp::DBusError *error)
-{
-//    Connection.Interface.Contacts
-//    http://telepathy.freedesktop.org/spec/Connection_Interface_Contacts.html#Method:GetContactAttributes
-
-    Tp::ContactAttributesMap contactAttributes;
-
-    Q_FOREACH (const uint handle, handles) {
-        if (m_handles.contains(handle)){
-            QVariantMap attributes;
-            attributes["org.freedesktop.Telepathy.Connection/contact-id"] = m_handles.value(handle);
-
-            if (handle != selfHandle() && interfaces.contains("org.freedesktop.Telepathy.Connection.Interface.ContactList")) {
-                attributes["org.freedesktop.Telepathy.Connection.Interface.ContactList/subscribe"] = Tp::SubscriptionStateYes;
-                attributes["org.freedesktop.Telepathy.Connection.Interface.ContactList/publish"] = Tp::SubscriptionStateYes;
-                attributes["org.freedesktop.Telepathy.Connection.Interface.SimplePresence/presence"] = QVariant::fromValue(getPresence(handle));
-            }
-            contactAttributes[handle] = attributes;
-        }
-    }
-    return contactAttributes;
-}
-
-Tp::SimplePresence ConnectConnection::getPresence(uint handle)
-{
-    return Tp::Presence::offline().barePresence();
-}
-
-uint ConnectConnection::setPresence(const QString &status, const QString &message, Tp::DBusError *error)
-{
-    return 0;
-}
-
-uint ConnectConnection::ensureContact(const QString &identifier)
-{
-    uint handle = getHandle(identifier);
-    if (!handle) {
-        handle = addContact(identifier);
-    }
-    return handle;
-}
-
-uint ConnectConnection::addContacts(const QStringList &identifiers)
-{
-    uint handle = 0;
-
-    if (!m_handles.isEmpty()) {
-        handle = m_handles.keys().last();
-    }
-
-    QList<uint> newHandles;
-    Q_FOREACH (const QString &identifier, identifiers) {
-        ++handle;
-        m_handles.insert(handle, identifier);
-        newHandles << handle;
-    }
-
-    return handle;
-}
-
-uint ConnectConnection::addContact(const QString &identifier)
-{
-    return addContacts(QStringList() << identifier);
-}
-
-/* Receive message from someone to ourself */
-bool ConnectConnection::receiveMessage(const QString &sender, const QString& senderName, const QString &message)
-{
-    uint senderHandle, targetHandle;
-
-    Tp::HandleType handleType = Tp::HandleTypeContact;
-    senderHandle = targetHandle = ensureContact(sender);
-
-    Tp::DBusError error;
-    bool yours;
-    
-    QVariantMap request;
-    request[TP_QT_IFACE_CHANNEL + QLatin1String(".ChannelType")] = TP_QT_IFACE_CHANNEL_TYPE_TEXT;
-    request[TP_QT_IFACE_CHANNEL + QLatin1String(".TargetHandle")] = targetHandle;
-    request[TP_QT_IFACE_CHANNEL + QLatin1String(".TargetHandleType")] = Tp::HandleTypeContact;
-    request[TP_QT_IFACE_CHANNEL + QLatin1String(".InitiatorHandle")] = targetHandle; //they texted you, so they started it
-    Tp::BaseChannelPtr channel = ensureChannel(request, yours, false, &error);
-    if (error.isValid()) {
-        qWarning() << "ensureChannel failed:" << error.name() << " " << error.message();
-        return false;
-    }
-
-    Tp::BaseChannelTextTypePtr textChannel = Tp::BaseChannelTextTypePtr::dynamicCast(channel->interface(TP_QT_IFACE_CHANNEL_TYPE_TEXT));
-    if (!textChannel) {
-        qDebug() << "Error, channel is not a textChannel??";
-        return false;
-    }
-
-    uint timestamp = QDateTime::currentMSecsSinceEpoch() / 1000;
-
-    Tp::MessagePartList body;
-    Tp::MessagePart text;
-    text["content-type"]            = QDBusVariant("text/plain");
-    text["content"]                 = QDBusVariant(message);
-    body << text;
-
-    Tp::MessagePartList partList;
-    Tp::MessagePart header;
-    header["message-received"]  = QDBusVariant(timestamp);
-    header["message-sender"]    = QDBusVariant(senderHandle);
-    header["message-sender-id"] = QDBusVariant(sender);
-    header["sender-nickname"]   = QDBusVariant(senderName);
-    header["message-type"]      = QDBusVariant(Tp::ChannelTextMessageTypeNormal);
-
-    partList << header << body;
-    textChannel->addReceivedMessage(partList);
-    return true;
-}
-
-void ConnectConnection::setContactList(const QStringList &identifiers)
-{
-    // Actually it don't clear previous list (not implemented yet)
-    addContacts(identifiers);
-
-//    Tp::ContactSubscriptionMap changes;
-//    Tp::HandleIdentifierMap identifiers;
-//    Tp::HandleIdentifierMap removals;
-
-    QList<uint> handles;
-
-    for (int i = 0; i < identifiers.count(); ++i) {
-        handles.append(ensureContact(identifiers.at(i)));
-    }
-}
-
-uint ConnectConnection::getHandle(const QString &identifier) const
-{
-    Q_FOREACH (uint key, m_handles.keys()) {
-        if (m_handles.value(key) == identifier) {
-            return key;
-        }
-    }
-
-    return 0;
-}
diff --git a/plugins/telepathy/telepathy-cm/connection.h b/plugins/telepathy/telepathy-cm/connection.h
deleted file mode 100644
index 2f05f7b..0000000
--- a/plugins/telepathy/telepathy-cm/connection.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
-    Copyright (C) 2014 Alexandr Akulich <akulichalexander at gmail.com>
-
-    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-    LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-    OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-    WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-*/
-
-#ifndef CONNECTCM_CONNECTION_H
-#define CONNECTCM_CONNECTION_H
-
-#include <TelepathyQt/BaseConnection>
-#include <TelepathyQt/BaseChannel>
-
-class ConnectConnection : public Tp::BaseConnection
-{
-    Q_OBJECT
-public:
-    ConnectConnection(const QDBusConnection &dbusConnection,
-            const QString &cmName, const QString &protocolName,
-            const QVariantMap &parameters);
-    ~ConnectConnection() override;
-
-    static Tp::SimpleStatusSpecMap getSimpleStatusSpecMap();
-
-    void connect(Tp::DBusError *error);
-    QStringList inspectHandles(uint handleType, const Tp::UIntList &handles, Tp::DBusError *error);
-    Tp::BaseChannelPtr createChannelCB(const QVariantMap &request, Tp::DBusError *error);
-
-    Tp::UIntList requestHandles(uint handleType, const QStringList &identifiers, Tp::DBusError *error);
-
-    Tp::ContactAttributesMap getContactListAttributes(const QStringList &interfaces, bool hold, Tp::DBusError *error);
-    Tp::ContactAttributesMap getContactAttributes(const Tp::UIntList &handles, const QStringList &interfaces, Tp::DBusError *error);
-
-    Tp::SimplePresence getPresence(uint handle);
-    uint setPresence(const QString &status, const QString &message, Tp::DBusError *error);
-
-    uint ensureContact(const QString &identifier);
-
-public Q_SLOTS:
-    bool receiveMessage(const QString &sender, const QString &senderName, const QString &message);
-    void setContactList(const QStringList &identifiers);
-
-Q_SIGNALS:
-    void messageReceived(const QString &sender, const QString &message);
-
-private:
-    uint getHandle(const QString &identifier) const;
-    uint addContact(const QString &identifier);
-    uint addContacts(const QStringList &identifiers);
-
-    Tp::BaseConnectionContactsInterfacePtr contactsIface;
-    Tp::BaseConnectionSimplePresenceInterfacePtr simplePresenceIface;
-    Tp::BaseConnectionContactListInterfacePtr contactListIface;
-    Tp::BaseConnectionAddressingInterfacePtr addressingIface;
-    Tp::BaseConnectionRequestsInterfacePtr requestsIface;
-
-    QMap<uint, QString> m_handles;
-    /* Maps a contact handle to its subscription state */
-
-    QString m_deviceId;
-};
-
-#endif // CONNECTCM_CONNECTION_H
diff --git a/plugins/telepathy/telepathy-cm/kdeconnect.manager b/plugins/telepathy/telepathy-cm/kdeconnect.manager
deleted file mode 100644
index a4dd290..0000000
--- a/plugins/telepathy/telepathy-cm/kdeconnect.manager
+++ /dev/null
@@ -1,4 +0,0 @@
-[ConnectionManager]
-Name = kdeconnect
-BusName = org.freedesktop.Telepathy.ConnectionManager.kdeconnect
-ObjectPath = /org/freedesktop/Telepathy/ConnectionManager/kdeconnect
diff --git a/plugins/telepathy/telepathy-cm/kdeconnecttelepathyprotocolfactory.cpp b/plugins/telepathy/telepathy-cm/kdeconnecttelepathyprotocolfactory.cpp
deleted file mode 100644
index 8c8f14e..0000000
--- a/plugins/telepathy/telepathy-cm/kdeconnecttelepathyprotocolfactory.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-#include <TelepathyQt/Types>
-#include <TelepathyQt/BaseConnectionManager>
-#include <TelepathyQt/Constants>
-#include <TelepathyQt/Debug>
-#include <TelepathyQt/Types>
-#include <TelepathyQt/ConnectionManager>
-
-#include <TelepathyQt/AccountManager>
-#include <TelepathyQt/Account>
-#include <TelepathyQt/PendingReady>
-#include <TelepathyQt/PendingAccount>
-#include <TelepathyQt/AccountSet>
-
-#include <QtDBus/QDBusConnection>
-#include "protocol.h"
-
-#include "kdeconnecttelepathyprotocolfactory.h"
-
-Tp::WeakPtr<KDEConnectTelepathyProtocol> KDEConnectTelepathyProtocolFactory::s_interface;
-
-ConnectProtocolPtr KDEConnectTelepathyProtocolFactory::interface() {
-    if (s_interface.isNull()) {
-        Tp::registerTypes();
-        Tp::enableWarnings(true);
-
-        ConnectProtocolPtr protocol = Tp::BaseProtocol::create<KDEConnectTelepathyProtocol>(
-                QDBusConnection::sessionBus(),
-                QLatin1String("kdeconnect"));
-        s_interface = protocol;
-
-        static Tp::BaseConnectionManagerPtr cm = Tp::BaseConnectionManager::create(
-                QDBusConnection::sessionBus(), QLatin1String("kdeconnect"));
-
-        protocol->setConnectionManagerName(cm->name());
-        protocol->setEnglishName(QLatin1String("KDE Connect"));
-        protocol->setIconName(QLatin1String("kdeconnect"));
-        protocol->setVCardField(QLatin1String("phone_number"));
-
-        cm->addProtocol(protocol);
-        cm->registerObject();
-        
-        //fake being a client and create an account to use this connection
-        //maybe this should be per device.. with a device ID as a parameter, but lets keep it connect for now
-        
-        Tp::AccountManagerPtr am = Tp::AccountManager::create(QDBusConnection::sessionBus());
-        Tp::PendingReady *pr = am->becomeReady();
-        QObject::connect(pr, &Tp::PendingOperation::finished, [pr,am]() {
-           if (pr->isError()) {
-               return;
-           }
-           Tp::AccountSetPtr accounts = am->accountsByProtocol("kdeconnect");
-           if (!accounts) {
-               return;
-           }
-           if (accounts->accounts().isEmpty()) {
-                Tp::PendingAccount* pa = am->createAccount("kdeconnect", "kdeconnect", "kdeconnect", QVariantMap(), QVariantMap());
-                QObject::connect(pa, &Tp::PendingOperation::finished, pa, [pa](){
-                    if (pa->isError() || !pa->account()) {
-                        return;
-                    }
-                    pa->account()->setEnabled(true);
-                    pa->account()->setRequestedPresence(Tp::Presence::available());
-                });
-           } else {
-               Tp::AccountPtr account = accounts->accounts().first();
-               account->setRequestedPresence(Tp::Presence::available());
-           }
-        });             
-    }
-    return s_interface.toStrongRef();
-}
diff --git a/plugins/telepathy/telepathy-cm/kdeconnecttelepathyprotocolfactory.h b/plugins/telepathy/telepathy-cm/kdeconnecttelepathyprotocolfactory.h
deleted file mode 100644
index 84d048a..0000000
--- a/plugins/telepathy/telepathy-cm/kdeconnecttelepathyprotocolfactory.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#include "protocol.h"
-
-typedef Tp::SharedPtr<KDEConnectTelepathyProtocol> ConnectProtocolPtr;
-
-/*
- * SingletonFactory for plugins to get access to the Telepathy connection manager
- * Whilst the main process also holds a reference.
- * 
- */
-class KDEConnectTelepathyProtocolFactory
-{
-public:
-    static ConnectProtocolPtr interface();
-private:
-    static Tp::WeakPtr<KDEConnectTelepathyProtocol> s_interface;
-};
diff --git a/plugins/telepathy/telepathy-cm/main.cpp b/plugins/telepathy/telepathy-cm/main.cpp
deleted file mode 100644
index f729a77..0000000
--- a/plugins/telepathy/telepathy-cm/main.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * Copyright 2016 David Edmundson <kde at davidedmundson.co.uk>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License or (at your option) version 3 or any later version
- * accepted by the membership of KDE e.V. (or its successor approved
- * by the membership of KDE e.V.), which shall act as a proxy
- * defined in Section 14 of version 3 of the license.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <QCoreApplication>
-
-#include <TelepathyQt/BaseConnectionManager>
-#include <TelepathyQt/Constants>
-#include <TelepathyQt/Debug>
-
-#include "kdeconnecttelepathyprotocolfactory.h"
-
-int main(int argc, char *argv[])
-{
-    QCoreApplication app(argc, argv);
-    app.setApplicationName(QLatin1String("telepathy-morse"));
-
-    KDEConnectTelepathyProtocolFactory::interface();
-
-    return app.exec();
-}
diff --git a/plugins/telepathy/telepathy-cm/protocol.cpp b/plugins/telepathy/telepathy-cm/protocol.cpp
deleted file mode 100644
index 167b667..0000000
--- a/plugins/telepathy/telepathy-cm/protocol.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
-    Copyright (C) 2014 Alexandr Akulich <akulichalexander at gmail.com>
-
-    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-    LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-    OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-    WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-*/
-
-#include "protocol.h"
-#include "connection.h"
-
-#include <TelepathyQt/BaseConnection>
-#include <TelepathyQt/Constants>
-#include <TelepathyQt/RequestableChannelClassSpec>
-#include <TelepathyQt/RequestableChannelClassSpecList>
-#include <TelepathyQt/Types>
-
-#include <QLatin1String>
-#include <QVariantMap>
-
-KDEConnectTelepathyProtocol::KDEConnectTelepathyProtocol(const QDBusConnection &dbusConnection, const QString &name)
-    : BaseProtocol(dbusConnection, name)
-{
-//     setParameters(Tp::ProtocolParameterList()
-//                   << Tp::ProtocolParameter(QLatin1String("device_id"), QLatin1String("s"), Tp::ConnMgrParamFlagRequired)
-//                   << Tp::ProtocolParameter(QLatin1String("self_name"), QLatin1String("s"), 0));
-
-    setRequestableChannelClasses(Tp::RequestableChannelClassSpecList() << Tp::RequestableChannelClassSpec::textChat());
-
-    // callbacks
-    setCreateConnectionCallback(memFun(this, &KDEConnectTelepathyProtocol::createConnection));
-    setIdentifyAccountCallback(memFun(this, &KDEConnectTelepathyProtocol::identifyAccount));
-    setNormalizeContactCallback(memFun(this, &KDEConnectTelepathyProtocol::normalizeContact));
-
-    addrIface = Tp::BaseProtocolAddressingInterface::create();
-    addrIface->setAddressableVCardFields(QStringList() << QLatin1String("x-example-vcard-field"));
-    addrIface->setAddressableUriSchemes(QStringList() << QLatin1String("example-uri-scheme"));
-    addrIface->setNormalizeVCardAddressCallback(memFun(this, &KDEConnectTelepathyProtocol::normalizeVCardAddress));
-    addrIface->setNormalizeContactUriCallback(memFun(this, &KDEConnectTelepathyProtocol::normalizeContactUri));
-    plugInterface(Tp::AbstractProtocolInterfacePtr::dynamicCast(addrIface));
-/*
-    presenceIface = Tp::BaseProtocolPresenceInterface::create();
-    presenceIface->setStatuses(Tp::PresenceSpecList(ConnectConnection::getConnectStatusSpecMap()));
-    plugInterface(Tp::AbstractProtocolInterfacePtr::dynamicCast(presenceIface));*/
-
-    auto bus = QDBusConnection::sessionBus();
-    bus.registerObject("/kdeconnect", this, QDBusConnection::ExportAllSignals | QDBusConnection::ExportAllSlots);
-
-    Tp::DBusError err;
-}
-
-KDEConnectTelepathyProtocol::~KDEConnectTelepathyProtocol()
-{
-}
-
-void KDEConnectTelepathyProtocol::setConnectionManagerName(const QString &newName)
-{
-    m_connectionManagerName = newName;
-}
-
-bool KDEConnectTelepathyProtocol::sendMessage(QString sender, QString senderName, QString message)
-{
-    if (m_connection) {
-        return m_connection->receiveMessage(sender, senderName, message);
-    }
-    return false;
-}
-
-void KDEConnectTelepathyProtocol::setContactList(QStringList list)
-{
-    if (m_connection) {
-        m_connection->setContactList(list);
-    }
-}
-
-Tp::BaseConnectionPtr KDEConnectTelepathyProtocol::createConnection(const QVariantMap &parameters, Tp::DBusError *error)
-{
-    Q_UNUSED(error)
-
-    auto newConnection = Tp::BaseConnection::create<ConnectConnection>(m_connectionManagerName, this->name(), parameters);
-    connect(newConnection.constData(), SIGNAL(messageReceived(QString,QString)), SIGNAL(messageReceived(QString,QString)));
-    m_connection = newConnection;
-
-    return newConnection;
-}
-
-QString KDEConnectTelepathyProtocol::identifyAccount(const QVariantMap &parameters, Tp::DBusError *error)
-{
-    qDebug() << Q_FUNC_INFO << parameters;
-    error->set(QLatin1String("IdentifyAccount.Error.NotImplemented"), QLatin1String(""));
-    return QString();
-}
-
-QString KDEConnectTelepathyProtocol::normalizeContact(const QString &contactId, Tp::DBusError *error)
-{
-    qDebug() << Q_FUNC_INFO << contactId;
-    error->set(QLatin1String("NormalizeContact.Error.NotImplemented"), QLatin1String(""));
-    return QString();
-}
-
-QString KDEConnectTelepathyProtocol::normalizeVCardAddress(const QString &vcardField, const QString vcardAddress,
-        Tp::DBusError *error)
-{
-    qDebug() << Q_FUNC_INFO << vcardField << vcardAddress;
-    error->set(QLatin1String("NormalizeVCardAddress.Error.NotImplemented"), QLatin1String(""));
-    return QString();
-}
-
-QString KDEConnectTelepathyProtocol::normalizeContactUri(const QString &uri, Tp::DBusError *error)
-{
-    qDebug() << Q_FUNC_INFO << uri;
-    error->set(QLatin1String("NormalizeContactUri.Error.NotImplemented"), QLatin1String(""));
-    return QString();
-}
diff --git a/plugins/telepathy/telepathy-cm/protocol.h b/plugins/telepathy/telepathy-cm/protocol.h
deleted file mode 100644
index c4b8ffd..0000000
--- a/plugins/telepathy/telepathy-cm/protocol.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
-    Copyright (C) 2014 Alexandr Akulich <akulichalexander at gmail.com>
-
-    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-    LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-    OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-    WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-*/
-
-#ifndef CONNECTCM_PROTOCOL_H
-#define CONNECTCM_PROTOCOL_H
-
-#include <TelepathyQt/BaseProtocol>
-
-class ConnectConnection;
-
-class KDEConnectTelepathyProtocol : public Tp::BaseProtocol
-{
-    Q_OBJECT
-    Q_DISABLE_COPY(KDEConnectTelepathyProtocol)
-    Q_CLASSINFO("D-Bus Interface", "org.freedesktop.Telepathy.ConnectionManager.kdeconnect")
-
-public:
-    KDEConnectTelepathyProtocol(const QDBusConnection &dbusConnection, const QString &name);
-    ~KDEConnectTelepathyProtocol() override;
-
-    QString connectionManagerName() const;
-    void setConnectionManagerName(const QString &newName);
-
-public Q_SLOTS:
-    bool sendMessage(QString sender, QString senderName, QString message);
-    void setContactList(QStringList list);
-
-Q_SIGNALS:
-    void contactsListChanged(QStringList);
-    void messageReceived(QString sender, QString message);
-
-private:
-    Tp::BaseConnectionPtr createConnection(const QVariantMap &parameters, Tp::DBusError *error);
-    QString identifyAccount(const QVariantMap &parameters, Tp::DBusError *error);
-    QString normalizeContact(const QString &contactId, Tp::DBusError *error);
-
-    // Proto.I.Addressing
-    QString normalizeVCardAddress(const QString &vCardField, const QString vCardAddress,
-            Tp::DBusError *error);
-    QString normalizeContactUri(const QString &uri, Tp::DBusError *error);
-
-    Tp::BaseProtocolAddressingInterfacePtr addrIface;
-    Tp::BaseProtocolAvatarsInterfacePtr avatarsIface;
-
-    QString m_connectionManagerName;
-    
-    //normally keeping the connection in the protocol would be really weird
-    //however we want to proxy the messages to the active connection and want a single entry point
-    Tp::SharedPtr<ConnectConnection> m_connection; 
-};
-
-inline QString KDEConnectTelepathyProtocol::connectionManagerName() const
-{
-    return m_connectionManagerName;
-}
-
-#endif // CONNECTCM_PROTOCOL_H
diff --git a/plugins/telepathy/telepathy-cm/textchannel.cpp b/plugins/telepathy/telepathy-cm/textchannel.cpp
deleted file mode 100644
index 04d91a5..0000000
--- a/plugins/telepathy/telepathy-cm/textchannel.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
-    Copyright (C) 2014 Alexandr Akulich <akulichalexander at gmail.com>
-
-    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-    LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-    OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-    WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-*/
-
-#include "textchannel.h"
-
-#include <TelepathyQt/Constants>
-#include <TelepathyQt/RequestableChannelClassSpec>
-#include <TelepathyQt/RequestableChannelClassSpecList>
-#include <TelepathyQt/Types>
-
-#include <QLatin1String>
-#include <QVariantMap>
-
-#include <QDebug>
-
-ConnectTextChannel::ConnectTextChannel(QObject *connection, Tp::BaseChannel *baseChannel, uint targetHandle, const QString &identifier)
-    : Tp::BaseChannelTextType(baseChannel),
-      m_connection(connection),
-      m_identifier(identifier)
-{
-    QStringList supportedContentTypes = QStringList() << "text/plain";
-    Tp::UIntList messageTypes = Tp::UIntList() << Tp::ChannelTextMessageTypeNormal;
-
-    uint messagePartSupportFlags = 0;
-    uint deliveryReportingSupport = 0;
-
-    m_messagesIface = Tp::BaseChannelMessagesInterface::create(this,
-                                                               supportedContentTypes,
-                                                               messageTypes,
-                                                               messagePartSupportFlags,
-                                                               deliveryReportingSupport);
-
-    baseChannel->plugInterface(Tp::AbstractChannelInterfacePtr::dynamicCast(m_messagesIface));
-
-    m_messagesIface->setSendMessageCallback(Tp::memFun(this, &ConnectTextChannel::sendMessageCallback));
-}
-
-ConnectTextChannelPtr ConnectTextChannel::create(QObject *connection, Tp::BaseChannel *baseChannel, uint targetHandle, const QString &identifier)
-{
-    return ConnectTextChannelPtr(new ConnectTextChannel(connection, baseChannel, targetHandle, identifier));
-}
-
-ConnectTextChannel::~ConnectTextChannel()
-{
-}
-
-QString ConnectTextChannel::sendMessageCallback(const Tp::MessagePartList &messageParts, uint flags, Tp::DBusError *error)
-{
-    QString content;
-    for (Tp::MessagePartList::const_iterator i = messageParts.begin()+1; i != messageParts.end(); ++i) {
-        if(i->count(QLatin1String("content-type"))
-            && i->value(QLatin1String("content-type")).variant().toString() == QLatin1String("text/plain")
-            && i->count(QLatin1String("content")))
-        {
-            content = i->value(QLatin1String("content")).variant().toString();
-            break;
-        }
-    }
-
-    QMetaObject::invokeMethod(m_connection, "messageReceived", Q_ARG(QString, m_identifier), Q_ARG(QString, content));
-
-    return QString();
-}
diff --git a/plugins/telepathy/telepathy-cm/textchannel.h b/plugins/telepathy/telepathy-cm/textchannel.h
deleted file mode 100644
index 9cbea98..0000000
--- a/plugins/telepathy/telepathy-cm/textchannel.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-    Copyright (C) 2014 Alexandr Akulich <akulichalexander at gmail.com>
-
-    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-    LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-    OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-    WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-*/
-
-#ifndef CONNECTCM_TEXTCHANNEL_H
-#define CONNECTCM_TEXTCHANNEL_H
-
-#include <TelepathyQt/BaseChannel>
-
-class ConnectTextChannel;
-
-typedef Tp::SharedPtr<ConnectTextChannel> ConnectTextChannelPtr;
-
-class ConnectTextChannel : public Tp::BaseChannelTextType
-{
-    Q_OBJECT
-public:
-    static ConnectTextChannelPtr create(QObject *connection, Tp::BaseChannel *baseChannel, uint targetHandle, const QString &identifier);
-    ~ConnectTextChannel() override;
-
-    QString sendMessageCallback(const Tp::MessagePartList &messageParts, uint flags, Tp::DBusError *error);
-
-private:
-    ConnectTextChannel(QObject *connection, Tp::BaseChannel *baseChannel, uint targetHandle, const QString &identifier);
-
-    QObject *m_connection;
-
-    QString m_identifier;
-
-    Tp::BaseChannelTextTypePtr m_channelTextType;
-    Tp::BaseChannelMessagesInterfacePtr m_messagesIface;
-
-};
-
-#endif // CONNECTCM_TEXTCHANNEL_H

-- 
kdeconnect packaging



More information about the pkg-kde-commits mailing list