Checking for single char line endings
authorSebastian Meyer <meyer@b1-systems.de>
Fri, 13 Jun 2014 12:52:55 +0000 (14:52 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Sun, 14 Sep 2014 19:56:36 +0000 (21:56 +0200)
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

src/core/corenetwork.cpp

index 18f2784..d57caca 100644 (file)
@@ -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());