diff options
| -rw-r--r-- | Swift/Controllers/Chat/ChatController.cpp | 2 | ||||
| -rw-r--r-- | Swift/Controllers/Chat/MUCController.cpp | 4 | ||||
| -rw-r--r-- | Swift/Controllers/UIInterfaces/ChatWindow.h | 3 | ||||
| -rw-r--r-- | Swift/Controllers/UnitTest/MockChatWindow.h | 2 | ||||
| -rw-r--r-- | Swift/QtUI/QtChatView.h | 2 | ||||
| -rw-r--r-- | Swift/QtUI/QtChatWindow.cpp | 4 | ||||
| -rw-r--r-- | Swift/QtUI/QtChatWindow.h | 2 | ||||
| -rw-r--r-- | Swift/QtUI/QtPlainChatView.cpp | 2 | ||||
| -rw-r--r-- | Swift/QtUI/QtPlainChatView.h | 2 | ||||
| -rw-r--r-- | Swift/QtUI/QtWebKitChatView.cpp | 13 | ||||
| -rw-r--r-- | Swift/QtUI/QtWebKitChatView.h | 4 |
11 files changed, 23 insertions, 17 deletions
diff --git a/Swift/Controllers/Chat/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp index 65d65a6..2367761 100644 --- a/Swift/Controllers/Chat/ChatController.cpp +++ b/Swift/Controllers/Chat/ChatController.cpp @@ -480,3 +480,3 @@ void ChatController::handlePresenceChange(boost::shared_ptr<Presence> newPresenc if (lastWasPresence_) { - chatWindow_->replaceLastMessage(chatMessageParser_->parseMessageBody(newStatusChangeString)); + chatWindow_->replaceLastMessage(chatMessageParser_->parseMessageBody(newStatusChangeString), ChatWindow::UpdateTimestamp); } else { diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp index 6bc7067..d09bc3d 100644 --- a/Swift/Controllers/Chat/MUCController.cpp +++ b/Swift/Controllers/Chat/MUCController.cpp @@ -346,3 +346,3 @@ void MUCController::handleJoinComplete(const std::string& nick) { setNick(nick); - chatWindow_->replaceLastMessage(chatMessageParser_->parseMessageBody(joinMessage)); + chatWindow_->replaceLastMessage(chatMessageParser_->parseMessageBody(joinMessage), ChatWindow::UpdateTimestamp); @@ -716,3 +716,3 @@ boost::optional<boost::posix_time::ptime> MUCController::getMessageTimestamp(boo void MUCController::updateJoinParts() { - chatWindow_->replaceLastMessage(chatMessageParser_->parseMessageBody(generateJoinPartString(joinParts_, isImpromptu()))); + chatWindow_->replaceLastMessage(chatMessageParser_->parseMessageBody(generateJoinPartString(joinParts_, isImpromptu())), ChatWindow::UpdateTimestamp); } diff --git a/Swift/Controllers/UIInterfaces/ChatWindow.h b/Swift/Controllers/UIInterfaces/ChatWindow.h index ba4b397..bf4744b 100644 --- a/Swift/Controllers/UIInterfaces/ChatWindow.h +++ b/Swift/Controllers/UIInterfaces/ChatWindow.h @@ -96,2 +96,3 @@ namespace Swift { enum MUCType { StandardMUC, ImpromptuMUC }; + enum TimestampBehaviour { KeepTimestamp, UpdateTimestamp }; @@ -144,3 +145,3 @@ namespace Swift { virtual void setTabComplete(TabComplete* completer) = 0; - virtual void replaceLastMessage(const ChatMessage& message) = 0; + virtual void replaceLastMessage(const ChatMessage& message, const TimestampBehaviour timestampBehaviour) = 0; virtual void setAckState(const std::string& id, AckState state) = 0; diff --git a/Swift/Controllers/UnitTest/MockChatWindow.h b/Swift/Controllers/UnitTest/MockChatWindow.h index e4c2548..823ea3a 100644 --- a/Swift/Controllers/UnitTest/MockChatWindow.h +++ b/Swift/Controllers/UnitTest/MockChatWindow.h @@ -31,3 +31,3 @@ namespace Swift { virtual void replaceWithAction(const ChatMessage& /*message*/, const std::string& /*id*/, const boost::posix_time::ptime& /*time*/, const HighlightAction& /*highlight*/) {} - virtual void replaceLastMessage(const ChatMessage& /*message*/) {} + virtual void replaceLastMessage(const ChatMessage& /*message*/, const TimestampBehaviour /*timestampBehaviour*/) {} diff --git a/Swift/QtUI/QtChatView.h b/Swift/QtUI/QtChatView.h index 61c6f24..52125b7 100644 --- a/Swift/QtUI/QtChatView.h +++ b/Swift/QtUI/QtChatView.h @@ -41,3 +41,3 @@ namespace Swift { virtual void replaceWithAction(const ChatWindow::ChatMessage& message, const std::string& id, const boost::posix_time::ptime& time, const HighlightAction& highlight) = 0; - virtual void replaceLastMessage(const ChatWindow::ChatMessage& message) = 0; + virtual void replaceLastMessage(const ChatWindow::ChatMessage& message, const ChatWindow::TimestampBehaviour /*timestampBehaviour*/) = 0; virtual void setAckState(const std::string& id, ChatWindow::AckState state) = 0; diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp index f0d2038..74ff109 100644 --- a/Swift/QtUI/QtChatWindow.cpp +++ b/Swift/QtUI/QtChatWindow.cpp @@ -793,4 +793,4 @@ void QtChatWindow::setWhiteboardSessionStatus(std::string id, const ChatWindow:: -void QtChatWindow::replaceLastMessage(const ChatMessage& message) { - messageLog_->replaceLastMessage(message); +void QtChatWindow::replaceLastMessage(const ChatMessage& message, const TimestampBehaviour timestampBehaviour) { + messageLog_->replaceLastMessage(message, timestampBehaviour); } diff --git a/Swift/QtUI/QtChatWindow.h b/Swift/QtUI/QtChatWindow.h index 95edcd0..b8e3c6a 100644 --- a/Swift/QtUI/QtChatWindow.h +++ b/Swift/QtUI/QtChatWindow.h @@ -114,3 +114,3 @@ namespace Swift { int getCount(); - void replaceLastMessage(const ChatMessage& message); + void replaceLastMessage(const ChatMessage& message, const TimestampBehaviour timestampBehaviour); void setAckState(const std::string& id, AckState state); diff --git a/Swift/QtUI/QtPlainChatView.cpp b/Swift/QtUI/QtPlainChatView.cpp index ee76438..23bf0af 100644 --- a/Swift/QtUI/QtPlainChatView.cpp +++ b/Swift/QtUI/QtPlainChatView.cpp @@ -156,3 +156,3 @@ void QtPlainChatView::replaceWithAction(const ChatWindow::ChatMessage& message, -void QtPlainChatView::replaceLastMessage(const ChatWindow::ChatMessage& message) +void QtPlainChatView::replaceLastMessage(const ChatWindow::ChatMessage& message, const ChatWindow::TimestampBehaviour /*timestampBehaviour*/) { diff --git a/Swift/QtUI/QtPlainChatView.h b/Swift/QtUI/QtPlainChatView.h index cf65fb3..06613f9 100644 --- a/Swift/QtUI/QtPlainChatView.h +++ b/Swift/QtUI/QtPlainChatView.h @@ -48,3 +48,3 @@ namespace Swift { virtual void replaceWithAction(const ChatWindow::ChatMessage& /*message*/, const std::string& /*id*/, const boost::posix_time::ptime& /*time*/, const HighlightAction& /*highlight*/); - virtual void replaceLastMessage(const ChatWindow::ChatMessage& /*message*/); + virtual void replaceLastMessage(const ChatWindow::ChatMessage& /*message*/, const ChatWindow::TimestampBehaviour /*timestampBehaviour*/); virtual void setAckState(const std::string& /*id*/, ChatWindow::AckState /*state*/); diff --git a/Swift/QtUI/QtWebKitChatView.cpp b/Swift/QtUI/QtWebKitChatView.cpp index 3f021e9..23bc099 100644 --- a/Swift/QtUI/QtWebKitChatView.cpp +++ b/Swift/QtUI/QtWebKitChatView.cpp @@ -216,3 +216,3 @@ void QtWebKitChatView::addLastSeenLine() { -void QtWebKitChatView::replaceLastMessage(const QString& newMessage) { +void QtWebKitChatView::replaceLastMessage(const QString& newMessage, const ChatWindow::TimestampBehaviour timestampBehaviour) { assert(viewReady_); @@ -224,2 +224,7 @@ void QtWebKitChatView::replaceLastMessage(const QString& newMessage) { replace.setInnerXml(ChatSnippet::escape(newMessage)); + if (timestampBehaviour == ChatWindow::UpdateTimestamp) { + replace = lastElement_.findFirst("span.swift_time"); + assert(!replace.isNull()); + replace.setInnerXml(ChatSnippet::timeToEscapedString(QDateTime::currentDateTime())); + } } @@ -228,3 +233,3 @@ void QtWebKitChatView::replaceLastMessage(const QString& newMessage, const QStri rememberScrolledToBottom(); - replaceLastMessage(newMessage); + replaceLastMessage(newMessage, ChatWindow::KeepTimestamp); QWebElement replace = lastElement_.findFirst("span.swift_time"); @@ -842,4 +847,4 @@ void QtWebKitChatView::addPresenceMessage(const ChatWindow::ChatMessage& message -void QtWebKitChatView::replaceLastMessage(const ChatWindow::ChatMessage& message) { - replaceLastMessage(chatMessageToHTML(message)); +void QtWebKitChatView::replaceLastMessage(const ChatWindow::ChatMessage& message, const ChatWindow::TimestampBehaviour timestampBehaviour) { + replaceLastMessage(chatMessageToHTML(message), timestampBehaviour); } diff --git a/Swift/QtUI/QtWebKitChatView.h b/Swift/QtUI/QtWebKitChatView.h index bdb2a75..fb6e4da 100644 --- a/Swift/QtUI/QtWebKitChatView.h +++ b/Swift/QtUI/QtWebKitChatView.h @@ -63,3 +63,3 @@ namespace Swift { virtual void replaceWithAction(const ChatWindow::ChatMessage& message, const std::string& id, const boost::posix_time::ptime& time, const HighlightAction& highlight) SWIFTEN_OVERRIDE; - void replaceLastMessage(const ChatWindow::ChatMessage& message); + void replaceLastMessage(const ChatWindow::ChatMessage& message, const ChatWindow::TimestampBehaviour timestampBehaviour); void setAckState(const std::string& id, ChatWindow::AckState state); @@ -82,3 +82,3 @@ namespace Swift { private: // previously public, now private - void replaceLastMessage(const QString& newMessage); + void replaceLastMessage(const QString& newMessage, const ChatWindow::TimestampBehaviour timestampBehaviour); void replaceLastMessage(const QString& newMessage, const QString& note); |
Swift