Limit user mode updates from WHO to given channel
authorShane Synan <digitalcircuit36939@gmail.com>
Mon, 29 Feb 2016 04:26:17 +0000 (22:26 -0600)
committerShane Synan <digitalcircuit36939@gmail.com>
Mon, 29 Feb 2016 04:30:50 +0000 (22:30 -0600)
Limit user mode updates in WHO replies to the given channel, unless
a '*' is specified indicating any channel.  IrcUsers are shared
between channels, while channel user modes are not.

Showing user modes in the Quassel tooltips need fixed client-side in
IrcUserItem::toolTip(), checking the current channel.

src/core/coresessioneventprocessor.cpp

index 0468d97..82da781 100644 (file)
@@ -942,8 +942,22 @@ void CoreSessionEventProcessor::processIrcEvent352(IrcEvent *e)
             // Some IRC servers decide to not follow the spec, returning only -some- of the user
             // modes in WHO despite listing them all in NAMES.  For now, assume it can only add
             // and not take away.  *sigh*
             // Some IRC servers decide to not follow the spec, returning only -some- of the user
             // modes in WHO despite listing them all in NAMES.  For now, assume it can only add
             // and not take away.  *sigh*
-            if (!validModes.isEmpty())
-                ircuser->addUserModes(validModes);
+            if (!validModes.isEmpty()) {
+                if (channel != "*") {
+                    // Channel-specific modes received, apply to given channel only
+                    IrcChannel *ircChan = e->network()->ircChannel(channel);
+                    if (ircChan) {
+                        // Do one mode at a time
+                        // TODO Better way of syncing this without breaking protocol?
+                        for (int i = 0; i < validModes.count(); ++i) {
+                            ircChan->addUserMode(ircuser, validModes.at(i));
+                        }
+                    }
+                } else {
+                    // Modes apply to the user everywhere
+                    ircuser->addUserModes(validModes);
+                }
+            }
         }
     }
 
         }
     }