summaryrefslogtreecommitdiff
path: root/poezio/decorators.py
diff options
context:
space:
mode:
Diffstat (limited to 'poezio/decorators.py')
-rw-r--r--poezio/decorators.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/poezio/decorators.py b/poezio/decorators.py
index 4b5d0320..51abf32c 100644
--- a/poezio/decorators.py
+++ b/poezio/decorators.py
@@ -162,3 +162,15 @@ class CommandArgParser:
command_args_parser = CommandArgParser()
+
+
+def deny_anonymous(func: Callable) -> Callable:
+ """Decorator to disable commands when using an anonymous account."""
+ def wrap(self: 'RosterInfoTab', *args, **kwargs):
+ if self.core.xmpp.anon:
+ return self.core.information(
+ 'This command is not available for anonymous accounts.',
+ 'Info'
+ )
+ return func(self, *args, **kwargs)
+ return wrap