comparison src/plugins/plugin_xep_0050.py @ 1071:eef1f200d733

plugin XEP-0050: form returned by completed command are now managed
author Goffi <goffi@goffi.org>
date Sat, 14 Jun 2014 17:26:22 +0200
parents 301b342c697a
children 387bbc459d8f
comparison
equal deleted inserted replaced
1070:ad023e60da8c 1071:eef1f200d733
253 command_elt = iq_elt.elements(NS_COMMANDS, "command").next() 253 command_elt = iq_elt.elements(NS_COMMANDS, "command").next()
254 status = command_elt.getAttribute('status', XEP_0050.STATUS.EXECUTING) 254 status = command_elt.getAttribute('status', XEP_0050.STATUS.EXECUTING)
255 if status in [XEP_0050.STATUS.COMPLETED, XEP_0050.STATUS.CANCELED]: 255 if status in [XEP_0050.STATUS.COMPLETED, XEP_0050.STATUS.CANCELED]:
256 # the command session is finished, we purge our session 256 # the command session is finished, we purge our session
257 del self.requesting[session_id] 257 del self.requesting[session_id]
258 return None 258 if status == XEP_0050.STATUS.COMPLETED:
259 session_id = None
260 else:
261 return None
259 remote_session_id = command_elt.getAttribute('sessionid') 262 remote_session_id = command_elt.getAttribute('sessionid')
260 if remote_session_id: 263 if remote_session_id:
261 session_data['remote_id'] = remote_session_id 264 session_data['remote_id'] = remote_session_id
262 data_elt = command_elt.elements(data_form.NS_X_DATA, 'x').next() 265 data_elt = command_elt.elements(data_form.NS_X_DATA, 'x').next()
266 if session_id is None:
267 return xml_tools.dataFormResult2XMLUI(data_elt)
263 form = data_form.Form.fromElement(data_elt) 268 form = data_form.Form.fromElement(data_elt)
264 return xml_tools.dataForm2XMLUI(form, self.__requesting_id, session_id=session_id) 269 return xml_tools.dataForm2XMLUI(form, self.__requesting_id, session_id=session_id)
265 270
266 def _requestingEntity(self, data, profile): 271 def _requestingEntity(self, data, profile):
267 """ 272 """