Skip to content
Snippets Groups Projects
Commit d42fe786 authored by Sébastien Blin's avatar Sébastien Blin
Browse files

presence: fix presence status for swarm with multiple members

Change-Id: Ic2e86b932c4805016689ffc41e4cede26b715954
parent 78724c2a
No related branches found
No related tags found
No related merge requests found
......@@ -171,17 +171,19 @@ ConversationListModelBase::dataForItem(item_t item, int role) const
return ret;
}
case Role::Presence: {
// The conversation can show a green dot if at least one peer is present
// A conversation presence is the max of the members presence
auto maxPresence = 0;
Q_FOREACH (const auto& peerUri, model_->peersForConversation(item.uid))
try {
auto& accInfo = lrcInstance_->getAccountInfo(accountId_);
if (peerUri == accInfo.profileInfo.uri)
return 2; // Self account
auto contact = accInfo.contactModel->getContact(peerUri);
return contact.presence;
if (contact.presence > maxPresence)
maxPresence = contact.presence;
} catch (const std::exception&) {
}
return false;
return maxPresence;
};
default:
break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment