Send message "quit" when disconnecting from WeeChat (before closing socket)

This commit is contained in:
Sebastien Helleu 2012-07-14 22:38:09 +02:00
parent d1b4884dfd
commit eafb7aebb2

View File

@ -114,7 +114,10 @@ class Network(QtCore.QObject):
def disconnect_weechat(self): def disconnect_weechat(self):
if self._socket.state() != QtNetwork.QAbstractSocket.UnconnectedState: 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.statusChanged.emit(self.status_disconnected, None)
self._socket.abort() self._socket.abort()