Philipp Hörist pushed to branch master at gajim / gajim

Commits:

2 changed files:

Changes:

  • gajim/common/const.py
    ... ... @@ -199,6 +199,12 @@ class MUCUser(IntEnum):
    199 199
         AFFILIATION = 3
    
    200 200
         AFFILIATION_TEXT = 4
    
    201 201
     
    
    202
    +@unique
    
    203
    +class Trust(IntEnum):
    
    204
    +    UNTRUSTED = 0
    
    205
    +    UNDECIDED = 1
    
    206
    +    BLIND = 2
    
    207
    +    VERIFIED = 3
    
    202 208
     
    
    203 209
     EME_MESSAGES = {
    
    204 210
         'urn:xmpp:otr:0':
    

  • gajim/conversation_textview.py
    ... ... @@ -44,7 +44,7 @@ from gajim.common import i18n
    44 44
     from gajim.common.i18n import _
    
    45 45
     from gajim.common.helpers import AdditionalDataDict
    
    46 46
     from gajim.common.fuzzyclock import FuzzyClock
    
    47
    -from gajim.common.const import StyleAttr
    
    47
    +from gajim.common.const import StyleAttr, Trust
    
    48 48
     
    
    49 49
     from gajim.gtk import util
    
    50 50
     from gajim.gtk.util import load_icon
    
    ... ... @@ -60,6 +60,22 @@ SHOWN = 2
    60 60
     
    
    61 61
     log = logging.getLogger('gajim.conversation_textview')
    
    62 62
     
    
    63
    +TRUST_SYMBOL_DATA = {
    
    64
    +    Trust.UNTRUSTED: ('dialog-error-symbolic',
    
    65
    +                      _('Untrusted'),
    
    66
    +                      'error-color'),
    
    67
    +    Trust.UNDECIDED: ('security-low-symbolic',
    
    68
    +                      _('Trust Not Decided'),
    
    69
    +                      'warning-color'),
    
    70
    +    Trust.BLIND: ('security-medium-symbolic',
    
    71
    +                  _('Unverified'),
    
    72
    +                  'success-color'),
    
    73
    +    Trust.VERIFIED: ('security-high-symbolic',
    
    74
    +                     _('Verified'),
    
    75
    +                     'encrypted-color')
    
    76
    +}
    
    77
    +
    
    78
    +
    
    63 79
     def is_selection_modified(mark):
    
    64 80
         name = mark.get_name()
    
    65 81
         return name in ('selection_bound', 'insert')
    
    ... ... @@ -1133,13 +1149,17 @@ class ConversationTextview(GObject.GObject):
    1133 1149
                 color = 'unencrypted-color'
    
    1134 1150
                 tooltip = _('Not encrypted')
    
    1135 1151
             else:
    
    1136
    -            icon = 'channel-secure-symbolic'
    
    1137
    -            color = 'encrypted-color'
    
    1138
    -            name, fingerprint = details
    
    1139
    -            if fingerprint is None:
    
    1140
    -                tooltip = name
    
    1152
    +            name, fingerprint, trust = details
    
    1153
    +            tooltip = _('Encrypted (%s)') % (name)
    
    1154
    +            if trust is None:
    
    1155
    +                # The encryption plugin did not pass trust information
    
    1156
    +                icon = 'channel-secure-symbolic'
    
    1157
    +                color = 'encrypted-color'
    
    1141 1158
                 else:
    
    1142
    -                tooltip = '%s %s' % (name, fingerprint)
    
    1159
    +                icon, trust_tooltip, color = TRUST_SYMBOL_DATA[trust]
    
    1160
    +                tooltip = tooltip + '\n' + trust_tooltip
    
    1161
    +            if fingerprint is not None:
    
    1162
    +                tooltip = tooltip + ' (' + fingerprint + ')'
    
    1143 1163
     
    
    1144 1164
             temp_mark = self._buffer.create_mark(None, iter_, True)
    
    1145 1165
             self._buffer.insert(iter_, ' ')
    
    ... ... @@ -1164,7 +1184,8 @@ class ConversationTextview(GObject.GObject):
    1164 1184
                 return
    
    1165 1185
     
    
    1166 1186
             fingerprint = additional_data.get_value('encrypted', 'fingerprint')
    
    1167
    -        return name, fingerprint
    
    1187
    +        trust = additional_data.get_value('encrypted', 'trust')
    
    1188
    +        return name, fingerprint, trust
    
    1168 1189
     
    
    1169 1190
         def print_time(self, text, kind, tim, simple, direction_mark, other_tags_for_time, iter_):
    
    1170 1191
             local_tim = time.localtime(tim)