From: Sebastian Meyer Date: Fri, 13 Jun 2014 12:52:55 +0000 (+0200) Subject: Checking for single char line endings X-Git-Tag: 0.11.0~33 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=b2eee7d31624cc32a20f01d5b8a612c675f79564;hp=951cd716c8c84f4ad340c9fbd57f0d9d4aa3f951 Checking for single char line endings This fixes problems with IRC servers sending only single char line endings. Before the last char on each line for thos servers would be chopped, now Quassel checks how the line ends and chops accordingly. Fixes #1267 --- diff --git a/src/core/corenetwork.cpp b/src/core/corenetwork.cpp index b7d496af..80986f06 100644 --- a/src/core/corenetwork.cpp +++ b/src/core/corenetwork.cpp @@ -411,7 +411,10 @@ void CoreNetwork::socketHasData() { while (socket.canReadLine()) { QByteArray s = socket.readLine(); - s.chop(2); + if (s.endsWith("\r\n")) + s.chop(2); + else if (s.endsWith("\n")) + s.chop(1); NetworkDataEvent *event = new NetworkDataEvent(EventManager::NetworkIncoming, this, s); #if QT_VERSION >= 0x040700 event->setTimestamp(QDateTime::currentDateTimeUtc());