telepathy-qt: BaseConnection: Implemented missed addChannel() method.
David Edmundson
davidedmundson at kemper.freedesktop.org
Mon Jul 28 06:25:15 PDT 2014
Module: telepathy-qt
Branch: master
Commit: aefe3feeb4c35dffd65239d2cc522e97f6ee2c59
URL: http://cgit.freedesktop.org/telepathy/telepathy-qt/commit/?id=aefe3feeb4c35dffd65239d2cc522e97f6ee2c59
Author: Alexandr Akulich <akulichalexander at gmail.com>
Date: Thu Jun 19 18:57:50 2014 +0600
BaseConnection: Implemented missed addChannel() method.
---
TelepathyQt/base-connection.cpp | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/TelepathyQt/base-connection.cpp b/TelepathyQt/base-connection.cpp
index 870e23f..44a75b0 100644
--- a/TelepathyQt/base-connection.cpp
+++ b/TelepathyQt/base-connection.cpp
@@ -415,6 +415,39 @@ BaseChannelPtr BaseConnection::ensureChannel(const QString &channelType, uint ta
return createChannel(channelType, targetHandleType, targetHandle, initiatorHandle, suppressHandler, error);
}
+void BaseConnection::addChannel(BaseChannelPtr channel)
+{
+ if (mPriv->channels.contains(channel)) {
+ qDebug() << "BaseConnection::addChannel: Channel already added.";
+ return;
+ }
+
+ mPriv->channels.insert(channel);
+
+ BaseConnectionRequestsInterfacePtr reqIface =
+ BaseConnectionRequestsInterfacePtr::dynamicCast(interface(TP_QT_IFACE_CONNECTION_INTERFACE_REQUESTS));
+
+ if (!reqIface.isNull()) {
+ //emit after return
+ QMetaObject::invokeMethod(reqIface.data(), "newChannels",
+ Qt::QueuedConnection,
+ Q_ARG(Tp::ChannelDetailsList, ChannelDetailsList() << channel->details()));
+ }
+
+ //emit after return
+ QMetaObject::invokeMethod(mPriv->adaptee, "newChannel",
+ Qt::QueuedConnection,
+ Q_ARG(QDBusObjectPath, QDBusObjectPath(channel->objectPath())),
+ Q_ARG(QString, channel->channelType()),
+ Q_ARG(uint, channel->targetHandleType()),
+ Q_ARG(uint, channel->targetHandle()),
+ Q_ARG(bool, false));
+
+ QObject::connect(channel.data(),
+ SIGNAL(closed()),
+ SLOT(removeChannel()));
+}
+
void BaseConnection::removeChannel()
{
BaseChannelPtr channel = BaseChannelPtr(
More information about the telepathy-commits
mailing list