Bug 1521761 - Hide annoying freenode messages about vulnerability scanning. r=florian
authorPatrick Cloke <clokep@gmail.com>
Wed, 23 Jan 2019 11:26:51 -0500
changeset 33423 a33001c055c0
parent 33422 2c5f5704fa2f
child 33424 043b81dfc262
push id2368
push userclokep@gmail.com
push dateMon, 28 Jan 2019 21:12:50 +0000
treeherdercomm-beta@56d23c07d815 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersflorian
bugs1521761
Bug 1521761 - Hide annoying freenode messages about vulnerability scanning. r=florian
chat/protocols/irc/ircServices.jsm
--- a/chat/protocols/irc/ircServices.jsm
+++ b/chat/protocols/irc/ircServices.jsm
@@ -31,17 +31,18 @@ function ServiceMessage(aAccount, aMessa
   // This should be a property of the account or configurable somehow, it maps
   // from server specific service names to our generic service names (e.g. if
   // irc.foo.net has a service called bar, which acts as a NickServ, we would
   // map "bar": "NickServ"). Note that the keys of this map should be
   // normalized.
   let nicknameToServiceName = {
     "chanserv": "ChanServ",
     "infoserv": "InfoServ",
-    "nickserv": "NickServ"
+    "nickserv": "NickServ",
+    "freenode-connect": "freenode-connect"
   };
 
   let nickname = aAccount.normalize(aMessage.origin);
   if (nicknameToServiceName.hasOwnProperty(nickname))
     aMessage.serviceName = nicknameToServiceName[nickname];
 
   return aMessage;
 }
@@ -224,11 +225,28 @@ var servicesBase = {
           (text == "You are already identified." || // Anope.
            text.slice(0, 30) == "You are already logged in as \x02")) { // Atheme.
         // Do not show the message if caused by the automatic reauthentication.
         this.isAuthenticated = true;
         return true;
       }
 
       return false;
+    },
+
+    /*
+     * freenode sends some annoying messages on start-up from a freenode-connect
+     * bot. Only show these if the user wants to see server messages. See bug
+     * 1521761.
+     */
+    "freenode-connect": function(aMessage) {
+      // If the user would like to see server messages, fall through to the
+      // standard handler.
+      if (this._showServerTab)
+        return false;
+
+      // Only ignore the message notifying of scanning (and include additional
+      // checking of the hostname).
+      return (aMessage.host.startsWith("freenode/utility-bot/") &&
+              aMessage.params[1].includes("connections will be scanned for vulnerabilities"));
     }
   }
 };