Commit db8111c2 authored by mathieui's avatar mathieui

Handle the case where the contact does not support anything

parent e356c442
......@@ -804,7 +804,6 @@ class OneToOneTab(ChatTab):
def features_checked(self, iq):
"Features check callback"
features = iq['disco_info'].get_features() or []
log.debug('\n\nFEATURES:\n%s\n\n%s\n\n', iq, features)
before = ('correct' in self.commands,
self.remote_supports_attention,
self.remote_supports_receipts)
......@@ -817,22 +816,30 @@ class OneToOneTab(ChatTab):
else:
self.__initial_disco = True
empty = not any((correct, attention, receipts))
features = []
if correct:
if correct or empty:
features.append(_('message correction (/correct)'))
if attention:
if attention or empty:
features.append(_('attention requests (/attention)'))
if receipts and config.get('request_message_receipts', True):
if (receipts or empty) \
and config.get('request_message_receipts', True):
features.append(_('message delivery receipts'))
if len(features) > 1:
tail = features.pop()
else:
tail = None
features_str = ', '.join(features)
if tail:
if tail and empty:
features_str += _(', or %s') % tail
elif tail:
features_str += _(' and %s') % tail
msg = _('\x19%s}This contact supports %s.')
if empty:
msg = _('\x19%s}This contact does not support %s.')
else:
msg = _('\x19%s}This contact supports %s.')
color = dump_tuple(get_theme().COLOR_INFORMATION_TEXT)
msg = msg % (color, features_str)
self.add_message(msg, typ=0)
......
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