summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-01-17 00:17:11 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-01-17 00:20:41 (GMT)
commited8990c5ee4f54d63e88b6bad28356d0c032a8c3 (patch)
treeac0ca6f18e4b01c76471d0f4660f8e111bc4fdac /Swift/Controllers/ChatControllerBase.cpp
parent9ece5e827fa308b36f18884487d34e0073870496 (diff)
downloadswift-contrib-ed8990c5ee4f54d63e88b6bad28356d0c032a8c3.zip
swift-contrib-ed8990c5ee4f54d63e88b6bad28356d0c032a8c3.tar.bz2
Preparation. for /me.
QtUI's implementation isn't done yet.
Diffstat (limited to 'Swift/Controllers/ChatControllerBase.cpp')
-rw-r--r--Swift/Controllers/ChatControllerBase.cpp14
1 files changed, 11 insertions, 3 deletions
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()));
}
}