diff options
author | Philipp Hörist <philipp@hoerist.com> | 2019-04-07 00:26:47 +0300 |
---|---|---|
committer | Philipp Hörist <philipp@hoerist.com> | 2019-04-07 00:26:47 +0300 |
commit | 11dffacfefb7db839ab5bdd47749edc935089dfa (patch) | |
tree | f7913470372ccae44ebad72545a1fbbe15bda857 /nbxmpp/structs.py | |
parent | cf7f06256a30afdcab426fdbc7217627f46f8812 (diff) |
Add Ad-Hoc Commands (XEP-0050) module
Diffstat (limited to 'nbxmpp/structs.py')
-rw-r--r-- | nbxmpp/structs.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/nbxmpp/structs.py b/nbxmpp/structs.py index f0ff532..f0d72a6 100644 --- a/nbxmpp/structs.py +++ b/nbxmpp/structs.py @@ -29,6 +29,7 @@ from nbxmpp.const import StatusCode from nbxmpp.const import PresenceType from nbxmpp.const import Error from nbxmpp.const import LOCATION_DATA +from nbxmpp.const import AdHocStatus StanzaHandler = namedtuple('StanzaHandler', 'name callback typ ns xmlns system priority') @@ -106,6 +107,25 @@ MuclumbusItem = namedtuple('MuclumbusItem', 'jid name nusers description languag SoftwareVersionResult = namedtuple('SoftwareVersionResult', 'name version os') +AdHocCommandNote = namedtuple('AdHocCommandNote', 'text type') + +class AdHocCommand(namedtuple('AdHocCommand', 'jid node name sessionid status data actions notes')): + + __slots__ = [] + + def __new__(cls, jid, node, name, sessionid=None, status=None, + data=None, actions=None, notes=None): + return super(AdHocCommand, cls).__new__(cls, jid, node, name, sessionid, + status, data, actions, notes) + + @property + def is_completed(self): + return self.status == AdHocStatus.COMPLETED + + @property + def is_canceled(self): + return self.status == AdHocStatus.CANCEL + class OMEMOBundle(namedtuple('OMEMOBundle', 'spk spk_signature ik otpks')): def pick_prekey(self): |