[SCM] ktp-common-internals packaging branch, master, updated. debian/15.12.1-2-1839-gf0635e9

Maximiliano Curia maxy at moszumanska.debian.org
Mon May 9 09:04:27 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=f342675

The following commit has been merged in the master branch:
commit f342675c4e0f8495c5b729f23599f2b4388f5327
Author: George Goldberg <grundleborg at googlemail.com>
Date:   Sat Feb 13 16:35:18 2010 +0000

    When the account has a connection, get the entire roster, upgrade it to have desired features and then create a TelepathyContact object for each contact.
    
    svn path=/trunk/playground/network/telepathy-integration-daemon/; revision=1089647
---
 kpeople/nepomuk-feeder/telepathyaccount.cpp | 46 ++++++++++++++++++++++++++---
 kpeople/nepomuk-feeder/telepathyaccount.h   |  1 +
 kpeople/nepomuk-feeder/telepathycontact.cpp |  5 ++--
 kpeople/nepomuk-feeder/telepathycontact.h   |  5 +++-
 4 files changed, 50 insertions(+), 7 deletions(-)

diff --git a/kpeople/nepomuk-feeder/telepathyaccount.cpp b/kpeople/nepomuk-feeder/telepathyaccount.cpp
index 75ed257..655a484 100644
--- a/kpeople/nepomuk-feeder/telepathyaccount.cpp
+++ b/kpeople/nepomuk-feeder/telepathyaccount.cpp
@@ -22,6 +22,7 @@
 #include "telepathyaccount.h"
 
 #include "telepathyaccountmonitor.h"
+#include "telepathycontact.h"
 
 // Ontology Vocabularies
 #include "nco.h"
@@ -35,6 +36,8 @@
 #include <Soprano/Model>
 #include <Soprano/QueryResultIterator>
 
+#include <TelepathyQt4/ContactManager>
+#include <TelepathyQt4/PendingContacts>
 #include <TelepathyQt4/PendingOperation>
 #include <TelepathyQt4/PendingReady>
 
@@ -206,8 +209,45 @@ void TelepathyAccount::onConnectionReady(Tp::PendingOperation *op)
         return;
     }
 
-    // TODO: Create TelepathyContact objects to take care of all the
-    // contacts in the connection's roster.
+    // We have a ready connection. Get all the contact list, and upgrade the contacts to have
+    // all the features we want to store in Nepomuk.
+    if (!m_connection->contactManager()) {
+        kWarning() << "ContactManager is Null. Abort getting contacts.";
+        return;
+    }
+
+    Tp::Contacts contacts = m_connection->contactManager()->allKnownContacts();
+
+    QSet<Tp::Contact::Feature> features;
+    features << Tp::Contact::FeatureAlias
+             << Tp::Contact::FeatureSimplePresence;
+
+    connect(m_connection->contactManager()->upgradeContacts(contacts.toList(), features),
+            SIGNAL(finished(Tp::PendingOperation*)),
+            SLOT(onContactsUpgraded(Tp::PendingOperation*)));
+}
+
+void TelepathyAccount::onContactsUpgraded(Tp::PendingOperation* op)
+{
+    if (op->isError()) {
+        kWarning() << "Upgrading contacts failed."
+                   << op->errorName()
+                   << op->errorMessage();
+        return;
+    }
+
+    Tp::PendingContacts *pc = qobject_cast<Tp::PendingContacts*>(op);
+
+    if (!pc) {
+        kWarning() << "Casting to Tp::PendingContacts failed. Abort.";
+        return;
+    }
+
+    // We have an upgraded contact list. Now we can create a TelepathyContact instance for
+    // each contact.
+    foreach (Tp::ContactPtr contact, pc->contacts()) {
+        new TelepathyContact(contact, this);
+    }
 }
 
 void TelepathyAccount::onNicknameChanged(const QString& nickname)
@@ -227,7 +267,5 @@ void TelepathyAccount::onCurrentPresenceChanged(Tp::SimplePresence presence)
 }
 
 
-
-
 #include "telepathyaccount.moc"
 
diff --git a/kpeople/nepomuk-feeder/telepathyaccount.h b/kpeople/nepomuk-feeder/telepathyaccount.h
index 9d898e2..cb577f7 100644
--- a/kpeople/nepomuk-feeder/telepathyaccount.h
+++ b/kpeople/nepomuk-feeder/telepathyaccount.h
@@ -58,6 +58,7 @@ private Q_SLOTS:
     void onConnectionReady(Tp::PendingOperation *op);
     void onNicknameChanged(const QString &nickname);
     void onCurrentPresenceChanged(Tp::SimplePresence presence);
+    void onContactsUpgraded(Tp::PendingOperation *op);
 
 private:
     Q_DISABLE_COPY(TelepathyAccount);
diff --git a/kpeople/nepomuk-feeder/telepathycontact.cpp b/kpeople/nepomuk-feeder/telepathycontact.cpp
index 0fbf205..1845913 100644
--- a/kpeople/nepomuk-feeder/telepathycontact.cpp
+++ b/kpeople/nepomuk-feeder/telepathycontact.cpp
@@ -23,9 +23,10 @@
 
 #include "telepathyaccount.h"
 
-TelepathyContact::TelepathyContact(TelepathyAccount *parent)
+TelepathyContact::TelepathyContact(Tp::ContactPtr contact, TelepathyAccount *parent)
  : QObject(parent),
-   m_parent(parent)
+   m_parent(parent),
+   m_contact(contact)
 {
     // TODO: Implement me!
 }
diff --git a/kpeople/nepomuk-feeder/telepathycontact.h b/kpeople/nepomuk-feeder/telepathycontact.h
index f3241db..c193da5 100644
--- a/kpeople/nepomuk-feeder/telepathycontact.h
+++ b/kpeople/nepomuk-feeder/telepathycontact.h
@@ -24,6 +24,8 @@
 
 #include <QtCore/QObject>
 
+#include <TelepathyQt4/Contact>
+
 class TelepathyAccount;
 
 /**
@@ -34,13 +36,14 @@ class TelepathyContact : public QObject
     Q_OBJECT
 
 public:
-    explicit TelepathyContact(TelepathyAccount *parent = 0);
+    explicit TelepathyContact(Tp::ContactPtr contact, TelepathyAccount *parent = 0);
     ~TelepathyContact();
 
 private:
     Q_DISABLE_COPY(TelepathyContact);
 
     TelepathyAccount *m_parent;
+    Tp::ContactPtr m_contact;
 };
 
 

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list