Mercurial > libervia-backend
changeset 5:c0c92129a54b
connect and disconnect management
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 19 Oct 2009 23:49:31 +0200 |
parents | 3c1cefd41186 |
children | 5799493fa548 |
files | sat.tac |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/sat.tac Mon Oct 19 22:53:21 2009 +0200 +++ b/sat.tac Mon Oct 19 23:49:31 2009 +0200 @@ -81,7 +81,7 @@ self.bridge.register("getProgress", self.getProgress) self._import_plugins() - self.connect() + #self.connect() def _import_plugins(self): @@ -99,13 +99,16 @@ def connect(self): print "connecting..." + reactor.connectTCP(self.memory.getParamV("Server", "Connection"), 5222, self.factory) + self.connectionStatus="online" #TODO: check if connection is OK + self.connected=True #TODO: use startedConnecting and clientConnectionLost of XMPPClientFactory def getService(self): print "GetService !" """if (self.connected): info("already connected !") return""" - info("Getting client...") + info("Getting service...") self.me = jid.JID(self.memory.getParamV("JabberID", "Connection")) self.factory = client.XMPPClientFactory(self.me, self.memory.getParamV("Password", "Connection")) self.factory.addBootstrap(xmlstream.STREAM_AUTHD_EVENT,self.authd) @@ -119,6 +122,11 @@ info("not connected !") return info("Disconnecting...") + self.factory.stopTrying() + if self.xmlstream: + self.xmlstream.sendFooter() + self.connectionStatus="offline" #TODO: check if connection is OK + self.connected=False #TODO: use startedConnecting and clientConnectionLost of XMPPClientFactory def run(self): debug("running app")