Handle IRCv3 servers without any capabilities
[quassel.git] / src / core / corenetwork.h
index d596c53..2bf57d6 100644 (file)
@@ -130,6 +130,14 @@ public:
      */
     void beginCapNegotiation();
 
+    /**
+     * Ends capability negotiation.
+     *
+     * This won't have effect if other CAP commands are in the command queue before calling this
+     * command.  It should only be called when capability negotiation is complete.
+     */
+    void endCapNegotiation();
+
     /**
      * List of capabilities requiring further core<->server messages to configure.
      *
@@ -169,6 +177,17 @@ public slots:
     void disconnectFromIrc(bool requested = true, const QString &reason = QString(),
                            bool withReconnect = false, bool forceImmediate = false);
 
+    /**
+     * Forcibly close the IRC server socket, waiting for it to close.
+     *
+     * Call CoreNetwork::disconnectFromIrc() first, allow the event loop to run, then if you need to
+     * be sure the network's disconencted (e.g. clean-up), call this.
+     *
+     * @param msecs  Maximum time to wait for socket to close, in milliseconds.
+     * @return True if socket closes successfully; false if error occurs or timeout reached
+     */
+    bool forceDisconnect(int msecs = 1000);
+
     void userInput(BufferInfo bufferInfo, QString msg);
 
     /**
@@ -372,6 +391,10 @@ private:
     bool _quitRequested;
     QString _quitReason;
 
+    bool _disconnectExpected;  /// If true, connection is quitting, expect a socket close
+    // This avoids logging a spurious RemoteHostClosedError whenever disconnect is called without
+    // specifying a permanent (saved to core session) disconnect.
+
     bool _previousConnectionAttemptFailed;
     int _lastUsedServerIndex;