diff options
Diffstat (limited to 'Swift')
-rw-r--r-- | Swift/Controllers/Chat/ChatController.cpp | 6 | ||||
-rw-r--r-- | Swift/Controllers/Chat/ChatController.h | 1 | ||||
-rw-r--r-- | Swift/Controllers/Chat/ChatControllerBase.cpp | 1 | ||||
-rw-r--r-- | Swift/Controllers/Chat/ChatControllerBase.h | 1 | ||||
-rw-r--r-- | Swift/Controllers/Chat/MUCController.cpp | 8 | ||||
-rw-r--r-- | Swift/Controllers/Chat/MUCController.h | 1 | ||||
-rw-r--r-- | Swift/Controllers/EventNotifier.cpp | 3 |
7 files changed, 19 insertions, 2 deletions
diff --git a/Swift/Controllers/Chat/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp index 722d68c..22ef68d 100644 --- a/Swift/Controllers/Chat/ChatController.cpp +++ b/Swift/Controllers/Chat/ChatController.cpp @@ -91,7 +91,6 @@ bool ChatController::isIncomingMessageFromMe(boost::shared_ptr<Message>) { } void ChatController::preHandleIncomingMessage(boost::shared_ptr<MessageEvent> messageEvent) { - eventController_->handleIncomingEvent(messageEvent); if (messageEvent->isReadable()) { chatWindow_->flash(); lastWasPresence_ = false; @@ -107,6 +106,11 @@ void ChatController::preHandleIncomingMessage(boost::shared_ptr<MessageEvent> me chatStateTracker_->handleMessageReceived(message); } +void ChatController::postHandleIncomingMessage(boost::shared_ptr<MessageEvent> messageEvent) { + eventController_->handleIncomingEvent(messageEvent); +} + + void ChatController::preSendMessageRequest(boost::shared_ptr<Message> message) { chatStateNotifier_->addChatStateRequest(message); } diff --git a/Swift/Controllers/Chat/ChatController.h b/Swift/Controllers/Chat/ChatController.h index b8ac1cd..dd4bf90 100644 --- a/Swift/Controllers/Chat/ChatController.h +++ b/Swift/Controllers/Chat/ChatController.h @@ -28,6 +28,7 @@ namespace Swift { bool isIncomingMessageFromMe(boost::shared_ptr<Message> message); void postSendMessage(const std::string &body, boost::shared_ptr<Stanza> sentStanza); void preHandleIncomingMessage(boost::shared_ptr<MessageEvent> messageEvent); + void postHandleIncomingMessage(boost::shared_ptr<MessageEvent> messageEvent); void preSendMessageRequest(boost::shared_ptr<Message>); std::string senderDisplayNameFromMessage(const JID& from); virtual boost::optional<boost::posix_time::ptime> getMessageTimestamp(boost::shared_ptr<Message>) const; diff --git a/Swift/Controllers/Chat/ChatControllerBase.cpp b/Swift/Controllers/Chat/ChatControllerBase.cpp index 7efa134..281d968 100644 --- a/Swift/Controllers/Chat/ChatControllerBase.cpp +++ b/Swift/Controllers/Chat/ChatControllerBase.cpp @@ -184,6 +184,7 @@ void ChatControllerBase::handleIncomingMessage(boost::shared_ptr<MessageEvent> m } chatWindow_->show(); chatWindow_->setUnreadMessageCount(unreadMessages_.size()); + postHandleIncomingMessage(messageEvent); } std::string ChatControllerBase::getErrorMessage(boost::shared_ptr<ErrorPayload> error) { diff --git a/Swift/Controllers/Chat/ChatControllerBase.h b/Swift/Controllers/Chat/ChatControllerBase.h index 6a92429..9573b1b 100644 --- a/Swift/Controllers/Chat/ChatControllerBase.h +++ b/Swift/Controllers/Chat/ChatControllerBase.h @@ -57,6 +57,7 @@ namespace Swift { virtual std::string senderDisplayNameFromMessage(const JID& from) = 0; virtual bool isIncomingMessageFromMe(boost::shared_ptr<Message>) = 0; virtual void preHandleIncomingMessage(boost::shared_ptr<MessageEvent>) {}; + virtual void postHandleIncomingMessage(boost::shared_ptr<MessageEvent>) {}; virtual void preSendMessageRequest(boost::shared_ptr<Message>) {}; virtual bool isFromContact(const JID& from); virtual boost::optional<boost::posix_time::ptime> getMessageTimestamp(boost::shared_ptr<Message>) const = 0; diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp index aaa9d3a..7729c8c 100644 --- a/Swift/Controllers/Chat/MUCController.cpp +++ b/Swift/Controllers/Chat/MUCController.cpp @@ -265,7 +265,6 @@ 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>()) { - eventController_->handleIncomingEvent(messageEvent); if (messageEvent->isReadable()) { chatWindow_->flash(); } @@ -294,6 +293,13 @@ void MUCController::preHandleIncomingMessage(boost::shared_ptr<MessageEvent> mes } } +void MUCController::postHandleIncomingMessage(boost::shared_ptr<MessageEvent> messageEvent) { + boost::shared_ptr<Message> message = messageEvent->getStanza(); + if (joined_ && messageEvent->getStanza()->getFrom().getResource() != nick_ && messageTargetsMe(message) && !message->getPayload<Delay>()) { + eventController_->handleIncomingEvent(messageEvent); + } +} + void MUCController::handleOccupantRoleChanged(const std::string& nick, const MUCOccupant& occupant, const MUCOccupant::Role& oldRole) { clearPresenceQueue(); receivedActivity(); diff --git a/Swift/Controllers/Chat/MUCController.h b/Swift/Controllers/Chat/MUCController.h index 30f7aa5..ebdd6cd 100644 --- a/Swift/Controllers/Chat/MUCController.h +++ b/Swift/Controllers/Chat/MUCController.h @@ -56,6 +56,7 @@ namespace Swift { std::string senderDisplayNameFromMessage(const JID& from); boost::optional<boost::posix_time::ptime> getMessageTimestamp(boost::shared_ptr<Message> message) const; void preHandleIncomingMessage(boost::shared_ptr<MessageEvent>); + void postHandleIncomingMessage(boost::shared_ptr<MessageEvent>); private: void clearPresenceQueue(); diff --git a/Swift/Controllers/EventNotifier.cpp b/Swift/Controllers/EventNotifier.cpp index 740f5c0..055ed3e 100644 --- a/Swift/Controllers/EventNotifier.cpp +++ b/Swift/Controllers/EventNotifier.cpp @@ -30,6 +30,9 @@ EventNotifier::~EventNotifier() { } void EventNotifier::handleEventAdded(boost::shared_ptr<StanzaEvent> event) { + if (event->getConcluded()) { + return; + } if (boost::shared_ptr<MessageEvent> messageEvent = boost::dynamic_pointer_cast<MessageEvent>(event)) { JID jid = messageEvent->getStanza()->getFrom(); std::string title = nickResolver->jidToNick(jid); |