summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/Controllers')
-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
7 files changed, 19 insertions, 9 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