summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2015-01-30 13:58:52 (GMT)
committerSwift Review <review@swift.im>2015-02-05 15:44:55 (GMT)
commitccaa8342069eaa07d6cb3a4273c83f44883472fe (patch)
tree9f33e7f0820ccee4d5e0b572706ad790f41d2bd4 /Swift/Controllers/Chat/ChatControllerBase.cpp
parent7d2ee8a852ca25f094ab003061d330a576a4806b (diff)
downloadswift-ccaa8342069eaa07d6cb3a4273c83f44883472fe.zip
swift-ccaa8342069eaa07d6cb3a4273c83f44883472fe.tar.bz2
Correctly render MUC system messages as system messages
Messages received from a MUC bare JID in a MUC have been rendered as user messages in the past. They are now rendered as system messages. Test-Information: Tested with a MUC component that sends a bare message on login. Change-Id: I9a548ec9b81db8ba329182e08446d72c3518c7cb
Diffstat (limited to 'Swift/Controllers/Chat/ChatControllerBase.cpp')
-rw-r--r--Swift/Controllers/Chat/ChatControllerBase.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/Swift/Controllers/Chat/ChatControllerBase.cpp b/Swift/Controllers/Chat/ChatControllerBase.cpp
index 29c0491..31fecbb 100644
--- a/Swift/Controllers/Chat/ChatControllerBase.cpp
+++ b/Swift/Controllers/Chat/ChatControllerBase.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.
*/
@@ -278,7 +278,7 @@ void ChatControllerBase::handleIncomingMessage(boost::shared_ptr<MessageEvent> m
highlight = highlighter_->findAction(body, senderDisplayNameFromMessage(from));
}
- boost::shared_ptr<Replace> replace = message->getPayload<Replace>();
+ boost::shared_ptr<Replace> replace = message->getPayload<Replace>();
if (replace) {
std::string body = message->getBody();
// Should check if the user has a previous message
@@ -289,7 +289,7 @@ void ChatControllerBase::handleIncomingMessage(boost::shared_ptr<MessageEvent> m
}
}
else {
- lastMessagesUIID_[from] = addMessage(body, senderDisplayNameFromMessage(from), isIncomingMessageFromMe(message), label, avatarManager_->getAvatarPath(from), timeStamp, highlight);
+ addMessageHandleIncomingMessage(from, body, isIncomingMessageFromMe(message), label, timeStamp, highlight);
}
logMessage(body, from, selfJID_, timeStamp, true);
@@ -300,6 +300,10 @@ void ChatControllerBase::handleIncomingMessage(boost::shared_ptr<MessageEvent> m
postHandleIncomingMessage(messageEvent, highlight);
}
+void ChatControllerBase::addMessageHandleIncomingMessage(const JID& from, const std::string& message, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const boost::posix_time::ptime& timeStamp, const HighlightAction& highlight) {
+ lastMessagesUIID_[from] = addMessage(message, senderDisplayNameFromMessage(from), senderIsSelf, label, avatarManager_->getAvatarPath(from), timeStamp, highlight);
+}
+
std::string ChatControllerBase::getErrorMessage(boost::shared_ptr<ErrorPayload> error) {
std::string defaultMessage = QT_TRANSLATE_NOOP("", "Error sending message");
if (!error->getText().empty()) {