ability to set priority via gajim-remote. see #3345

This commit is contained in:
Yann Leboulanger 2009-09-03 23:18:49 +02:00
parent 91b7004dc9
commit c5e447fab8
2 changed files with 35 additions and 0 deletions

View file

@ -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'),
[

View file

@ -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.'''