Checking for single char line endings
[quassel.git] / src / core / corenetwork.cpp
index b7d496a..80986f0 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());