diff options
-rw-r--r-- | Swift/Controllers/Chat/ChatController.cpp | 11 | ||||
-rw-r--r-- | Swift/Controllers/Chat/ChatController.h | 3 | ||||
-rw-r--r-- | Swift/Controllers/Chat/ChatControllerBase.cpp | 2 | ||||
-rw-r--r-- | Swift/Controllers/Chat/ChatControllerBase.h | 1 | ||||
-rw-r--r-- | Swift/Controllers/Chat/MUCController.cpp | 4 | ||||
-rw-r--r-- | Swift/Controllers/Chat/MUCController.h | 1 |
6 files changed, 19 insertions, 3 deletions
diff --git a/Swift/Controllers/Chat/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp index 10b7825..d28b29b 100644 --- a/Swift/Controllers/Chat/ChatController.cpp +++ b/Swift/Controllers/Chat/ChatController.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2014 Isode Limited. + * Copyright (c) 2010-2015 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -430,6 +430,15 @@ void ChatController::handleWhiteboardWindowShow() { eventStream_->send(boost::make_shared<ShowWhiteboardUIEvent>(toJID_)); } +std::string ChatController::senderHighlightNameFromMessage(const JID& from) { + if (isInMUC_) { + return nickResolver_->jidToNick(from); + } + else { + return from.toBare().toString(); + } +} + std::string ChatController::senderDisplayNameFromMessage(const JID& from) { return nickResolver_->jidToNick(from); } diff --git a/Swift/Controllers/Chat/ChatController.h b/Swift/Controllers/Chat/ChatController.h index 775e737..317a836 100644 --- a/Swift/Controllers/Chat/ChatController.h +++ b/Swift/Controllers/Chat/ChatController.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2014 Isode Limited. + * Copyright (c) 2010-2015 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -52,6 +52,7 @@ namespace Swift { void preHandleIncomingMessage(boost::shared_ptr<MessageEvent> messageEvent); void postHandleIncomingMessage(boost::shared_ptr<MessageEvent> messageEvent, const HighlightAction&); void preSendMessageRequest(boost::shared_ptr<Message>); + std::string senderHighlightNameFromMessage(const JID& from); std::string senderDisplayNameFromMessage(const JID& from); virtual boost::optional<boost::posix_time::ptime> getMessageTimestamp(boost::shared_ptr<Message>) const; void handleStanzaAcked(boost::shared_ptr<Stanza> stanza); diff --git a/Swift/Controllers/Chat/ChatControllerBase.cpp b/Swift/Controllers/Chat/ChatControllerBase.cpp index 31fecbb..042ed3a 100644 --- a/Swift/Controllers/Chat/ChatControllerBase.cpp +++ b/Swift/Controllers/Chat/ChatControllerBase.cpp @@ -275,7 +275,7 @@ void ChatControllerBase::handleIncomingMessage(boost::shared_ptr<MessageEvent> m // Highlight if (!isIncomingMessageFromMe(message)) { - highlight = highlighter_->findAction(body, senderDisplayNameFromMessage(from)); + highlight = highlighter_->findAction(body, senderHighlightNameFromMessage(from)); } boost::shared_ptr<Replace> replace = message->getPayload<Replace>(); diff --git a/Swift/Controllers/Chat/ChatControllerBase.h b/Swift/Controllers/Chat/ChatControllerBase.h index 0166b6b..49e24e8 100644 --- a/Swift/Controllers/Chat/ChatControllerBase.h +++ b/Swift/Controllers/Chat/ChatControllerBase.h @@ -79,6 +79,7 @@ namespace Swift { */ virtual void postSendMessage(const std::string&, boost::shared_ptr<Stanza>) {} virtual std::string senderDisplayNameFromMessage(const JID& from) = 0; + virtual std::string senderHighlightNameFromMessage(const JID& from) = 0; virtual bool isIncomingMessageFromMe(boost::shared_ptr<Message>) = 0; virtual void preHandleIncomingMessage(boost::shared_ptr<MessageEvent>) {} virtual void addMessageHandleIncomingMessage(const JID& from, const std::string& message, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const boost::posix_time::ptime& time, const HighlightAction& highlight); diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp index 70a638e..10d63a7 100644 --- a/Swift/Controllers/Chat/MUCController.cpp +++ b/Swift/Controllers/Chat/MUCController.cpp @@ -750,6 +750,10 @@ bool MUCController::isIncomingMessageFromMe(boost::shared_ptr<Message> message) return nick_ == from.getResource(); } +std::string MUCController::senderHighlightNameFromMessage(const JID& from) { + return from.getResource(); +} + std::string MUCController::senderDisplayNameFromMessage(const JID& from) { return from.getResource(); } diff --git a/Swift/Controllers/Chat/MUCController.h b/Swift/Controllers/Chat/MUCController.h index bf15b01..5e033ed 100644 --- a/Swift/Controllers/Chat/MUCController.h +++ b/Swift/Controllers/Chat/MUCController.h @@ -72,6 +72,7 @@ namespace Swift { protected: void preSendMessageRequest(boost::shared_ptr<Message> message); bool isIncomingMessageFromMe(boost::shared_ptr<Message> message); + std::string senderHighlightNameFromMessage(const JID& from); std::string senderDisplayNameFromMessage(const JID& from); boost::optional<boost::posix_time::ptime> getMessageTimestamp(boost::shared_ptr<Message> message) const; virtual void preHandleIncomingMessage(boost::shared_ptr<MessageEvent>); |