Make the features disco in chat more user-friendly

This commit is contained in:
mathieui 2014-10-25 16:50:19 +02:00
parent 0dc36d9598
commit d2ca062eaa
No known key found for this signature in database
GPG key ID: C59F84CEEFD616E3
2 changed files with 12 additions and 25 deletions

View file

@ -817,32 +817,17 @@ class OneToOneTab(ChatTab):
else: else:
self.__initial_disco = True self.__initial_disco = True
empty = not any((correct, attention, receipts)) ok = get_theme().CHAR_OK
nope = get_theme().CHAR_ERROR
features = [] correct = ok if correct else nope
if correct or empty: attention = ok if attention else nope
features.append(_('message correction (/correct)')) receipts = ok if receipts else nope
if attention or empty:
features.append(_('attention requests (/attention)'))
if (receipts or empty) \
and config.get('request_message_receipts'):
features.append(_('message delivery receipts'))
if len(features) > 1:
tail = features.pop()
else:
tail = None
features_str = ', '.join(features)
if tail and empty:
features_str += _(', nor %s') % tail
elif tail:
features_str += _(' and %s') % tail
if empty: msg = _('\x19%s}Contact supports: correction [%s], '
msg = _('\x19%s}This contact does not support %s.') 'attention [%s], receipts [%s].')
else:
msg = _('\x19%s}This contact supports %s.')
color = dump_tuple(get_theme().COLOR_INFORMATION_TEXT) color = dump_tuple(get_theme().COLOR_INFORMATION_TEXT)
msg = msg % (color, features_str) msg = msg % (color, correct, attention, receipts)
self.add_message(msg, typ=0) self.add_message(msg, typ=0)
self.core.refresh_window() self.core.refresh_window()

View file

@ -301,10 +301,12 @@ class Theme(object):
CHAR_QUIT = '<---' CHAR_QUIT = '<---'
CHAR_KICK = '-!-' CHAR_KICK = '-!-'
CHAR_NEW_TEXT_SEPARATOR = '- ' CHAR_NEW_TEXT_SEPARATOR = '- '
CHAR_ACK_RECEIVED = '' CHAR_OK = ''
CHAR_ERROR = ''
CHAR_ACK_RECEIVED = CHAR_OK
CHAR_COLUMN_ASC = '' CHAR_COLUMN_ASC = ''
CHAR_COLUMN_DESC = '' CHAR_COLUMN_DESC = ''
CHAR_ROSTER_ERROR = '' CHAR_ROSTER_ERROR = CHAR_ERROR
CHAR_ROSTER_TUNE = '' CHAR_ROSTER_TUNE = ''
CHAR_ROSTER_ASKED = '?' CHAR_ROSTER_ASKED = '?'
CHAR_ROSTER_ACTIVITY = 'A' CHAR_ROSTER_ACTIVITY = 'A'