Handle IRCv3 servers without any capabilities
[quassel.git] / src / core / corenetwork.cpp
index 34bb426..e3963c4 100644 (file)
@@ -1006,8 +1006,13 @@ QString CoreNetwork::takeQueuedCap()
 void CoreNetwork::beginCapNegotiation()
 {
     // Don't begin negotiation if no capabilities are queued to request
-    if (!capNegotiationInProgress())
+    if (!capNegotiationInProgress()) {
+        // If the server doesn't have any capabilities, but supports CAP LS, continue on with the
+        // normal connection.
+        displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("No capabilities available"));
+        endCapNegotiation();
         return;
+    }
 
     _capNegotiationActive = true;
     displayMsg(Message::Server, BufferInfo::StatusBuffer, "",
@@ -1036,11 +1041,16 @@ void CoreNetwork::sendNextCap()
             _capNegotiationActive = false;
         }
 
-        // If nick registration is already complete, CAP END is not required
-        if (!_capInitialNegotiationEnded) {
-            putRawLine(serverEncode(QString("CAP END")));
-            _capInitialNegotiationEnded = true;
-        }
+        endCapNegotiation();
+    }
+}
+
+void CoreNetwork::endCapNegotiation()
+{
+    // If nick registration is already complete, CAP END is not required
+    if (!_capInitialNegotiationEnded) {
+        putRawLine(serverEncode(QString("CAP END")));
+        _capInitialNegotiationEnded = true;
     }
 }