allow to not specify status in gajim-remote change_status to change only status message. Fixes #5039

This commit is contained in:
Yann Leboulanger 2010-01-14 21:16:13 +01:00
parent 1e6ab49e09
commit 7f56222e44
2 changed files with 14 additions and 4 deletions

View File

@ -106,7 +106,7 @@ class GajimRemote:
_('Changes the status of account or accounts'),
[
#offline, online, chat, away, xa, dnd, invisible should not be translated
(_('status'), _('one of: offline, online, chat, away, xa, dnd, invisible '), True),
(_('status'), _('one of: offline, online, chat, away, xa, dnd, invisible. If not set, use accoun\'t previous status'), False),
(_('message'), _('status message'), False),
(_('account'), _('change status of account "account". '
'If not specified, try to change status of all accounts that have '

View File

@ -416,9 +416,13 @@ class SignalObject(dbus.service.Object):
specified status is changed for all accounts
"""
if status not in ('offline', 'online', 'chat',
'away', 'xa', 'dnd', 'invisible'):
return DBUS_BOOLEAN(False)
'away', 'xa', 'dnd', 'invisible'):
status = ''
if account:
if not status:
if account not in gajim.connections:
return DBUS_BOOLEAN(False)
status = gajim.SHOW_LIST[gajim.connections[account].connected]
gobject.idle_add(gajim.interface.roster.send_status, account,
status, message)
else:
@ -427,8 +431,14 @@ class SignalObject(dbus.service.Object):
if not gajim.config.get_per('accounts', acc,
'sync_with_global_status'):
continue
if status:
status_ = status
else:
if acc not in gajim.connections:
continue
status_ = gajim.SHOW_LIST[gajim.connections[acc].connected]
gobject.idle_add(gajim.interface.roster.send_status, acc,
status, message)
status_, message)
return DBUS_BOOLEAN(False)
@dbus.service.method(INTERFACE, in_signature='ss', out_signature='')