From eafb7aebb29adcd299a3800cc8b4c117edd20f1c Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sat, 14 Jul 2012 22:38:09 +0200 Subject: [PATCH] Send message "quit" when disconnecting from WeeChat (before closing socket) --- src/qweechat/network.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/qweechat/network.py b/src/qweechat/network.py index e9f25bc..636afcf 100644 --- a/src/qweechat/network.py +++ b/src/qweechat/network.py @@ -114,7 +114,10 @@ class Network(QtCore.QObject): def disconnect_weechat(self): if self._socket.state() != QtNetwork.QAbstractSocket.UnconnectedState: - if self._socket.state() != QtNetwork.QAbstractSocket.ConnectedState: + if self._socket.state() == QtNetwork.QAbstractSocket.ConnectedState: + self._socket.write('quit\n') + self._socket.waitForBytesWritten(1000) + else: self.statusChanged.emit(self.status_disconnected, None) self._socket.abort()