From 67c0420a2798ddb2c64fec01c1d37f038ad39262 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Wed, 25 Apr 2012 20:47:25 +0200
Subject: Convert /me in notification bubbles.

Resolves: #757

diff --git a/Swift/Controllers/EventNotifier.cpp b/Swift/Controllers/EventNotifier.cpp
index a4edabf..7feaac8 100644
--- a/Swift/Controllers/EventNotifier.cpp
+++ b/Swift/Controllers/EventNotifier.cpp
@@ -7,9 +7,11 @@
 #include "Swift/Controllers/EventNotifier.h"
 
 #include <boost/bind.hpp>
+#include <boost/algorithm/string.hpp>
 
 #include <Swift/Controllers/Intl.h>
 #include <Swiften/Base/format.h>
+#include <Swiften/Base/String.h>
 #include "Swift/Controllers/XMPPEvents/EventController.h"
 #include "SwifTools/Notifier/Notifier.h"
 #include "Swiften/Avatars/AvatarManager.h"
@@ -44,7 +46,11 @@ void EventNotifier::handleEventAdded(boost::shared_ptr<StanzaEvent> event) {
 			if (messageEvent->getStanza()->getType() == Message::Groupchat) {
 				activationJID = jid.toBare();
 			}
-			notifier->showMessage(Notifier::IncomingMessage, title, messageEvent->getStanza()->getBody(), avatarManager->getAvatarPath(jid), boost::bind(&EventNotifier::handleNotificationActivated, this, activationJID));
+			std::string messageText = messageEvent->getStanza()->getBody();
+			if (boost::starts_with(messageText, "/me ")) {
+				messageText = "*" + String::getSplittedAtFirst(messageText, ' ').second + "*";
+			}
+			notifier->showMessage(Notifier::IncomingMessage, title, messageText, avatarManager->getAvatarPath(jid), boost::bind(&EventNotifier::handleNotificationActivated, this, activationJID));
 		}
 	}
 	else if(boost::shared_ptr<SubscriptionRequestEvent> subscriptionEvent = boost::dynamic_pointer_cast<SubscriptionRequestEvent>(event)) {
-- 
cgit v0.10.2-6-g49f6