X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcore%2Fcorenetwork.h;h=2bf57d6e6c38c7f6e68f06a8ea6e76406ea38fcf;hb=a9c005dc7e3ab74b00d3c161be3dee52584002bf;hp=669b667521d26a919382082e17161f4813c34e86;hpb=45a0d954542db252ceb62b61243ee5c2253383de;p=quassel.git diff --git a/src/core/corenetwork.h b/src/core/corenetwork.h index 669b6675..2bf57d6e 100644 --- a/src/core/corenetwork.h +++ b/src/core/corenetwork.h @@ -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. * @@ -156,7 +164,29 @@ public slots: void setPingInterval(int interval); void connectToIrc(bool reconnecting = false); - void disconnectFromIrc(bool requested = true, const QString &reason = QString(), bool withReconnect = false); + /** + * Disconnect from the IRC server. + * + * Begin disconnecting from the IRC server, including optionally reconnecting. + * + * @param requested If true, user requested this disconnect; don't try to reconnect + * @param reason Reason for quitting, defaulting to the user-configured quit reason + * @param withReconnect Reconnect to the network after disconnecting (e.g. ping timeout) + * @param forceImmediate Immediately disconnect from network, skipping queue of other commands + */ + 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); @@ -361,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;