[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:07:23 UTC 2016


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

The following commit has been merged in the master branch:
commit 3b3f26157fcacfc83ad964becc3bc5cba670905e
Author: Vishesh Handa <handa.vish at gmail.com>
Date:   Sat Dec 24 20:16:51 2011 +0530

    Slight optimization of NepomukStorage::cleanupAccountContacts
    
    Use sets instead of lists.
---
 kpeople/nepomuk-feeder/nepomuk-storage.cpp | 60 ++++++++++++++----------------
 1 file changed, 28 insertions(+), 32 deletions(-)

diff --git a/kpeople/nepomuk-feeder/nepomuk-storage.cpp b/kpeople/nepomuk-feeder/nepomuk-storage.cpp
index e4c4f25..178558b 100644
--- a/kpeople/nepomuk-feeder/nepomuk-storage.cpp
+++ b/kpeople/nepomuk-feeder/nepomuk-storage.cpp
@@ -4,6 +4,8 @@
  * Copyright (C) 2009-2011 Collabora Ltd. <info at collabora.co.uk>
  *   @author George Goldberg <george.goldberg at collabora.co.uk>
  *
+ * Copyright (C) 2011 Vishesh Handa <handa.vish at gmail.com>
+ *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
@@ -687,38 +689,32 @@ void NepomukStorage::cleanupAccountContacts(const QString &path, const QList<QSt
 {
     kDebug() << path << ids;
 
-//     // Go through all the contacts in the cache and make any that are not in the list we
-//     // received from the account into Ghost Contacts. Do this as a batch job to improve performance.
-//     foreach (const ContactIdentifier &cid, m_contacts.keys()) {
-//         if (cid.accountId() == path) {
-//             if (!ids.contains(cid.contactId())) {
-//                 // TODO: Do this properly once the ontology supports this
-//                 // TODO: Do this as a batch job to reduce the number of nepomuk queries that result.
-//                 kDebug() << "Ghosting contact: " << cid.contactId();
-//                 setContactPublishState(path, cid.contactId(), Tp::Contact::PresenceStateNo);
-//                 setContactSubscriptionState(path, cid.contactId(), Tp::Contact::PresenceStateNo);
-//             }
-//         }
-//     }
-//
-//     // Go through all the contacts that we have received from the account and create any
-//     // new ones in neponmuk. Do this as a batch job to improve performance.
-//     foreach (const QString &id, ids) {
-//         bool found = false;
-//         foreach (const ContactIdentifier &cid, m_contacts.keys()) {
-//             if (cid.accountId() == path) {
-//                 if (cid.contactId() == id) {
-//                     found = true;
-//                     break;
-//                 }
-//             }
-//         }
-//         if (!found) {
-//             // TODO: Add all these accounts as a batch job
-//             kDebug() << "Adding contact:" << id;
-//             createContact(path, id);
-//         }
-//     }
+    QSet<QString> idSet = ids.toSet();
+
+    // Go through all the contacts in the cache and make any that are not in the list we
+    // received from the account into Ghost Contacts. Do this as a batch job to improve performance.
+    foreach (const ContactIdentifier &cid, m_contacts.keys()) {
+        if (cid.accountId() == path) {
+            if (!idSet.contains(cid.contactId())) {
+                // TODO: Do this properly once the ontology supports this
+                // TODO: Do this as a batch job to reduce the number of nepomuk queries that result.
+                kDebug() << "Ghosting contact: " << cid.contactId();
+                setContactPublishState(path, cid.contactId(), Tp::Contact::PresenceStateNo);
+                setContactSubscriptionState(path, cid.contactId(), Tp::Contact::PresenceStateNo);
+            }
+        }
+    }
+
+    // Go through all the contacts that we have received from the account and create any
+    // new ones in Nepomuk. Do this as a batch job to improve performance.
+    QSet<QString> nepomukIds;
+    foreach( const ContactIdentifier& ci, m_contacts.keys() )
+        nepomukIds.insert( ci.contactId() );
+
+    QSet<QString> newIds = idSet.subtract( nepomukIds );
+    foreach( const QString& id, newIds ) {
+        createContact(path, id);
+    }
 }
 
 void NepomukStorage::createContact(const QString &path, const QString &id)

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list