diff src/core/sat_main.py @ 813:1a1600491d9d

core: registerNewAccount partial fix
author Goffi <goffi@goffi.org>
date Tue, 04 Feb 2014 18:54:06 +0100
parents 1fe00f0c9a91
children 2d901b7fa861
line wrap: on
line diff
--- 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)