diff sat.tac @ 135:7452ac3818e7

Core, wix: added profile management for RegisterNewAccount method, and LaunchAction
author Goffi <goffi@goffi.org>
date Fri, 16 Jul 2010 20:16:13 +0800
parents ded2431cea5a
children 61f1e509e684
line wrap: on
line diff
--- a/sat.tac	Fri Jul 16 20:15:14 2010 +0800
+++ b/sat.tac	Fri Jul 16 20:16:13 2010 +0800
@@ -243,7 +243,6 @@
         generic.FallbackHandler.__init__(self)
 
     def iqFallback(self, iq):
-        #pdb.set_trace()
         print "iqFallback: xml = [%s], handled=%s" % (iq.toXml(), "True" if iq.handled else "False")
         generic.FallbackHandler.iqFallback(self, iq)
 
@@ -478,10 +477,9 @@
         return next_id 
 
     def registerNewAccountCB(self, id, data, profile):
-        #FIXME: gof: profile not managed here !
-        user = jid.parse(self.memory.getParamA("JabberID", "Connection"))[0]
-        password = self.memory.getParamA("Password", "Connection")
-        server = self.memory.getParamA("Server", "Connection")
+        user = jid.parse(self.memory.getParamA("JabberID", "Connection", profile_key=profile))[0]
+        password = self.memory.getParamA("Password", "Connection", profile_key=profile)
+        server = self.memory.getParamA("Server", "Connection", profile_key=profile)
 
         if not user or not password or not server:
             info (_('No user or server given'))
@@ -490,24 +488,23 @@
             return
 
         confirm_id = sat_next_id()
-        self.__private_data[confirm_id]=id
+        self.__private_data[confirm_id]=(id,profile)
     
         self.askConfirmation(confirm_id, "YES/NO",
-            {"message":_("Are you sure to register new account [%(user)s] to server %(server)s ?") % {'user':user, 'server':server}},
+            {"message":_("Are you sure to register new account [%(user)s] to server %(server)s ?") % {'user':user, 'server':server, 'profile':profile}},
             self.regisConfirmCB)
         print ("===============+++++++++++ REGISTER NEW ACCOUNT++++++++++++++============")
         print "id=",id
         print "data=",data
 
     def regisConfirmCB(self, id, accepted, data):
-        #FIXME: gof: profile not managed here !
         print _("register Confirmation CB ! (%s)") % str(accepted)
-        action_id = self.__private_data[id]
+        action_id,profile = self.__private_data[id]
         del self.__private_data[id]
-        user = jid.parse(self.memory.getParamA("JabberID", "Connection"))[0]
-        password = self.memory.getParamA("Password", "Connection")
-        server = self.memory.getParamA("Server", "Connection")
         if accepted:
+            user = jid.parse(self.memory.getParamA("JabberID", "Connection", profile_key=profile))[0]
+            password = self.memory.getParamA("Password", "Connection", profile_key=profile)
+            server = self.memory.getParamA("Server", "Connection", profile_key=profile)
             self.registerNewAccount(user, password, server, id=action_id)
         else:
             self.actionResult(action_id, "SUPPRESS", {})
@@ -645,7 +642,7 @@
         to_jid=jid.JID(to)
         self.profiles[profile].roster.removeItem(to_jid)
         self.profiles[profile].presence.unsubscribe(to_jid)
-        self.host.bridge.contactDeleted(to, profile)
+        self.bridge.contactDeleted(to, profile)
 
 
     ## callbacks ##