Philipp Hörist pushed to branch master at gajim / gajim
Commits:
-
2c34dd6d
by Philipp Hörist at 2017-06-11T20:06:34+02:00
6 changed files:
- + icons/hicolor/16x16/status/channel-secure-croped-symbolic.symbolic.png
- src/chat_control.py
- src/chat_control_base.py
- src/common/connection_handlers_events.py
- src/conversation_textview.py
- src/groupchat_control.py
Changes:
No preview for this file type
| ... | ... | @@ -990,7 +990,7 @@ class ChatControl(ChatControlBase): |
| 990 | 990 |
def get_our_nick(self):
|
| 991 | 991 |
return gajim.nicks[self.account]
|
| 992 | 992 |
|
| 993 |
- def print_conversation(self, text, frm='', tim=None, encrypted=False,
|
|
| 993 |
+ def print_conversation(self, text, frm='', tim=None, encrypted=None,
|
|
| 994 | 994 |
subject=None, xhtml=None, simple=False, xep0184_id=None,
|
| 995 | 995 |
displaymarking=None, msg_log_id=None, correct_id=None,
|
| 996 | 996 |
msg_stanza_id=None, additional_data=None):
|
| ... | ... | @@ -1023,12 +1023,6 @@ class ChatControl(ChatControlBase): |
| 1023 | 1023 |
kind = 'info'
|
| 1024 | 1024 |
name = ''
|
| 1025 | 1025 |
else:
|
| 1026 |
- if self.session and self.session.enable_encryption:
|
|
| 1027 |
- # ESessions
|
|
| 1028 |
- if not encrypted:
|
|
| 1029 |
- msg = _('The following message was NOT encrypted')
|
|
| 1030 |
- ChatControlBase.print_conversation_line(self, msg, 'status',
|
|
| 1031 |
- '', tim)
|
|
| 1032 | 1026 |
if not frm:
|
| 1033 | 1027 |
kind = 'incoming'
|
| 1034 | 1028 |
name = contact.get_shown_name()
|
| ... | ... | @@ -1048,7 +1042,8 @@ class ChatControl(ChatControlBase): |
| 1048 | 1042 |
subject=subject, old_kind=self.old_msg_kind, xhtml=xhtml,
|
| 1049 | 1043 |
simple=simple, xep0184_id=xep0184_id, displaymarking=displaymarking,
|
| 1050 | 1044 |
msg_log_id=msg_log_id, msg_stanza_id=msg_stanza_id,
|
| 1051 |
- correct_id=correct_id, additional_data=additional_data)
|
|
| 1045 |
+ correct_id=correct_id, additional_data=additional_data,
|
|
| 1046 |
+ encrypted=encrypted)
|
|
| 1052 | 1047 |
if text.startswith('/me ') or text.startswith('/me\n'):
|
| 1053 | 1048 |
self.old_msg_kind = None
|
| 1054 | 1049 |
else:
|
| ... | ... | @@ -894,7 +894,8 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools): |
| 894 | 894 |
other_tags_for_name=[], other_tags_for_time=[], other_tags_for_text=[],
|
| 895 | 895 |
count_as_new=True, subject=None, old_kind=None, xhtml=None, simple=False,
|
| 896 | 896 |
xep0184_id=None, graphics=True, displaymarking=None, msg_log_id=None,
|
| 897 |
- msg_stanza_id=None, correct_id=None, additional_data=None):
|
|
| 897 |
+ msg_stanza_id=None, correct_id=None, additional_data=None,
|
|
| 898 |
+ encrypted=None):
|
|
| 898 | 899 |
"""
|
| 899 | 900 |
Print 'chat' type messages
|
| 900 | 901 |
correct_id = (message_id, correct_id)
|
| ... | ... | @@ -919,7 +920,8 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools): |
| 919 | 920 |
other_tags_for_name, other_tags_for_time, other_tags_for_text,
|
| 920 | 921 |
subject, old_kind, xhtml, simple=simple, graphics=graphics,
|
| 921 | 922 |
displaymarking=displaymarking, msg_stanza_id=msg_stanza_id,
|
| 922 |
- correct_id=correct_id, additional_data=additional_data)
|
|
| 923 |
+ correct_id=correct_id, additional_data=additional_data,
|
|
| 924 |
+ encrypted=encrypted)
|
|
| 923 | 925 |
|
| 924 | 926 |
if xep0184_id is not None:
|
| 925 | 927 |
textview.add_xep0184_mark(xep0184_id)
|
| ... | ... | @@ -1497,6 +1497,7 @@ class GcMessageReceivedEvent(nec.NetworkIncomingEvent): |
| 1497 | 1497 |
self.nickname = self.msg_obj.resource
|
| 1498 | 1498 |
self.timestamp = self.msg_obj.timestamp
|
| 1499 | 1499 |
self.xhtml_msgtxt = self.stanza.getXHTML()
|
| 1500 |
+ self.encrypted = self.msg_obj.encrypted
|
|
| 1500 | 1501 |
self.correct_id = None # XEP-0308
|
| 1501 | 1502 |
|
| 1502 | 1503 |
if gajim.config.get('ignore_incoming_xhtml'):
|
| ... | ... | @@ -170,6 +170,8 @@ class ConversationTextview(GObject.GObject): |
| 170 | 170 |
|
| 171 | 171 |
MESSAGE_CORRECTED_PIXBUF = gtkgui_helpers.get_icon_pixmap(
|
| 172 | 172 |
'document-edit-symbolic')
|
| 173 |
+ MESSAGE_ENCRYPTED_PIXBUF = gtkgui_helpers.get_icon_pixmap(
|
|
| 174 |
+ 'channel-secure-croped-symbolic')
|
|
| 173 | 175 |
|
| 174 | 176 |
# smooth scroll constants
|
| 175 | 177 |
MAX_SCROLL_TIME = 0.4 # seconds
|
| ... | ... | @@ -1100,7 +1102,8 @@ class ConversationTextview(GObject.GObject): |
| 1100 | 1102 |
def print_conversation_line(self, text, jid, kind, name, tim,
|
| 1101 | 1103 |
other_tags_for_name=None, other_tags_for_time=None, other_tags_for_text=None,
|
| 1102 | 1104 |
subject=None, old_kind=None, xhtml=None, simple=False, graphics=True,
|
| 1103 |
- displaymarking=None, msg_stanza_id=None, correct_id=None, additional_data=None):
|
|
| 1105 |
+ displaymarking=None, msg_stanza_id=None, correct_id=None, additional_data=None,
|
|
| 1106 |
+ encrypted=None):
|
|
| 1104 | 1107 |
"""
|
| 1105 | 1108 |
Print 'chat' type messages
|
| 1106 | 1109 |
"""
|
| ... | ... | @@ -1168,6 +1171,9 @@ class ConversationTextview(GObject.GObject): |
| 1168 | 1171 |
self.print_time(text, kind, tim, simple, direction_mark,
|
| 1169 | 1172 |
other_tags_for_time, iter_)
|
| 1170 | 1173 |
|
| 1174 |
+ if encrypted:
|
|
| 1175 |
+ buffer_.insert_pixbuf(iter_, self.MESSAGE_ENCRYPTED_PIXBUF)
|
|
| 1176 |
+ |
|
| 1171 | 1177 |
# If there's a displaymarking, print it here.
|
| 1172 | 1178 |
if displaymarking:
|
| 1173 | 1179 |
self.print_displaymarking(displaymarking, iter_=iter_)
|
| ... | ... | @@ -1090,14 +1090,14 @@ class GroupchatControl(ChatControlBase): |
| 1090 | 1090 |
# don't print xhtml if it's an old message.
|
| 1091 | 1091 |
# Like that xhtml messages are grayed too.
|
| 1092 | 1092 |
self.print_old_conversation(obj.msgtxt, contact=obj.nick,
|
| 1093 |
- tim=obj.timestamp, xhtml=None,
|
|
| 1093 |
+ tim=obj.timestamp, xhtml=None, encrypted=obj.encrypted,
|
|
| 1094 | 1094 |
displaymarking=obj.displaymarking, msg_stanza_id=obj.id_)
|
| 1095 | 1095 |
else:
|
| 1096 | 1096 |
if obj.nick == self.nick:
|
| 1097 | 1097 |
self.last_sent_txt = obj.msgtxt
|
| 1098 | 1098 |
self.print_conversation(obj.msgtxt, contact=obj.nick,
|
| 1099 | 1099 |
tim=obj.timestamp, xhtml=obj.xhtml_msgtxt,
|
| 1100 |
- displaymarking=obj.displaymarking,
|
|
| 1100 |
+ displaymarking=obj.displaymarking, encrypted=obj.encrypted,
|
|
| 1101 | 1101 |
correct_id=obj.correct_id, msg_stanza_id=obj.id_)
|
| 1102 | 1102 |
obj.needs_highlight = self.needs_visual_notification(obj.msgtxt)
|
| 1103 | 1103 |
|
| ... | ... | @@ -1153,7 +1153,7 @@ class GroupchatControl(ChatControlBase): |
| 1153 | 1153 |
return None
|
| 1154 | 1154 |
|
| 1155 | 1155 |
def print_old_conversation(self, text, contact='', tim=None, xhtml = None,
|
| 1156 |
- displaymarking=None, msg_stanza_id=None):
|
|
| 1156 |
+ displaymarking=None, msg_stanza_id=None, encrypted=None):
|
|
| 1157 | 1157 |
if contact:
|
| 1158 | 1158 |
if contact == self.nick: # it's us
|
| 1159 | 1159 |
kind = 'outgoing'
|
| ... | ... | @@ -1165,13 +1165,16 @@ class GroupchatControl(ChatControlBase): |
| 1165 | 1165 |
small_attr = ['small']
|
| 1166 | 1166 |
else:
|
| 1167 | 1167 |
small_attr = []
|
| 1168 |
+ |
|
| 1168 | 1169 |
ChatControlBase.print_conversation_line(self, text, kind, contact, tim,
|
| 1169 | 1170 |
small_attr, small_attr + ['restored_message'],
|
| 1170 | 1171 |
small_attr + ['restored_message'], count_as_new=False, xhtml=xhtml,
|
| 1171 |
- displaymarking=displaymarking, msg_stanza_id=msg_stanza_id)
|
|
| 1172 |
+ displaymarking=displaymarking, msg_stanza_id=msg_stanza_id,
|
|
| 1173 |
+ encrypted=encrypted)
|
|
| 1172 | 1174 |
|
| 1173 | 1175 |
def print_conversation(self, text, contact='', tim=None, xhtml=None,
|
| 1174 |
- graphics=True, displaymarking=None, correct_id=None, msg_stanza_id=None):
|
|
| 1176 |
+ graphics=True, displaymarking=None, correct_id=None, msg_stanza_id=None,
|
|
| 1177 |
+ encrypted=None):
|
|
| 1175 | 1178 |
"""
|
| 1176 | 1179 |
Print a line in the conversation
|
| 1177 | 1180 |
|
| ... | ... | @@ -1233,7 +1236,7 @@ class GroupchatControl(ChatControlBase): |
| 1233 | 1236 |
ChatControlBase.print_conversation_line(self, text, kind, contact, tim,
|
| 1234 | 1237 |
other_tags_for_name, [], other_tags_for_text, xhtml=xhtml,
|
| 1235 | 1238 |
graphics=graphics, displaymarking=displaymarking,
|
| 1236 |
- correct_id=correct_id, msg_stanza_id=msg_stanza_id)
|
|
| 1239 |
+ correct_id=correct_id, msg_stanza_id=msg_stanza_id, encrypted=encrypted)
|
|
| 1237 | 1240 |
|
| 1238 | 1241 |
def get_nb_unread(self):
|
| 1239 | 1242 |
type_events = ['printed_marked_gc_msg']
|