plugin XEP-0234: fix action type when pre-flight file confirmation is confirmed:
the `C.META_TYPE_FILE` can't be used in this case as it is a preflight and we don't have yet data such as progress ID. `C.META_TYPE_FILE` is used as a sub-type to help with dialog management in frontend.
This commit is contained in:
parent
f20e5d6103
commit
a804e6a9dc
2 changed files with 20 additions and 8 deletions
|
|
@ -347,6 +347,8 @@ class Const(object):
|
|||
) # //default = normal output (stderr or a file with twistd), path/to/file for a file (must be the first if used), //memory for memory (options can be put in parenthesis, e.g.: //memory(500) for a 500 lines memory)
|
||||
|
||||
## action constants ##
|
||||
#: simple confirmation dialog
|
||||
META_TYPE_CONFIRM = "confirm"
|
||||
META_TYPE_FILE = "file"
|
||||
META_TYPE_CALL = "call"
|
||||
META_TYPE_OVERWRITE = "overwrite"
|
||||
|
|
|
|||
|
|
@ -443,22 +443,27 @@ class XEP_0234(BaseApplicationHandler):
|
|||
).format(peer_jid=peer_jid, human_name=self.human_name)
|
||||
confirm_title = D_("File sent from an unknown contact")
|
||||
action_type = C.META_TYPE_NOT_IN_ROSTER_LEAK
|
||||
action_subtype = None
|
||||
else:
|
||||
confirm_msg = D_(
|
||||
"{peer_jid} wants to send a file ro you, do you accept?"
|
||||
"{peer_jid} wants to send a file to you, do you accept?"
|
||||
).format(peer_jid=peer_jid)
|
||||
confirm_title = D_("File Proposed")
|
||||
action_type = C.META_TYPE_FILE
|
||||
action_type = C.META_TYPE_CONFIRM
|
||||
action_subtype = C.META_TYPE_FILE
|
||||
action_extra = {
|
||||
"type": action_type,
|
||||
"session_id": session_id,
|
||||
"from_jid": peer_jid.full(),
|
||||
}
|
||||
if action_subtype is not None:
|
||||
action_extra["subtype"] = action_subtype
|
||||
accepted = await xml_tools.defer_confirm(
|
||||
self.host,
|
||||
confirm_msg,
|
||||
confirm_title,
|
||||
profile=client.profile,
|
||||
action_extra={
|
||||
"type": action_type,
|
||||
"session_id": session_id,
|
||||
"from_jid": peer_jid.full(),
|
||||
},
|
||||
action_extra=action_extra
|
||||
)
|
||||
if accepted:
|
||||
session["file_accepted"] = True
|
||||
|
|
@ -546,7 +551,12 @@ class XEP_0234(BaseApplicationHandler):
|
|||
return desc_elt
|
||||
|
||||
async def jingle_request_confirmation(
|
||||
self, client, action, session, content_name, desc_elt
|
||||
self,
|
||||
client: SatXMPPEntity,
|
||||
action: str,
|
||||
session: dict,
|
||||
content_name: str,
|
||||
desc_elt: domish.Element,
|
||||
):
|
||||
"""This method request confirmation for a jingle session"""
|
||||
content_data = session["contents"][content_name]
|
||||
|
|
|
|||
Loading…
Reference in a new issue