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

Commit

Permalink
Merge pull request #62 from matthewvogt/valid-im
Browse files Browse the repository at this point in the history
[libcontacts] Track whether contacts have valid IM accounts
  • Loading branch information
matthewvogt committed Dec 10, 2013
2 parents 25f3505 + 0c2c5a7 commit 88ea3dc
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 @@ -1936,6 +1936,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 @@ -1947,6 +1950,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 88ea3dc

Please sign in to comment.