+
+ if (coreNetwork(e)->useCapMultiPrefix()) {
+ // If multi-prefix is enabled, all modes will be sent in WHO replies.
+ // :kenny.chatspike.net 352 guest #test grawity broken.symlink *.chatspike.net grawity H@%+ :0 Mantas M.
+ // See: http://ircv3.net/specs/extensions/multi-prefix-3.1.html
+ QString uncheckedModes = e->params()[5];
+ QString validModes = QString();
+ while (!uncheckedModes.isEmpty()) {
+ // Mode found in 1 left-most character, add it to the list
+ if (e->network()->prefixes().contains(uncheckedModes[0])) {
+ validModes.append(e->network()->prefixToMode(uncheckedModes[0]));
+ }
+ // Remove this mode from the list of unchecked modes
+ uncheckedModes = uncheckedModes.remove(0, 1);
+ }
+
+ // 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);
+ }