diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-09-12 18:29:39 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-09-13 19:19:52 (GMT) |
commit | ef1052bbdb315aaa1c6254098ea05638d9a25b2f (patch) | |
tree | 482277f649f6c0fc00027514ea8986861fe33437 /Swift/Controllers/Chat/ChatController.cpp | |
parent | 3ae8cccfe9c6bfed5dda5f024a5cb046ccfc9793 (diff) | |
download | swift-contrib-ef1052bbdb315aaa1c6254098ea05638d9a25b2f.zip swift-contrib-ef1052bbdb315aaa1c6254098ea05638d9a25b2f.tar.bz2 |
Added presence notifier.
Diffstat (limited to 'Swift/Controllers/Chat/ChatController.cpp')
-rw-r--r-- | Swift/Controllers/Chat/ChatController.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Swift/Controllers/Chat/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp index 9154b9a..e621a6d 100644 --- a/Swift/Controllers/Chat/ChatController.cpp +++ b/Swift/Controllers/Chat/ChatController.cpp @@ -31,7 +31,7 @@ ChatController::ChatController(const JID& self, StanzaChannel* stanzaChannel, IQ chatStateMessageSender_ = new ChatStateMessageSender(chatStateNotifier_, stanzaChannel, contact); chatStateTracker_ = new ChatStateTracker(); nickResolver_ = nickResolver; - presenceOracle_->onPresenceChange.connect(boost::bind(&ChatController::handlePresenceChange, this, _1, _2)); + presenceOracle_->onPresenceChange.connect(boost::bind(&ChatController::handlePresenceChange, this, _1)); chatStateTracker_->onChatStateChange.connect(boost::bind(&ChatWindow::setContactChatState, chatWindow_, _1)); stanzaChannel_->onStanzaAcked.connect(boost::bind(&ChatController::handleStanzaAcked, this, _1)); String nick = nickResolver_->jidToNick(toJID_); @@ -134,19 +134,20 @@ String ChatController::getStatusChangeString(boost::shared_ptr<Presence> presenc return ""; } -void ChatController::handlePresenceChange(boost::shared_ptr<Presence> newPresence, boost::shared_ptr<Presence> previousPresence) { +void ChatController::handlePresenceChange(boost::shared_ptr<Presence> newPresence) { if (!toJID_.equals(newPresence->getFrom(), toJID_.isBare() ? JID::WithoutResource : JID::WithResource)) { return; } - chatStateTracker_->handlePresenceChange(newPresence, previousPresence); + chatStateTracker_->handlePresenceChange(newPresence); String newStatusChangeString = getStatusChangeString(newPresence); - if (!previousPresence || newStatusChangeString != getStatusChangeString(previousPresence)) { + if (newStatusChangeString != lastStatusChangeString_) { if (lastWasPresence_) { chatWindow_->replaceLastMessage(newStatusChangeString); } else { chatWindow_->addPresenceMessage(newStatusChangeString); } + lastStatusChangeString_ = newStatusChangeString; lastWasPresence_ = true; } } |