summaryrefslogtreecommitdiff
path: root/sunshine
diff options
context:
space:
mode:
authorKrzysztof Klinikowski <kkszysiu@gmail.com>2010-03-08 17:38:54 +0100
committerKrzysztof Klinikowski <kkszysiu@gmail.com>2010-03-08 17:38:54 +0100
commite0472f44211280287c6cf6bba7c0e204547cb1ae (patch)
tree0fa40b64c8cf26995fe012c65f420a960a6386bb /sunshine
parent0a9ac9759ff74fd60deca80dbb75385743b850fc (diff)
Now we have cleanly closing connection.
Diffstat (limited to 'sunshine')
-rw-r--r--sunshine/connection.py7
-rwxr-xr-xsunshine/lqsoft/pygadu/models.py3
-rwxr-xr-xsunshine/lqsoft/pygadu/twisted_protocol.py2
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:]