summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-10-22 10:53:01 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-10-22 10:53:01 (GMT)
commit5b22db817bfc84db5ce1956ec1cb4a6d9f98e35b (patch)
treef3f8d8a30391471e2d5ac0f7e9103e7713aa2933 /Swift
parent784e8b04bc510e18a75f8f696713366bc00f3cab (diff)
downloadswift-5b22db817bfc84db5ce1956ec1cb4a6d9f98e35b.zip
swift-5b22db817bfc84db5ce1956ec1cb4a6d9f98e35b.tar.bz2
Don't send composing events to offline users.
Resolves: #637
Diffstat (limited to 'Swift')
-rw-r--r--Swift/Controllers/Chat/ChatController.cpp9
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_) {