telepathy-qt: dbus-tubes: Merge onAcceptFinished and onOfferFinished

Dario Freddi drf at kemper.freedesktop.org
Tue Jul 3 15:08:40 PDT 2012


Module: telepathy-qt
Branch: master
Commit: a9b4d2c813df13fb18ba5447a639e0fac1bbd0c6
URL:    http://cgit.freedesktop.org/telepathy/telepathy-qt/commit/?id=a9b4d2c813df13fb18ba5447a639e0fac1bbd0c6

Author: Dario Freddi <dario.freddi at collabora.co.uk>
Date:   Thu Jun  9 16:40:26 2011 +0200

dbus-tubes: Merge onAcceptFinished and onOfferFinished

---

 TelepathyQt/pending-dbus-tube.cpp |   36 ++++++------------------------------
 TelepathyQt/pending-dbus-tube.h   |    3 +--
 2 files changed, 7 insertions(+), 32 deletions(-)

diff --git a/TelepathyQt/pending-dbus-tube.cpp b/TelepathyQt/pending-dbus-tube.cpp
index b7b3ff7..755ab8b 100644
--- a/TelepathyQt/pending-dbus-tube.cpp
+++ b/TelepathyQt/pending-dbus-tube.cpp
@@ -71,11 +71,11 @@ PendingDBusTube::PendingDBusTube(
     mPriv->tube = object;
 
     if (string->isFinished()) {
-        onAcceptFinished(string);
+        onConnectionFinished(string);
     } else {
         // Connect the pending void
         connect(string, SIGNAL(finished(Tp::PendingOperation*)),
-                this, SLOT(onAcceptFinished(Tp::PendingOperation*)));
+                this, SLOT(onConnectionFinished(Tp::PendingOperation*)));
     }
 }
 
@@ -88,11 +88,11 @@ PendingDBusTube::PendingDBusTube(
     mPriv->tube = object;
 
     if (string->isFinished()) {
-        onOfferFinished(string);
+        onConnectionFinished(string);
     } else {
         // Connect the pending void
         connect(string, SIGNAL(finished(Tp::PendingOperation*)),
-                this, SLOT(onOfferFinished(Tp::PendingOperation*)));
+                this, SLOT(onConnectionFinished(Tp::PendingOperation*)));
     }
 }
 
@@ -128,7 +128,7 @@ QString PendingDBusTube::address() const
     return mPriv->tube->address();
 }
 
-void PendingDBusTube::onAcceptFinished(PendingOperation *op)
+void PendingDBusTube::onConnectionFinished(PendingOperation *op)
 {
     if (op->isError()) {
         // Fail
@@ -136,31 +136,7 @@ void PendingDBusTube::onAcceptFinished(PendingOperation *op)
         return;
     }
 
-    debug() << "Accept tube finished successfully";
-
-    // Now get the address and set it
-    PendingString *ps = qobject_cast<PendingString*>(op);
-    mPriv->tube->setAddress(ps->result());
-
-    // It might have been already opened - check
-    if (mPriv->tube->state() == TubeChannelStateOpen) {
-        onStateChanged(mPriv->tube->state());
-    } else {
-        // Wait until the tube gets opened on the other side
-        connect(mPriv->tube.data(), SIGNAL(stateChanged(Tp::TubeChannelState)),
-                this, SLOT(onStateChanged(Tp::TubeChannelState)));
-    }
-}
-
-void PendingDBusTube::onOfferFinished(PendingOperation *op)
-{
-    if (op->isError()) {
-        // Fail
-        setFinishedWithError(op->errorName(), op->errorMessage());
-        return;
-    }
-
-    debug() << "Offer tube finished successfully";
+    debug() << "Accept/Offer tube finished successfully";
 
     // Now get the address and set it
     PendingString *ps = qobject_cast<PendingString*>(op);
diff --git a/TelepathyQt/pending-dbus-tube.h b/TelepathyQt/pending-dbus-tube.h
index 9da3745..9a77197 100644
--- a/TelepathyQt/pending-dbus-tube.h
+++ b/TelepathyQt/pending-dbus-tube.h
@@ -43,8 +43,7 @@ public:
     QString address() const;
 
 private Q_SLOTS:
-    TP_QT_NO_EXPORT void onAcceptFinished(Tp::PendingOperation *op);
-    TP_QT_NO_EXPORT void onOfferFinished(Tp::PendingOperation *op);
+    TP_QT_NO_EXPORT void onConnectionFinished(Tp::PendingOperation *op);
     TP_QT_NO_EXPORT void onStateChanged(Tp::TubeChannelState state);
 
 private:



More information about the telepathy-commits mailing list