From ca01b263f9feea11822e41ccf94b01d3e38e5817 Mon Sep 17 00:00:00 2001 From: Kevin Smith <git@kismith.co.uk> Date: Fri, 11 Feb 2011 13:25:26 +0000 Subject: 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. 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_; -- cgit v0.10.2-6-g49f6