diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-12-31 23:34:20 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2010-12-31 23:34:20 (GMT) |
commit | 513db0b2e7018a61e03b19236955d4a2ffbbc79e (patch) | |
tree | 7778ca540bc094d4b822d41510e26d8ab154d77c /Swift | |
parent | 9ad4cc1f2b5117268348cc5625be782f717ad081 (diff) | |
download | swift-513db0b2e7018a61e03b19236955d4a2ffbbc79e.zip swift-513db0b2e7018a61e03b19236955d4a2ffbbc79e.tar.bz2 |
Fix presence folding when receiving non-readable messages.
Resolves: #640
Diffstat (limited to 'Swift')
-rw-r--r-- | Swift/Controllers/Chat/ChatController.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Swift/Controllers/Chat/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp index ea21aa9..302d80c 100644 --- a/Swift/Controllers/Chat/ChatController.cpp +++ b/Swift/Controllers/Chat/ChatController.cpp @@ -90,6 +90,7 @@ void ChatController::preHandleIncomingMessage(boost::shared_ptr<MessageEvent> me eventController_->handleIncomingEvent(messageEvent); if (messageEvent->isReadable()) { chatWindow_->flash(); + lastWasPresence_ = false; } boost::shared_ptr<Message> message = messageEvent->getStanza(); JID from = message->getFrom(); @@ -100,7 +101,6 @@ void ChatController::preHandleIncomingMessage(boost::shared_ptr<MessageEvent> me } chatStateNotifier_->receivedMessageFromContact(message->getPayload<ChatState>()); chatStateTracker_->handleMessageReceived(message); - lastWasPresence_ = false; } void ChatController::preSendMessageRequest(boost::shared_ptr<Message> message) { @@ -148,7 +148,7 @@ String ChatController::senderDisplayNameFromMessage(const JID& from) { String ChatController::getStatusChangeString(boost::shared_ptr<Presence> presence) { String nick = senderDisplayNameFromMessage(presence->getFrom()); String response = nick; - if (presence->getType() == Presence::Unavailable) { + if (presence->getType() == Presence::Unavailable || presence->getType() == Presence::Error) { response += " has gone offline"; } else if (presence->getType() == Presence::Available) { StatusShow::Type show = presence->getShow(); @@ -167,7 +167,9 @@ String ChatController::getStatusChangeString(boost::shared_ptr<Presence> presenc } void ChatController::handlePresenceChange(boost::shared_ptr<Presence> newPresence) { - if (!toJID_.equals(newPresence->getFrom(), toJID_.isBare() ? JID::WithoutResource : JID::WithResource)) { + if ((!toJID_.equals(newPresence->getFrom(), toJID_.isBare() ? JID::WithoutResource : JID::WithResource)) + || + (newPresence->getType() != Presence::Unavailable && newPresence->getType() != Presence::Error)) { return; } |