summaryrefslogtreecommitdiff
path: root/sunshine
diff options
context:
space:
mode:
authorKrzysztof Klinikowski <kkszysiu@gmail.com>2010-06-22 20:40:11 +0200
committerKrzysztof Klinikowski <kkszysiu@gmail.com>2010-06-22 20:40:11 +0200
commit397c3d3c54d6e006d4206b330da9906f3a040836 (patch)
treee660eb74240573d2f49b15c4ebc06d87d0bbcd63 /sunshine
parent3998d09a3d3047ab9f154701c5fc86b7376207dd (diff)
Some changes. Now CM should be have more stability. Fixed some crashes.
Diffstat (limited to 'sunshine')
-rw-r--r--sunshine/connection.py17
-rwxr-xr-xsunshine/lqsoft/pygadu/models.py7
-rwxr-xr-xsunshine/lqsoft/pygadu/twisted_protocol.py1
3 files changed, 16 insertions, 9 deletions
diff --git a/sunshine/connection.py b/sunshine/connection.py
index 0f7d045..b0880e3 100644
--- a/sunshine/connection.py
+++ b/sunshine/connection.py
@@ -277,12 +277,16 @@ class SunshineConnection(telepathy.server.Connection,
if self.profile.exportLoop:
self.profile.exportLoop.stop()
self.profile.exportLoop = None
-
- logger.info("Disconnecting")
+
+ #if self._status == telepathy.CONNECTION_STATUS_DISCONNECTED:
+ # self.profile.disconnect()
+ # self.factory.disconnect()
+
self.StatusChanged(telepathy.CONNECTION_STATUS_DISCONNECTED,
telepathy.CONNECTION_STATUS_REASON_REQUESTED)
self.profile.disconnect()
- os._exit(1)
+
+ logger.info("Disconnecting")
def GetInterfaces(self):
return self._interfaces
@@ -420,8 +424,11 @@ class SunshineConnection(telepathy.server.Connection,
self.getServerAdress(uin)
def on_server_adress_fetched_failed(self, error, uin):
- logger.info("Failed to get page with server IP adress.")
- self.getServerAdress(uin)
+ logger.error("Failed to get page with server IP adress.")
+ self.StatusChanged(telepathy.CONNECTION_STATUS_DISCONNECTED,
+ telepathy.CONNECTION_STATUS_REASON_NETWORK_ERROR)
+ self._manager.disconnected(self)
+ #self.factory.disconnect()
def on_contactsImported(self):
logger.info("No contacts in the XML contacts file yet. Contacts imported.")
diff --git a/sunshine/lqsoft/pygadu/models.py b/sunshine/lqsoft/pygadu/models.py
index c571793..c3149b5 100755
--- a/sunshine/lqsoft/pygadu/models.py
+++ b/sunshine/lqsoft/pygadu/models.py
@@ -16,6 +16,7 @@ class GaduProfile(object):
self.__contacts = {}
self.__groups = {}
self.__connection = None
+ self.handler = None
self.contactsLoop = None
self.exportLoop = None
@@ -71,7 +72,8 @@ class GaduProfile(object):
return self.__connection is not None
def disconnect(self):
- self.__connection.loseConnection()
+ print 'Protocol disconnecting'
+ self.handler.transport.loseConnection()
def addContact(self, contact):
#if self.__contacts.has_key(contact.uin):
@@ -172,9 +174,6 @@ class GaduProfile(object):
self.__contacts = {}
self.__groups = {}
- def disconnect(self):
- self.__connection.transport.loseConnection()
-
# stuff that should be implemented by user
def onCreditialsNeeded(self, *args, **kwargs):
return (self.uin, self.__hashelem, self.__status)
diff --git a/sunshine/lqsoft/pygadu/twisted_protocol.py b/sunshine/lqsoft/pygadu/twisted_protocol.py
index f6e9aff..859e256 100755
--- a/sunshine/lqsoft/pygadu/twisted_protocol.py
+++ b/sunshine/lqsoft/pygadu/twisted_protocol.py
@@ -16,6 +16,7 @@ class GaduClient(Protocol):
def __init__(self, profile):
self.user_profile = profile # the user connected to this client
+ self.user_profile.handler = self
self.doLogin = Deferred()
self.doLogin.addCallbacks(profile._creditials, self._onInvalidCreditials)
self.doLogin.addCallbacks(self._doLogin, self._onLoginFailed)