Commit d619e0c5 authored by ge0rg's avatar ge0rg

Roster: display presence.show when contact goes offline, if available.

parent f3aad52c
...@@ -1068,7 +1068,8 @@ class HandlerCore: ...@@ -1068,7 +1068,8 @@ class HandlerCore:
'{http://jabber.org/protocol/muc#user}x') is not None: '{http://jabber.org/protocol/muc#user}x') is not None:
return return
jid = presence['from'] jid = presence['from']
if not logger.log_roster_change(jid.bare, 'got offline'): status = presence['status']
if not logger.log_roster_change(jid.bare, 'got offline{}'.format(' ({})'.format(status) if status else '')):
self.core.information('Unable to write in the log file', 'Error') self.core.information('Unable to write in the log file', 'Error')
# If a resource got offline, display the message in the conversation with this # If a resource got offline, display the message in the conversation with this
# precise resource. # precise resource.
...@@ -1078,12 +1079,15 @@ class HandlerCore: ...@@ -1078,12 +1079,15 @@ class HandlerCore:
roster.connected -= 1 roster.connected -= 1
if contact.name: if contact.name:
name = contact.name name = contact.name
offline_msg = '%s is \x191}offline' % name
if status:
offline_msg += ' (\x19o%s\x191})' % status
if jid.resource: if jid.resource:
self.core.add_information_message_to_conversation_tab( self.core.add_information_message_to_conversation_tab(
jid.full, '\x195}%s is \x191}offline' % name) jid.full, '\x195}' + offline_msg)
self.core.add_information_message_to_conversation_tab( self.core.add_information_message_to_conversation_tab(
jid.bare, '\x195}%s is \x191}offline' % name) jid.bare, '\x195}' + offline_msg)
self.core.information('\x193}%s \x195}is \x191}offline' % name, self.core.information('\x193}' + offline_msg,
'Roster') 'Roster')
roster.modified() roster.modified()
if isinstance(self.core.tabs.current_tab, tabs.RosterInfoTab): if isinstance(self.core.tabs.current_tab, tabs.RosterInfoTab):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment