summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/Controllers/Chat')
-rw-r--r--Swift/Controllers/Chat/ChatController.cpp22
-rw-r--r--Swift/Controllers/Chat/ChatsManager.cpp4
-rw-r--r--Swift/Controllers/Chat/UserSearchController.cpp2
3 files changed, 14 insertions, 14 deletions
diff --git a/Swift/Controllers/Chat/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp
index bedc427..51c7349 100644
--- a/Swift/Controllers/Chat/ChatController.cpp
+++ b/Swift/Controllers/Chat/ChatController.cpp
@@ -69,11 +69,11 @@ ChatController::ChatController(const JID& self, StanzaChannel* stanzaChannel, IQ
69 if (isInMUC) { 69 if (isInMUC) {
70 startMessage = str(format(QT_TRANSLATE_NOOP("", "Starting chat with %1% in chatroom %2%")) % nick % contact.toBare().toString()); 70 startMessage = str(format(QT_TRANSLATE_NOOP("", "Starting chat with %1% in chatroom %2%")) % nick % contact.toBare().toString());
71 theirPresence = presenceOracle->getLastPresence(contact); 71 theirPresence = presenceOracle->getLastPresence(contact);
72 } else { 72 } else {
73 startMessage = str(format(QT_TRANSLATE_NOOP("", "Starting chat with %1% - %2%")) % nick % contact.toBare().toString()); 73 startMessage = str(format(QT_TRANSLATE_NOOP("", "Starting chat with %1% - %2%")) % nick % contact.toBare().toString());
74 theirPresence = contact.isBare() ? presenceOracle->getHighestPriorityPresence(contact.toBare()) : presenceOracle->getLastPresence(contact); 74 theirPresence = contact.isBare() ? presenceOracle->getAccountPresence(contact) : presenceOracle->getLastPresence(contact);
75 } 75 }
76 Idle::ref idle; 76 Idle::ref idle;
77 if (theirPresence && (idle = theirPresence->getPayload<Idle>())) { 77 if (theirPresence && (idle = theirPresence->getPayload<Idle>())) {
78 startMessage += str(format(QT_TRANSLATE_NOOP("", ", who has been idle since %1%")) % dateTimeToLocalString(idle->getSince())); 78 startMessage += str(format(QT_TRANSLATE_NOOP("", ", who has been idle since %1%")) % dateTimeToLocalString(idle->getSince()));
79 } 79 }
@@ -141,11 +141,11 @@ void ChatController::setToJID(const JID& jid) {
141 ChatControllerBase::setToJID(jid); 141 ChatControllerBase::setToJID(jid);
142 Presence::ref presence; 142 Presence::ref presence;
143 if (isInMUC_) { 143 if (isInMUC_) {
144 presence = presenceOracle_->getLastPresence(jid); 144 presence = presenceOracle_->getLastPresence(jid);
145 } else { 145 } else {
146 presence = jid.isBare() ? presenceOracle_->getHighestPriorityPresence(jid.toBare()) : presenceOracle_->getLastPresence(jid); 146 presence = jid.isBare() ? presenceOracle_->getAccountPresence(jid.toBare()) : presenceOracle_->getLastPresence(jid);
147 } 147 }
148 chatStateNotifier_->setContactIsOnline(presence && presence->getType() == Presence::Available); 148 chatStateNotifier_->setContactIsOnline(presence && presence->getType() == Presence::Available);
149 handleBareJIDCapsChanged(toJID_); 149 handleBareJIDCapsChanged(toJID_);
150} 150}
151 151
@@ -462,22 +462,22 @@ std::string ChatController::getStatusChangeString(boost::shared_ptr<Presence> pr
462 } 462 }
463 return response + "."; 463 return response + ".";
464} 464}
465 465
466void ChatController::handlePresenceChange(boost::shared_ptr<Presence> newPresence) { 466void ChatController::handlePresenceChange(boost::shared_ptr<Presence> newPresence) {
467 bool me = false; 467 bool relevantPresence = false;
468 if (toJID_.isBare()) { 468
469 newPresence = presenceOracle_->getHighestPriorityPresence(toJID_); 469 if (toJID_.equals(newPresence->getFrom(), JID::WithoutResource)) {
470 if ((newPresence ? newPresence->getShow() : StatusShow::None) != lastShownStatus_) { 470 // Presence matches ChatController JID.
471 me = true; 471 newPresence = presenceOracle_->getAccountPresence(toJID_);
472 } 472 relevantPresence = true;
473 } else if (toJID_.equals(newPresence->getFrom(), JID::WithResource)) {
474 me = true;
475 } 473 }
476 if (!me) { 474
475 if (!relevantPresence) {
477 return; 476 return;
478 } 477 }
478
479 if (!newPresence) { 479 if (!newPresence) {
480 newPresence = boost::make_shared<Presence>(); 480 newPresence = boost::make_shared<Presence>();
481 newPresence->setType(Presence::Unavailable); 481 newPresence->setType(Presence::Unavailable);
482 } 482 }
483 lastShownStatus_ = newPresence->getShow(); 483 lastShownStatus_ = newPresence->getShow();
diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp
index 343f490..8a06333 100644
--- a/Swift/Controllers/Chat/ChatsManager.cpp
+++ b/Swift/Controllers/Chat/ChatsManager.cpp
@@ -285,11 +285,11 @@ ChatListWindow::Chat ChatsManager::updateChatStatusAndAvatarHelper(const ChatLis
285 } 285 }
286 } else { 286 } else {
287 if (avatarManager_) { 287 if (avatarManager_) {
288 fixedChat.avatarPath = avatarManager_->getAvatarPath(fixedChat.jid); 288 fixedChat.avatarPath = avatarManager_->getAvatarPath(fixedChat.jid);
289 } 289 }
290 Presence::ref presence = presenceOracle_->getHighestPriorityPresence(fixedChat.jid.toBare()); 290 Presence::ref presence = presenceOracle_->getAccountPresence(fixedChat.jid.toBare());
291 fixedChat.statusType = presence ? presence->getShow() : StatusShow::None; 291 fixedChat.statusType = presence ? presence->getShow() : StatusShow::None;
292 } 292 }
293 return fixedChat; 293 return fixedChat;
294} 294}
295 295
@@ -407,11 +407,11 @@ ChatListWindow::Chat ChatsManager::createChatListChatItem(const JID& jid, const
407 ChatController* controller = getChatControllerIfExists(jid, false); 407 ChatController* controller = getChatControllerIfExists(jid, false);
408 if (controller) { 408 if (controller) {
409 unreadCount = controller->getUnreadCount(); 409 unreadCount = controller->getUnreadCount();
410 } 410 }
411 JID bareishJID = mucRegistry_->isMUC(jid.toBare()) ? jid : jid.toBare(); 411 JID bareishJID = mucRegistry_->isMUC(jid.toBare()) ? jid : jid.toBare();
412 Presence::ref presence = presenceOracle_->getHighestPriorityPresence(bareishJID); 412 Presence::ref presence = presenceOracle_->getAccountPresence(bareishJID);
413 StatusShow::Type type = presence ? presence->getShow() : StatusShow::None; 413 StatusShow::Type type = presence ? presence->getShow() : StatusShow::None;
414 boost::filesystem::path avatarPath = avatarManager_ ? avatarManager_->getAvatarPath(bareishJID) : boost::filesystem::path(); 414 boost::filesystem::path avatarPath = avatarManager_ ? avatarManager_->getAvatarPath(bareishJID) : boost::filesystem::path();
415 return ChatListWindow::Chat(bareishJID, nickResolver_->jidToNick(bareishJID), activity, unreadCount, type, avatarPath, false, privateMessage); 415 return ChatListWindow::Chat(bareishJID, nickResolver_->jidToNick(bareishJID), activity, unreadCount, type, avatarPath, false, privateMessage);
416 } 416 }
417} 417}
diff --git a/Swift/Controllers/Chat/UserSearchController.cpp b/Swift/Controllers/Chat/UserSearchController.cpp
index 454a110..291472f 100644
--- a/Swift/Controllers/Chat/UserSearchController.cpp
+++ b/Swift/Controllers/Chat/UserSearchController.cpp
@@ -303,11 +303,11 @@ Contact::ref UserSearchController::convertJIDtoContact(const JID& jid) {
303 contact->name = jid.toString(); 303 contact->name = jid.toString();
304 } 304 }
305 } 305 }
306 306
307 // presence lookup 307 // presence lookup
308 Presence::ref presence = presenceOracle_->getHighestPriorityPresence(jid); 308 Presence::ref presence = presenceOracle_->getAccountPresence(jid);
309 if (presence) { 309 if (presence) {
310 contact->statusType = presence->getShow(); 310 contact->statusType = presence->getShow();
311 } else { 311 } else {
312 contact->statusType = StatusShow::None; 312 contact->statusType = StatusShow::None;
313 } 313 }