summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Moreira Magalhaes (andrunko) <andre.magalhaes@collabora.co.uk>2010-12-20 10:28:46 -0200
committerAndre Moreira Magalhaes (andrunko) <andre.magalhaes@collabora.co.uk>2010-12-20 10:28:46 -0200
commit6e42077552bb3a4603764679da70f6a8694c22fb (patch)
treebbdd3073853ae625e623ce135bb86d537ab94105
parent9ce3709ffd3091a384bbc462b093a600c87f027b (diff)
ContactManager: Ignore contact list group events until the initial groups are received.
-rw-r--r--TelepathyQt4/contact-manager.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/TelepathyQt4/contact-manager.cpp b/TelepathyQt4/contact-manager.cpp
index 18b3ff6d..506e9ace 100644
--- a/TelepathyQt4/contact-manager.cpp
+++ b/TelepathyQt4/contact-manager.cpp
@@ -116,6 +116,7 @@ struct TELEPATHY_QT4_NO_EXPORT ContactManager::Private
bool canChangeContactList;
bool contactListRequestUsesMessage;
QSet<QString> allKnownGroups;
+ bool contactListGroupPropertiesReceived;
QQueue<void (Private::*)()> contactListChangesQueue;
QQueue<ContactListUpdateInfo> contactListUpdatesQueue;
QQueue<ContactListGroupsUpdateInfo> contactListGroupsUpdatesQueue;
@@ -182,6 +183,7 @@ ContactManager::Private::Private(ContactManager *parent, Connection *connection)
fallbackContactList(false),
canChangeContactList(false),
contactListRequestUsesMessage(false),
+ contactListGroupPropertiesReceived(false),
processingContactListChanges(false),
requestAvatarsIdle(false)
{
@@ -1879,6 +1881,10 @@ void ContactManager::onContactListGroupsChanged(const Tp::UIntList &contacts,
{
Q_ASSERT(mPriv->fallbackContactList == false);
+ if (!mPriv->contactListGroupPropertiesReceived) {
+ return;
+ }
+
mPriv->contactListGroupsUpdatesQueue.enqueue(Private::ContactListGroupsUpdateInfo(contacts,
added, removed));
mPriv->contactListChangesQueue.enqueue(&Private::processContactListGroupsUpdates);
@@ -1889,6 +1895,10 @@ void ContactManager::onContactListGroupsCreated(const QStringList &names)
{
Q_ASSERT(mPriv->fallbackContactList == false);
+ if (!mPriv->contactListGroupPropertiesReceived) {
+ return;
+ }
+
mPriv->contactListGroupsCreatedQueue.enqueue(names);
mPriv->contactListChangesQueue.enqueue(&Private::processContactListGroupsCreated);
mPriv->processContactListChanges();
@@ -1898,6 +1908,10 @@ void ContactManager::onContactListGroupRenamed(const QString &oldName, const QSt
{
Q_ASSERT(mPriv->fallbackContactList == false);
+ if (!mPriv->contactListGroupPropertiesReceived) {
+ return;
+ }
+
mPriv->contactListGroupRenamedQueue.enqueue(
Private::ContactListGroupRenamedInfo(oldName, newName));
mPriv->contactListChangesQueue.enqueue(&Private::processContactListGroupRenamed);
@@ -1908,6 +1922,10 @@ void ContactManager::onContactListGroupsRemoved(const QStringList &names)
{
Q_ASSERT(mPriv->fallbackContactList == false);
+ if (!mPriv->contactListGroupPropertiesReceived) {
+ return;
+ }
+
mPriv->contactListGroupsRemovedQueue.enqueue(names);
mPriv->contactListChangesQueue.enqueue(&Private::processContactListGroupsRemoved);
mPriv->processContactListChanges();
@@ -2135,8 +2153,10 @@ void ContactManager::updateContactListContacts(const ContactSubscriptionMap &cha
void ContactManager::setContactListGroupsProperties(const QVariantMap &props)
{
Q_ASSERT(mPriv->fallbackContactList == false);
+ Q_ASSERT(mPriv->contactListGroupPropertiesReceived == false);
mPriv->allKnownGroups = qdbus_cast<QStringList>(props[QLatin1String("Groups")]).toSet();
+ mPriv->contactListGroupPropertiesReceived = true;
}
void ContactManager::setContactListChannels(