comparison src/plugins/plugin_xep_0234.py @ 1567:268fda4236ca

plugins XE0166, XEP-0234, XEP-0260, XEP-0261: renamed session key managing other peer's jid to "peer_jid" instead of "to_jid"
author Goffi <goffi@goffi.org>
date Sun, 08 Nov 2015 14:44:33 +0100
parents ec3848916ee8
children 1f7a34d499e0
comparison
equal deleted inserted replaced
1566:ec3848916ee8 1567:268fda4236ca
62 host.bridge.addMethod("fileJingleSend", ".plugin", in_sign='sssss', out_sign='', method=self._fileJingleSend) 62 host.bridge.addMethod("fileJingleSend", ".plugin", in_sign='sssss', out_sign='', method=self._fileJingleSend)
63 63
64 def getHandler(self, profile): 64 def getHandler(self, profile):
65 return XEP_0234_handler() 65 return XEP_0234_handler()
66 66
67 def _fileJingleSend(self, to_jid, filepath, name="", file_desc="", profile=C.PROF_KEY_NONE): 67 def _fileJingleSend(self, peer_jid, filepath, name="", file_desc="", profile=C.PROF_KEY_NONE):
68 return self.fileJingleSend(jid.JID(to_jid), filepath, name or None, file_desc or None, profile) 68 return self.fileJingleSend(jid.JID(peer_jid), filepath, name or None, file_desc or None, profile)
69 69
70 def fileJingleSend(self, to_jid, filepath, name=None, file_desc=None, profile=C.PROF_KEY_NONE): 70 def fileJingleSend(self, peer_jid, filepath, name=None, file_desc=None, profile=C.PROF_KEY_NONE):
71 self._j.initiate(to_jid, 71 self._j.initiate(peer_jid,
72 [{'app_ns': NS_JINGLE_FT, 72 [{'app_ns': NS_JINGLE_FT,
73 'senders': self._j.ROLE_INITIATOR, 73 'senders': self._j.ROLE_INITIATOR,
74 'app_kwargs': {'filepath': filepath, 74 'app_kwargs': {'filepath': filepath,
75 'name': name, 75 'name': name,
76 'file_desc': file_desc}, 76 'file_desc': file_desc},
91 return (defer.Deferred): True if transfer is accepted 91 return (defer.Deferred): True if transfer is accepted
92 """ 92 """
93 application_data = content_data['application_data'] 93 application_data = content_data['application_data']
94 file_data = application_data['file_data'] 94 file_data = application_data['file_data']
95 d = xml_tools.deferDialog(self.host, 95 d = xml_tools.deferDialog(self.host,
96 _(CONFIRM).format(entity=session['to_jid'].full(), **file_data), 96 _(CONFIRM).format(entity=session['peer_jid'].full(), **file_data),
97 _(CONFIRM_TITLE), 97 _(CONFIRM_TITLE),
98 type_=C.XMLUI_DIALOG_FILE, 98 type_=C.XMLUI_DIALOG_FILE,
99 options={C.XMLUI_DATA_FILETYPE: C.XMLUI_DATA_FILETYPE_DIR}, 99 options={C.XMLUI_DATA_FILETYPE: C.XMLUI_DATA_FILETYPE_DIR},
100 profile=profile) 100 profile=profile)
101 d.addCallback(self._gotConfirmation, session, content_data, application_data, profile) 101 d.addCallback(self._gotConfirmation, session, content_data, application_data, profile)