Skip to content
This repository has been archived by the owner on Sep 4, 2021. It is now read-only.

Commit

Permalink
[libcontacts] Track whether contacts have valid IM accounts
Browse files Browse the repository at this point in the history
Although QContactStatusFlags reports whether an account has any IM
accounts configured, we need to also know whether any of those accounts
are connected to valid telepathy accounts.
  • Loading branch information
matthewvogt committed Dec 6, 2013
1 parent 380fa72 commit 0c2c5a7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/seasidecache.cpp
Expand Up @@ -1854,6 +1854,9 @@ bool SeasideCache::updateContactIndexing(const QContact &oldContact, const QCont
oldAddresses.insert(address);
}

// Keep track of whether this contact has any valid IM accounts
bool hasValid = false;

foreach (const QContactOnlineAccount &account, contact.details<QContactOnlineAccount>()) {
const StringPair address(addressPair(account));
if (!validAddressPair(address))
Expand All @@ -1865,6 +1868,13 @@ bool SeasideCache::updateContactIndexing(const QContact &oldContact, const QCont
}

m_onlineAccountIds[address] = iid;
hasValid = true;
}

if (hasValid) {
item->statusFlags |= HasValidOnlineAccount;
} else {
item->statusFlags &= ~HasValidOnlineAccount;
}

if (!oldAddresses.isEmpty()) {
Expand Down
5 changes: 5 additions & 0 deletions src/seasidecache.h
Expand Up @@ -117,6 +117,11 @@ class CONTACTCACHE_EXPORT SeasideCache : public QObject
ContactComplete
};

enum {
// Must be after the highest bit used in QContactStatusFlags::Flag
HasValidOnlineAccount = (QContactStatusFlags::IsOnline << 1)
};

struct ItemData
{
virtual ~ItemData() {}
Expand Down

0 comments on commit 0c2c5a7

Please sign in to comment.