# HG changeset patch # User Goffi # Date 1391536446 -3600 # Node ID 1a1600491d9d43e7c9aceccf013273970b1313ac # Parent 084b52afdcebf760d028381d5ee57f0f4424910c core: registerNewAccount partial fix diff -r 084b52afdceb -r 1a1600491d9d src/core/sat_main.py --- a/src/core/sat_main.py Tue Feb 04 18:51:16 2014 +0100 +++ b/src/core/sat_main.py Tue Feb 04 18:54:06 2014 +0100 @@ -378,12 +378,12 @@ return None return self.profiles[profile].getHostJid() - def registerNewAccount(self, login, password, email, server, port=5222, id=None, profile_key='@NONE@'): + def registerNewAccount(self, login, password, email, server, port=5222, id_=None, profile_key='@NONE@'): """Connect to a server and create a new account using in-band registration""" profile = self.memory.getProfileName(profile_key) assert(profile) - next_id = id or sat_next_id() # the id is used to send server's answer + next_id = id_ or self.get_next_id() # the id is used to send server's answer serverRegistrer = xmlstream.XmlStreamFactory(xmpp.RegisteringAuthenticator(self, server, login, password, email, next_id, profile)) connector = reactor.connectTCP(server, port, serverRegistrer) serverRegistrer.clientConnectionLost = lambda conn, reason: connector.disconnect() @@ -397,11 +397,9 @@ server = self.memory.getParamA("Server", "Connection", profile_key=profile) if not user or not password or not server: - info(_('No user or server given')) - #TODO: a proper error message must be sent to frontend - self.actionResult(id, "ERROR", {'message': _("No user, password or server given, can't register new account.")}, profile) - return + raise exceptions.DataError(_("No user, password or server given, can't register new account.")) + # FIXME: to be fixed with XMLUI dialogs once their implemented confirm_id = sat_next_id() self.__private_data[confirm_id] = (id, profile) diff -r 084b52afdceb -r 1a1600491d9d src/memory/memory.py --- a/src/memory/memory.py Tue Feb 04 18:51:16 2014 +0100 +++ b/src/memory/memory.py Tue Feb 04 18:54:06 2014 +0100 @@ -213,7 +213,7 @@ self.default_profile = None self.params = {} self.params_gen = {} - host.registerCallback(host.registerNewAccountCB, force_id="registerNewAccount") + host.registerCallback(host.registerNewAccountCB, with_data=True, force_id="registerNewAccount") def createProfile(self, profile): """Create a new profile