diff options
author | Richard Maudsley <richard.maudsley@isode.com> | 2014-04-17 10:17:10 (GMT) |
---|---|---|
committer | Swift Review <review@swift.im> | 2014-05-27 14:07:38 (GMT) |
commit | e5975a6d4809bf05f8c9df724c926bd26fc4a9df (patch) | |
tree | d81d2ff3b0f6f63a4aac1aeff00180c78f6edbbe /Swift/Controllers/Chat | |
parent | 67cc8dff4e80344c2d10e2691c562c2440fd8c1c (diff) | |
download | swift-e5975a6d4809bf05f8c9df724c926bd26fc4a9df.zip swift-e5975a6d4809bf05f8c9df724c926bd26fc4a9df.tar.bz2 |
Impromptu chat notifications happen like chats, not MUCs.
Change-Id: Ibebadd0064f0535a7a2504a385a16d875760a9db
Diffstat (limited to 'Swift/Controllers/Chat')
-rw-r--r-- | Swift/Controllers/Chat/MUCController.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp index ffd86f9..4860fc8 100644 --- a/Swift/Controllers/Chat/MUCController.cpp +++ b/Swift/Controllers/Chat/MUCController.cpp @@ -109,7 +109,7 @@ MUCController::MUCController ( muc_->onAffiliationListReceived.connect(boost::bind(&MUCController::handleAffiliationListReceived, this, _1, _2)); muc_->onConfigurationFailed.connect(boost::bind(&MUCController::handleConfigurationFailed, this, _1)); muc_->onConfigurationFormReceived.connect(boost::bind(&MUCController::handleConfigurationFormReceived, this, _1)); - highlighter_->setMode(Highlighter::MUCMode); + highlighter_->setMode(isImpromptu_ ? Highlighter::ChatMode : Highlighter::MUCMode); highlighter_->setNick(nick_); if (timerFactory) { loginCheckTimer_ = boost::shared_ptr<Timer>(timerFactory->createTimer(MUC_JOIN_WARNING_TIMEOUT_MILLISECONDS)); @@ -494,13 +494,15 @@ void MUCController::preHandleIncomingMessage(boost::shared_ptr<MessageEvent> mes } clearPresenceQueue(); boost::shared_ptr<Message> message = messageEvent->getStanza(); - if (joined_ && messageEvent->getStanza()->getFrom().getResource() != nick_ && messageTargetsMe(message) && !message->getPayload<Delay>() && messageEvent->isReadable() -) { + if (joined_ && messageEvent->getStanza()->getFrom().getResource() != nick_ && messageTargetsMe(message) && !message->getPayload<Delay>() && messageEvent->isReadable()) { chatWindow_->flash(); } else { messageEvent->setTargetsMe(false); } + if (messageEvent->isReadable() && isImpromptu_) { + chatWindow_->flash(); /* behave like a regular char*/ + } if (joined_) { std::string nick = message->getFrom().getResource(); if (nick != nick_ && currentOccupants_.find(nick) != currentOccupants_.end()) { @@ -529,10 +531,12 @@ void MUCController::preHandleIncomingMessage(boost::shared_ptr<MessageEvent> mes void MUCController::postHandleIncomingMessage(boost::shared_ptr<MessageEvent> messageEvent, const HighlightAction& highlight) { boost::shared_ptr<Message> message = messageEvent->getStanza(); - if (joined_ && messageEvent->getStanza()->getFrom().getResource() != nick_ && messageTargetsMe(message) && !message->getPayload<Delay>()) { - eventController_->handleIncomingEvent(messageEvent); - if (!messageEvent->getConcluded()) { - highlighter_->handleHighlightAction(highlight); + if (joined_ && messageEvent->getStanza()->getFrom().getResource() != nick_ && !message->getPayload<Delay>()) { + if (messageTargetsMe(message) || isImpromptu_) { + eventController_->handleIncomingEvent(messageEvent); + if (!messageEvent->getConcluded()) { + highlighter_->handleHighlightAction(highlight); + } } } } |