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'), _('Changes the status of account or accounts'),
[ [
#offline, online, chat, away, xa, dnd, invisible should not be translated #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), (_('message'), _('status message'), False),
(_('account'), _('change status of account "account". ' (_('account'), _('change status of account "account". '
'If not specified, try to change status of all accounts that have ' '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 specified status is changed for all accounts
""" """
if status not in ('offline', 'online', 'chat', if status not in ('offline', 'online', 'chat',
'away', 'xa', 'dnd', 'invisible'): 'away', 'xa', 'dnd', 'invisible'):
return DBUS_BOOLEAN(False) status = ''
if account: 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, gobject.idle_add(gajim.interface.roster.send_status, account,
status, message) status, message)
else: else:
@ -427,8 +431,14 @@ class SignalObject(dbus.service.Object):
if not gajim.config.get_per('accounts', acc, if not gajim.config.get_per('accounts', acc,
'sync_with_global_status'): 'sync_with_global_status'):
continue 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, gobject.idle_add(gajim.interface.roster.send_status, acc,
status, message) status_, message)
return DBUS_BOOLEAN(False) return DBUS_BOOLEAN(False)
@dbus.service.method(INTERFACE, in_signature='ss', out_signature='') @dbus.service.method(INTERFACE, in_signature='ss', out_signature='')