telepathy-qt: dbus-tubes: Inject parameters in case the tube is offered
Dario Freddi
drf at kemper.freedesktop.org
Tue Jul 3 15:08:43 PDT 2012
Module: telepathy-qt
Branch: master
Commit: 97d1e301ad27be733d1b0f88a90426d2d1b08420
URL: http://cgit.freedesktop.org/telepathy/telepathy-qt/commit/?id=97d1e301ad27be733d1b0f88a90426d2d1b08420
Author: Dario Freddi <dario.freddi at collabora.com>
Date: Fri Nov 4 20:51:49 2011 +0100
dbus-tubes: Inject parameters in case the tube is offered
---
TelepathyQt/outgoing-dbus-tube-channel.cpp | 2 +-
TelepathyQt/pending-dbus-tube-connection.cpp | 31 ++++++++++++++++++++++++++
TelepathyQt/pending-dbus-tube-connection.h | 3 ++
3 files changed, 35 insertions(+), 1 deletions(-)
diff --git a/TelepathyQt/outgoing-dbus-tube-channel.cpp b/TelepathyQt/outgoing-dbus-tube-channel.cpp
index 940f1b0..a698c62 100644
--- a/TelepathyQt/outgoing-dbus-tube-channel.cpp
+++ b/TelepathyQt/outgoing-dbus-tube-channel.cpp
@@ -200,7 +200,7 @@ PendingDBusTubeConnection *OutgoingDBusTubeChannel::offerTube(const QVariantMap
OutgoingDBusTubeChannelPtr(this));
PendingDBusTubeConnection *op = new PendingDBusTubeConnection(ps, requireCredentials,
- 0, OutgoingDBusTubeChannelPtr(this));
+ parameters, OutgoingDBusTubeChannelPtr(this));
return op;
}
diff --git a/TelepathyQt/pending-dbus-tube-connection.cpp b/TelepathyQt/pending-dbus-tube-connection.cpp
index b8f9d3d..d6e4f62 100644
--- a/TelepathyQt/pending-dbus-tube-connection.cpp
+++ b/TelepathyQt/pending-dbus-tube-connection.cpp
@@ -44,6 +44,7 @@ struct TP_QT_NO_EXPORT PendingDBusTubeConnection::Private
bool requiresCredentials;
uchar credentialByte;
+ QVariantMap parameters;
};
PendingDBusTubeConnection::Private::Private(PendingDBusTubeConnection *parent)
@@ -93,6 +94,32 @@ PendingDBusTubeConnection::PendingDBusTubeConnection(
}
PendingDBusTubeConnection::PendingDBusTubeConnection(
+ PendingString* string,
+ bool requiresCredentials,
+ const QVariantMap& parameters,
+ const DBusTubeChannelPtr& object)
+ : PendingOperation(object)
+ , mPriv(new Private(this))
+{
+ mPriv->tube = object;
+
+ mPriv->requiresCredentials = requiresCredentials;
+ mPriv->parameters = parameters;
+
+ connect(mPriv->tube.data(), SIGNAL(invalidated(Tp::DBusProxy*,QString,QString)),
+ this, SLOT(onChannelInvalidated(Tp::DBusProxy*,QString,QString)));
+
+ if (string->isFinished()) {
+ onConnectionFinished(string);
+ } else {
+ // Connect the pending void
+ connect(string, SIGNAL(finished(Tp::PendingOperation*)),
+ this, SLOT(onConnectionFinished(Tp::PendingOperation*)));
+ }
+}
+
+
+PendingDBusTubeConnection::PendingDBusTubeConnection(
const QString &errorName,
const QString &errorMessage,
const DBusTubeChannelPtr &object)
@@ -185,6 +212,10 @@ void PendingDBusTubeConnection::onStateChanged(TubeChannelState state)
{
debug() << "Tube state changed to " << state;
if (state == TubeChannelStateOpen) {
+ if (!mPriv->parameters.isEmpty()) {
+ // Inject the parameters into the tube
+ mPriv->tube->setParameters(mPriv->parameters);
+ }
// The tube is ready: mark the operation as finished
setFinished();
}
diff --git a/TelepathyQt/pending-dbus-tube-connection.h b/TelepathyQt/pending-dbus-tube-connection.h
index c281137..dff5702 100644
--- a/TelepathyQt/pending-dbus-tube-connection.h
+++ b/TelepathyQt/pending-dbus-tube-connection.h
@@ -56,6 +56,9 @@ private:
TP_QT_NO_EXPORT PendingDBusTubeConnection(PendingString *string,
bool requiresCredentials, uchar credentialByte,
const DBusTubeChannelPtr &object);
+ TP_QT_NO_EXPORT PendingDBusTubeConnection(PendingString *string,
+ bool requiresCredentials, const QVariantMap ¶meters,
+ const DBusTubeChannelPtr &object);
TP_QT_NO_EXPORT PendingDBusTubeConnection(const QString &errorName, const QString &errorMessage,
const DBusTubeChannelPtr &object);
More information about the telepathy-commits
mailing list