Not sure where the right place for patches is into TpQt4. So I'll just
spam the list.

Currently in TpQt4::TextChannel there's no way to get the supported
message types for a channel, so I don't know whether I should/can
handle "/me " type actions in my client code.
So I added support to retrieve this property.

http://telepathy.freedesktop.org/spec/Channel_Interface_Messages.html
- messageTypes property.


--
David Edmundson
From 747873c69b5017fe3d7490d38af9ea93562c9dba Mon Sep 17 00:00:00 2001
From: David Edmundson <[email protected]>
Date: Wed, 28 Sep 2011 18:35:50 +0100
Subject: [PATCH] Add a method to find available message types for a text channel.

---
 TelepathyQt4/text-channel.cpp |   14 ++++++++++++++
 TelepathyQt4/text-channel.h   |    1 +
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/TelepathyQt4/text-channel.cpp b/TelepathyQt4/text-channel.cpp
index 91a34ac..0686040 100644
--- a/TelepathyQt4/text-channel.cpp
+++ b/TelepathyQt4/text-channel.cpp
@@ -74,6 +74,7 @@ struct TELEPATHY_QT4_NO_EXPORT TextChannel::Private
     bool gotProperties;
 
     // requires FeatureMessageCapabilities
+    UIntList channelTextMessageTypes;
     QStringList supportedContentTypes;
     MessagePartSupportFlags messagePartSupport;
     DeliveryReportingSupportFlags deliveryReportingSupport;
@@ -316,6 +317,8 @@ void TextChannel::Private::updateCapabilities()
         return;
     }
 
+    channelTextMessageTypes = qdbus_cast<UIntList>(props[QLatin1String("MessageTypes")]);
+    
     supportedContentTypes = qdbus_cast<QStringList>(
             props[QLatin1String("SupportedContentTypes")]);
     if (supportedContentTypes.isEmpty()) {
@@ -726,6 +729,17 @@ QStringList TextChannel::supportedContentTypes() const
     return mPriv->supportedContentTypes;
 }
 
+
+/** Returns true if the provided message type is supported.
+  *
+  */
+
+bool TextChannel::supportsMessageType(ChannelTextMessageType messageType) const
+{
+    return mPriv->channelTextMessageTypes.contains(messageType);
+}
+
+
 /**
  * Return a set of flags indicating support for multi-part messages on this
  * channel.
diff --git a/TelepathyQt4/text-channel.h b/TelepathyQt4/text-channel.h
index 71a4626..1b8e241 100644
--- a/TelepathyQt4/text-channel.h
+++ b/TelepathyQt4/text-channel.h
@@ -59,6 +59,7 @@ public:
     bool canInviteContacts() const;
 
     // requires FeatureMessageCapabilities
+    bool supportsMessageType(ChannelTextMessageType messageType) const;
     QStringList supportedContentTypes() const;
     MessagePartSupportFlags messagePartSupport() const;
     DeliveryReportingSupportFlags deliveryReportingSupport() const;
-- 
1.7.4.1

_______________________________________________
telepathy mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/telepathy

Reply via email to