Trim the last parameter except for PRIVMSG and NOTICE
authorManuel Nickschas <sputnick@quassel-irc.org>
Wed, 20 Feb 2013 19:31:54 +0000 (20:31 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Wed, 20 Feb 2013 19:36:20 +0000 (20:36 +0100)
Just to be sure that we won't encounter any more side-effects with
ircds sending random trailing whitespace, let's trim the last parameter
except for PRIVMSG and NOTICE.

src/core/ircparser.cpp

index f3db4fc..0d47398 100644 (file)
@@ -308,6 +308,11 @@ void IrcParser::processNetworkIncoming(NetworkDataEvent *e)
         for (int i = decParams.count(); i < params.count(); i++)
             decParams << net->serverDecode(params.at(i));
 
+        // We want to trim the last param just in case, except for PRIVMSG and NOTICE
+        // ... but those happen to be the only ones not using defaultHandling anyway
+        if (!decParams.isEmpty() && decParams.last().endsWith(' '))
+            decParams.append(decParams.takeLast().trimmed());
+
         IrcEvent *event;
         if (type == EventManager::IrcEventNumeric)
             event = new IrcEventNumeric(num, net, prefix, target);