changeset f6c4bf3a5767 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=f6c4bf3a5767
description: Added /status, /away, /online commands. Fixed command error reporting
diffstat:
src/command_system/errors.py | 3 ++
src/command_system/implementation/standard.py | 29 +++++++++++++++++++++++++++
2 files changed, 32 insertions(+), 0 deletions(-)
diffs (52 lines):
diff -r d90d9aee1358 -r f6c4bf3a5767 src/command_system/errors.py
--- a/src/command_system/errors.py Sun Dec 20 23:16:58 2009 +0100
+++ b/src/command_system/errors.py Tue Dec 22 21:31:11 2009 +0200
@@ -30,6 +30,9 @@
super(BaseError, self).__init__()
+ def __str__(self):
+ return self.message
+
class DefinitionError(BaseError):
"""
Used to indicate errors occured on command definition.
diff -r d90d9aee1358 -r f6c4bf3a5767 src/command_system/implementation/standard.py
--- a/src/command_system/implementation/standard.py Sun Dec 20 23:16:58 2009 +0100
+++ b/src/command_system/implementation/standard.py Tue Dec 22 21:31:11 2009 +0200
@@ -128,6 +128,35 @@
self.echo(formatted)
+ @command(raw=True, empty=True)
+ @documentation(_("""
+ Set current the status
+
+ Status can be given as one of the following values: online, away,
+ chat, xa, dnd.
+ """))
+ def status(self, status, message):
+ if status not in ('online', 'away', 'chat', 'xa', 'dnd'):
+ raise CommandError("Invalid status given")
+ for connection in gajim.connections.itervalues():
+ connection.change_status(status, message)
+
+ @command(raw=True, empty=True)
+ @documentation(_("Set the current status to away"))
+ def away(self, message):
+ if not message:
+ message = _("Away")
+ for connection in gajim.connections.itervalues():
+ connection.change_status('away', message)
+
+ @command('back', raw=True, empty=True)
+ @documentation(_("Set the current status to online"))
+ def online(self, message):
+ if not message:
+ message = _("Available")
+ for connection in gajim.connections.itervalues():
+ connection.change_status('online', message)
+
class StandardChatCommands(CommandContainer):
"""
This command container contains standard command which are unique to a chat.