diff options
author | Krzysztof Klinikowski <kkszysiu@gmail.com> | 2010-03-08 17:38:54 +0100 |
---|---|---|
committer | Krzysztof Klinikowski <kkszysiu@gmail.com> | 2010-03-08 17:38:54 +0100 |
commit | e0472f44211280287c6cf6bba7c0e204547cb1ae (patch) | |
tree | 0fa40b64c8cf26995fe012c65f420a960a6386bb | |
parent | 0a9ac9759ff74fd60deca80dbb75385743b850fc (diff) |
Now we have cleanly closing connection.
-rw-r--r-- | sunshine/connection.py | 7 | ||||
-rwxr-xr-x | sunshine/lqsoft/pygadu/models.py | 3 | ||||
-rwxr-xr-x | sunshine/lqsoft/pygadu/twisted_protocol.py | 2 |
3 files changed, 8 insertions, 4 deletions
diff --git a/sunshine/connection.py b/sunshine/connection.py index 26cb283..9cf81aa 100644 --- a/sunshine/connection.py +++ b/sunshine/connection.py @@ -333,11 +333,12 @@ class SunshineConnection(telepathy.server.Connection, self.profile.exportLoop = None logger.info("Disconnecting") - self.profile.setMyState('NOT_AVAILABLE', self._personal_message) + #self.profile.setMyState('NOT_AVAILABLE', self._personal_message) self.StatusChanged(telepathy.CONNECTION_STATUS_DISCONNECTED, telepathy.CONNECTION_STATUS_REASON_REQUESTED) - if reactor.running: - reactor.stop() + self.profile.disconnect() + #if reactor.running: + # reactor.stop() def RequestHandles(self, handle_type, names, sender): logger.info("Method RequestHandles called, handle type: %s, names: %s" % (str(handle_type), str(names))) diff --git a/sunshine/lqsoft/pygadu/models.py b/sunshine/lqsoft/pygadu/models.py index 5b34b52..0245728 100755 --- a/sunshine/lqsoft/pygadu/models.py +++ b/sunshine/lqsoft/pygadu/models.py @@ -70,6 +70,9 @@ class GaduProfile(object): """Is the profile currently used in an active connection""" return self.__connection is not None + def disconnect(self): + self.__connection.loseConnection() + def addContact(self, contact): if self.__contacts.has_key(contact.uin): raise ValueError("Contact with UIN %d already exists." % contact.uin) diff --git a/sunshine/lqsoft/pygadu/twisted_protocol.py b/sunshine/lqsoft/pygadu/twisted_protocol.py index 22fb02b..7e38503 100755 --- a/sunshine/lqsoft/pygadu/twisted_protocol.py +++ b/sunshine/lqsoft/pygadu/twisted_protocol.py @@ -40,7 +40,7 @@ class GaduClient(Protocol): self.__pingThread.stop() self.__pingThread = None - Protocol.connectionLost(self, reason) + Protocol.connectionLost(self, reason) def __pop_data(self, n): data, self.__buffer = self.__buffer[:n], self.__buffer[n:] |