comparison sat/plugins/plugin_xep_0234.py @ 4052:2ced30f6d5de

plugin XEP-0166, 0176, 0234: minor renaming + type hints
author Goffi <goffi@goffi.org>
date Mon, 29 May 2023 13:32:19 +0200
parents 524856bd7b19
children
comparison
equal deleted inserted replaced
4051:c23cad65ae99 4052:2ced30f6d5de
695 client, session, content_name, content_data 695 client, session, content_name, content_data
696 ) 696 )
697 else: 697 else:
698 raise NotImplementedError 698 raise NotImplementedError
699 699
700 def jingle_terminate(self, client, action, session, content_name, jingle_elt): 700 def jingle_terminate(self, client, action, session, content_name, reason_elt):
701 if jingle_elt.decline: 701 if reason_elt.decline:
702 # progress is the only way to tell to frontends that session has been declined 702 # progress is the only way to tell to frontends that session has been declined
703 progress_id = self.get_progress_id(session, content_name) 703 progress_id = self.get_progress_id(session, content_name)
704 self.host.bridge.progress_error( 704 self.host.bridge.progress_error(
705 progress_id, C.PROGRESS_ERROR_DECLINED, client.profile 705 progress_id, C.PROGRESS_ERROR_DECLINED, client.profile
706 ) 706 )
707 elif not jingle_elt.success: 707 elif not reason_elt.success:
708 progress_id = self.get_progress_id(session, content_name) 708 progress_id = self.get_progress_id(session, content_name)
709 first_child = jingle_elt.firstChildElement() 709 first_child = reason_elt.firstChildElement()
710 if first_child is not None: 710 if first_child is not None:
711 reason = first_child.name 711 reason = first_child.name
712 if jingle_elt.text is not None: 712 if reason_elt.text is not None:
713 reason = f"{reason} - {jingle_elt.text}" 713 reason = f"{reason} - {reason_elt.text}"
714 else: 714 else:
715 reason = C.PROGRESS_ERROR_FAILED 715 reason = C.PROGRESS_ERROR_FAILED
716 self.host.bridge.progress_error( 716 self.host.bridge.progress_error(
717 progress_id, reason, client.profile 717 progress_id, reason, client.profile
718 ) 718 )