From 747873c69b5017fe3d7490d38af9ea93562c9dba Mon Sep 17 00:00:00 2001 From: David Edmundson 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(props[QLatin1String("MessageTypes")]); + supportedContentTypes = qdbus_cast( 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