telepathy-qt: Contact: check for enabled features in methods related to ClientTypes

Dario Freddi drf at kemper.freedesktop.org
Thu Jul 5 06:06:02 PDT 2012


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

Author: Dario Freddi <dario.freddi at collabora.com>
Date:   Thu Jul  5 12:55:56 2012 +0200

Contact: check for enabled features in methods related to ClientTypes

---

 TelepathyQt/contact.cpp |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/TelepathyQt/contact.cpp b/TelepathyQt/contact.cpp
index 117b1c6..d73ae2c 100644
--- a/TelepathyQt/contact.cpp
+++ b/TelepathyQt/contact.cpp
@@ -932,6 +932,12 @@ PendingOperation *Contact::removeFromGroup(const QString &group)
  */
 QStringList Contact::clientTypes() const
 {
+    if (!mPriv->requestedFeatures.contains(FeatureClientTypes)) {
+        warning() << "Contact::clientTypes() used on" << this
+            << "for which FeatureClientTypes hasn't been requested - returning an empty list";
+        return QStringList();
+    }
+
     return mPriv->clientTypes;
 }
 
@@ -939,6 +945,11 @@ QStringList Contact::clientTypes() const
  */
 PendingStringList *Contact::requestClientTypes()
 {
+    if (!mPriv->requestedFeatures.contains(FeatureClientTypes)) {
+        warning() << "Contact::requestClientTypes() used on" << this
+            << "for which FeatureClientTypes hasn't been requested - the operation will fail";
+    }
+
     Client::ConnectionInterfaceClientTypesInterface *clientTypesInterface =
         manager()->connection()->interface<Client::ConnectionInterfaceClientTypesInterface>();
 



More information about the telepathy-commits mailing list