diff src/core/sat_main.py @ 332:8c9b9ef13ba1

core: minor refactoring
author Goffi <goffi@goffi.org>
date Tue, 24 May 2011 00:48:29 +0200
parents 0a8eb0461f31
children 953536246d9d
line wrap: on
line diff
--- a/src/core/sat_main.py	Mon May 23 21:32:28 2011 +0200
+++ b/src/core/sat_main.py	Tue May 24 00:48:29 2011 +0200
@@ -42,7 +42,7 @@
 import sys
 import os.path
 
-from sat.core.xmpp import SatXMPPClient, SatMessageProtocol, SatRosterProtocol, SatPresenceProtocol, SatDiscoProtocol, SatFallbackHandler, RegisteringAuthenticator, SatVersionHandler
+from sat.core import xmpp
 from sat.tools.memory import Memory
 from sat.tools.xml_tools import tupleList2dataForm
 from sat.tools.misc import TriggerManager
@@ -97,7 +97,7 @@
         self.__progress_cb_map = {}  #callback called when a progress is requested (key = progress id)
         self.__general_cb_map = {}  #callback called for general reasons (key = name) 
         self.__private_data = {}  #used for internal callbacks (key = id)
-        self.trigger = TriggerManager() #trigger are user to change SàT behaviour 
+        self.trigger = TriggerManager() #trigger are used to change SàT behaviour 
         self.profiles = {}
         self.plugins = {}
         self.menus = {} #used to know which new menus are wanted by plugins
@@ -192,24 +192,24 @@
         if (self.isConnected(profile)):
             info(_("already connected !"))
             return
-        current = self.profiles[profile] = SatXMPPClient(self, profile,
+        current = self.profiles[profile] = xmpp.SatXMPPClient(self, profile,
             jid.JID(self.memory.getParamA("JabberID", "Connection", profile_key = profile), profile),
             self.memory.getParamA("Password", "Connection", profile_key = profile),
             self.memory.getParamA("Server", "Connection", profile_key = profile), 5222)
 
-        current.messageProt = SatMessageProtocol(self)
+        current.messageProt = xmpp.SatMessageProtocol(self)
         current.messageProt.setHandlerParent(current)
         
-        current.roster = SatRosterProtocol(self)
+        current.roster = xmpp.SatRosterProtocol(self)
         current.roster.setHandlerParent(current)
 
-        current.presence = SatPresenceProtocol(self)
+        current.presence = xmpp.SatPresenceProtocol(self)
         current.presence.setHandlerParent(current)
 
-        current.fallBack = SatFallbackHandler(self)
+        current.fallBack = xmpp.SatFallbackHandler(self)
         current.fallBack.setHandlerParent(current)
 
-        current.versionHandler = SatVersionHandler(self.get_const('client_name'),
+        current.versionHandler = xmpp.SatVersionHandler(self.get_const('client_name'),
                                                      self.get_const('client_version'))
         current.versionHandler.setHandlerParent(current)
 
@@ -269,7 +269,7 @@
         """Connect to a server and create a new account using in-band registration"""
 
         next_id = id or sat_next_id()  #the id is used to send server's answer
-        serverRegistrer = xmlstream.XmlStreamFactory(RegisteringAuthenticator(self, server, login, password, next_id))
+        serverRegistrer = xmlstream.XmlStreamFactory(xmpp.RegisteringAuthenticator(self, server, login, password, next_id))
         connector = reactor.connectTCP(server, port, serverRegistrer)
         serverRegistrer.clientConnectionLost = lambda conn, reason: connector.disconnect()