summary refs log tree commit diff
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2014-09-16 16:01:38 +0100
committerKegan Dougal <kegan@matrix.org>2014-09-16 16:10:48 +0100
commitd7b206cc9325e4cc7b460bf5bfc218ad2b304fc1 (patch)
tree77bef62de4cdb33a481c89ecfff6cf3e2fc4d280
parentWEB-27: We don't need to show the user-count in Recents in the room sidepanel... (diff)
downloadsynapse-d7b206cc9325e4cc7b460bf5bfc218ad2b304fc1.tar.xz
Added basic RegExp support.
Diffstat (limited to '')
-rw-r--r--webclient/components/matrix/event-handler-service.js6
-rw-r--r--webclient/settings/settings.html2
2 files changed, 3 insertions, 5 deletions
diff --git a/webclient/components/matrix/event-handler-service.js b/webclient/components/matrix/event-handler-service.js
index 72859eae3e..0c7c0d1696 100644
--- a/webclient/components/matrix/event-handler-service.js
+++ b/webclient/components/matrix/event-handler-service.js
@@ -74,10 +74,8 @@ function(matrixService, $rootScope, $q, $timeout, mPresence) {
         // bing word list check
         if (bingWords && !shouldBing) {
             for (var i=0; i<bingWords.length; i++) {
-                // TODO: Should really be a word check, not a string of characters check.
-                // E.g. bing word is "coffee", "I have coffee" = bing, "I am a coffeepot" = no bing
-                // Currently it will bing for both.
-                if (content.indexOf(bingWords[i]) != -1) {
+                var re = RegExp(bingWords[i]);
+                if (content.search(re) != -1) {
                     shouldBing = true;
                     break;
                 }
diff --git a/webclient/settings/settings.html b/webclient/settings/settings.html
index b251cce569..0a5a3db51f 100644
--- a/webclient/settings/settings.html
+++ b/webclient/settings/settings.html
@@ -55,7 +55,7 @@
                 <div class="section">
                     <h4>Additional words to alert on:</h4>
                     <p>Leave blank to alert on all messages.</p>
-                    <input size=40 name="bingWords" ng-model="settings.bingWords" ng-list placeholder="Enter case-sensitive words separated with ,"
+                    <input size=40 name="bingWords" ng-model="settings.bingWords" ng-list placeholder="Enter words separated with , (supports regex)"
                     ng-blur="saveBingWords()"/>
                     <ul>
                         <li ng-repeat="word in settings.bingWords">{{word}}</li>