summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2012-04-25 18:47:25 (GMT)
committerRemko Tronçon <git@el-tramo.be>2012-04-25 18:47:25 (GMT)
commit67c0420a2798ddb2c64fec01c1d37f038ad39262 (patch)
tree4e004c3790cfc0a6c2975a0bb5598d4327e31031
parent508a5e258d5de152b5b58ceca67a0135383f4fe0 (diff)
downloadswift-contrib-67c0420a2798ddb2c64fec01c1d37f038ad39262.zip
swift-contrib-67c0420a2798ddb2c64fec01c1d37f038ad39262.tar.bz2
Convert /me in notification bubbles.
Resolves: #757
-rw-r--r--Swift/Controllers/EventNotifier.cpp8
1 files changed, 7 insertions, 1 deletions
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)) {