[Telepathy-commits] [telepathy-qt4/master] ContactManager: Added canRemoveContactsPresenceSubscription/removeContactsPresenceSubscription.

Andre Moreira Magalhaes (andrunko) andre.magalhaes at collabora.co.uk
Thu Feb 26 15:22:31 PST 2009


---
 TelepathyQt4/Client/contact-manager.cpp |   24 ++++++++++++++++++++++++
 TelepathyQt4/Client/contact-manager.h   |    3 +++
 2 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/TelepathyQt4/Client/contact-manager.cpp b/TelepathyQt4/Client/contact-manager.cpp
index 2f61d45..0bc2eba 100644
--- a/TelepathyQt4/Client/contact-manager.cpp
+++ b/TelepathyQt4/Client/contact-manager.cpp
@@ -171,6 +171,30 @@ PendingOperation *ContactManager::requestContactsPresenceSubscription(
     return subscribeChannel->groupAddContacts(contacts);
 }
 
+bool ContactManager::canRemoveContactsPresenceSubscription() const
+{
+    QSharedPointer<Channel> subscribeChannel;
+    if (mPriv->contactListsChannels.contains(ContactListChannel::TypeSubscribe)) {
+        subscribeChannel = mPriv->contactListsChannels[ContactListChannel::TypeSubscribe].channel;
+    }
+    return subscribeChannel && subscribeChannel->groupCanRemoveContacts();
+}
+
+PendingOperation *ContactManager::removeContactsPresenceSubscription(
+        const QList<QSharedPointer<Contact> > &contacts, const QString &message)
+{
+    if (!canRemoveContactsPresenceSubscription()) {
+        warning() << "Contact subscription removal requested, "
+            "but unable to remove contacts";
+        return new PendingFailure(this, TELEPATHY_ERROR_NOT_IMPLEMENTED,
+                "Cannot remove contacts presence subscription");
+    }
+
+    QSharedPointer<Channel> subscribeChannel =
+        mPriv->contactListsChannels[ContactListChannel::TypeSubscribe].channel;
+    return subscribeChannel->groupRemoveContacts(contacts);
+}
+
 bool ContactManager::canAuthorizeContactsPresencePublication() const
 {
     QSharedPointer<Channel> publishChannel;
diff --git a/TelepathyQt4/Client/contact-manager.h b/TelepathyQt4/Client/contact-manager.h
index 211d1cd..18ba78f 100644
--- a/TelepathyQt4/Client/contact-manager.h
+++ b/TelepathyQt4/Client/contact-manager.h
@@ -62,6 +62,9 @@ class ContactManager : public QObject
         bool canRequestContactsPresenceSubscription() const;
         PendingOperation *requestContactsPresenceSubscription(
                 const QList<QSharedPointer<Contact> > &contacts, const QString &message = QString());
+        bool canRemoveContactsPresenceSubscription() const;
+        PendingOperation *removeContactsPresenceSubscription(
+                const QList<QSharedPointer<Contact> > &contacts, const QString &message = QString());
         bool canAuthorizeContactsPresencePublication() const;
         PendingOperation *authorizeContactsPresencePublication(
                 const QList<QSharedPointer<Contact> > &contacts, const QString &message = QString());
-- 
1.5.6.5




More information about the telepathy-commits mailing list