core: minor refactoring

This commit is contained in:
Goffi 2011-05-24 00:48:29 +02:00
commit ded007be26

View file

@ -42,7 +42,7 @@ from logging import debug, info, error
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 @@ class SAT(service.Service):
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 @@ class SAT(service.Service):
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 @@ class SAT(service.Service):
"""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()