diff --git a/src/gajim-remote.py b/src/gajim-remote.py index c0a7ccf59..8926cf341 100644 --- a/src/gajim-remote.py +++ b/src/gajim-remote.py @@ -114,6 +114,16 @@ class GajimRemote: '"sync with global status" option set'), False) ] ], + 'set_priority': [ + _('Changes the priority of account or accounts'), + [ + (_('priority'), _('priority you want to give to the account'), + True), + (_('account'), _('change the priority of the given account. ' + 'If not specified, change status of all accounts that have' + ' "sync with global status" option set'), False) + ] + ], 'open_chat': [ _('Shows the chat dialog so that you can send messages to a contact'), [ diff --git a/src/remote_control.py b/src/remote_control.py index f9c6d5947..e331b8c05 100644 --- a/src/remote_control.py +++ b/src/remote_control.py @@ -401,6 +401,31 @@ class SignalObject(dbus.service.Object): status, message) return DBUS_BOOLEAN(False) + @dbus.service.method(INTERFACE, in_signature='ss', out_signature='') + def set_priority(self, prio, account): + ''' set_priority(prio, account). account is optional - + if not specified priority is changed for all accounts. that are synced + with global status''' + if account: + gajim.config.set_per('accounts', account, 'priority', prio) + show = gajim.SHOW_LIST[gajim.connections[account].connected] + status = gajim.connections[account].status + gobject.idle_add(gajim.connections[account].change_status, show, + status) + else: + # account not specified, so change prio of all accounts + for acc in gajim.contacts.get_accounts(): + if not gajim.account_is_connected(acc): + continue + if not gajim.config.get_per('accounts', acc, + 'sync_with_global_status'): + continue + gajim.config.set_per('accounts', acc, 'priority', prio) + show = gajim.SHOW_LIST[gajim.connections[acc].connected] + status = gajim.connections[acc].status + gobject.idle_add(gajim.connections[acc].change_status, show, + status) + @dbus.service.method(INTERFACE, in_signature='', out_signature='') def show_next_pending_event(self): '''Show the window(s) with next pending event in tabbed/group chats.'''