summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2011-01-19 19:40:50 (GMT)
committerKevin Smith <git@kismith.co.uk>2011-01-19 20:08:06 (GMT)
commitb4fd267e414786efb11ca5492b7de308934d316c (patch)
tree0a13b9fdd9239a6054de58c56b0c809491129d07 /Swift/Controllers/Chat/MUCController.cpp
parent0d3d7579032959203c5c52f5ced9de5494c7b0bf (diff)
downloadswift-b4fd267e414786efb11ca5492b7de308934d316c.zip
swift-b4fd267e414786efb11ca5492b7de308934d316c.tar.bz2
Only highlight in MUCs on complete-word nicknames.
Resolves: #738
Diffstat (limited to 'Swift/Controllers/Chat/MUCController.cpp')
-rw-r--r--Swift/Controllers/Chat/MUCController.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp
index 975a2d2..a447f60 100644
--- a/Swift/Controllers/Chat/MUCController.cpp
+++ b/Swift/Controllers/Chat/MUCController.cpp
@@ -7,6 +7,7 @@
#include "Swift/Controllers/Chat/MUCController.h"
#include <boost/bind.hpp>
+#include <boost/regex.hpp>
#include "Swiften/Network/Timer.h"
#include "Swiften/Network/TimerFactory.h"
@@ -226,7 +227,9 @@ JID MUCController::nickToJID(const String& nick) {
}
bool MUCController::messageTargetsMe(boost::shared_ptr<Message> message) {
- return message->getBody().getLowerCase().contains(nick_.getLowerCase());
+ String stringRegexp(".*\\b" + nick_.getLowerCase() + "\\b.*");
+ boost::regex myRegexp(stringRegexp.getUTF8String());
+ return boost::regex_match(message->getBody().getLowerCase().getUTF8String(), myRegexp);
}
void MUCController::preHandleIncomingMessage(boost::shared_ptr<MessageEvent> messageEvent) {