[telepathy-qt4/master] TextChannel: Added support for setting local chat state.

Andre Moreira Magalhaes (andrunko) andre.magalhaes at collabora.co.uk
Mon Nov 2 07:55:28 PST 2009


---
 TelepathyQt4/text-channel.cpp |   21 +++++++++++++++++++++
 TelepathyQt4/text-channel.h   |    2 ++
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/TelepathyQt4/text-channel.cpp b/TelepathyQt4/text-channel.cpp
index 05aa624..2d8a0e0 100644
--- a/TelepathyQt4/text-channel.cpp
+++ b/TelepathyQt4/text-channel.cpp
@@ -28,6 +28,7 @@
 #include <TelepathyQt4/ContactManager>
 #include <TelepathyQt4/Message>
 #include <TelepathyQt4/PendingContacts>
+#include <TelepathyQt4/PendingFailure>
 #include <TelepathyQt4/PendingReady>
 #include <TelepathyQt4/ReceivedMessage>
 #include <TelepathyQt4/ReferencedHandles>
@@ -888,6 +889,26 @@ PendingSendMessage *TextChannel::send(const MessagePartList &parts,
     return op;
 }
 
+/**
+ * Set the local chat state and notify other members of the channel that it has
+ * changed.
+ *
+ * \param state The new state.
+ * \sa chatStateChanged()
+ */
+PendingOperation *TextChannel::setChatState(ChannelChatState state)
+{
+    if (!interfaces().contains(TELEPATHY_INTERFACE_CHANNEL_INTERFACE_CHAT_STATE)) {
+        warning() << "TextChannel::setChatState() used with no chat "
+            "state interface";
+        return new PendingFailure(TELEPATHY_ERROR_NOT_IMPLEMENTED,
+                "TextChannel does not support chat state interface",
+                this);
+    }
+    return new PendingVoid(chatStateInterface()->SetChatState(
+                (uint) state), this);
+}
+
 void TextChannel::onMessageSent(const MessagePartList &parts,
         uint flags,
         const QString &sentMessageToken)
diff --git a/TelepathyQt4/text-channel.h b/TelepathyQt4/text-channel.h
index 9287521..dd3e59d 100644
--- a/TelepathyQt4/text-channel.h
+++ b/TelepathyQt4/text-channel.h
@@ -106,6 +106,8 @@ public Q_SLOTS:
         return groupAddContacts(contacts, message);
     }
 
+    PendingOperation *setChatState(ChannelChatState state);
+
 Q_SIGNALS:
     // FeatureMessageSentSignal
     void messageSent(const Tp::Message &message,
-- 
1.5.6.5




More information about the telepathy-commits mailing list