Commit f7294b29 authored by mathieui's avatar mathieui

Improve dynamic conversation tabs

Add color to the info messages
Unlock the tab when the locked resource goes offline
parent c2d9151f
......@@ -3457,8 +3457,11 @@ class Core(object):
jid = presence['from']
contact = roster[jid.bare]
tab = self.get_conversation_by_jid(jid, create=False)
if isinstance(tab, tabs.DynamicConversationTab) and tab.get_dest_jid() != jid.full:
tab.unlock(from_=jid.full)
if isinstance(tab, tabs.DynamicConversationTab):
if tab.get_dest_jid() != jid.full:
tab.unlock(from_=jid.full)
elif presence['type'] == 'unavailable':
tab.unlock()
if contact is None:
return
roster.modified()
......
......@@ -387,7 +387,12 @@ class DynamicConversationTab(ConversationTab):
assert(resource)
if resource != self.locked_resource:
self.locked_resource = resource
self.add_message(_('Conversation locked to %s/%s.') % (self.name, resource), typ=0)
message = _('\x19%s}Conversation locked to %s/%s.') % (
dump_tuple(get_theme().COLOR_INFORMATION_TEXT),
self.name,
resource)
self.add_message(message, typ=0)
def unlock_command(self, arg=None):
self.unlock()
......@@ -400,10 +405,17 @@ class DynamicConversationTab(ConversationTab):
"""
if self.locked_resource != None:
self.locked_resource = None
if from_:
self.add_message(_('Conversation unlocked (received activity from %s).') % from_, typ=0)
message = _('\x19%s}Conversation unlocked '
'(received activity from %s).') % (
dump_tuple(get_theme().COLOR_INFORMATION_TEXT),
from_)
self.add_message(message, typ=0)
else:
self.add_message(_('Conversation unlocked.'), typ=0)
message = _('\x19%s}Conversation unlocked.') % (
dump_tuple(get_theme().COLOR_INFORMATION_TEXT))
self.add_message(message, typ=0)
def get_dest_jid(self):
"""
......
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