SàT: plugin 0077 & 0100: fixed profile management
This commit is contained in:
parent
e188365430
commit
546a114cde
1 changed files with 15 additions and 12 deletions
|
|
@ -50,9 +50,9 @@ class XEP_0077():
|
|||
host.bridge.addMethod("in_band_register", ".communication", in_sign='ss', out_sign='s', method=self.in_band_register)
|
||||
host.bridge.addMethod("in_band_submit", ".request", in_sign='sa(ss)', out_sign='s', method=self.in_band_submit)
|
||||
|
||||
def addTrigger(self, target, cb):
|
||||
def addTrigger(self, target, cb, profile):
|
||||
"""Add a callback which is called when registration to target is successful"""
|
||||
self.triggers[target] = cb
|
||||
self.triggers[target] = (cb, profile)
|
||||
|
||||
def reg_ok(self, answer):
|
||||
"""Called after the first get IQ"""
|
||||
|
|
@ -99,7 +99,8 @@ class XEP_0077():
|
|||
answer_data={"message":_("Registration successfull")}
|
||||
self.host.bridge.actionResult(answer_type, answer['id'], answer_data)
|
||||
if self.triggers.has_key(answer["from"]):
|
||||
self.triggers[answer["from"]](answer["from"])
|
||||
callback,profile = self.triggers[answer["from"]]
|
||||
callback(answer["from"], profile)
|
||||
del self.triggers[answer["from"]]
|
||||
|
||||
def registrationFailure(self, failure):
|
||||
|
|
@ -117,9 +118,9 @@ class XEP_0077():
|
|||
if self.triggers.has_key(answer["from"]):
|
||||
del self.triggers[answer["from"]]
|
||||
|
||||
def in_band_submit(self, action, target, fields):
|
||||
def in_band_submit(self, action, target, fields, profile):
|
||||
"""Submit a form for registration, using data_form"""
|
||||
id, deferred = self.host.submitForm(action, target, fields)
|
||||
id, deferred = self.host.submitForm(action, target, fields, profile)
|
||||
if action == 'CANCEL':
|
||||
deferred.addCallbacks(self.unregistrationAnswer, self.unregistrationFailure)
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in a new issue