summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/QtChatWindow.cpp')
-rw-r--r--Swift/QtUI/QtChatWindow.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp
index fdf1ebc..a0b25a9 100644
--- a/Swift/QtUI/QtChatWindow.cpp
+++ b/Swift/QtUI/QtChatWindow.cpp
@@ -28,7 +28,7 @@
#include <QUrl>
namespace Swift {
-QtChatWindow::QtChatWindow(const QString &contact, UIEventStream* eventStream) : QtTabbable(), contact_(contact), previousMessageWasSelf_(false), previousMessageWasSystem_(false), eventStream_(eventStream) {
+QtChatWindow::QtChatWindow(const QString &contact, UIEventStream* eventStream) : QtTabbable(), contact_(contact), previousMessageWasSelf_(false), previousMessageWasSystem_(false), previousMessageWasPresence_(false), eventStream_(eventStream) {
unreadCount_ = 0;
inputEnabled_ = true;
completer_ = NULL;
@@ -268,6 +268,7 @@ void QtChatWindow::addMessage(const String &message, const String &senderName, b
previousMessageWasSelf_ = senderIsSelf;
previousSenderName_ = P2QSTRING(senderName);
previousMessageWasSystem_ = false;
+ previousMessageWasPresence_ = false;
}
int QtChatWindow::getCount() {
@@ -289,6 +290,7 @@ void QtChatWindow::addErrorMessage(const String& errorMessage) {
previousMessageWasSelf_ = false;
previousMessageWasSystem_ = true;
+ previousMessageWasPresence_ = false;
}
void QtChatWindow::addSystemMessage(const String& message) {
@@ -302,8 +304,24 @@ void QtChatWindow::addSystemMessage(const String& message) {
previousMessageWasSelf_ = false;
previousMessageWasSystem_ = true;
+ previousMessageWasPresence_ = false;
}
+void QtChatWindow::addPresenceMessage(const String& message) {
+ if (isWidgetSelected()) {
+ onAllMessagesRead();
+ }
+
+ QString messageHTML(Qt::escape(P2QSTRING(message)));
+ messageHTML.replace("\n","<br/>");
+ messageLog_->addMessage(SystemMessageSnippet(messageHTML, QDateTime::currentDateTime(),previousMessageWasPresence_));
+
+ previousMessageWasSelf_ = false;
+ previousMessageWasSystem_ = false;
+ previousMessageWasPresence_ = true;
+}
+
+
void QtChatWindow::returnPressed() {
if (!inputEnabled_) {
return;