diff options
author | Tobias Markmann <tm@ayena.de> | 2015-11-30 13:53:53 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2015-12-17 21:36:37 (GMT) |
commit | 60074cfedd4a10dbdec43c9c0bbc62d5a75279c5 (patch) | |
tree | fe1980d9d7ea826f7c72f90529586f134db4f911 /Swift/Controllers/Chat/ChatController.cpp | |
parent | 02a5b5c7f263913bd3d9b6977a1c6935e90c97eb (diff) | |
download | swift-60074cfedd4a10dbdec43c9c0bbc62d5a75279c5.zip swift-60074cfedd4a10dbdec43c9c0bbc62d5a75279c5.tar.bz2 |
Do not consult presence oracle for MUC PM presence
Test-Information:
Added unit test verifying the behavior.
Verified with multiple Swift instances in a MUC room that for
MUC PMs only the same full JID presence counts.
Change-Id: I08148221be34c3548f18da634586c828fd60feff
Diffstat (limited to 'Swift/Controllers/Chat/ChatController.cpp')
-rw-r--r-- | Swift/Controllers/Chat/ChatController.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/Swift/Controllers/Chat/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp index 503a050..e2751f7 100644 --- a/Swift/Controllers/Chat/ChatController.cpp +++ b/Swift/Controllers/Chat/ChatController.cpp @@ -466,10 +466,22 @@ std::string ChatController::getStatusChangeString(boost::shared_ptr<Presence> pr void ChatController::handlePresenceChange(boost::shared_ptr<Presence> newPresence) { bool relevantPresence = false; - if (toJID_.equals(newPresence->getFrom(), JID::WithoutResource)) { - // Presence matches ChatController JID. - newPresence = presenceOracle_->getAccountPresence(toJID_); - relevantPresence = true; + if (isInMUC_) { + // For MUC participants we only have a single presence to choose one and + // even for multi-session nicknames multiple resources are not distinguishable + // to other participants. + if (toJID_.equals(newPresence->getFrom(), JID::WithResource)) { + relevantPresence = true; + } + } + else { + // For standard chats we retrieve the account presence from the PresenceOracle, + // as there can be multiple presences to choose from. + if (toJID_.equals(newPresence->getFrom(), JID::WithoutResource)) { + // Presence matches ChatController JID. + newPresence = presenceOracle_->getAccountPresence(toJID_); + relevantPresence = true; + } } if (!relevantPresence) { |