changeset 1557:22f0307864b4

plugin XEP-0234: "senders" handling
author Goffi <goffi@goffi.org>
date Mon, 02 Nov 2015 22:02:41 +0100
parents cbfbe028d099
children 6a8dd91476f0
files src/plugins/plugin_xep_0234.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0234.py	Mon Nov 02 22:02:41 2015 +0100
+++ b/src/plugins/plugin_xep_0234.py	Mon Nov 02 22:02:41 2015 +0100
@@ -74,6 +74,7 @@
     def fileJingleSend(self, to_jid, filepath, name=None, file_desc=None, profile=C.PROF_KEY_NONE):
         self._j.initiate(to_jid,
                          [{'app_ns': NS_JINGLE_FT,
+                           'senders': self._j.ROLE_INITIATOR,
                            'app_kwargs': {'filepath': filepath,
                                           'name': name,
                                           'file_desc': file_desc},
@@ -165,6 +166,9 @@
     def jingleRequestConfirmation(self, action, session, content_name, desc_elt, profile):
         """This method request confirmation for a jingle session"""
         content_data = session['contents'][content_name]
+        if content_data['senders'] not in (self._j.ROLE_INITIATOR, self._j.ROLE_RESPONDER):
+            log.warning(u"Bad sender, assuming initiator")
+            content_data['senders'] = self._j.ROLE_INITIATOR
         # first we grab file informations
         try:
             file_elt = desc_elt.elements(NS_JINGLE_FT, 'file').next()