summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorOlli Salli <ollisal@gmail.com>2011-07-26 18:53:01 +0300
committerOlli Salli <ollisal@gmail.com>2011-10-10 19:17:40 +0300
commit28e8e74feeb5bdd213d389e5655e4aceb6f2acec (patch)
tree817f03f1b89a9078ac26d74e8506096f6c98fa56 /examples
parentc40f9fe9e885d48c8946350900941cf71130b89e (diff)
StreamTubeServer: Implement tubeRequested, tubeClosed
Diffstat (limited to 'examples')
-rw-r--r--examples/stream-tubes/tube-initiator.cpp31
-rw-r--r--examples/stream-tubes/tube-initiator.h5
2 files changed, 34 insertions, 2 deletions
diff --git a/examples/stream-tubes/tube-initiator.cpp b/examples/stream-tubes/tube-initiator.cpp
index 4000fa78..91ac2fb8 100644
--- a/examples/stream-tubes/tube-initiator.cpp
+++ b/examples/stream-tubes/tube-initiator.cpp
@@ -28,13 +28,14 @@
#include <TelepathyQt4/ClientRegistrar>
#include <TelepathyQt4/Constants>
#include <TelepathyQt4/ContactManager>
-#include <TelepathyQt4/StreamTubeChannel>
-#include <TelepathyQt4/StreamTubeServer>
+#include <TelepathyQt4/OutgoingStreamTubeChannel>
#include <TelepathyQt4/PendingChannelRequest>
#include <TelepathyQt4/PendingContacts>
#include <TelepathyQt4/PendingOperation>
#include <TelepathyQt4/PendingReady>
#include <TelepathyQt4/Presence>
+#include <TelepathyQt4/StreamTubeChannel>
+#include <TelepathyQt4/StreamTubeServer>
#include <QDebug>
#include <QTcpServer>
@@ -60,6 +61,14 @@ TubeInitiator::TubeInitiator(const QString &accountName, const QString &receiver
QString() /* autogenerated Client name */,
false /* don't monitor connections for now */,
accountFactory, connectionFactory);
+
+ connect(mTubeServer.data(),
+ SIGNAL(tubeRequested(Tp::AccountPtr,Tp::OutgoingStreamTubeChannelPtr,QDateTime,Tp::ChannelRequestHints)),
+ SLOT(onTubeRequested(Tp::AccountPtr,Tp::OutgoingStreamTubeChannelPtr,QDateTime,Tp::ChannelRequestHints)));
+ connect(mTubeServer.data(),
+ SIGNAL(tubeClosed(Tp::AccountPtr,Tp::OutgoingStreamTubeChannelPtr,QString,QString)),
+ SLOT(onTubeClosed(Tp::AccountPtr,Tp::OutgoingStreamTubeChannelPtr,QString,QString)));
+
mTubeServer->exportTcpSocket(mServer);
// TODO: Start monitoring connections and connect to the connection monitoring signals
@@ -252,6 +261,24 @@ void TubeInitiator::onStreamTubeChannelCreated(PendingOperation *op)
qDebug() << "Stream tube channel created!";
}
+void TubeInitiator::onTubeRequested(
+ const Tp::AccountPtr &acc,
+ const Tp::OutgoingStreamTubeChannelPtr &tube,
+ const QDateTime &time,
+ const Tp::ChannelRequestHints &hints)
+{
+ qDebug() << "Handler received requested tube channel " << tube->objectPath();
+}
+
+void TubeInitiator::onTubeClosed(
+ const Tp::AccountPtr &acc,
+ const Tp::OutgoingStreamTubeChannelPtr &tube,
+ const QString &error,
+ const QString &message)
+{
+ qDebug() << "Closed tube channel " << tube->objectPath();
+}
+
/*
void TubeInitiator::onStreamTubeChannelNewConnection(uint connectionId)
{
diff --git a/examples/stream-tubes/tube-initiator.h b/examples/stream-tubes/tube-initiator.h
index bfe38217..6eee2ee2 100644
--- a/examples/stream-tubes/tube-initiator.h
+++ b/examples/stream-tubes/tube-initiator.h
@@ -31,6 +31,7 @@ using namespace Tp;
namespace Tp
{
+class ChannelRequestHints;
class PendingOperation;
}
@@ -52,6 +53,10 @@ private Q_SLOTS:
void gotContactCapabilities(QDBusPendingCallWatcher *watcher);
*/
void onStreamTubeChannelCreated(Tp::PendingOperation *op);
+ void onTubeRequested(const Tp::AccountPtr &, const Tp::OutgoingStreamTubeChannelPtr &,
+ const QDateTime &, const Tp::ChannelRequestHints &);
+ void onTubeClosed(const Tp::AccountPtr &, const Tp::OutgoingStreamTubeChannelPtr &,
+ const QString &, const QString &);
//void onStreamTubeChannelNewConnection(uint);
void onTcpServerNewConnection();
void onDataFromSocket();