[telepathy-qt4/master] COntactManager: Added addGroup method.

Andre Moreira Magalhaes (andrunko) andre.magalhaes at collabora.co.uk
Wed Jul 22 00:39:32 PDT 2009


---
 TelepathyQt4/contact-manager.cpp |   11 +++++++++++
 TelepathyQt4/contact-manager.h   |    2 ++
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/TelepathyQt4/contact-manager.cpp b/TelepathyQt4/contact-manager.cpp
index f84252c..8fc8068 100644
--- a/TelepathyQt4/contact-manager.cpp
+++ b/TelepathyQt4/contact-manager.cpp
@@ -163,6 +163,17 @@ QStringList ContactManager::allKnownGroups() const
     return mPriv->contactListGroupsChannels.keys();
 }
 
+PendingOperation *ContactManager::addGroup(const QString &group)
+{
+    if (group.isEmpty() || group.trimmed().isEmpty()) {
+        return new PendingFailure(this, TELEPATHY_ERROR_INVALID_ARGUMENT,
+                "Group must be a non-empty UTF-8 string");
+    }
+
+    return connection()->requestHandles(HandleTypeGroup,
+            QStringList() << group);
+}
+
 Contacts ContactManager::groupContacts(const QString &group) const
 {
     if (!mPriv->contactListGroupsChannels.contains(group)) {
diff --git a/TelepathyQt4/contact-manager.h b/TelepathyQt4/contact-manager.h
index 36e0686..8c5cf47 100644
--- a/TelepathyQt4/contact-manager.h
+++ b/TelepathyQt4/contact-manager.h
@@ -56,6 +56,8 @@ public:
     Contacts allKnownContacts() const;
     QStringList allKnownGroups() const;
 
+    PendingOperation *addGroup(const QString &group);
+
     Contacts groupContacts(const QString &group) const;
     PendingOperation *groupAddContacts(const QString &group,
             const QList<ContactPtr> &contacts);
-- 
1.5.6.5




More information about the telepathy-commits mailing list