[Telepathy-commits] [telepathy-qt4/master] TextChannel: Implement canInviteContacts and the Capabilities feature
Simon McVittie
simon.mcvittie at collabora.co.uk
Wed Feb 18 11:00:38 PST 2009
---
TelepathyQt4/Client/text-channel.cpp | 78 +++++++++++++++++++++++++++++++++-
TelepathyQt4/Client/text-channel.h | 25 +----------
2 files changed, 79 insertions(+), 24 deletions(-)
diff --git a/TelepathyQt4/Client/text-channel.cpp b/TelepathyQt4/Client/text-channel.cpp
index ed40abe..9970b8f 100644
--- a/TelepathyQt4/Client/text-channel.cpp
+++ b/TelepathyQt4/Client/text-channel.cpp
@@ -81,7 +81,10 @@ TextChannel::Private::~Private()
* Features that can be enabled on a TextChannel using becomeReady().
*
* \value FeatureMessageQueue Doesn't do anything yet
- * \value FeatureMessageCapabilities Doesn't do anything yet
+ * \value FeatureMessageCapabilities The supportedContentTypes,
+ * messagePartSupport and
+ * deliveryReportingSupport methods can
+ * be called
*/
/**
@@ -127,6 +130,79 @@ bool TextChannel::hasMessagesInterface() const
}
/**
+ * Return whether contacts can be invited into this channel using
+ * inviteContacts (which is equivalent to groupAddContacts). Whether this
+ * is the case depends on the underlying protocol, the type of channel,
+ * and the user's privileges (in some chatrooms, only a privileged user
+ * can invite other contacts).
+ *
+ * This is an alias for groupCanAddContacts, to indicate its meaning more
+ * clearly for Text channels.
+ *
+ * The result of calling this method is undefined until basic Group
+ * functionality has been enabled by calling becomeReady and waiting for the
+ * pending operation to complete.
+ *
+ * \return The same thing as groupCanAddContacts
+ */
+bool TextChannel::canInviteContacts() const
+{
+ return groupCanAddContacts();
+}
+
+/* <!--x--> in the block below is used to escape the star-slash sequence */
+/**
+ * Return a list of supported MIME content types for messages on this channel.
+ * For a simple text channel this will be a list containing one item,
+ * "text/plain".
+ *
+ * This list may contain the special value "*<!--x-->/<!--x-->*", which
+ * indicates that any content type is supported.
+ *
+ * The result of calling this method is undefined until the
+ * FeatureMessageCapabilities Feature has been enabled, by calling becomeReady
+ * and waiting for the pending operation to complete
+ *
+ * \return A list of MIME content types
+ */
+QStringList TextChannel::supportedContentTypes() const
+{
+ return mPriv->supportedContentTypes;
+}
+
+/**
+ * Return a set of flags indicating support for multi-part messages on this
+ * channel. This is zero on simple text channels, or greater than zero if
+ * there is partial or full support for multi-part messages.
+ *
+ * The result of calling this method is undefined until the
+ * FeatureMessageCapabilities Feature has been enabled, by calling becomeReady
+ * and waiting for the pending operation to complete.
+ *
+ * \return A set of MessagePartSupportFlags
+ */
+MessagePartSupportFlags TextChannel::messagePartSupport() const
+{
+ return mPriv->messagePartSupport;
+}
+
+/**
+ * Return a set of flags indicating support for delivery reporting on this
+ * channel. This is zero if there are no particular guarantees, or greater
+ * than zero if delivery reports can be expected under certain circumstances.
+ *
+ * The result of calling this method is undefined until the
+ * FeatureMessageCapabilities Feature has been enabled, by calling becomeReady
+ * and waiting for the pending operation to complete.
+ *
+ * \return A set of DeliveryReportingSupportFlags
+ */
+DeliveryReportingSupportFlags TextChannel::deliveryReportingSupport() const
+{
+ return mPriv->deliveryReportingSupport;
+}
+
+/**
* Return whether the desired features are ready for use.
*
* \param channelFeatures Features of the Channel class
diff --git a/TelepathyQt4/Client/text-channel.h b/TelepathyQt4/Client/text-channel.h
index 92ee039..1b165f1 100644
--- a/TelepathyQt4/Client/text-channel.h
+++ b/TelepathyQt4/Client/text-channel.h
@@ -154,46 +154,25 @@ public:
// created, and that messageReceived will be emitted. If not enabled,
// messageReceived will not be emitted.
FeatureMessageQueue = 1,
-
- // FeatureMessageCapabilities guarantees that messagePartSupport,
- // supportedContentTypes and deliveryReportingSupport have been
- // downloaded. This information is for people who'll send messages.
- //
- // Implementation detail: FeatureMessageQueue might as
- // well imply this as a side-effect (it doesn't take any more round
- // trips).
FeatureMessageCapabilities = 2,
-
_Padding = 0xFFFFFFFF
};
Q_DECLARE_FLAGS(Features, Feature)
bool hasMessagesInterface() const;
+ bool canInviteContacts() const;
bool isReady(Channel::Features channelFeatures = 0,
Features textFeatures = 0) const;
-
PendingReadyChannel *becomeReady(Channel::Features channelFeatures = 0,
Features textFeatures = 0);
-#if 0
- inline bool canInviteContacts() const
- {
- return groupCanAddContacts();
- }
-
// requires FeatureMessageCapabilities
- //
- // ["text/plain"] if hasMessagesInterface() is false
- // ["*/*"] if all content types are allowed
QStringList supportedContentTypes() const;
-
- // requires FeatureMessageCapabilities
MessagePartSupportFlags messagePartSupport() const;
-
- // requires FeatureMessageCapabilities
DeliveryReportingSupportFlags deliveryReportingSupport() const;
+#if 0
// requires FeatureMessageQueue
QList<ReceivedMessage> messageQueue() const;
#endif
--
1.5.6.5
More information about the telepathy-commits
mailing list