From db8111c295f38051f9bff8c010717f561725248a Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 18 May 2014 13:53:30 +0200 Subject: Handle the case where the contact does not support anything --- src/tabs/basetabs.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/tabs/basetabs.py b/src/tabs/basetabs.py index 44066955..c2efc9bc 100644 --- a/src/tabs/basetabs.py +++ b/src/tabs/basetabs.py @@ -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) -- cgit v1.2.3