telepathy-qt: BaseConnection: addChannel() used in createChannel().
Alexandr Akulich
kaffeine at kemper.freedesktop.org
Thu May 14 03:54:13 PDT 2015
Module: telepathy-qt
Branch: master
Commit: 931387e987f38e6edcaaf1109726dc251b01f123
URL: http://cgit.freedesktop.org/telepathy/telepathy-qt/commit/?id=931387e987f38e6edcaaf1109726dc251b01f123
Author: Alexandr Akulich <akulichalexander at gmail.com>
Date: Tue May 12 10:26:18 2015 +0500
BaseConnection: addChannel() used in createChannel().
Reduced code duplication in cost of little overhead for channels.contains().
---
TelepathyQt/base-connection.cpp | 29 +++--------------------------
TelepathyQt/base-connection.h | 2 +-
2 files changed, 4 insertions(+), 27 deletions(-)
diff --git a/TelepathyQt/base-connection.cpp b/TelepathyQt/base-connection.cpp
index 373b4d6..bc3d8fb 100644
--- a/TelepathyQt/base-connection.cpp
+++ b/TelepathyQt/base-connection.cpp
@@ -418,30 +418,7 @@ Tp::BaseChannelPtr BaseConnection::createChannel(const QVariantMap &request, boo
if (error->isValid())
return BaseChannelPtr();
- 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, suppressHandler));
-
- QObject::connect(channel.data(),
- SIGNAL(closed()),
- SLOT(removeChannel()));
+ addChannel(channel, suppressHandler);
return channel;
}
@@ -551,7 +528,7 @@ Tp::BaseChannelPtr BaseConnection::ensureChannel(const QVariantMap &request, boo
return createChannel(request, suppressHandler, error);
}
-void BaseConnection::addChannel(BaseChannelPtr channel)
+void BaseConnection::addChannel(BaseChannelPtr channel, bool suppressHandler)
{
if (mPriv->channels.contains(channel)) {
qDebug() << "BaseConnection::addChannel: Channel already added.";
@@ -577,7 +554,7 @@ void BaseConnection::addChannel(BaseChannelPtr channel)
Q_ARG(QString, channel->channelType()),
Q_ARG(uint, channel->targetHandleType()),
Q_ARG(uint, channel->targetHandle()),
- Q_ARG(bool, false));
+ Q_ARG(bool, suppressHandler));
QObject::connect(channel.data(),
SIGNAL(closed()),
diff --git a/TelepathyQt/base-connection.h b/TelepathyQt/base-connection.h
index ee3cfb1..b390851 100644
--- a/TelepathyQt/base-connection.h
+++ b/TelepathyQt/base-connection.h
@@ -101,7 +101,7 @@ public:
BaseChannelPtr ensureChannel(const QVariantMap &request, bool &yours, bool suppressHandler, DBusError *error);
- void addChannel(BaseChannelPtr channel);
+ void addChannel(BaseChannelPtr channel, bool suppressHandler = false);
QList<AbstractConnectionInterfacePtr> interfaces() const;
AbstractConnectionInterfacePtr interface(const QString &interfaceName) const;
More information about the telepathy-commits
mailing list