[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:08:15 UTC 2016


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

The following commit has been merged in the master branch:
commit 7a8c0dac8f8e3977f098db0421cbaaed90ad2eda
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Sat May 3 01:51:58 2014 +0200

    Map connection presence type to string
    
    In libkpeople we pass the presence around as a string as that's all
    KABC::custom() supports.
    
    We used to use presence->status(); this is problematic as it is free
    text which can contain anything; especially when on multiple protocols.
    
    A presence might have the status "chat" which is mapped to the presence
    type Tp::ConnectionPresenceTypeOnline. We want to use this mapping and
    only have a subset of presence strings.
    
    BUG: 334207
---
 kpeople/datasourceplugin/im-persons-data-source.cpp | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/kpeople/datasourceplugin/im-persons-data-source.cpp b/kpeople/datasourceplugin/im-persons-data-source.cpp
index 43b19a1..ee85760 100644
--- a/kpeople/datasourceplugin/im-persons-data-source.cpp
+++ b/kpeople/datasourceplugin/im-persons-data-source.cpp
@@ -65,6 +65,9 @@ private Q_SLOTS:
 private:
     QString createUri(const KTp::ContactPtr &contact) const;
     KABC::Addressee contactToAddressee(const Tp::ContactPtr &contact) const;
+
+    //presence names indexed by ConnectionPresenceType
+    QVector<QString> m_presenceStrings;
     QHash<QString, KTp::ContactPtr> m_contacts;
     KABC::Addressee::Map m_contactVCards;
 };
@@ -73,6 +76,17 @@ KTpAllContacts::KTpAllContacts()
 {
     Tp::registerTypes();
 
+    m_presenceStrings.reserve(9);
+    m_presenceStrings.insert(Tp::ConnectionPresenceTypeUnset, QString());
+    m_presenceStrings.insert(Tp::ConnectionPresenceTypeOffline, QString::fromLatin1("offline"));
+    m_presenceStrings.insert(Tp::ConnectionPresenceTypeAvailable, QString::fromLatin1("available"));
+    m_presenceStrings.insert(Tp::ConnectionPresenceTypeAway, QString::fromLatin1("away"));
+    m_presenceStrings.insert(Tp::ConnectionPresenceTypeExtendedAway, QString::fromLatin1("xa"));
+    m_presenceStrings.insert(Tp::ConnectionPresenceTypeHidden, QString::fromLatin1("hidden")); //of 'offline' ?
+    m_presenceStrings.insert(Tp::ConnectionPresenceTypeBusy, QString::fromLatin1("busy"));
+    m_presenceStrings.insert(Tp::ConnectionPresenceTypeUnknown, QString());
+    m_presenceStrings.insert(Tp::ConnectionPresenceTypeError, QString());
+
     loadCache();
 }
 
@@ -247,9 +261,11 @@ KABC::Addressee KTpAllContacts::contactToAddressee(const Tp::ContactPtr &contact
     if (contact && account) {
         vcard.setFormattedName(contact->alias());
         vcard.setCategories(contact->groups());
+
+        //TODO make "telepathy" a member variable string so that we ref count the same object instead of making new strings
         vcard.insertCustom(QLatin1String("telepathy"), QLatin1String("contactId"), contact->id());
         vcard.insertCustom(QLatin1String("telepathy"), QLatin1String("accountPath"), account->objectPath());
-        vcard.insertCustom(QLatin1String("telepathy"), QLatin1String("presence"), contact->presence().status());
+        vcard.insertCustom(QLatin1String("telepathy"), QLatin1String("presence"), m_presenceStrings.at(contact->presence().type()));
         if (!contact->avatarData().fileName.isEmpty()) {
             vcard.setPhoto(KABC::Picture(contact->avatarData().fileName));
         }

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list