Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
norstbox
gajim
Commits
ae4c98cb
Verified
Commit
ae4c98cb
authored
Mar 17, 2019
by
Malte L
Browse files
Show trust level for incoming encrypted messages
parent
5af7fbd4
Changes
2
Hide whitespace changes
Inline
Side-by-side
gajim/common/const.py
View file @
ae4c98cb
...
...
@@ -199,6 +199,12 @@ class MUCUser(IntEnum):
AFFILIATION
=
3
AFFILIATION_TEXT
=
4
@
unique
class
Trust
(
IntEnum
):
UNTRUSTED
=
0
UNDECIDED
=
1
BLIND
=
2
VERIFIED
=
3
EME_MESSAGES
=
{
'urn:xmpp:otr:0'
:
...
...
gajim/conversation_textview.py
View file @
ae4c98cb
...
...
@@ -44,7 +44,7 @@ from gajim.common import i18n
from
gajim.common.i18n
import
_
from
gajim.common.helpers
import
AdditionalDataDict
from
gajim.common.fuzzyclock
import
FuzzyClock
from
gajim.common.const
import
StyleAttr
from
gajim.common.const
import
StyleAttr
,
Trust
from
gajim.gtk
import
util
from
gajim.gtk.util
import
load_icon
...
...
@@ -60,6 +60,22 @@ SHOWN = 2
log
=
logging
.
getLogger
(
'gajim.conversation_textview'
)
TRUST_SYMBOL_DATA
=
{
Trust
.
UNTRUSTED
:
(
'dialog-error-symbolic'
,
_
(
'Untrusted'
),
'error-color'
),
Trust
.
UNDECIDED
:
(
'security-low-symbolic'
,
_
(
'Trust Not Decided'
),
'warning-color'
),
Trust
.
BLIND
:
(
'security-medium-symbolic'
,
_
(
'Unverified'
),
'success-color'
),
Trust
.
VERIFIED
:
(
'security-high-symbolic'
,
_
(
'Verified'
),
'encrypted-color'
)
}
def
is_selection_modified
(
mark
):
name
=
mark
.
get_name
()
return
name
in
(
'selection_bound'
,
'insert'
)
...
...
@@ -1133,13 +1149,17 @@ class ConversationTextview(GObject.GObject):
color
=
'unencrypted-color'
tooltip
=
_
(
'Not encrypted'
)
else
:
icon
=
'channel-secure-symbolic'
color
=
'encrypted-color'
name
,
fingerprint
=
details
if
fingerprint
is
None
:
tooltip
=
name
name
,
fingerprint
,
trust
=
details
tooltip
=
_
(
'Encrypted (%s)'
)
%
(
name
)
if
trust
is
None
:
# The encryption plugin did not pass trust information
icon
=
'channel-secure-symbolic'
color
=
'encrypted-color'
else
:
tooltip
=
'%s %s'
%
(
name
,
fingerprint
)
icon
,
trust_tooltip
,
color
=
TRUST_SYMBOL_DATA
[
trust
]
tooltip
=
tooltip
+
'
\n
'
+
trust_tooltip
if
fingerprint
is
not
None
:
tooltip
=
tooltip
+
' ('
+
fingerprint
+
')'
temp_mark
=
self
.
_buffer
.
create_mark
(
None
,
iter_
,
True
)
self
.
_buffer
.
insert
(
iter_
,
' '
)
...
...
@@ -1164,7 +1184,8 @@ class ConversationTextview(GObject.GObject):
return
fingerprint
=
additional_data
.
get_value
(
'encrypted'
,
'fingerprint'
)
return
name
,
fingerprint
trust
=
additional_data
.
get_value
(
'encrypted'
,
'trust'
)
return
name
,
fingerprint
,
trust
def
print_time
(
self
,
text
,
kind
,
tim
,
simple
,
direction_mark
,
other_tags_for_time
,
iter_
):
local_tim
=
time
.
localtime
(
tim
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment