[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/network/kopete/protocols/telepathy
From: George Goldberg <grundleborg () googlemail ! com>
Date: 2009-08-10 21:31:45
Message-ID: 1249939905.656710.19039.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1009806 by gberg:
Fix bug where contacst were not upgraded to have the required features exposed by \
bugfix upstream in tpqt4.
M +37 -5 telepathycontactmanager.cpp
M +1 -0 telepathycontactmanager.h
--- trunk/playground/network/kopete/protocols/telepathy/telepathycontactmanager.cpp \
#1009805:1009806 @@ -33,6 +33,7 @@
#include <TelepathyQt4/Connection>
#include <TelepathyQt4/ContactManager>
#include <TelepathyQt4/Account>
+#include <TelepathyQt4/Contact>
#include <TelepathyQt4/PendingContacts>
#include <TelepathyQt4/PendingReady>
@@ -129,9 +130,35 @@
SIGNAL(presencePublicationRequested(const Tp::Contacts &)),
SLOT(onPresencePublicationRequested(const Tp::Contacts &)));
- QSet<QSharedPointer<Tp::Contact> > contacts = \
d->connection->contactManager()->allKnownContacts(); + QSet<Tp::ContactPtr> \
contacts = d->connection->contactManager()->allKnownContacts();
- foreach(QSharedPointer<Tp::Contact> contact, contacts) {
+ QSet<Tp::Contact::Feature> features;
+ features << Tp::Contact::FeatureAlias
+ << Tp::Contact::FeatureAvatarToken
+ << Tp::Contact::FeatureSimplePresence;
+
+ QObject::connect(d->connection->contactManager()->upgradeContacts(contacts.toList(), \
features), + SIGNAL(finished(Tp::PendingOperation*)),
+ SLOT(onContactsUpgraded(Tp::PendingOperation*)));
+}
+
+void TelepathyContactManager::onContactsUpgraded(Tp::PendingOperation *op)
+{
+ kDebug(TELEPATHY_DEBUG_AREA);
+
+ if (op->isError()) {
+ kWarning() << "Upgrading contacts failed:" << op->errorName() << \
op->errorMessage(); + return;
+ }
+
+ Tp::PendingContacts *pendingContacts = qobject_cast<Tp::PendingContacts*>(op);
+
+ if (!pendingContacts) {
+ kWarning() << "Slot called with incorrect type.";
+ return;
+ }
+
+ foreach(Tp::ContactPtr contact, pendingContacts->contacts()) {
if ((contact->publishState() == Tp::Contact::PresenceStateYes) ||
(contact->subscriptionState() == Tp::Contact::PresenceStateYes) ) {
createContact(contact);
@@ -143,9 +170,14 @@
{
kDebug(TELEPATHY_DEBUG_AREA);
- foreach(QSharedPointer<Tp::Contact> contact, contacts) {
- createContact(contact);
- }
+ QSet<Tp::Contact::Feature> features;
+ features << Tp::Contact::FeatureAlias
+ << Tp::Contact::FeatureAvatarToken
+ << Tp::Contact::FeatureSimplePresence;
+
+ QObject::connect(d->connection->contactManager()->upgradeContacts(contacts.toList(), \
features), + SIGNAL(finished(Tp::PendingOperation*)),
+ SLOT(onContactsUpgraded(Tp::PendingOperation*)));
}
void TelepathyContactManager::createContact(QSharedPointer<Tp::Contact> contact)
--- trunk/playground/network/kopete/protocols/telepathy/telepathycontactmanager.h \
#1009805:1009806 @@ -44,6 +44,7 @@
private slots:
void onConnectionReady(Tp::PendingOperation*);
+ void onContactsUpgraded(Tp::PendingOperation *op);
void onPresencePublicationRequested(const Tp::Contacts &);
private:
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic