diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-10-22 10:53:01 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2010-10-22 10:53:01 (GMT) |
commit | 5b22db817bfc84db5ce1956ec1cb4a6d9f98e35b (patch) | |
tree | f3f8d8a30391471e2d5ac0f7e9103e7713aa2933 /Swift | |
parent | 784e8b04bc510e18a75f8f696713366bc00f3cab (diff) | |
download | swift-contrib-5b22db817bfc84db5ce1956ec1cb4a6d9f98e35b.zip swift-contrib-5b22db817bfc84db5ce1956ec1cb4a6d9f98e35b.tar.bz2 |
Don't send composing events to offline users.
Resolves: #637
Diffstat (limited to 'Swift')
-rw-r--r-- | Swift/Controllers/Chat/ChatController.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Swift/Controllers/Chat/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp index 0247c0e..10a0336 100644 --- a/Swift/Controllers/Chat/ChatController.cpp +++ b/Swift/Controllers/Chat/ChatController.cpp @@ -54,6 +54,7 @@ ChatController::ChatController(const JID& self, StanzaChannel* stanzaChannel, IQ if (theirPresence && !theirPresence->getStatus().isEmpty()) { startMessage += " (" + theirPresence->getStatus() + ")"; } + chatStateNotifier_->setContactIsOnline(theirPresence && theirPresence->getType() == Presence::Available); startMessage += "."; chatWindow_->addSystemMessage(startMessage); chatWindow_->onUserTyping.connect(boost::bind(&ChatStateNotifier::setUserIsTyping, chatStateNotifier_)); @@ -80,6 +81,13 @@ void ChatController::setToJID(const JID& jid) { chatStateMessageSender_->setContact(jid); ChatControllerBase::setToJID(jid); handleCapsChanged(jid); + Presence::ref presence; + if (isInMUC_) { + presence = presenceOracle_->getLastPresence(jid); + } else { + presence = jid.isBare() ? presenceOracle_->getHighestPriorityPresence(jid.toBare()) : presenceOracle_->getLastPresence(jid); + } + chatStateNotifier_->setContactIsOnline(presence && presence->getType() == Presence::Available); } bool ChatController::isIncomingMessageFromMe(boost::shared_ptr<Message>) { @@ -174,6 +182,7 @@ void ChatController::handlePresenceChange(boost::shared_ptr<Presence> newPresenc } chatStateTracker_->handlePresenceChange(newPresence); + chatStateNotifier_->setContactIsOnline(newPresence->getType() == Presence::Available); String newStatusChangeString = getStatusChangeString(newPresence); if (newStatusChangeString != lastStatusChangeString_) { if (lastWasPresence_) { |