Core, wix: added profile management for RegisterNewAccount method, and LaunchAction

This commit is contained in:
Goffi 2010-07-16 20:16:13 +08:00
commit 10c45f4b1d
4 changed files with 19 additions and 20 deletions

View file

@ -74,6 +74,7 @@ class Param(wx.Frame):
sizer.Add(label)
elif type=="button":
ctrl = wx.Button(panel, -1, value)
ctrl.callback_id = param.getAttribute("callback_id")
else:
error(_("FIXME FIXME FIXME")) #FIXME !
raise NotImplementedError
@ -108,8 +109,9 @@ class Param(wx.Frame):
"""Called when a paramated is modified"""
self.__save_parameters()
name, category = event.GetEventObject().param_id
data = {"name":name, "category":category}
id = self.host.bridge.launchAction("button", data)
callback_id = event.GetEventObject().callback_id
data = {"name":name, "category":category, "callback_id":callback_id}
id = self.host.bridge.launchAction("button", data, profile_key = self.host.profile)
self.host.current_action_ids.add(id)
event.Skip()

View file

@ -199,7 +199,7 @@ class XMLUI(wx.Frame):
else:
data[field] = ctrl['control'].GetValue()
id = self.host.bridge.launchAction("button", data)
id = self.host.bridge.launchAction("button", data, profile_key = self.host.profile)
self.host.current_action_ids.add(id)
event.Skip()

23
sat.tac
View file

@ -243,7 +243,6 @@ class SatFallbackHandler(generic.FallbackHandler):
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 @@ class SAT(service.Service):
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 @@ class SAT(service.Service):
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 @@ class SAT(service.Service):
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 ##

View file

@ -126,7 +126,7 @@ class DbusObject(dbus.service.Object):
in_signature='s', out_signature='i')
def createProfile(self, name):
info ('Profile creation asked')
return self.cb["createProfile"](str(name))
return self.cb["createProfile"](unicode(name))
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
in_signature='s', out_signature='i')
@ -243,9 +243,9 @@ class DbusObject(dbus.service.Object):
return self.cb["delContact"](entity, profile_key)
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
in_signature='sa{ss}', out_signature='s')
def launchAction(self, type, data):
return self.cb["launchAction"](type, data)
in_signature='sa{ss}s', out_signature='s')
def launchAction(self, type, data, profile_key='@DEFAULT@'):
return self.cb["launchAction"](type, data, profile_key)
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
in_signature='sba{ss}', out_signature='')