From 67c0420a2798ddb2c64fec01c1d37f038ad39262 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= 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 +#include #include #include +#include #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 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 subscriptionEvent = boost::dynamic_pointer_cast(event)) { -- cgit v0.10.2-6-g49f6