Add a forceImmediate flag to issueQuit, allowing the QUIT command to
jump the command queue.
A future update will prioritize QUIT when core is shutting down so
other messages won't block showing the user's quit message.
Don't prioritize QUIT normally in case the user sends some messages,
thinks they've all been delivered, then sends a QUIT.
(Eventually, Quassel should display queued messages differently from
messages that have been sent)
Closes GH-201.
-void CoreNetwork::disconnectFromIrc(bool requested, const QString &reason, bool withReconnect)
+void CoreNetwork::disconnectFromIrc(bool requested, const QString &reason, bool withReconnect,
+ bool forceImmediate)
{
_quitRequested = requested; // see socketDisconnected();
if (!withReconnect) {
{
_quitRequested = requested; // see socketDisconnected();
if (!withReconnect) {
socketDisconnected();
} else {
if (socket.state() == QAbstractSocket::ConnectedState) {
socketDisconnected();
} else {
if (socket.state() == QAbstractSocket::ConnectedState) {
- userInputHandler()->issueQuit(_quitReason);
+ userInputHandler()->issueQuit(_quitReason, forceImmediate);
} else {
socket.close();
}
} else {
socket.close();
}
void setPingInterval(int interval);
void connectToIrc(bool reconnecting = false);
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);
void userInput(BufferInfo bufferInfo, QString msg);
void userInput(BufferInfo bufferInfo, QString msg);
-void CoreUserInputHandler::issueQuit(const QString &reason)
+void CoreUserInputHandler::issueQuit(const QString &reason, bool forceImmediate)
- emit putCmd("QUIT", serverEncode(reason));
+ // If needing an immediate QUIT (e.g. core shutdown), prepend this to the queue
+ emit putCmd("QUIT", serverEncode(reason), QByteArray(), forceImmediate);
void defaultHandler(QString cmd, const BufferInfo &bufferInfo, const QString &text);
void defaultHandler(QString cmd, const BufferInfo &bufferInfo, const QString &text);
- void issueQuit(const QString &reason);
+ /**
+ * Send a QUIT to the IRC server, optionally skipping the command queue.
+ *
+ * @param reason Reason for quitting, often displayed to other IRC clients
+ * @param forceImmediate Immediately quit, skipping queue of other commands
+ */
+ void issueQuit(const QString &reason, bool forceImmediate = false);
void issueAway(const QString &msg, bool autoCheck = true);
protected:
void issueAway(const QString &msg, bool autoCheck = true);
protected: