[SCM] ktp-common-internals packaging branch, master, updated. debian/15.12.1-2-1839-gf0635e9
Maximiliano Curia
maxy at moszumanska.debian.org
Mon May 9 09:08:18 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=54647c0
The following commit has been merged in the master branch:
commit 54647c06ad4f93611fee304434231a2a7b4004de
Author: Marcin Ziemiński <zieminn at gmail.com>
Date: Fri Jul 11 16:48:44 2014 +0200
Create simple observer and text channel proxy without usable send method.
Signed-off-by: Marcin Ziemiński <zieminn at gmail.com>
---
otr-proxy/CMakeLists.txt | 21 ++
otr-proxy/KTpProxy/CMakeLists.txt | 23 ++
otr-proxy/KTpProxy/constants.h | 29 ++
otr-proxy/KTpProxy/main.cpp | 69 +++++
otr-proxy/KTpProxy/otr-proxy-channel-adaptee.cpp | 158 ++++++++++
otr-proxy/KTpProxy/otr-proxy-channel-adaptee.h | 82 +++++
otr-proxy/KTpProxy/otr-proxy-channel-internal.h | 11 +
otr-proxy/KTpProxy/otr-proxy-channel.cpp | 89 ++++++
otr-proxy/KTpProxy/otr-proxy-channel.h | 67 ++++
otr-proxy/KTpProxy/proxy-observer.cpp | 53 ++++
otr-proxy/KTpProxy/proxy-observer.h | 49 +++
otr-proxy/KTpProxy/proxy-service-adaptee.cpp | 39 +++
otr-proxy/KTpProxy/proxy-service-adaptee.h | 55 ++++
otr-proxy/KTpProxy/proxy-service.cpp | 121 ++++++++
otr-proxy/KTpProxy/proxy-service.h | 68 +++++
otr-proxy/KTpProxy/svc-channel-proxy.cpp | 136 +++++++++
otr-proxy/KTpProxy/svc-channel-proxy.h | 338 +++++++++++++++++++++
otr-proxy/KTpProxy/svc-proxy-service.cpp | 23 ++
otr-proxy/KTpProxy/svc-proxy-service.h | 82 +++++
otr-proxy/KTpProxy/types.h | 33 ++
otr-proxy/data/CMakeLists.txt | 6 +
...eedesktop.Telepathy.Client.KTp.Proxy.service.in | 3 +
otr-proxy/spec/ChannelProxy_Interface_OTR.xml | 242 +++++++++++++++
otr-proxy/spec/ProxyService.xml | 47 +++
24 files changed, 1844 insertions(+)
diff --git a/otr-proxy/CMakeLists.txt b/otr-proxy/CMakeLists.txt
new file mode 100644
index 0000000..0ea2e92
--- /dev/null
+++ b/otr-proxy/CMakeLists.txt
@@ -0,0 +1,21 @@
+project(ktp-proxy)
+set(KTP_PROXY_VERSION "0.1.1")
+
+set(KDE_MIN_VERSION "4.13.1")
+find_package (KDE4 ${KDE_MIN_VERSION} REQUIRED)
+find_package (TelepathyQt4 0.9.1 REQUIRED)
+find_package (TelepathyQt4Service 0.9.2.1 REQUIRED)
+
+include_directories (${KDE4_INCLUDES}
+ ${TELEPATHY_QT4_INCLUDE_DIR}
+)
+
+include (KDE4Defaults)
+
+add_definitions (${KDE4_DEFINITIONS})
+
+configure_file(version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h @ONLY)
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
+
+add_subdirectory(KTpProxy)
+add_subdirectory(data)
diff --git a/otr-proxy/KTpProxy/CMakeLists.txt b/otr-proxy/KTpProxy/CMakeLists.txt
new file mode 100644
index 0000000..ea29ff2
--- /dev/null
+++ b/otr-proxy/KTpProxy/CMakeLists.txt
@@ -0,0 +1,23 @@
+set(ktp-proxy_SRCS
+ main.cpp
+ proxy-observer.cpp
+ proxy-service-adaptee.cpp
+ proxy-service.cpp
+ svc-channel-proxy.cpp
+ svc-proxy-service.cpp
+ otr-proxy-channel.cpp
+ otr-proxy-channel-adaptee.cpp
+)
+
+set(ktp-proxy_LIBS
+ ${KDE4_KDECORE_LIBS}
+ ${KDE4_KDEUI_LIBS}
+ ${KDE4_KIO_LIBS}
+ ${TELEPATHY_QT4_LIBRARIES}
+ ${TELEPATHY_QT4_SERVICE_LIBRARIES}
+)
+
+kde4_add_executable(ktp-proxy ${ktp-proxy_SRCS})
+
+target_link_libraries(ktp-proxy ${ktp-proxy_LIBS})
+install(TARGETS ktp-proxy DESTINATION ${LIBEXEC_INSTALL_DIR})
diff --git a/otr-proxy/KTpProxy/constants.h b/otr-proxy/KTpProxy/constants.h
new file mode 100644
index 0000000..578c5d4
--- /dev/null
+++ b/otr-proxy/KTpProxy/constants.h
@@ -0,0 +1,29 @@
+/***************************************************************************
+ * Copyright (C) 2014 by Marcin Ziemiński <zieminn at gmail.com> *
+ * *
+ * 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.1 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * 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, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+#ifndef KTP_PROXY_CONSTANTS_HEADER
+#define KTP_PROXY_CONSTANTS_HEADER
+
+#define KTP_PROXY_BUS_NAME (QString::fromLatin1("org.freedesktop.Telepathy.Client.KTp.Proxy"))
+#define KTP_PROXY_SERVICE_OBJECT_PATH (QString::fromLatin1("/org/freedesktop/TelepathyProxy/ProxyService"))
+#define KTP_PROXY_CHANNEL_OBJECT_PATH_PREFIX (QString::fromLatin1("/org/freedesktop/TelepathyProxy/OtrChannelProxy/"))
+
+#define KTP_PROXY_ERROR_NOT_CONNECTED (QString::fromLatin1("org.freedesktop.TelepathyProxy.Error.NotConnected"))
+
+#endif
diff --git a/otr-proxy/KTpProxy/main.cpp b/otr-proxy/KTpProxy/main.cpp
new file mode 100644
index 0000000..c7b12e0
--- /dev/null
+++ b/otr-proxy/KTpProxy/main.cpp
@@ -0,0 +1,69 @@
+/***************************************************************************
+ * Copyright (C) 2014 by Marcin Ziemiński <zieminn at gmail.com> *
+ * *
+ * 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.1 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * 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, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+#include "proxy-service.h"
+#include "version.h"
+
+#include <KAboutData>
+#include <KCmdLineArgs>
+#include <KApplication>
+#include <KDebug>
+
+#include <QDBusConnection>
+
+#include <TelepathyQt/AbstractAdaptor>
+#include <TelepathyQt/Channel>
+#include <TelepathyQt/Connection>
+#include <TelepathyQt/ClientRegistrar>
+#include <TelepathyQt/TextChannel>
+
+
+int main(int argc, char *argv[])
+{
+ KAboutData aboutData("ktp-proxy", 0,
+ ki18n("Channel proxy service"),
+ KTP_PROXY_VERSION);
+
+ aboutData.addAuthor(ki18n("Marcin Ziemiński"), ki18n("Developer"), "zieminn at gmail.com");
+ aboutData.setProductName("telepathy/ktp-proxy");
+ aboutData.setLicense(KAboutData::License_GPL_V2);
+ aboutData.setProgramIconName(QLatin1String("telepathy-kde"));
+
+ KCmdLineArgs::init(argc, argv, &aboutData);
+
+ KApplication app(false);
+
+ Tp::registerTypes();
+
+ Tp::DBusError error;
+ QDBusConnection dbusConnection = QDBusConnection::sessionBus();
+ ProxyService ps(dbusConnection);
+ ps.registerService(&error);
+
+ if(error.isValid())
+ {
+ kError() << "Could not register ProxyService
"
+ << "error name: " << error.name() << "
"
+ << "error message: " << error.message();
+
+ return 1;
+ } else {
+ return app.exec();
+ }
+}
diff --git a/otr-proxy/KTpProxy/otr-proxy-channel-adaptee.cpp b/otr-proxy/KTpProxy/otr-proxy-channel-adaptee.cpp
new file mode 100644
index 0000000..364979c
--- /dev/null
+++ b/otr-proxy/KTpProxy/otr-proxy-channel-adaptee.cpp
@@ -0,0 +1,158 @@
+/***************************************************************************
+ * Copyright (C) 2014 by Marcin Ziemiński <zieminn at gmail.com> *
+ * *
+ * 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.1 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * 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, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+#include "otr-proxy-channel-adaptee.h"
+#include "otr-proxy-channel.h"
+#include "constants.h"
+
+#include <TelepathyQt/DBusObject>
+#include <TelepathyQt/TextChannel>
+
+#include <KDebug>
+
+// TODO
+// - add errors to spec
+
+OtrProxyChannel::Adaptee::Adaptee(OtrProxyChannel *pc, const QDBusConnection &dbusConnection, const Tp::TextChannelPtr &channel)
+ : adaptor(new Tp::Service::ChannelProxyInterfaceOTRAdaptor(dbusConnection, this, pc->dbusObject())),
+ pc(pc),
+ chan(channel),
+ isConnected(false)
+{
+ connect(chan.data(), SIGNAL(invalidated(Tp::DBusProxy*,const QString&,const QString&)), SIGNAL(closed()));
+}
+
+QDBusObjectPath OtrProxyChannel::Adaptee::wrappedChannel() const
+{
+ return QDBusObjectPath(chan->objectPath());
+}
+
+bool OtrProxyChannel::Adaptee::connected() const
+{
+ return isConnected;
+}
+
+Tp::MessagePartListList OtrProxyChannel::Adaptee::pendingMessages() const
+{
+ Tp::MessagePartListList messages;
+ Q_FOREACH(const Tp::ReceivedMessage &mes, chan->messageQueue()) {
+ messages << mes.parts();
+ }
+
+ return messages;
+}
+
+uint OtrProxyChannel::Adaptee::trustLevel() const
+{
+ return 1;
+}
+
+QString OtrProxyChannel::Adaptee::localFingerprint() const
+{
+ return QString::fromLatin1("not implemented");
+}
+
+QString OtrProxyChannel::Adaptee::remoteFingerprint() const
+{
+ return QString::fromLatin1("not implemented");
+}
+
+Tp::TextChannelPtr OtrProxyChannel::Adaptee::channel() const
+{
+ return chan;
+}
+
+void OtrProxyChannel::Adaptee::connectProxy(
+ const Tp::Service::ChannelProxyInterfaceOTRAdaptor::ConnectProxyContextPtr &context)
+{
+ kDebug() << "Connecting proxy: " << pc->objectPath();
+ connect(chan.data(),
+ SIGNAL(messageReceived(const Tp::ReceivedMessage&)),
+ SLOT(onMessageReceived(const Tp::ReceivedMessage&)));
+
+ connect(chan.data(),
+ SIGNAL(pendingMessageRemoved(const Tp::ReceivedMessage&)),
+ SLOT(onPendingMessageRemoved(const Tp::ReceivedMessage&)));
+
+ isConnected = true;
+ context->setFinished();
+}
+void OtrProxyChannel::Adaptee::disconnectProxy(
+ const Tp::Service::ChannelProxyInterfaceOTRAdaptor::DisconnectProxyContextPtr &context)
+{
+ kDebug() << "Disconnecting proxy: " << pc->objectPath();
+ disconnect(chan.data(), SIGNAL(messageReceived(const Tp::ReceivedMessage&)),
+ this, SLOT(onMessageReceived(const Tp::ReceivedMessage&)));
+
+ disconnect(chan.data(), SIGNAL(pendingMessageRemoved(const Tp::ReceivedMessage&)),
+ this, SLOT(onPendingMessageRemoved(const Tp::ReceivedMessage&)));
+
+ isConnected = false;
+ context->setFinished();
+}
+
+void OtrProxyChannel::Adaptee::sendMessage(const Tp::MessagePartList &message, uint flags,
+ const Tp::Service::ChannelProxyInterfaceOTRAdaptor::SendMessageContextPtr &context)
+{
+ if(!connected()) {
+ context->setFinishedWithError(KTP_PROXY_ERROR_NOT_CONNECTED, QString::fromLatin1("Proxy is not connected"));
+ return;
+ }
+ context->setFinished();
+}
+
+void OtrProxyChannel::Adaptee::acknowledgePendingMessages(const Tp::UIntList &ids,
+ const Tp::Service::ChannelProxyInterfaceOTRAdaptor::AcknowledgePendingMessagesContextPtr &context)
+{
+ if(!connected()) {
+ context->setFinishedWithError(KTP_PROXY_ERROR_NOT_CONNECTED, QString::fromLatin1("Proxy is not connected"));
+ return;
+ }
+ context->setFinished();
+}
+
+void OtrProxyChannel::Adaptee::initialize(const Tp::Service::ChannelProxyInterfaceOTRAdaptor::InitializeContextPtr &context)
+{
+ if(!connected()) {
+ context->setFinishedWithError(KTP_PROXY_ERROR_NOT_CONNECTED, QString::fromLatin1("Proxy is not connected"));
+ return;
+ }
+ context->setFinished();
+}
+
+void OtrProxyChannel::Adaptee::stop(const Tp::Service::ChannelProxyInterfaceOTRAdaptor::StopContextPtr &context)
+{
+ if(!connected()) {
+ context->setFinishedWithError(KTP_PROXY_ERROR_NOT_CONNECTED, QString::fromLatin1("Proxy is not connected"));
+ return;
+ }
+ context->setFinished();
+}
+
+void OtrProxyChannel::Adaptee::onMessageReceived(const Tp::ReceivedMessage &receivedMessage)
+{
+ kDebug() << "Received message: " << receivedMessage.text();
+ emit messageReceived(receivedMessage.parts());
+}
+
+void OtrProxyChannel::Adaptee::onPendingMessageRemoved(const Tp::ReceivedMessage &receivedMessage)
+{
+ QDBusVariant variant = receivedMessage.header().value(QLatin1String("pending-message-id"));
+ emit pendingMessagesRemoved(Tp::UIntList() << variant.variant().toUInt(NULL));
+}
diff --git a/otr-proxy/KTpProxy/otr-proxy-channel-adaptee.h b/otr-proxy/KTpProxy/otr-proxy-channel-adaptee.h
new file mode 100644
index 0000000..123c58f
--- /dev/null
+++ b/otr-proxy/KTpProxy/otr-proxy-channel-adaptee.h
@@ -0,0 +1,82 @@
+/***************************************************************************
+ * Copyright (C) 2014 by Marcin Ziemiński <zieminn at gmail.com> *
+ * *
+ * 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.1 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * 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, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+#ifndef KTP_PROXY_OTR_PROXY_CHANNEL_ADAPTEE_HEADER
+#define KTP_PROXY_OTR_PROXY_CHANNEL_ADAPTEE_HEADER
+
+#include "svc-channel-proxy.h"
+#include "otr-proxy-channel.h"
+
+#include <TelepathyQt/ReceivedMessage>
+
+#include <QDBusObjectPath>
+#include <QDBusConnection>
+
+class OtrProxyChannel::Adaptee : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QDBusObjectPath wrappedChannel READ wrappedChannel)
+ Q_PROPERTY(bool connected READ connected)
+ Q_PROPERTY(Tp::MessagePartListList pendingMessages READ pendingMessages)
+ Q_PROPERTY(uint trustLevel READ trustLevel)
+ Q_PROPERTY(QString localFingerprint READ localFingerprint)
+ Q_PROPERTY(QString remoteFingerprint READ remoteFingerprint)
+
+ public:
+ Adaptee(OtrProxyChannel *pc, const QDBusConnection &dbusConnection, const Tp::TextChannelPtr &channel);
+
+ QDBusObjectPath wrappedChannel() const;
+ bool connected() const;
+ Tp::MessagePartListList pendingMessages() const;
+ uint trustLevel() const;
+ QString localFingerprint() const;
+ QString remoteFingerprint() const;
+
+ Tp::TextChannelPtr channel() const;
+
+ private Q_SLOTS:
+ void connectProxy(const Tp::Service::ChannelProxyInterfaceOTRAdaptor::ConnectProxyContextPtr &context);
+ void disconnectProxy(const Tp::Service::ChannelProxyInterfaceOTRAdaptor::DisconnectProxyContextPtr &context);
+ void sendMessage(const Tp::MessagePartList &message, uint flags,
+ const Tp::Service::ChannelProxyInterfaceOTRAdaptor::SendMessageContextPtr &context);
+ void acknowledgePendingMessages(const Tp::UIntList &ids,
+ const Tp::Service::ChannelProxyInterfaceOTRAdaptor::AcknowledgePendingMessagesContextPtr &context);
+
+ void initialize(const Tp::Service::ChannelProxyInterfaceOTRAdaptor::InitializeContextPtr &context);
+ void stop(const Tp::Service::ChannelProxyInterfaceOTRAdaptor::StopContextPtr &context);
+
+ void onMessageReceived(const Tp::ReceivedMessage &receivedMessage);
+ void onPendingMessageRemoved(const Tp::ReceivedMessage &receivedMessage);
+
+ Q_SIGNALS:
+ void messageSent(const Tp::MessagePartList &content, uint flags, const QString &messageToken);
+ void messageReceived(const Tp::MessagePartList &message);
+ void pendingMessagesRemoved(const Tp::UIntList &ids);
+ void sessionRefreshed();
+ void closed();
+
+ private:
+ Tp::Service::ChannelProxyInterfaceOTRAdaptor *adaptor;
+ OtrProxyChannel *pc;
+ Tp::TextChannelPtr chan;
+ bool isConnected;
+
+};
+
+#endif
diff --git a/otr-proxy/KTpProxy/otr-proxy-channel-internal.h b/otr-proxy/KTpProxy/otr-proxy-channel-internal.h
new file mode 100644
index 0000000..1edc7dd
--- /dev/null
+++ b/otr-proxy/KTpProxy/otr-proxy-channel-internal.h
@@ -0,0 +1,11 @@
+#ifndef KTP_PROXY_OTR_PROXY_CHANNEL_INTERNAL_HEADER
+#define KTP_PROXY_OTR_PROXY_CHANNEL_INTERNAL_HEADER
+
+#include "svc-channel-proxy.h"
+
+class OtrProxyChannel::Adaptee : public QObject
+{
+
+};
+
+#endif /* KTP_PROXY_OTR_PROXY_CHANNEL_INTERNAL_HEADER */
diff --git a/otr-proxy/KTpProxy/otr-proxy-channel.cpp b/otr-proxy/KTpProxy/otr-proxy-channel.cpp
new file mode 100644
index 0000000..9c4e8f8
--- /dev/null
+++ b/otr-proxy/KTpProxy/otr-proxy-channel.cpp
@@ -0,0 +1,89 @@
+/***************************************************************************
+ * Copyright (C) 2014 by Marcin Ziemiński <zieminn at gmail.com> *
+ * *
+ * 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.1 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * 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, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+#include "otr-proxy-channel.h"
+#include "otr-proxy-channel-adaptee.h"
+#include "constants.h"
+
+#include <TelepathyQt/Channel>
+#include <TelepathyQt/TextChannel>
+#include <TelepathyQt/DBusError>
+#include <TelepathyQt/Connection>
+
+class OtrProxyChannel::Private
+{
+ public:
+ Private(const QDBusConnection &dbusConnection,
+ OtrProxyChannel *pc,
+ const Tp::TextChannelPtr &channel)
+ : adaptee(pc, dbusConnection, channel)
+ {
+ }
+
+ Adaptee adaptee;
+};
+
+OtrProxyChannel::OtrProxyChannel(const QDBusConnection &dbusConnection, const Tp::TextChannelPtr &channel)
+ : Tp::DBusService(dbusConnection),
+ d(new Private(dbusConnection, this, channel))
+{
+ connect(&d->adaptee, SIGNAL(closed()), SLOT(onClosed()));
+}
+
+OtrProxyChannel::~OtrProxyChannel()
+{
+ delete d;
+}
+
+OtrProxyChannelPtr OtrProxyChannel::create(const QDBusConnection &dbusConnection, const Tp::TextChannelPtr &channel)
+{
+ return OtrProxyChannelPtr(new OtrProxyChannel(dbusConnection, channel));
+}
+
+void OtrProxyChannel::registerService(Tp::DBusError *error)
+{
+ int index;
+ QString connectionId = d->adaptee.channel()->connection()->objectPath();
+ index = connectionId.lastIndexOf(QChar::fromLatin1('/'));
+ connectionId = connectionId.mid(index+1);
+
+ QString channelId = d->adaptee.channel()->objectPath();
+ index = channelId.lastIndexOf(QChar::fromLatin1('/'));
+ channelId = channelId.mid(index+1);
+
+ QString objectPath = QString::fromLatin1("%1%2/%3").arg(KTP_PROXY_CHANNEL_OBJECT_PATH_PREFIX, connectionId, channelId);
+
+ Tp::DBusService::registerObject(KTP_PROXY_BUS_NAME, objectPath, error);
+}
+
+QVariantMap OtrProxyChannel::immutableProperties() const
+{
+ return QVariantMap();
+}
+
+Tp::TextChannelPtr OtrProxyChannel::wrappedChannel() const
+{
+ return d->adaptee.channel();
+}
+
+void OtrProxyChannel::onClosed()
+{
+ emit closed();
+}
+
diff --git a/otr-proxy/KTpProxy/otr-proxy-channel.h b/otr-proxy/KTpProxy/otr-proxy-channel.h
new file mode 100644
index 0000000..1497f97
--- /dev/null
+++ b/otr-proxy/KTpProxy/otr-proxy-channel.h
@@ -0,0 +1,67 @@
+/***************************************************************************
+ * Copyright (C) 2014 by Marcin Ziemiński <zieminn at gmail.com> *
+ * *
+ * 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.1 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * 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, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+#ifndef KTP_PROXY_OTR_PROXY_CHANNEL_HEADER
+#define KTP_PROXY_OTR_PROXY_CHANNEL_HEADER
+
+#include "types.h"
+
+#include <TelepathyQt/DBusService>
+#include <TelepathyQt/TextChannel>
+
+#include <QDBusObjectPath>
+
+class OtrProxyChannel : public Tp::DBusService
+{
+
+ Q_OBJECT
+ Q_DISABLE_COPY(OtrProxyChannel)
+
+ private:
+ OtrProxyChannel(const QDBusConnection &dbusConnection, const Tp::TextChannelPtr &channel);
+
+ public:
+ ~OtrProxyChannel();
+ static OtrProxyChannelPtr create(const QDBusConnection &dbusConnection, const Tp::TextChannelPtr &channel);
+
+ void registerService(Tp::DBusError *error);
+
+ QVariantMap immutableProperties() const;
+
+ bool isConnected() const;
+
+ Tp::TextChannelPtr wrappedChannel() const;
+
+ Q_SIGNALS:
+ void connected(const QDBusObjectPath &proxyPath);
+ void disconnected(const QDBusObjectPath &proxyPath);
+ void closed();
+
+ private Q_SLOTS:
+ void onClosed();
+
+ private:
+ class Adaptee;
+ friend class Adaptee;
+ class Private;
+ friend class Private;
+ Private *d;
+};
+
+#endif /* KTP_PROXY_OTR_PROXY_CHANNEL_HEADER */
diff --git a/otr-proxy/KTpProxy/proxy-observer.cpp b/otr-proxy/KTpProxy/proxy-observer.cpp
new file mode 100644
index 0000000..87e7b54
--- /dev/null
+++ b/otr-proxy/KTpProxy/proxy-observer.cpp
@@ -0,0 +1,53 @@
+/***************************************************************************
+ * Copyright (C) 2014 by Marcin Ziemiński <zieminn at gmail.com> *
+ * *
+ * 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.1 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * 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, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+#include "proxy-observer.h"
+#include "proxy-service.h"
+
+#include <TelepathyQt/ChannelClassSpecList>
+#include <TelepathyQt/Channel>
+
+#include <KDebug>
+
+
+ProxyObserver::ProxyObserver(ProxyService *ps)
+ : Tp::AbstractClientObserver(Tp::ChannelClassSpecList() << Tp::ChannelClassSpec::textChat()),
+ ps(ps)
+{
+
+}
+
+ProxyObserver::~ProxyObserver() { }
+
+void ProxyObserver::observeChannels(
+ const Tp::MethodInvocationContextPtr<> &context,
+ const Tp::AccountPtr &account,
+ const Tp::ConnectionPtr &connection,
+ const QList<Tp::ChannelPtr> &channels,
+ const Tp::ChannelDispatchOperationPtr &dispatchOperation,
+ const QList<Tp::ChannelRequestPtr> &requestsSatisfied,
+ const Tp::AbstractClientObserver::ObserverInfo &observerInfo)
+{
+
+ kDebug() << "Observed a channel";
+ Q_FOREACH(const Tp::ChannelPtr &chan, channels) {
+ ps->addChannel(chan);
+ }
+ context->setFinished();
+}
diff --git a/otr-proxy/KTpProxy/proxy-observer.h b/otr-proxy/KTpProxy/proxy-observer.h
new file mode 100644
index 0000000..5b37e02
--- /dev/null
+++ b/otr-proxy/KTpProxy/proxy-observer.h
@@ -0,0 +1,49 @@
+/***************************************************************************
+ * Copyright (C) 2014 by Marcin Ziemiński <zieminn at gmail.com> *
+ * *
+ * 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.1 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * 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, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+#ifndef KTP_PROXY_OBSERVER_HEADER
+#define KTP_PROXY_OBSERVER_HEADER
+
+#include "types.h"
+
+#include <TelepathyQt/AbstractClientObserver>
+#include <TelepathyQt/Types>
+
+class ProxyService;
+
+class ProxyObserver : public Tp::AbstractClientObserver
+{
+ public:
+ ProxyObserver(ProxyService *ps);
+ ~ProxyObserver();
+
+ virtual void observeChannels(
+ const Tp::MethodInvocationContextPtr<> &context,
+ const Tp::AccountPtr &account,
+ const Tp::ConnectionPtr &connection,
+ const QList<Tp::ChannelPtr> &channels,
+ const Tp::ChannelDispatchOperationPtr &dispatchOperation,
+ const QList<Tp::ChannelRequestPtr> &requestsSatisfied,
+ const Tp::AbstractClientObserver::ObserverInfo &observerInfo);
+
+ private:
+ ProxyService *ps;
+};
+
+#endif
diff --git a/otr-proxy/KTpProxy/proxy-service-adaptee.cpp b/otr-proxy/KTpProxy/proxy-service-adaptee.cpp
new file mode 100644
index 0000000..379ae29
--- /dev/null
+++ b/otr-proxy/KTpProxy/proxy-service-adaptee.cpp
@@ -0,0 +1,39 @@
+/***************************************************************************
+ * Copyright (C) 2014 by Marcin Ziemiński <zieminn at gmail.com> *
+ * *
+ * 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.1 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * 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, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+#include "proxy-service-adaptee.h"
+#include "svc-proxy-service.h"
+#include "proxy-service.h"
+
+#include <TelepathyQt/DBusObject>
+
+ProxyServiceAdaptee::ProxyServiceAdaptee(ProxyService *ps, const QDBusConnection &dbusConnection)
+ : adaptor(new Tp::Service::ProxyServiceAdaptor(dbusConnection, this, ps->dbusObject()))
+{
+}
+ProxyServiceAdaptee::~ProxyServiceAdaptee() { }
+
+void ProxyServiceAdaptee::onProxyConnected(const QDBusObjectPath &proxyPath)
+{
+ emit proxyconnected(proxyPath);
+}
+void ProxyServiceAdaptee::onProxyDisconnected(const QDBusObjectPath &proxyPath)
+{
+ emit proxydisconnected(proxyPath);
+}
diff --git a/otr-proxy/KTpProxy/proxy-service-adaptee.h b/otr-proxy/KTpProxy/proxy-service-adaptee.h
new file mode 100644
index 0000000..c43113c
--- /dev/null
+++ b/otr-proxy/KTpProxy/proxy-service-adaptee.h
@@ -0,0 +1,55 @@
+/***************************************************************************
+ * Copyright (C) 2014 by Marcin Ziemiński <zieminn at gmail.com> *
+ * *
+ * 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.1 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * 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, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+#ifndef KTP_PROXY_PROXY_SERVICE_ADAPTEE_HEADER
+#define KTP_PROXY_PROXY_SERVICE_ADAPTEE_HEADER
+
+#include <QDBusObjectPath>
+#include <QDBusConnection>
+
+namespace Tp
+{
+namespace Service
+{
+ class ProxyServiceAdaptor;
+}
+}
+class ProxyService;
+
+class ProxyServiceAdaptee : public QObject
+{
+ Q_OBJECT
+
+ public:
+ ProxyServiceAdaptee(ProxyService *ps, const QDBusConnection &dbusConnection);
+ ~ProxyServiceAdaptee();
+
+ Q_SIGNALS:
+ void proxyconnected(const QDBusObjectPath &proxyPath);
+ void proxydisconnected(const QDBusObjectPath &proxyPath);
+
+ public Q_SLOTS:
+ void onProxyConnected(const QDBusObjectPath &proxyPath);
+ void onProxyDisconnected(const QDBusObjectPath &proxyPath);
+
+ private:
+ Tp::Service::ProxyServiceAdaptor *adaptor;
+};
+
+#endif
diff --git a/otr-proxy/KTpProxy/proxy-service.cpp b/otr-proxy/KTpProxy/proxy-service.cpp
new file mode 100644
index 0000000..a40806e
--- /dev/null
+++ b/otr-proxy/KTpProxy/proxy-service.cpp
@@ -0,0 +1,121 @@
+/***************************************************************************
+ * Copyright (C) 2014 by Marcin Ziemiński <zieminn at gmail.com> *
+ * *
+ * 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.1 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * 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, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+#include "proxy-service.h"
+#include "proxy-observer.h"
+#include "otr-proxy-channel.h"
+#include "constants.h"
+
+#include <TelepathyQt/ClientRegistrar>
+#include <TelepathyQt/TextChannel>
+#include <TelepathyQt/PendingReady>
+
+#include <KDebug>
+#include <KApplication>
+
+ProxyService::ProxyService(const QDBusConnection &dbusConnection)
+ : Tp::DBusService(dbusConnection),
+ adaptee(this, dbusConnection),
+ observer(new ProxyObserver(this)),
+ registrar(Tp::ClientRegistrar::create(dbusConnection))
+{
+}
+
+ProxyService::~ProxyService()
+{
+ registrar->unregisterClients();
+}
+
+void ProxyService::addChannel(const Tp::ChannelPtr &channel)
+{
+ Tp::TextChannelPtr textChannel = Tp::TextChannel::create(channel->connection(), channel->objectPath(), QVariantMap());
+ Tp::PendingReady *pendingReady =
+ textChannel->becomeReady(Tp::Features()
+ << Tp::TextChannel::FeatureCore
+ << Tp::TextChannel::FeatureMessageQueue
+ << Tp::TextChannel::FeatureMessageCapabilities
+ );
+
+ connect(pendingReady, SIGNAL(finished(Tp::PendingOperation*)), SLOT(onChannelReady(Tp::PendingOperation*)));
+}
+
+void ProxyService::registerService(Tp::DBusError *error)
+{
+ Tp::AbstractClientPtr baseObserverPtr = Tp::AbstractClientPtr::dynamicCast(observer);
+ const bool isRegistered = registrar->registerClient(baseObserverPtr, QString::fromLatin1("ProxyObserver"));
+ if(!isRegistered) {
+ error->set(
+ QString::fromLatin1("Client registering error"),
+ QString::fromLatin1("Could not register the observer"));
+ return;
+ }
+
+ DBusService::registerObject(KTP_PROXY_BUS_NAME, KTP_PROXY_SERVICE_OBJECT_PATH, error);
+}
+
+QVariantMap ProxyService::immutableProperties() const
+{
+ return QVariantMap();
+}
+
+void ProxyService::onChannelProxyClosed()
+{
+ OtrProxyChannel *proxyChannel = dynamic_cast<OtrProxyChannel*>(QObject::sender());
+ kDebug() << "Removing proxy: " << proxyChannel->objectPath()
+ << " for the channel: " << proxyChannel->wrappedChannel()->objectPath();
+
+ channels.remove(proxyChannel);
+}
+
+void ProxyService::onChannelReady(Tp::PendingOperation *pendingChanReady)
+{
+ if(pendingChanReady->isError()) {
+ kWarning() << "Channel couldn't become ready due to: "
+ << pendingChanReady->errorName() << " - " << pendingChanReady->errorMessage();
+ return;
+ }
+ Tp::PendingReady *pendingReady = dynamic_cast<Tp::PendingReady*>(pendingChanReady);
+ Tp::TextChannelPtr textChannel = Tp::TextChannelPtr::dynamicCast(pendingReady->proxy());
+ kDebug() << "Channel ready: " << textChannel->objectPath();
+
+ Tp::DBusError error;
+ OtrProxyChannelPtr proxyChannel = OtrProxyChannel::create(dbusConnection(), textChannel);
+ proxyChannel->registerService(&error);
+
+ if(error.isValid()) {
+ kError() << "Couldn't install proxy for the channel: " << textChannel->objectPath() << "
"
+ << "error name: " << error.name() << "
"
+ << "error message: " << error.message();
+
+ return;
+ }
+
+ channels.insert(proxyChannel.data(), proxyChannel);
+
+ connect(proxyChannel.data(), SIGNAL(closed()), SLOT(onChannelProxyClosed()));
+ QObject::connect(
+ proxyChannel.data(), SIGNAL(connected(const QDBusObjectPath&)),
+ &adaptee, SLOT(onProxyConnected(const QDBusObjectPath&)));
+ QObject::connect(
+ proxyChannel.data(), SIGNAL(disconnected(const QDBusObjectPath&)),
+ &adaptee, SLOT(onProxyDisconnected(const QDBusObjectPath&)));
+
+ kDebug() << "Installed proxy: " << proxyChannel->objectPath() << "
"
+ << " for the channel: " << textChannel->objectPath();
+}
diff --git a/otr-proxy/KTpProxy/proxy-service.h b/otr-proxy/KTpProxy/proxy-service.h
new file mode 100644
index 0000000..d395e3d
--- /dev/null
+++ b/otr-proxy/KTpProxy/proxy-service.h
@@ -0,0 +1,68 @@
+/***************************************************************************
+ * Copyright (C) 2014 by Marcin Ziemiński <zieminn at gmail.com> *
+ * *
+ * 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.1 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * 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, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+#ifndef KTP_PROXY_PROXY_SERVICE_HEADER
+#define KTP_PROXY_PROXY_SERVICE_HEADER
+
+#include "proxy-service-adaptee.h"
+#include "proxy-observer.h"
+#include "types.h"
+
+#include <TelepathyQt/AbstractClientObserver>
+#include <TelepathyQt/Types>
+#include <TelepathyQt/DBusService>
+
+#include <QDBusConnection>
+#include <QMap>
+
+namespace Tp
+{
+ class PendingOperation;
+}
+
+
+class ProxyService : public Tp::DBusService
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(ProxyService)
+
+ public:
+ ProxyService(const QDBusConnection &dbusConnection);
+ ~ProxyService();
+
+ void addChannel(const Tp::ChannelPtr &channel);
+
+ void registerService(Tp::DBusError *error);
+
+ QVariantMap immutableProperties() const;
+
+ private Q_SLOTS:
+ void onChannelProxyClosed();
+
+ private Q_SLOTS:
+ void onChannelReady(Tp::PendingOperation *pendingChanReady);
+
+ private:
+ ProxyServiceAdaptee adaptee;
+ QMap<OtrProxyChannel*, OtrProxyChannelPtr> channels;
+ ProxyObserverPtr observer;
+ Tp::ClientRegistrarPtr registrar;
+};
+
+#endif
diff --git a/otr-proxy/KTpProxy/svc-channel-proxy.cpp b/otr-proxy/KTpProxy/svc-channel-proxy.cpp
new file mode 100644
index 0000000..10e2155
--- /dev/null
+++ b/otr-proxy/KTpProxy/svc-channel-proxy.cpp
@@ -0,0 +1,136 @@
+#include "svc-channel-proxy.h"
+
+#include <TelepathyQt/Constants>
+#include <TelepathyQt/MethodInvocationContext>
+
+namespace Tp
+{
+namespace Service
+{
+
+ChannelProxyInterfaceOTRAdaptor::ChannelProxyInterfaceOTRAdaptor(const QDBusConnection& bus, QObject* adaptee, QObject* parent)
+ : Tp::AbstractAdaptor(bus, adaptee, parent)
+{
+ connect(adaptee, SIGNAL(messageSent(const Tp::MessagePartList&, uint, const QString&)), SIGNAL(MessageSent(const Tp::MessagePartList&, uint, const QString&)));
+ connect(adaptee, SIGNAL(messageReceived(const Tp::MessagePartList&)), SIGNAL(MessageReceived(const Tp::MessagePartList&)));
+ connect(adaptee, SIGNAL(pendingMessagesRemoved(const Tp::UIntList&)), SIGNAL(PendingMessagesRemoved(const Tp::UIntList&)));
+ connect(adaptee, SIGNAL(sessionRefreshed()), SIGNAL(SessionRefreshed()));
+}
+
+ChannelProxyInterfaceOTRAdaptor::~ChannelProxyInterfaceOTRAdaptor()
+{
+}
+
+QDBusObjectPath ChannelProxyInterfaceOTRAdaptor::WrappedChannel() const
+{
+ return qvariant_cast< QDBusObjectPath >(adaptee()->property("wrappedChannel"));
+}
+
+bool ChannelProxyInterfaceOTRAdaptor::Connected() const
+{
+ return qvariant_cast< bool >(adaptee()->property("connected"));
+}
+
+Tp::MessagePartListList ChannelProxyInterfaceOTRAdaptor::PendingMessages() const
+{
+ return qvariant_cast< Tp::MessagePartListList >(adaptee()->property("pendingMessages"));
+}
+
+uint ChannelProxyInterfaceOTRAdaptor::TrustLevel() const
+{
+ return qvariant_cast< uint >(adaptee()->property("trustLevel"));
+}
+
+QString ChannelProxyInterfaceOTRAdaptor::LocalFingerprint() const
+{
+ return qvariant_cast< QString >(adaptee()->property("localFingerprint"));
+}
+
+QString ChannelProxyInterfaceOTRAdaptor::RemoteFingerprint() const
+{
+ return qvariant_cast< QString >(adaptee()->property("remoteFingerprint"));
+}
+
+void ChannelProxyInterfaceOTRAdaptor::ConnectProxy(const QDBusMessage& dbusMessage)
+{
+ if (!adaptee()->metaObject()->indexOfMethod("connectProxy(Tp::Service::ChannelProxyInterfaceOTRAdaptor::ConnectProxyContextPtr)") == -1) {
+ dbusConnection().send(dbusMessage.createErrorReply(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented")));
+ return;
+ }
+
+ ConnectProxyContextPtr ctx = ConnectProxyContextPtr(
+ new Tp::MethodInvocationContext< >(dbusConnection(), dbusMessage));
+ QMetaObject::invokeMethod(adaptee(), "connectProxy",
+ Q_ARG(Tp::Service::ChannelProxyInterfaceOTRAdaptor::ConnectProxyContextPtr, ctx));
+}
+
+void ChannelProxyInterfaceOTRAdaptor::DisconnectProxy(const QDBusMessage& dbusMessage)
+{
+ if (!adaptee()->metaObject()->indexOfMethod("disconnectProxy(Tp::Service::ChannelProxyInterfaceOTRAdaptor::DisconnectProxyContextPtr)") == -1) {
+ dbusConnection().send(dbusMessage.createErrorReply(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented")));
+ return;
+ }
+
+ DisconnectProxyContextPtr ctx = DisconnectProxyContextPtr(
+ new Tp::MethodInvocationContext< >(dbusConnection(), dbusMessage));
+ QMetaObject::invokeMethod(adaptee(), "disconnectProxy",
+ Q_ARG(Tp::Service::ChannelProxyInterfaceOTRAdaptor::DisconnectProxyContextPtr, ctx));
+}
+
+QString ChannelProxyInterfaceOTRAdaptor::SendMessage(const Tp::MessagePartList& message, uint flags, const QDBusMessage& dbusMessage)
+{
+ if (!adaptee()->metaObject()->indexOfMethod("sendMessage(Tp::MessagePartList,uint,Tp::Service::ChannelProxyInterfaceOTRAdaptor::SendMessageContextPtr)") == -1) {
+ dbusConnection().send(dbusMessage.createErrorReply(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented")));
+ return QString();
+ }
+
+ SendMessageContextPtr ctx = SendMessageContextPtr(
+ new Tp::MethodInvocationContext< QString >(dbusConnection(), dbusMessage));
+ QMetaObject::invokeMethod(adaptee(), "sendMessage",
+ Q_ARG(Tp::MessagePartList, message), Q_ARG(uint, flags),
+ Q_ARG(Tp::Service::ChannelProxyInterfaceOTRAdaptor::SendMessageContextPtr, ctx));
+ return QString();
+}
+
+void ChannelProxyInterfaceOTRAdaptor::AcknowledgePendingMessages(const Tp::UIntList& IDs, const QDBusMessage& dbusMessage)
+{
+ if (!adaptee()->metaObject()->indexOfMethod("acknowledgePendingMessages(Tp::UIntList,Tp::Service::ChannelProxyInterfaceOTRAdaptor::AcknowledgePendingMessagesContextPtr)") == -1) {
+ dbusConnection().send(dbusMessage.createErrorReply(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented")));
+ return;
+ }
+
+ AcknowledgePendingMessagesContextPtr ctx = AcknowledgePendingMessagesContextPtr(
+ new Tp::MethodInvocationContext< >(dbusConnection(), dbusMessage));
+ QMetaObject::invokeMethod(adaptee(), "acknowledgePendingMessages",
+ Q_ARG(Tp::UIntList, IDs),
+ Q_ARG(Tp::Service::ChannelProxyInterfaceOTRAdaptor::AcknowledgePendingMessagesContextPtr, ctx));
+}
+
+void ChannelProxyInterfaceOTRAdaptor::Initialize(const QDBusMessage& dbusMessage)
+{
+ if (!adaptee()->metaObject()->indexOfMethod("initialize(Tp::Service::ChannelProxyInterfaceOTRAdaptor::InitializeContextPtr)") == -1) {
+ dbusConnection().send(dbusMessage.createErrorReply(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented")));
+ return;
+ }
+
+ InitializeContextPtr ctx = InitializeContextPtr(
+ new Tp::MethodInvocationContext< >(dbusConnection(), dbusMessage));
+ QMetaObject::invokeMethod(adaptee(), "initialize",
+ Q_ARG(Tp::Service::ChannelProxyInterfaceOTRAdaptor::InitializeContextPtr, ctx));
+}
+
+void ChannelProxyInterfaceOTRAdaptor::Stop(const QDBusMessage& dbusMessage)
+{
+ if (!adaptee()->metaObject()->indexOfMethod("stop(Tp::Service::ChannelProxyInterfaceOTRAdaptor::StopContextPtr)") == -1) {
+ dbusConnection().send(dbusMessage.createErrorReply(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented")));
+ return;
+ }
+
+ StopContextPtr ctx = StopContextPtr(
+ new Tp::MethodInvocationContext< >(dbusConnection(), dbusMessage));
+ QMetaObject::invokeMethod(adaptee(), "stop",
+ Q_ARG(Tp::Service::ChannelProxyInterfaceOTRAdaptor::StopContextPtr, ctx));
+}
+
+}
+}
diff --git a/otr-proxy/KTpProxy/svc-channel-proxy.h b/otr-proxy/KTpProxy/svc-channel-proxy.h
new file mode 100644
index 0000000..088eb70
--- /dev/null
+++ b/otr-proxy/KTpProxy/svc-channel-proxy.h
@@ -0,0 +1,338 @@
+#ifndef KTP_PROXY_SVC_CHANNEL_PROXY_HEADER
+#define KTP_PROXY_SVC_CHANNEL_PROXY_HEADER
+
+/*
+ * This file contains D-Bus adaptor classes generated by qt-svc-gen.py.
+ *
+ * This file can be distributed under the same terms as the specification from
+ * which it was generated.
+ */
+
+#include <TelepathyQt/AbstractAdaptor>
+#include <TelepathyQt/Global>
+#include <TelepathyQt/Types>
+
+#include <QObject>
+#include <QtDBus>
+
+namespace Tp
+{
+namespace Service
+{
+
+/**
+ *
--
ktp-common-internals packaging
More information about the pkg-kde-commits
mailing list