summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
Diffstat (limited to 'Swift')
-rw-r--r--Swift/Controllers/ChatController.cpp6
-rw-r--r--Swift/Controllers/ChatControllerBase.cpp14
-rw-r--r--Swift/Controllers/ChatControllerBase.h1
-rw-r--r--Swift/Controllers/MUCController.cpp4
-rw-r--r--Swift/Controllers/MainController.cpp2
-rw-r--r--Swift/Controllers/UIInterfaces/ChatWindow.h (renamed from Swift/Controllers/ChatWindow.h)1
-rw-r--r--Swift/Controllers/UIInterfaces/ChatWindowFactory.h (renamed from Swift/Controllers/ChatWindowFactory.h)0
-rw-r--r--Swift/QtUI/QtChatWindow.cpp4
-rw-r--r--Swift/QtUI/QtChatWindow.h3
-rw-r--r--Swift/QtUI/QtChatWindowFactory.h2
10 files changed, 26 insertions, 11 deletions
diff --git a/Swift/Controllers/ChatController.cpp b/Swift/Controllers/ChatController.cpp
index 90e5567..c4f45d8 100644
--- a/Swift/Controllers/ChatController.cpp
+++ b/Swift/Controllers/ChatController.cpp
@@ -3,8 +3,8 @@
#include <boost/bind.hpp>
#include "Swiften/Avatars/AvatarManager.h"
-#include "Swift/Controllers/ChatWindow.h"
-#include "Swift/Controllers/ChatWindowFactory.h"
+#include "Swift/Controllers/UIInterfaces/ChatWindow.h"
+#include "Swift/Controllers/UIInterfaces/ChatWindowFactory.h"
#include "Swift/Controllers/NickResolver.h"
namespace Swift {
@@ -33,7 +33,7 @@ void ChatController::preHandleIncomingMessage(boost::shared_ptr<Message> message
}
void ChatController::postSendMessage(const String& body) {
- chatWindow_->addMessage(body, "me", true, labelsEnabled_ ? chatWindow_->getSelectedSecurityLabel() : boost::optional<SecurityLabel>(), String(avatarManager_->getAvatarPath(selfJID_).string()));
+ addMessage(body, "me", true, labelsEnabled_ ? chatWindow_->getSelectedSecurityLabel() : boost::optional<SecurityLabel>(), String(avatarManager_->getAvatarPath(selfJID_).string()));
}
String ChatController::senderDisplayNameFromMessage(const JID& from) {
diff --git a/Swift/Controllers/ChatControllerBase.cpp b/Swift/Controllers/ChatControllerBase.cpp
index 2b873f1..3e1ce5e 100644
--- a/Swift/Controllers/ChatControllerBase.cpp
+++ b/Swift/Controllers/ChatControllerBase.cpp
@@ -5,8 +5,8 @@
#include "Swiften/Client/StanzaChannel.h"
#include "Swiften/Base/foreach.h"
-#include "Swift/Controllers/ChatWindow.h"
-#include "Swift/Controllers/ChatWindowFactory.h"
+#include "Swift/Controllers/UIInterfaces/ChatWindow.h"
+#include "Swift/Controllers/UIInterfaces/ChatWindowFactory.h"
#include "Swiften/Queries/Requests/GetSecurityLabelsCatalogRequest.h"
#include "Swiften/Avatars/AvatarManager.h"
@@ -89,6 +89,14 @@ void ChatControllerBase::activateChatWindow() {
chatWindow_->activate();
}
+void ChatControllerBase::addMessage(const String& message, const String& senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const String& avatarPath) {
+ if (message.beginsWith("/me ")) {
+ chatWindow_->addMessage(message, senderName, senderIsSelf, label, avatarPath);
+ } else {
+ chatWindow_->addAction(message, senderName, senderIsSelf, label, avatarPath);
+ }
+}
+
void ChatControllerBase::handleIncomingMessage(boost::shared_ptr<MessageEvent> messageEvent) {
unreadMessages_.push_back(messageEvent);
chatWindow_->setUnreadMessageCount(unreadMessages_.size());
@@ -105,7 +113,7 @@ void ChatControllerBase::handleIncomingMessage(boost::shared_ptr<MessageEvent> m
boost::shared_ptr<SecurityLabel> label = message->getPayload<SecurityLabel>();
boost::optional<SecurityLabel> maybeLabel = label ? boost::optional<SecurityLabel>(*label) : boost::optional<SecurityLabel>();
JID from = message->getFrom();
- chatWindow_->addMessage(body, senderDisplayNameFromMessage(from), isIncomingMessageFromMe(message), maybeLabel, String(avatarManager_->getAvatarPath(from).string()));
+ addMessage(body, senderDisplayNameFromMessage(from), isIncomingMessageFromMe(message), maybeLabel, String(avatarManager_->getAvatarPath(from).string()));
}
}
diff --git a/Swift/Controllers/ChatControllerBase.h b/Swift/Controllers/ChatControllerBase.h
index c780789..abf0116 100644
--- a/Swift/Controllers/ChatControllerBase.h
+++ b/Swift/Controllers/ChatControllerBase.h
@@ -30,6 +30,7 @@ namespace Swift {
void activateChatWindow();
void setAvailableServerFeatures(boost::shared_ptr<DiscoInfo> info);
void handleIncomingMessage(boost::shared_ptr<MessageEvent> message);
+ void addMessage(const String& message, const String& senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const String& avatarPath);
void setEnabled(bool enabled);
void setToJID(const JID& jid) {toJID_ = jid;};
protected:
diff --git a/Swift/Controllers/MUCController.cpp b/Swift/Controllers/MUCController.cpp
index 4d0acca..c85fffa 100644
--- a/Swift/Controllers/MUCController.cpp
+++ b/Swift/Controllers/MUCController.cpp
@@ -3,8 +3,8 @@
#include <boost/bind.hpp>
#include "Swiften/Base/foreach.h"
-#include "Swift/Controllers/ChatWindow.h"
-#include "Swift/Controllers/ChatWindowFactory.h"
+#include "Swift/Controllers/UIInterfaces/ChatWindow.h"
+#include "Swift/Controllers/UIInterfaces/ChatWindowFactory.h"
#include "Swiften/Avatars/AvatarManager.h"
#include "Swiften/MUC/MUC.h"
#include "Swiften/Client/StanzaChannel.h"
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index 946b7d0..3fd0764 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -8,7 +8,7 @@
#include "Swiften/Application/Application.h"
#include "Swiften/Application/ApplicationMessageDisplay.h"
#include "Swift/Controllers/ChatController.h"
-#include "Swift/Controllers/ChatWindowFactory.h"
+#include "Swift/Controllers/UIInterfaces/ChatWindowFactory.h"
#include "Swift/Controllers/ChatsManager.h"
#include "Swift/Controllers/EventController.h"
#include "Swift/Controllers/UIInterfaces/LoginWindow.h"
diff --git a/Swift/Controllers/ChatWindow.h b/Swift/Controllers/UIInterfaces/ChatWindow.h
index db1e9e3..59c3152 100644
--- a/Swift/Controllers/ChatWindow.h
+++ b/Swift/Controllers/UIInterfaces/ChatWindow.h
@@ -19,6 +19,7 @@ namespace Swift {
virtual ~ChatWindow() {};
virtual void addMessage(const String& message, const String& senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const String& avatarPath) = 0;
+ virtual void addAction(const String& message, const String& senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const String& avatarPath) = 0;
virtual void addSystemMessage(const String& message) = 0;
virtual void addErrorMessage(const String& message) = 0;
diff --git a/Swift/Controllers/ChatWindowFactory.h b/Swift/Controllers/UIInterfaces/ChatWindowFactory.h
index c55ddba..c55ddba 100644
--- a/Swift/Controllers/ChatWindowFactory.h
+++ b/Swift/Controllers/UIInterfaces/ChatWindowFactory.h
diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp
index 831dbfd..e982b21 100644
--- a/Swift/QtUI/QtChatWindow.cpp
+++ b/Swift/QtUI/QtChatWindow.cpp
@@ -172,6 +172,10 @@ void QtChatWindow::addMessage(const String &message, const String &senderName, b
previousMessageWasSystem_ = false;
}
+void QtChatWindow::addAction(const String &message, const String &senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const String& avatarPath) {
+ addMessage(message, senderName, senderIsSelf, label, avatarPath);
+}
+
void QtChatWindow::addErrorMessage(const String& errorMessage) {
if (isWidgetSelected()) {
onAllMessagesRead();
diff --git a/Swift/QtUI/QtChatWindow.h b/Swift/QtUI/QtChatWindow.h
index b743aaf..e147fb8 100644
--- a/Swift/QtUI/QtChatWindow.h
+++ b/Swift/QtUI/QtChatWindow.h
@@ -1,7 +1,7 @@
#ifndef SWIFT_QtChatWindow_H
#define SWIFT_QtChatWindow_H
-#include "Swift/Controllers/ChatWindow.h"
+#include "Swift/Controllers/UIInterfaces/ChatWindow.h"
#include "QtTabbable.h"
@@ -21,6 +21,7 @@ namespace Swift {
QtChatWindow(const QString &contact, QtTreeWidgetFactory* treeWidgetFactory);
~QtChatWindow();
void addMessage(const String &message, const String &senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const String& avatarPath);
+ void addAction(const String &message, const String &senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const String& avatarPath);
void addSystemMessage(const String& message);
void addErrorMessage(const String& errorMessage);
void show();
diff --git a/Swift/QtUI/QtChatWindowFactory.h b/Swift/QtUI/QtChatWindowFactory.h
index 0c8a092..51db3db 100644
--- a/Swift/QtUI/QtChatWindowFactory.h
+++ b/Swift/QtUI/QtChatWindowFactory.h
@@ -1,7 +1,7 @@
#ifndef SWIFT_QtChatWindowFactory_H
#define SWIFT_QtChatWindowFactory_H
-#include "Swift/Controllers/ChatWindowFactory.h"
+#include "Swift/Controllers/UIInterfaces/ChatWindowFactory.h"
#include "Swiften/JID/JID.h"
#include "QtSettingsProvider.h"