telepathy-qt: AbstractChannelInterface: Added close() method called on channel close.

Alexandr Akulich kaffeine at kemper.freedesktop.org
Fri Jan 15 08:09:33 PST 2016


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

Author: Alexandr Akulich <akulichalexander at gmail.com>
Date:   Wed Jan  6 21:47:45 2016 +0500

AbstractChannelInterface: Added close() method called on channel close.

This method let interface to have a custom shutdown logic.

E.g. server-side FileTransfer interface should change
Channel.Type.FileTransfer.State to Cancelled on channel close.

---

 TelepathyQt/base-channel.cpp |    8 ++++++++
 TelepathyQt/base-channel.h   |    1 +
 2 files changed, 9 insertions(+)

diff --git a/TelepathyQt/base-channel.cpp b/TelepathyQt/base-channel.cpp
index 91d4c2e..eb41463 100644
--- a/TelepathyQt/base-channel.cpp
+++ b/TelepathyQt/base-channel.cpp
@@ -250,6 +250,10 @@ void BaseChannel::setRequested(bool requested)
 
 void BaseChannel::close()
 {
+    foreach(const AbstractChannelInterfacePtr &iface, interfaces()) {
+        iface->close();
+    }
+
     // Method is used in destructor, so (to be sure that adaptee is exists) we should use DirectConnection
     QMetaObject::invokeMethod(mPriv->adaptee, "closed", Qt::DirectConnection);
     emit closed();
@@ -367,6 +371,10 @@ AbstractChannelInterface::~AbstractChannelInterface()
 {
 }
 
+void AbstractChannelInterface::close()
+{
+}
+
 void AbstractChannelInterface::setBaseChannel(BaseChannel *channel)
 {
     Q_UNUSED(channel)
diff --git a/TelepathyQt/base-channel.h b/TelepathyQt/base-channel.h
index 1af92a0..4ef02d9 100644
--- a/TelepathyQt/base-channel.h
+++ b/TelepathyQt/base-channel.h
@@ -104,6 +104,7 @@ public:
     virtual ~AbstractChannelInterface();
 
 protected:
+    virtual void close();
     virtual void setBaseChannel(BaseChannel *channel);
 
 private:



More information about the telepathy-commits mailing list