diff options
Diffstat (limited to 'Swift')
| -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 @@ -479,5 +479,5 @@ void ChatController::handlePresenceChange(boost::shared_ptr<Presence> newPresenc  	if (newStatusChangeString != lastStatusChangeString_) {  		if (lastWasPresence_) { -			chatWindow_->replaceLastMessage(chatMessageParser_->parseMessageBody(newStatusChangeString)); +			chatWindow_->replaceLastMessage(chatMessageParser_->parseMessageBody(newStatusChangeString), ChatWindow::UpdateTimestamp);  		} else {  			chatWindow_->addPresenceMessage(chatMessageParser_->parseMessageBody(newStatusChangeString), ChatWindow::DefaultDirection); 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 @@ -345,5 +345,5 @@ void MUCController::handleJoinComplete(const std::string& nick) {  	}  	setNick(nick); -	chatWindow_->replaceLastMessage(chatMessageParser_->parseMessageBody(joinMessage)); +	chatWindow_->replaceLastMessage(chatMessageParser_->parseMessageBody(joinMessage), ChatWindow::UpdateTimestamp);  #ifdef SWIFT_EXPERIMENTAL_HISTORY @@ -715,5 +715,5 @@ 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 @@ -95,4 +95,5 @@ namespace Swift {  			enum Direction { UnknownDirection, DefaultDirection };  			enum MUCType { StandardMUC, ImpromptuMUC }; +			enum TimestampBehaviour { KeepTimestamp, UpdateTimestamp };  			ChatWindow() {} @@ -143,5 +144,5 @@ namespace Swift {  			virtual void setRosterModel(Roster* model) = 0;  			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;  			virtual void flash() = 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 @@ -30,5 +30,5 @@ namespace Swift {  			virtual void replaceMessage(const ChatMessage& /*message*/, const std::string& /*id*/, const boost::posix_time::ptime& /*time*/, const HighlightAction& /*highlight*/) {}  			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*/) {}  			// File transfer related stuff 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 @@ -40,5 +40,5 @@ namespace Swift {  			virtual void replaceMessage(const ChatWindow::ChatMessage& message, const std::string& id, const boost::posix_time::ptime& time, const HighlightAction& highlight) = 0;  			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 @@ -792,6 +792,6 @@ 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 @@ -113,5 +113,5 @@ namespace Swift {  			void setTabComplete(TabComplete* completer);  			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 @@ -155,5 +155,5 @@ 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*/)  {  	QString text = "<p>The last message was corrected to:<br/>"; 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 @@ -47,5 +47,5 @@ namespace Swift {  			virtual void replaceMessage(const ChatWindow::ChatMessage& /*message*/, const std::string& /*id*/, const boost::posix_time::ptime& /*time*/, const HighlightAction& /*highlight*/);  			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 @@ -215,5 +215,5 @@ void QtWebKitChatView::addLastSeenLine() {  } -void QtWebKitChatView::replaceLastMessage(const QString& newMessage) { +void QtWebKitChatView::replaceLastMessage(const QString& newMessage, const ChatWindow::TimestampBehaviour timestampBehaviour) {  	assert(viewReady_);  	rememberScrolledToBottom(); @@ -223,9 +223,14 @@ void QtWebKitChatView::replaceLastMessage(const QString& newMessage) {  	QString old = lastElement_.toOuterXml();  	replace.setInnerXml(ChatSnippet::escape(newMessage)); +	if (timestampBehaviour == ChatWindow::UpdateTimestamp) { +		replace = lastElement_.findFirst("span.swift_time"); +		assert(!replace.isNull()); +		replace.setInnerXml(ChatSnippet::timeToEscapedString(QDateTime::currentDateTime())); +	}  }  void QtWebKitChatView::replaceLastMessage(const QString& newMessage, const QString& note) {  	rememberScrolledToBottom(); -	replaceLastMessage(newMessage); +	replaceLastMessage(newMessage, ChatWindow::KeepTimestamp);  	QWebElement replace = lastElement_.findFirst("span.swift_time");  	assert(!replace.isNull()); @@ -841,6 +846,6 @@ 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 @@ -62,5 +62,5 @@ namespace Swift {  			virtual void replaceMessage(const ChatWindow::ChatMessage& message, const std::string& id, const boost::posix_time::ptime& time, const HighlightAction& highlight) SWIFTEN_OVERRIDE;  			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); @@ -81,5 +81,5 @@ 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);  			void replaceMessage(const QString& newMessage, const QString& id, const QDateTime& time);  | 
 Swift