Skip to content
Snippets Groups Projects
Commit ff7aa9b7 authored by Yann Leboulanger's avatar Yann Leboulanger
Browse files

gajim-remote now has get_status_message

parent b3f631f6
No related branches found
No related tags found
No related merge requests found
......@@ -496,6 +496,18 @@ def get_global_show():
if connected > maxi:
maxi = connected
return gajim.SHOW_LIST[maxi]
def get_global_status():
maxi = 0
for account in gajim.connections:
if not gajim.config.get_per('accounts', account,
'sync_with_global_status'):
continue
connected = gajim.connections[account].connected
if connected > maxi:
maxi = connected
status = gajim.connections[account].status
return status
def get_icon_name_to_show(contact, account = None):
'''Get the icon name to show in online, away, requested, ...'''
......
......@@ -196,7 +196,13 @@ class GajimRemote:
(_('account'), _(''), False)
]
],
'get_status_message': [
_('Returns current status message(the global one unless account is specified)'),
[
(_('account'), _(''), False)
]
],
}
if self.argv_len < 2 or \
sys.argv[1] not in self.commands.keys(): # no args or bad args
......
......@@ -107,6 +107,7 @@ class SignalObject(DbusPrototype):
self.add_contact,
self.remove_contact,
self.get_status,
self.get_status_message,
])
def raise_signal(self, signal, arg):
......@@ -137,6 +138,20 @@ class SignalObject(DbusPrototype):
# return show for the given account
index = gajim.connections[account].connected
return STATUS_LIST[index]
def get_status_message(self, *args):
'''get_status(account = None)
returns status which is the global one
unless account is given'''
account = self._get_real_arguments(args, 1)[0]
accounts = gajim.contacts.keys()
if not account:
# If user did not ask for account, returns the global status
return str(helpers.get_global_status())
# return show for the given account
status = gajim.connections[account].status
return str(status)
def send_file(self, *args):
'''send_file(file_path, jid, account=None)
......@@ -488,3 +503,4 @@ class SignalObject(DbusPrototype):
remove_contact = method(INTERFACE)(remove_contact)
add_contact = method(INTERFACE)(add_contact)
get_status = method(INTERFACE)(get_status)
get_status_message = method(INTERFACE)(get_status_message)
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