diff options
author | Kevin Smith <git@kismith.co.uk> | 2011-02-11 13:25:26 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2011-02-11 13:25:26 (GMT) |
commit | ca01b263f9feea11822e41ccf94b01d3e38e5817 (patch) | |
tree | 8c20bc0b3b6541cf70c80b41f87c9681fbeb167c /Swift/Controllers | |
parent | e81caa93d528bf7e73e66057093814371a538bf2 (diff) | |
download | swift-ca01b263f9feea11822e41ccf94b01d3e38e5817.zip swift-ca01b263f9feea11822e41ccf94b01d3e38e5817.tar.bz2 |
Don't mark MUC Context as unread.
Resolves: #724
Release-Notes: Historical messages received when joining a room will no longer be marked as unread.
Diffstat (limited to 'Swift/Controllers')
-rw-r--r-- | Swift/Controllers/Chat/ChatControllerBase.cpp | 7 | ||||
-rw-r--r-- | Swift/Controllers/Chat/MUCController.cpp | 11 | ||||
-rw-r--r-- | Swift/Controllers/Chat/MUCController.h | 1 |
3 files changed, 14 insertions, 5 deletions
diff --git a/Swift/Controllers/Chat/ChatControllerBase.cpp b/Swift/Controllers/Chat/ChatControllerBase.cpp index 7430f69..ca0916d 100644 --- a/Swift/Controllers/Chat/ChatControllerBase.cpp +++ b/Swift/Controllers/Chat/ChatControllerBase.cpp @@ -143,13 +143,10 @@ bool ChatControllerBase::isFromContact(const JID& from) { } void ChatControllerBase::handleIncomingMessage(boost::shared_ptr<MessageEvent> messageEvent) { - if (messageEvent->isReadable()) { + preHandleIncomingMessage(messageEvent); + if (messageEvent->isReadable() && !messageEvent->getConcluded()) { unreadMessages_.push_back(messageEvent); } - - - - preHandleIncomingMessage(messageEvent); boost::shared_ptr<Message> message = messageEvent->getStanza(); String body = message->getBody(); if (message->isError()) { diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp index e4c13af..156c6a2 100644 --- a/Swift/Controllers/Chat/MUCController.cpp +++ b/Swift/Controllers/Chat/MUCController.cpp @@ -53,6 +53,7 @@ MUCController::MUCController ( joined_ = false; lastWasPresence_ = false; shouldJoinOnReconnect_ = true; + doneGettingHistory_ = false; events_ = uiEventStream; roster_ = new Roster(false, true); @@ -96,6 +97,7 @@ void MUCController::rejoin() { if (parting_) { joined_ = false; parting_ = false; + doneGettingHistory_ = false; //FIXME: check for received activity if (lastActivity_ == boost::posix_time::not_a_date_time) { muc_->joinAs(nick_); @@ -256,6 +258,15 @@ void MUCController::preHandleIncomingMessage(boost::shared_ptr<MessageEvent> mes if (!message->getSubject().isEmpty() && message->getBody().isEmpty()) { chatWindow_->addSystemMessage("The room subject is now: " + message->getSubject()); + doneGettingHistory_ = true; + } + + if (!doneGettingHistory_ && !message->getPayload<Delay>()) { + doneGettingHistory_ = true; + } + + if (!doneGettingHistory_) { + messageEvent->conclude(); } } diff --git a/Swift/Controllers/Chat/MUCController.h b/Swift/Controllers/Chat/MUCController.h index 374ad79..258b730 100644 --- a/Swift/Controllers/Chat/MUCController.h +++ b/Swift/Controllers/Chat/MUCController.h @@ -90,6 +90,7 @@ namespace Swift { bool joined_; bool lastWasPresence_; bool shouldJoinOnReconnect_; + bool doneGettingHistory_; boost::bsignals::scoped_connection avatarChangedConnection_; boost::shared_ptr<Timer> loginCheckTimer_; std::set<String> currentOccupants_; |