X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fircserverhandler.cpp;h=14b35075da17ce86ed9a6b1095f4d1f8ec41ab63;hp=7614d6ef554b7decb22e224435624372668ed934;hb=6f69d56e0725945e38f9bcfb30573417bbc01b62;hpb=26943d14192c5cf546613b8909809c95f304a57b diff --git a/src/core/ircserverhandler.cpp b/src/core/ircserverhandler.cpp index 7614d6ef..14b35075 100644 --- a/src/core/ircserverhandler.cpp +++ b/src/core/ircserverhandler.cpp @@ -57,11 +57,23 @@ void IrcServerHandler::handleServerMsg(QByteArray msg) { // NOTE: This assumes that this is true in raw encoding, but well, hopefully there are no servers running in japanese on protocol level... int idx = msg.indexOf(" :"); if(idx >= 0) { - if(msg.length() > idx + 2) trailing = msg.mid(idx + 2); + if(msg.length() > idx + 2) + trailing = msg.mid(idx + 2); msg = msg.left(idx); } // OK, now it is safe to split... QList params = msg.split(' '); + + // This could still contain empty elements due to (faulty?) ircds sending multiple spaces in a row + // Also, QByteArray is not nearly as convenient to work with as QString for such things :) + QList::iterator iter = params.begin(); + while(iter != params.end()) { + if(iter->isEmpty()) + iter = params.erase(iter); + else + ++iter; + } + if(!trailing.isEmpty()) params << trailing; if(params.count() < 1) { qWarning() << "Received invalid string from server!";