comparison src/plugins/plugin_xep_0050.py @ 1505:5ddc4cf251fa

plugin XEP-0050: pre-fill the target server's field with user's host.
author souliane <souliane@mailoo.org>
date Wed, 02 Sep 2015 12:47:23 +0200
parents 987e74cbb839
children 4eca4f5e21ec
comparison
equal deleted inserted replaced
1504:a2e4b976e707 1505:5ddc4cf251fa
399 """ 399 """
400 form_ui = xml_tools.XMLUI("form", submit_id=self.__requesting_id) 400 form_ui = xml_tools.XMLUI("form", submit_id=self.__requesting_id)
401 form_ui.addText(_("Please enter target jid"), 'instructions') 401 form_ui.addText(_("Please enter target jid"), 'instructions')
402 form_ui.changeContainer("pairs") 402 form_ui.changeContainer("pairs")
403 form_ui.addLabel("jid") 403 form_ui.addLabel("jid")
404 form_ui.addString("jid") 404 jid = form_ui.addString("jid", value=self.host.getClient(profile).jid.host)
405 return {'xmlui': form_ui.toXml()} 405 return {'xmlui': form_ui.toXml()}
406 406
407 def _statusCallback(self, command_elt, session_data, action, node, profile): 407 def _statusCallback(self, command_elt, session_data, action, node, profile):
408 """ Ad-hoc command used to change the "show" part of status """ 408 """ Ad-hoc command used to change the "show" part of status """
409 actions = session_data.setdefault('actions',[]) 409 actions = session_data.setdefault('actions',[])
429 except (KeyError, StopIteration): 429 except (KeyError, StopIteration):
430 raise AdHocError(XEP_0050.ERROR.BAD_PAYLOAD) 430 raise AdHocError(XEP_0050.ERROR.BAD_PAYLOAD)
431 if show not in SHOWS: 431 if show not in SHOWS:
432 raise AdHocError(XEP_0050.ERROR.BAD_PAYLOAD) 432 raise AdHocError(XEP_0050.ERROR.BAD_PAYLOAD)
433 if show == "disconnect": 433 if show == "disconnect":
434 self.host.disconnect(profile) 434 self.host.disconnect(profile)
435 else: 435 else:
436 self.host.setPresence(show=show, profile_key=profile) 436 self.host.setPresence(show=show, profile_key=profile)
437 437
438 # job done, we can end the session 438 # job done, we can end the session
439 form = data_form.Form('form', title=_(u'Updated')) 439 form = data_form.Form('form', title=_(u'Updated'))