diff options
author | mathieui <mathieui@mathieui.net> | 2014-05-18 13:53:30 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2014-05-18 13:53:30 +0200 |
commit | db8111c295f38051f9bff8c010717f561725248a (patch) | |
tree | 8d7a59e6b34039159b74c136442cd5e16cf79036 | |
parent | e356c442b2ab240d9a96b07f946b6f3e86b260c8 (diff) | |
download | poezio-db8111c295f38051f9bff8c010717f561725248a.tar.gz poezio-db8111c295f38051f9bff8c010717f561725248a.tar.bz2 poezio-db8111c295f38051f9bff8c010717f561725248a.tar.xz poezio-db8111c295f38051f9bff8c010717f561725248a.zip |
Handle the case where the contact does not support anything
-rw-r--r-- | src/tabs/basetabs.py | 19 |
1 files changed, 13 insertions, 6 deletions
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) |