diff options
Diffstat (limited to 'poezio/core/structs.py')
-rw-r--r-- | poezio/core/structs.py | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/poezio/core/structs.py b/poezio/core/structs.py index 4ce0ef43..82effd48 100644 --- a/poezio/core/structs.py +++ b/poezio/core/structs.py @@ -1,7 +1,9 @@ """ Module defining structures useful to the core class and related methods """ -import collections + +__all__ = ['ERROR_AND_STATUS_CODES', 'DEPRECATED_ERRORS', 'POSSIBLE_SHOW', + 'Status', 'Command'] # http://xmpp.org/extensions/xep-0045.html#errorstatus ERROR_AND_STATUS_CODES = { @@ -36,14 +38,27 @@ DEPRECATED_ERRORS = { '510': 'Disconnected', } -possible_show = {'available':None, - 'chat':'chat', - 'away':'away', - 'afk':'away', - 'dnd':'dnd', - 'busy':'dnd', - 'xa':'xa' - } +POSSIBLE_SHOW = { + 'available': None, + 'chat': 'chat', + 'away': 'away', + 'afk': 'away', + 'dnd': 'dnd', + 'busy': 'dnd', + 'xa': 'xa' +} + +class Status: + __slots__ = ('show', 'message') + def __init__(self, show, message): + self.show = show + self.message = message -Status = collections.namedtuple('Status', 'show message') -Command = collections.namedtuple('Command', 'func desc comp short usage') +class Command: + __slots__ = ('func', 'desc', 'comp', 'short_desc', 'usage') + def __init__(self, func, desc, comp, short_desc, usage): + self.func = func + self.desc = desc + self.comp = comp + self.short_desc = short_desc + self.usage = usage |