Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
ceea0a8d by lovetox at 2020-11-22T22:56:39+01:00
AdHoc: Parse default action
- - - - -
2 changed files:
- nbxmpp/modules/adhoc.py
- nbxmpp/structs.py
Changes:
=====================================
nbxmpp/modules/adhoc.py
=====================================
@@ -96,11 +96,18 @@ class AdHoc(BaseModule):
notes.append(AdHocCommandNote(text=note.getData(),
type=type_))
+ default = None
actions_ = command.getTag('actions')
if actions_ is not None:
for action_ in actions_.getChildren():
actions.append(AdHocAction(action_.getName()))
+ default = actions_.getAttr('execute')
+ if default is not None:
+ default = AdHocAction(default)
+ if default not in actions:
+ default = None
+
yield AdHocCommand(
jid=str(response.getFrom()),
name=None,
@@ -109,6 +116,7 @@ class AdHoc(BaseModule):
status=AdHocStatus(attrs['status']),
data=command.getTag('x', namespace=Namespace.DATA),
actions=actions,
+ default=default,
notes=notes)
except Exception as error:
raise MalformedStanzaError(str(error), response)
=====================================
nbxmpp/structs.py
=====================================
@@ -396,14 +396,14 @@ class DiscoIdentity(namedtuple('DiscoIdentity', 'category
type name lang')):
return hash(str(self))
-class AdHocCommand(namedtuple('AdHocCommand', 'jid node name sessionid status
data actions notes')):
+class AdHocCommand(namedtuple('AdHocCommand', 'jid node name sessionid status
data actions default notes')):
__slots__ = []
def __new__(cls, jid, node, name, sessionid=None, status=None,
- data=None, actions=None, notes=None):
+ data=None, actions=None, default=None, notes=None):
return super(AdHocCommand, cls).__new__(cls, jid, node, name,
sessionid,
- status, data, actions, notes)
+ status, data, actions,
default, notes)
@property
def is_completed(self):
View it on GitLab:
https://dev.gajim.org/gajim/python-nbxmpp/-/commit/ceea0a8d6a6bdc9eabeb710f08ea2e2a30301cf1
--
View it on GitLab:
https://dev.gajim.org/gajim/python-nbxmpp/-/commit/ceea0a8d6a6bdc9eabeb710f08ea2e2a30301cf1
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits