diff sat.tac @ 52:6455fb62ff83

Connection/disconnection signals - wix, sortilege: management of this new signals /!\ sortilege is bugged, the contact list window is not updated correctly
author Goffi <goffi@goffi.org>
date Thu, 07 Jan 2010 01:55:30 +1100
parents daa1f01a5332
children a5b5fb5fc9fd
line wrap: on
line diff
--- a/sat.tac	Thu Jan 07 00:17:27 2010 +1100
+++ b/sat.tac	Thu Jan 07 01:55:30 2010 +1100
@@ -70,10 +70,11 @@
 
 class SatXMPPClient(client.XMPPClient):
     
-    def __init__(self, user_jid, password, host=None, port=5222):
+    def __init__(self, bridge, user_jid, password, host=None, port=5222):
         client.XMPPClient.__init__(self, user_jid, password, host, port)
         self.factory.clientConnectionLost = self.connectionLost
         self.__connected=False
+        self.bridge = bridge
 
     def _authd(self, xmlstream):
         print "SatXMPPClient"
@@ -81,6 +82,7 @@
         self.__connected=True
         print "********** CONNECTED **********"
         self.streamInitialized()
+        self.bridge.connected() #we send the signal to the clients
 
     def streamInitialized(self):
         """Called after _authd"""
@@ -97,6 +99,7 @@
             self.keep_alife.stop()
         except AttributeError:
             debug("No keep_alife")
+        self.bridge.disconnected() #we send the signal to the clients
 
 
 class SatMessageProtocol(xmppim.MessageProtocol):
@@ -356,7 +359,7 @@
             return
         print "connecting..."
         self.me = jid.JID(self.memory.getParamA("JabberID", "Connection"))
-        self.xmppclient = SatXMPPClient(self.me, self.memory.getParamA("Password", "Connection"),
+        self.xmppclient = SatXMPPClient(self.bridge, self.me, self.memory.getParamA("Password", "Connection"),
             self.memory.getParamA("Server", "Connection"), 5222)
         self.xmppclient.streamInitialized = self.streamInitialized