Philipp Hörist pushed to branch master at gajim / python-nbxmpp


Commits:
6e3bc165 by lovetox at 2021-05-03T22:52:55+02:00
AdHoc: Cancel action is always possible

- - - - -


1 changed file:

- nbxmpp/modules/adhoc.py


Changes:

=====================================
nbxmpp/modules/adhoc.py
=====================================
@@ -150,12 +150,15 @@ def _parse_notes(command):
 
 
 def _parse_actions(command):
+    if command.getAttr('status') != 'executing':
+        return [], None
+
     actions_node = command.getTag('actions')
     if actions_node is None:
         # If there is no <actions/> element,
         # the user-agent can use a single-stage dialog or view.
         # The action "execute" is equivalent to the action "complete".
-        return [AdHocAction.COMPLETE], AdHocAction.COMPLETE
+        return [AdHocAction.CANCEL, AdHocAction.COMPLETE], AdHocAction.COMPLETE
 
     actions = []
     for action in actions_node.getChildren():
@@ -167,6 +170,9 @@ def _parse_actions(command):
     if not actions:
         raise ValueError('actions element without actions')
 
+    # The action "cancel" is always allowed.
+    actions.append(AdHocAction.CANCEL)
+
     default = actions_node.getAttr('execute')
     if default is None:
         # If the "execute" attribute is absent, it defaults to "next".



View it on GitLab: 
https://dev.gajim.org/gajim/python-nbxmpp/-/commit/6e3bc1655ed7210a9ef86fdb645c67d5c0693ce4

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/python-nbxmpp/-/commit/6e3bc1655ed7210a9ef86fdb645c67d5c0693ce4
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list
Commits@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to