summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2015-01-30 13:56:12 (GMT)
committerSwift Review <review@swift.im>2015-02-03 17:27:11 (GMT)
commit53c86d070255ae1a33b7a3642bb6eb9ce42e7f70 (patch)
treef2793fbb216ffcd9b34bde3c8f6d1c419523c214 /Swift/QtUI/SystemMessageSnippet.cpp
parent4b2c07264f6cfccf8ed577c9b68b5b237e528be0 (diff)
downloadswift-53c86d070255ae1a33b7a3642bb6eb9ce42e7f70.zip
swift-53c86d070255ae1a33b7a3642bb6eb9ce42e7f70.tar.bz2
Fix chat log system messages related to entering a room
In the past MUCController added a "trying to enter..." message and later tried to replace this with "entered room as..." message. However, any message received in between, like a system message about room topic, came in between since MUCController replaced the *last* message added to the log. The new code also adds message IDs to system messages. This way the correct message can be replaced on successful login, no matter how many messages came in between. Test-Information: Tested against a MUC component that send a system message before sending the join presence back to a user. Change-Id: I3bcb5d78de680494965d837b2ad3edb847ff7f99
Diffstat (limited to 'Swift/QtUI/SystemMessageSnippet.cpp')
-rw-r--r--Swift/QtUI/SystemMessageSnippet.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/Swift/QtUI/SystemMessageSnippet.cpp b/Swift/QtUI/SystemMessageSnippet.cpp
index 28bf5d2..e752e32 100644
--- a/Swift/QtUI/SystemMessageSnippet.cpp
+++ b/Swift/QtUI/SystemMessageSnippet.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010 Isode Limited.
+ * Copyright (c) 2010-2015 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -10,9 +10,9 @@
namespace Swift {
-SystemMessageSnippet::SystemMessageSnippet(const QString& message, const QDateTime& time, bool appendToPrevious, QtChatTheme* theme, Direction direction) : ChatSnippet(appendToPrevious) {
+SystemMessageSnippet::SystemMessageSnippet(const QString& message, const QDateTime& time, bool appendToPrevious, QtChatTheme* theme, const QString& id, Direction direction) : ChatSnippet(appendToPrevious) {
if (appendToPrevious) {
- setContinuationFallbackSnippet(boost::shared_ptr<ChatSnippet>(new SystemMessageSnippet(message, time, false, theme, direction)));
+ setContinuationFallbackSnippet(boost::shared_ptr<ChatSnippet>(new SystemMessageSnippet(message, time, false, theme, id, direction)));
}
content_ = theme->getStatus();
@@ -20,6 +20,7 @@ SystemMessageSnippet::SystemMessageSnippet(const QString& message, const QDateTi
content_.replace("%message%", wrapResizable("<span class='swift_message'>" + escape(message) + "</span>"));
content_.replace("%shortTime%", wrapResizable(escape(time.toString("h:mm"))));
content_.replace("%time%", wrapResizable("<span class='swift_time'>" + timeToEscapedString(time) + "</span>"));
+ content_ = QString("<div id='%1'>%2</div>").arg(id).arg(content_);
}
SystemMessageSnippet::~SystemMessageSnippet() {