Merge branch 'bugfix/xep_0009' into 'master'

xep-0009: fixed bugs

See merge request poezio/slixmpp!172
This commit is contained in:
mathieui 2022-02-04 23:11:28 +01:00
commit 714f9aae0d
2 changed files with 7 additions and 7 deletions

View file

@ -22,7 +22,7 @@ def fault2xml(fault):
def xml2fault(params):
vals = []
for value in params.xml.findall('{%s}value' % _namespace):
for value in params.findall('{%s}value' % _namespace):
vals.append(_xml2py(value))
fault = dict()
fault['code'] = vals[0]['faultCode']

View file

@ -53,8 +53,8 @@ class XEP_0009(BasePlugin):
def make_iq_method_call(self, pto, pmethod, params):
iq = self.xmpp.make_iq_set()
iq.attrib['to'] = pto
iq.attrib['from'] = self.xmpp.boundjid.full
iq['to'] = pto
iq['from'] = self.xmpp.boundjid.full
iq.enable('rpc_query')
iq['rpc_query']['method_call']['method_name'] = pmethod
iq['rpc_query']['method_call']['params'] = params
@ -62,16 +62,16 @@ class XEP_0009(BasePlugin):
def make_iq_method_response(self, pid, pto, params):
iq = self.xmpp.make_iq_result(pid)
iq.attrib['to'] = pto
iq.attrib['from'] = self.xmpp.boundjid.full
iq['to'] = pto
iq['from'] = self.xmpp.boundjid.full
iq.enable('rpc_query')
iq['rpc_query']['method_response']['params'] = params
return iq
def make_iq_method_response_fault(self, pid, pto, params):
iq = self.xmpp.make_iq_result(pid)
iq.attrib['to'] = pto
iq.attrib['from'] = self.xmpp.boundjid.full
iq['to'] = pto
iq['from'] = self.xmpp.boundjid.full
iq.enable('rpc_query')
iq['rpc_query']['method_response']['params'] = None
iq['rpc_query']['method_response']['fault'] = params