Skip to content
Snippets Groups Projects
Commit 306519f6 authored by Alexander Cherniuk's avatar Alexander Cherniuk
Browse files

Added /status, /away, /online commands. Fixed command error reporting

parent 11c83109
No related branches found
No related tags found
No related merge requests found
......@@ -30,6 +30,9 @@ class BaseError(Exception):
super(BaseError, self).__init__()
def __str__(self):
return self.message
class DefinitionError(BaseError):
"""
Used to indicate errors occured on command definition.
......
......@@ -128,6 +128,35 @@ class StandardCommonCommands(CommandContainer):
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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment