plugin XEP-0166, 0176, 0234: minor renaming + type hints
This commit is contained in:
parent
1781694141
commit
5c6578a1f6
3 changed files with 20 additions and 9 deletions
|
|
@ -100,6 +100,10 @@ class BaseApplicationHandler(abc.ABC):
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def jingle_terminate(
|
def jingle_terminate(
|
||||||
self,
|
self,
|
||||||
|
client: SatXMPPEntity,
|
||||||
|
action: str,
|
||||||
|
session: dict,
|
||||||
|
content_name: str,
|
||||||
reason_elt: domish.Element
|
reason_elt: domish.Element
|
||||||
) -> Union[
|
) -> Union[
|
||||||
Callable[..., None],
|
Callable[..., None],
|
||||||
|
|
@ -144,7 +148,7 @@ class BaseTransportHandler(abc.ABC):
|
||||||
action: str,
|
action: str,
|
||||||
session: dict,
|
session: dict,
|
||||||
content_name: str,
|
content_name: str,
|
||||||
transport_elt: domish.Element
|
reason_elt: domish.Element
|
||||||
) -> Union[
|
) -> Union[
|
||||||
Callable[..., None],
|
Callable[..., None],
|
||||||
Callable[..., Awaitable[None]]
|
Callable[..., Awaitable[None]]
|
||||||
|
|
@ -156,7 +160,7 @@ class BaseTransportHandler(abc.ABC):
|
||||||
@param action: Jingle action
|
@param action: Jingle action
|
||||||
@param session: Jingle Session
|
@param session: Jingle Session
|
||||||
@param content_name: Name of the content
|
@param content_name: Name of the content
|
||||||
@param transport_elt: Transport element
|
@param reason_elt: <reason> element
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -290,7 +290,14 @@ class XEP_0176(BaseTransportHandler):
|
||||||
|
|
||||||
return transport_elt
|
return transport_elt
|
||||||
|
|
||||||
def jingle_terminate(self, client, action, session, content_name, reason_elt):
|
def jingle_terminate(
|
||||||
|
self,
|
||||||
|
client: SatXMPPEntity,
|
||||||
|
action: str,
|
||||||
|
session: dict,
|
||||||
|
content_name: str,
|
||||||
|
reason_elt: domish.Element,
|
||||||
|
) -> None:
|
||||||
log.debug("ICE-UDP session terminated")
|
log.debug("ICE-UDP session terminated")
|
||||||
|
|
||||||
def update_candidates(
|
def update_candidates(
|
||||||
|
|
|
||||||
|
|
@ -697,20 +697,20 @@ class XEP_0234:
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def jingle_terminate(self, client, action, session, content_name, jingle_elt):
|
def jingle_terminate(self, client, action, session, content_name, reason_elt):
|
||||||
if jingle_elt.decline:
|
if reason_elt.decline:
|
||||||
# progress is the only way to tell to frontends that session has been declined
|
# progress is the only way to tell to frontends that session has been declined
|
||||||
progress_id = self.get_progress_id(session, content_name)
|
progress_id = self.get_progress_id(session, content_name)
|
||||||
self.host.bridge.progress_error(
|
self.host.bridge.progress_error(
|
||||||
progress_id, C.PROGRESS_ERROR_DECLINED, client.profile
|
progress_id, C.PROGRESS_ERROR_DECLINED, client.profile
|
||||||
)
|
)
|
||||||
elif not jingle_elt.success:
|
elif not reason_elt.success:
|
||||||
progress_id = self.get_progress_id(session, content_name)
|
progress_id = self.get_progress_id(session, content_name)
|
||||||
first_child = jingle_elt.firstChildElement()
|
first_child = reason_elt.firstChildElement()
|
||||||
if first_child is not None:
|
if first_child is not None:
|
||||||
reason = first_child.name
|
reason = first_child.name
|
||||||
if jingle_elt.text is not None:
|
if reason_elt.text is not None:
|
||||||
reason = f"{reason} - {jingle_elt.text}"
|
reason = f"{reason} - {reason_elt.text}"
|
||||||
else:
|
else:
|
||||||
reason = C.PROGRESS_ERROR_FAILED
|
reason = C.PROGRESS_ERROR_FAILED
|
||||||
self.host.bridge.progress_error(
|
self.host.bridge.progress_error(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue