gajim-remote now has get_status_message

This commit is contained in:
Yann Leboulanger 2005-12-28 21:15:48 +00:00
parent b3f631f6c2
commit ff7aa9b765
3 changed files with 35 additions and 1 deletions

View File

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

View File

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

View File

@ -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)