Bug 466184 - Exclude channel users who already have, or already don't have, the respective mode when doing /op *, /voice *, etc. SEAMONKEY_2_1a1_BUILD1 SEAMONKEY_2_1a1_RELEASE SEAMONKEY_2_1a2_BUILD1 SEAMONKEY_2_1a2_BUILD2 SEAMONKEY_2_1a2_RELEASE
authorJames Ross <silver@warwickcompsoc.co.uk>
Fri, 19 Mar 2010 19:23:17 +0000
changeset 1279 b774ffc606f01692f101d5d33dd2f6bba9656dc4
parent 1278 b321c9d29cf0e71c8a8e795f89d0a3f9c8880f86
child 1282 496a3398c698764e46a4e008eda09b35c6860632
child 1284 72ef84f24df72fe36a00df31182cb30d1bab82d2
child 1290 6a02dfb32fe5c788ed2f36cfe5373be43e988cc0
push id38
push usersilver@warwickcompsoc.co.uk
push dateFri, 19 Mar 2010 19:24:47 +0000
bugs466184
Bug 466184 - Exclude channel users who already have, or already don't have, the respective mode when doing /op *, /voice *, etc. r=gijs
xul/content/commands.js
--- a/xul/content/commands.js
+++ b/xul/content/commands.js
@@ -1045,21 +1045,29 @@ function cmdChanUserMode(e)
     // then a normal list, then finally a singular item (canon. or otherwise).
     if (e.canonNickList)
     {
         nicks = combineNicks(e.canonNickList);
     }
     else if (e.nickname && (e.nickname == "*"))
     {
         var me = e.server.me;
-        for (user in e.channel.users)
+        var mode = modestr.substr(1, 1);
+        var adding = modestr[0] == "+";
+        for (userKey in e.channel.users)
         {
-            var user2 = e.channel.users[user];
-            if (user2.encodedName != me.encodedName)
-                nickList.push(user2.encodedName);
+            var user = e.channel.users[userKey];
+            /* Never change our own mode and avoid trying to change someone
+             * else in a no-op manner (e.g. voicing an already voiced user).
+             */
+            if ((user.encodedName != me.encodedName) &&
+                (arrayContains(user.modes, mode) ^ adding))
+            {
+                nickList.push(user.encodedName);
+            }
         }
         nicks = combineNicks(nickList);
     }
     else if (e.nicknameList)
     {
         for (var i = 0; i < e.nicknameList.length; i++)
         {
             user = e.channel.getUser(e.nicknameList[i]);