Bug 955278 - Message notifications do not take /me into account, r=aleth.
authorNihanth Subramanya <nhnt11@gmail.com>
Wed, 22 May 2013 09:50:36 +0530
changeset 22641 b08788b5beef74215d190ae589cf6759d6d45b37
parent 22640 b56427984c3df88cac3c102e37b5dbc66b98143d
child 22642 e458f2e5115bf0c09eb41463488b66da1067fbd3
push id1225
push userflorian@queze.net
push dateSat, 11 Jan 2014 23:24:55 +0000
treeherdertry-comm-central@1d7aa08cb2d7 [default view] [failures only]
reviewersaleth
bugs955278
Bug 955278 - Message notifications do not take /me into account, r=aleth.
im/modules/ibNotifications.jsm
--- a/im/modules/ibNotifications.jsm
+++ b/im/modules/ibNotifications.jsm
@@ -54,21 +54,25 @@ var Notifications = {
     // notification is clicked.
     let observer = {
       observe: function(aSubject, aTopic, aData) {
         if (aTopic == "alertclickcallback")
           Conversations.focusConversation(aMessage.conversation);
       }
     };
 
+    // Handle third person messages
+    let name = aMessage.alias || aMessage.who;
+    if (messageText.startsWith("/me "))
+      messageText = messageText.replace(/^\/me/, name);
+
     // Finally show the notification!
     Components.classes["@mozilla.org/alerts-service;1"]
               .getService(Components.interfaces.nsIAlertsService)
-              .showAlertNotification(icon, aMessage.alias || aMessage.who,
-                                     messageText, true, "", observer);
+              .showAlertNotification(icon, name, messageText, true, "", observer);
   },
 
   init: function() {
     Services.obs.addObserver(Notifications, "new-text", false);
   },
 
   _notificationPrefName: "messenger.options.notifyOfNewMessages",
   observe: function(aSubject, aTopic, aData) {