comparison sat/plugins/plugin_xep_0234.py @ 3404:26a0af6e32c1

plugin XEP-0166: new trigger point + coroutines + helper methods: - a new `XEP-0166_initiate` async trigger point is available - `initate` is now a coroutine - `jingleSessionInit` in applications and transports handlers are now called using `utils.adDeferred` - new `getApplication` helper method, to retrieve application from its namespace - new `getContentData` helper method to retrieve application and its argument from content
author Goffi <goffi@goffi.org>
date Thu, 12 Nov 2020 14:53:15 +0100
parents 404d4b29de52
children c84c54c6b046
comparison
equal deleted inserted replaced
3403:404d4b29de52 3404:26a0af6e32c1
403 progress_id = yield progress_id_d 403 progress_id = yield progress_id_d
404 defer.returnValue(progress_id) 404 defer.returnValue(progress_id)
405 405
406 # jingle callbacks 406 # jingle callbacks
407 407
408 def jingleDescriptionElt(
409 self, client, session, content_name, filepath, name, extra, progress_id_d
410 ):
411 return domish.Element((NS_JINGLE_FT, "description"))
412
408 def jingleSessionInit( 413 def jingleSessionInit(
409 self, client, session, content_name, filepath, name, extra, progress_id_d 414 self, client, session, content_name, filepath, name, extra, progress_id_d
410 ): 415 ):
411 if extra is None: 416 if extra is None:
412 extra = {} 417 extra = {}
421 content_data = session["contents"][content_name] 426 content_data = session["contents"][content_name]
422 application_data = content_data["application_data"] 427 application_data = content_data["application_data"]
423 assert "file_path" not in application_data 428 assert "file_path" not in application_data
424 application_data["file_path"] = filepath 429 application_data["file_path"] = filepath
425 file_data = application_data["file_data"] = {} 430 file_data = application_data["file_data"] = {}
426 desc_elt = domish.Element((NS_JINGLE_FT, "description")) 431 desc_elt = self.jingleDescriptionElt(
432 client, session, content_name, filepath, name, extra, progress_id_d)
427 file_elt = desc_elt.addElement("file") 433 file_elt = desc_elt.addElement("file")
428 434
429 if content_data["senders"] == self._j.ROLE_INITIATOR: 435 if content_data["senders"] == self._j.ROLE_INITIATOR:
430 # we send a file 436 # we send a file
431 if name is None: 437 if name is None: