From 22096d58af13463e5e7eb24d93ad9d656817b415 Mon Sep 17 00:00:00 2001 From: Nulll Date: Mon, 29 May 2017 18:23:49 +0200 Subject: [PATCH 1/5] Update servers.xml --- data/other/servers.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/data/other/servers.xml b/data/other/servers.xml index 617860d5f..be35c0357 100644 --- a/data/other/servers.xml +++ b/data/other/servers.xml @@ -8,6 +8,7 @@ --> + From 2c34dd6d458d2a09731925fa2e7346ac0b545e4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Sun, 11 Jun 2017 01:58:27 +0200 Subject: [PATCH 2/5] Show encryption icon in chat --- .../channel-secure-croped-symbolic.symbolic.png | Bin 0 -> 246 bytes src/chat_control.py | 11 +++-------- src/chat_control_base.py | 6 ++++-- src/common/connection_handlers_events.py | 1 + src/conversation_textview.py | 8 +++++++- src/groupchat_control.py | 15 +++++++++------ 6 files changed, 24 insertions(+), 17 deletions(-) create mode 100644 icons/hicolor/16x16/status/channel-secure-croped-symbolic.symbolic.png diff --git a/icons/hicolor/16x16/status/channel-secure-croped-symbolic.symbolic.png b/icons/hicolor/16x16/status/channel-secure-croped-symbolic.symbolic.png new file mode 100644 index 0000000000000000000000000000000000000000..976c7f8dd5a3e789881c385df48e301de97b1a52 GIT binary patch literal 246 zcmeAS@N?(olHy`uVBq!ia0vp^0zk~o!3HGD9`RZNDVAa<&kznEsNqQI0P-1&gWR1M z)}51i36e~A^mSxl*x1kgCy^D%=PdAuEM{QfI|9OtQ?>b|fr8bZE{-7@!AJY=@-`^& zv~))w&|7o#e8UD||Epmx8W-7<9!;Mz>2=|fhNd7ctLFjPy$lCZdkzXPomUBN_`c6} zifHnhb+a`a>XeJm?bPbfRK1p=7FZ&4xGkt__XPQ`YrmzoF=XfNoooNC^kQ{KV(Yyh kZu^gI*Ix6XoZ$f9#ODh=?;DR literal 0 HcmV?d00001 diff --git a/src/chat_control.py b/src/chat_control.py index db7cca9a4..58e31a67f 100644 --- a/src/chat_control.py +++ b/src/chat_control.py @@ -990,7 +990,7 @@ class ChatControl(ChatControlBase): def get_our_nick(self): return gajim.nicks[self.account] - def print_conversation(self, text, frm='', tim=None, encrypted=False, + def print_conversation(self, text, frm='', tim=None, encrypted=None, subject=None, xhtml=None, simple=False, xep0184_id=None, displaymarking=None, msg_log_id=None, correct_id=None, msg_stanza_id=None, additional_data=None): @@ -1023,12 +1023,6 @@ class ChatControl(ChatControlBase): kind = 'info' name = '' else: - if self.session and self.session.enable_encryption: - # ESessions - if not encrypted: - msg = _('The following message was NOT encrypted') - ChatControlBase.print_conversation_line(self, msg, 'status', - '', tim) if not frm: kind = 'incoming' name = contact.get_shown_name() @@ -1048,7 +1042,8 @@ class ChatControl(ChatControlBase): subject=subject, old_kind=self.old_msg_kind, xhtml=xhtml, simple=simple, xep0184_id=xep0184_id, displaymarking=displaymarking, msg_log_id=msg_log_id, msg_stanza_id=msg_stanza_id, - correct_id=correct_id, additional_data=additional_data) + correct_id=correct_id, additional_data=additional_data, + encrypted=encrypted) if text.startswith('/me ') or text.startswith('/me\n'): self.old_msg_kind = None else: diff --git a/src/chat_control_base.py b/src/chat_control_base.py index ea3324c7c..9dd5acdf2 100644 --- a/src/chat_control_base.py +++ b/src/chat_control_base.py @@ -894,7 +894,8 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools): other_tags_for_name=[], other_tags_for_time=[], other_tags_for_text=[], count_as_new=True, subject=None, old_kind=None, xhtml=None, simple=False, xep0184_id=None, graphics=True, displaymarking=None, msg_log_id=None, - msg_stanza_id=None, correct_id=None, additional_data=None): + msg_stanza_id=None, correct_id=None, additional_data=None, + encrypted=None): """ Print 'chat' type messages correct_id = (message_id, correct_id) @@ -919,7 +920,8 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools): other_tags_for_name, other_tags_for_time, other_tags_for_text, subject, old_kind, xhtml, simple=simple, graphics=graphics, displaymarking=displaymarking, msg_stanza_id=msg_stanza_id, - correct_id=correct_id, additional_data=additional_data) + correct_id=correct_id, additional_data=additional_data, + encrypted=encrypted) if xep0184_id is not None: textview.add_xep0184_mark(xep0184_id) diff --git a/src/common/connection_handlers_events.py b/src/common/connection_handlers_events.py index 312d810ba..d88508203 100644 --- a/src/common/connection_handlers_events.py +++ b/src/common/connection_handlers_events.py @@ -1497,6 +1497,7 @@ class GcMessageReceivedEvent(nec.NetworkIncomingEvent): self.nickname = self.msg_obj.resource self.timestamp = self.msg_obj.timestamp self.xhtml_msgtxt = self.stanza.getXHTML() + self.encrypted = self.msg_obj.encrypted self.correct_id = None # XEP-0308 if gajim.config.get('ignore_incoming_xhtml'): diff --git a/src/conversation_textview.py b/src/conversation_textview.py index b0146b6bf..db481044d 100644 --- a/src/conversation_textview.py +++ b/src/conversation_textview.py @@ -170,6 +170,8 @@ class ConversationTextview(GObject.GObject): MESSAGE_CORRECTED_PIXBUF = gtkgui_helpers.get_icon_pixmap( 'document-edit-symbolic') + MESSAGE_ENCRYPTED_PIXBUF = gtkgui_helpers.get_icon_pixmap( + 'channel-secure-croped-symbolic') # smooth scroll constants MAX_SCROLL_TIME = 0.4 # seconds @@ -1100,7 +1102,8 @@ class ConversationTextview(GObject.GObject): def print_conversation_line(self, text, jid, kind, name, tim, other_tags_for_name=None, other_tags_for_time=None, other_tags_for_text=None, subject=None, old_kind=None, xhtml=None, simple=False, graphics=True, - displaymarking=None, msg_stanza_id=None, correct_id=None, additional_data=None): + displaymarking=None, msg_stanza_id=None, correct_id=None, additional_data=None, + encrypted=None): """ Print 'chat' type messages """ @@ -1168,6 +1171,9 @@ class ConversationTextview(GObject.GObject): self.print_time(text, kind, tim, simple, direction_mark, other_tags_for_time, iter_) + if encrypted: + buffer_.insert_pixbuf(iter_, self.MESSAGE_ENCRYPTED_PIXBUF) + # If there's a displaymarking, print it here. if displaymarking: self.print_displaymarking(displaymarking, iter_=iter_) diff --git a/src/groupchat_control.py b/src/groupchat_control.py index 71cd8aa79..834e709f0 100644 --- a/src/groupchat_control.py +++ b/src/groupchat_control.py @@ -1090,14 +1090,14 @@ class GroupchatControl(ChatControlBase): # don't print xhtml if it's an old message. # Like that xhtml messages are grayed too. self.print_old_conversation(obj.msgtxt, contact=obj.nick, - tim=obj.timestamp, xhtml=None, + tim=obj.timestamp, xhtml=None, encrypted=obj.encrypted, displaymarking=obj.displaymarking, msg_stanza_id=obj.id_) else: if obj.nick == self.nick: self.last_sent_txt = obj.msgtxt self.print_conversation(obj.msgtxt, contact=obj.nick, tim=obj.timestamp, xhtml=obj.xhtml_msgtxt, - displaymarking=obj.displaymarking, + displaymarking=obj.displaymarking, encrypted=obj.encrypted, correct_id=obj.correct_id, msg_stanza_id=obj.id_) obj.needs_highlight = self.needs_visual_notification(obj.msgtxt) @@ -1153,7 +1153,7 @@ class GroupchatControl(ChatControlBase): return None def print_old_conversation(self, text, contact='', tim=None, xhtml = None, - displaymarking=None, msg_stanza_id=None): + displaymarking=None, msg_stanza_id=None, encrypted=None): if contact: if contact == self.nick: # it's us kind = 'outgoing' @@ -1165,13 +1165,16 @@ class GroupchatControl(ChatControlBase): small_attr = ['small'] else: small_attr = [] + ChatControlBase.print_conversation_line(self, text, kind, contact, tim, small_attr, small_attr + ['restored_message'], small_attr + ['restored_message'], count_as_new=False, xhtml=xhtml, - displaymarking=displaymarking, msg_stanza_id=msg_stanza_id) + displaymarking=displaymarking, msg_stanza_id=msg_stanza_id, + encrypted=encrypted) def print_conversation(self, text, contact='', tim=None, xhtml=None, - graphics=True, displaymarking=None, correct_id=None, msg_stanza_id=None): + graphics=True, displaymarking=None, correct_id=None, msg_stanza_id=None, + encrypted=None): """ Print a line in the conversation @@ -1233,7 +1236,7 @@ class GroupchatControl(ChatControlBase): ChatControlBase.print_conversation_line(self, text, kind, contact, tim, other_tags_for_name, [], other_tags_for_text, xhtml=xhtml, graphics=graphics, displaymarking=displaymarking, - correct_id=correct_id, msg_stanza_id=msg_stanza_id) + correct_id=correct_id, msg_stanza_id=msg_stanza_id, encrypted=encrypted) def get_nb_unread(self): type_events = ['printed_marked_gc_msg'] From 209fa4c92634cdd86ee6ae25b34c3ab63630e822 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Sun, 11 Jun 2017 22:54:15 +0200 Subject: [PATCH 3/5] Dont set scrollbar policy in GC config window This crashes Gajim on Windows. Its to be investigated why this happens and how we can avoid it. --- src/config.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/config.py b/src/config.py index 63b3d31d5..ceb138c06 100644 --- a/src/config.py +++ b/src/config.py @@ -2935,7 +2935,6 @@ class GroupchatConfigWindow: self.affiliation_treeview[affiliation].append_column(col) sw = Gtk.ScrolledWindow() - sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.NEVER) sw.add(self.affiliation_treeview[affiliation]) add_on_vbox.pack_start(sw, True, True, 0) gajim.connections[self.account].get_affiliation_list(self.room_jid, From f7754487ccee4f4a1e797225041f53966f6639c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Mon, 12 Jun 2017 22:04:22 +0200 Subject: [PATCH 4/5] Fix Layout issues with long status messages Fixes #8652 --- data/gui/tooltip_gc_contact.ui | 20 +- data/gui/vcard_information_window.ui | 287 ++++++++++++--------------- src/tooltips.py | 2 + src/vcard.py | 16 +- 4 files changed, 149 insertions(+), 176 deletions(-) diff --git a/data/gui/tooltip_gc_contact.ui b/data/gui/tooltip_gc_contact.ui index f4403d913..bfa67bae5 100644 --- a/data/gui/tooltip_gc_contact.ui +++ b/data/gui/tooltip_gc_contact.ui @@ -1,5 +1,5 @@ - + @@ -10,8 +10,8 @@ True False + start start - 0 @@ -26,10 +26,11 @@ True False + start start True + word-char 40 - 0 @@ -44,9 +45,9 @@ True False + start start Jabber ID: - 0 0 @@ -69,9 +70,9 @@ True False + start start Resource: - 0 0 @@ -82,8 +83,8 @@ True False + start start - 0 0 @@ -95,8 +96,8 @@ True False + start start - 0 0 @@ -108,6 +109,7 @@ True False + start True @@ -120,8 +122,8 @@ True False + start True - 0 1 @@ -132,8 +134,8 @@ True False + start True - 0 diff --git a/data/gui/vcard_information_window.ui b/data/gui/vcard_information_window.ui index c14d10f00..8ba56c295 100644 --- a/data/gui/vcard_information_window.ui +++ b/data/gui/vcard_information_window.ui @@ -1,7 +1,7 @@ - + False 12 @@ -20,8 +20,8 @@ True True + start True - 0 False @@ -50,9 +50,10 @@ True False + end + start <b>Jabber ID:</b> True - 1 0 @@ -63,10 +64,10 @@ True False + end + start <b>Resource:</b> True - 1 - 0 0 @@ -77,10 +78,10 @@ True False + end + start <b>Status:</b> True - 1 - 0 0 @@ -91,10 +92,10 @@ True False + end + start <b>Client:</b> True - 1 - 0 0 @@ -105,10 +106,10 @@ True False + end + start <b>System:</b> True - 1 - 0 0 @@ -119,10 +120,10 @@ True False + end + start <b>Contact time:</b> True - 1 - 0 0 @@ -133,10 +134,11 @@ True False + start + start + 5 True - 5 True - 0 1 @@ -153,11 +155,11 @@ True False + start + start + 5 True - 5 True - 0 - 0 @@ -166,38 +168,15 @@ 1 - - - True - False - True - False - - - True - False - True - 5 - True - 0 - 0 - - - - - 1 - 2 - - True False + start + start + 5 True - 5 True - 0 - 0 1 @@ -208,12 +187,12 @@ True False + start + start + 5 True - 5 True True - 0 - 0 1 @@ -224,11 +203,11 @@ True False + start + start + 5 True - 5 True - 0 - 0 1 @@ -240,16 +219,115 @@ False True start - 5 <b>User avatar:</b> True - 0 2 0 + + + False + True + <b>Configured avatar:</b> + True + + + 2 + 0 + + + + + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + start + start + gtk-missing-image + + + 2 + 1 + 7 + + + + + True + False + end + start + <b>Ask:</b> + True + + + 0 + 7 + + + + + True + False + end + start + <b>Subscription:</b> + True + + + 0 + 6 + + + + + True + False + start + start + 5 + True + word-char + True + 20 + 30 + + + 1 + 2 + + + + + True + False + start + start + 5 + True + + + 1 + 6 + + + + + True + False + start + start + 5 + True + + + 1 + 7 + + True @@ -261,8 +339,8 @@ False True - 0 - 0 + start + start gtk-missing-image @@ -273,99 +351,6 @@ 7 - - - False - True - <b>Configured avatar:</b> - True - 0 - - - 2 - 0 - - - - - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - True - 0 - gtk-missing-image - - - 2 - 1 - 7 - - - - - True - False - <b>Ask:</b> - True - 1 - - - 0 - 7 - - - - - True - False - False - - - True - False - True - 5 - 0 - - - - - 1 - 7 - - - - - True - False - <b>Subscription:</b> - True - 1 - - - 0 - 6 - - - - - True - False - False - - - True - False - True - 5 - 0 - - - - - 1 - 6 - - @@ -373,8 +358,6 @@ True False Contact - 0 - 0 False @@ -952,8 +935,6 @@ True False Personal Info - 0 - 0 1 @@ -1353,8 +1334,6 @@ True False Work - 0 - 0 2 @@ -1387,8 +1366,6 @@ True False About - 0 - 0 3 diff --git a/src/tooltips.py b/src/tooltips.py index 3c9d30388..468bc336f 100644 --- a/src/tooltips.py +++ b/src/tooltips.py @@ -31,6 +31,7 @@ from gi.repository import Gtk from gi.repository import Gdk from gi.repository import GLib +from gi.repository import Pango import os import time from datetime import datetime @@ -207,6 +208,7 @@ class StatusTable: self.table.insert_row(self.current_row) self.text_label = Gtk.Label() self.text_label.set_line_wrap(True) + self.text_label.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR) self.text_label.set_max_width_chars(35) self.text_label.set_halign(Gtk.Align.START) self.text_label.set_valign(Gtk.Align.START) diff --git a/src/vcard.py b/src/vcard.py index 6054ee817..be3daf0f3 100644 --- a/src/vcard.py +++ b/src/vcard.py @@ -404,11 +404,8 @@ class VcardWindow: if self.contact.status: stats += ': ' + self.contact.status status_label = self.xml.get_object('status_label') - status_label.set_max_width_chars(15) status_label.set_text(stats) - - status_label_eventbox = self.xml.get_object('status_label_eventbox') - status_label_eventbox.set_tooltip_text(stats) + status_label.set_tooltip_text(stats) def fill_jabber_page(self): self.xml.get_object('nickname_label').set_markup( @@ -430,7 +427,6 @@ class VcardWindow: else: uf_sub = helpers.get_uf_sub(self.contact.sub) subscription_label.set_text(uf_sub) - eb = self.xml.get_object('subscription_label_eventbox') if self.contact.sub == 'from': tt_text = _("This contact is interested in your presence information, but you are not interested in their presence") elif self.contact.sub == 'to': @@ -439,16 +435,15 @@ class VcardWindow: tt_text = _("The contact and you want to exchange presence information") else: # None tt_text = _("You and the contact have a mutual disinterest in each-others presence information") - eb.set_tooltip_text(tt_text) + subscription_label.set_tooltip_text(tt_text) uf_ask = helpers.get_uf_ask(self.contact.ask) ask_label.set_text(uf_ask) - eb = self.xml.get_object('ask_label_eventbox') if self.contact.ask == 'subscribe': tt_text = _("You are waiting contact's answer about your subscription request") else: tt_text = _("There is no pending subscription request.") - eb.set_tooltip_text(tt_text) + ask_label.set_tooltip_text(tt_text) resources = '%s (%s)' % (self.contact.resource, str( self.contact.priority)) @@ -613,11 +608,8 @@ class ZeroconfVcardWindow: if self.contact.status: stats += ': ' + self.contact.status status_label = self.xml.get_object('status_label') - status_label.set_max_width_chars(15) status_label.set_text(stats) - - status_label_eventbox = self.xml.get_object('status_label_eventbox') - status_label_eventbox.set_tooltip_text(stats) + status_label.set_tooltip_text(stats) def fill_contact_page(self): self.xml.get_object('nickname_label').set_markup( From 9dc389cc32f8bc8f51c694f54b5a4785c04c5296 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Mon, 12 Jun 2017 23:32:59 +0200 Subject: [PATCH 5/5] Show warning icon when encryption is disabled 'channel-insecure-symbolic' icon if no encryption is selected 'channel-secure-symbolic' if an encryption is selected --- src/chat_control.py | 1 + src/chat_control_base.py | 15 +++++++++++++++ src/groupchat_control.py | 1 + src/gtkgui_helpers.py | 11 +++++++++-- 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/chat_control.py b/src/chat_control.py index 58e31a67f..1009a8699 100644 --- a/src/chat_control.py +++ b/src/chat_control.py @@ -287,6 +287,7 @@ class ChatControl(ChatControlBase): self.encryption_menu = self.xml.get_object('encryption_menu') self.encryption_menu.set_menu_model( gui_menu_builder.get_encryption_menu(self.contact, self.type_id)) + self.set_encryption_menu_icon() # restore previous conversation self.restore_conversation() self.msg_textview.grab_focus() diff --git a/src/chat_control_base.py b/src/chat_control_base.py index 9dd5acdf2..da7aff3a2 100644 --- a/src/chat_control_base.py +++ b/src/chat_control_base.py @@ -36,6 +36,7 @@ from gi.repository import GObject from gi.repository import GLib from gi.repository import Gio import gtkgui_helpers +from gtkgui_helpers import Color import message_control import dialogs import history_window @@ -442,6 +443,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools): self.terminate_esessions() action.set_state(param) self.set_encryption_state(encryption) + self.set_encryption_menu_icon() self.set_lock_image() def set_encryption_state(self, encryption): @@ -455,6 +457,19 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools): state = gajim.config.get_per('encryption', config_key, 'encryption') return state or None + def set_encryption_menu_icon(self): + for child in self.encryption_menu.get_children(): + if isinstance(child, Gtk.Image): + image = child + break + + if not self.encryption: + icon = gtkgui_helpers.get_icon_pixmap( + 'channel-insecure-symbolic', color=[Color.BLACK]) + else: + icon = gtkgui_helpers.get_icon_pixmap('channel-secure-symbolic') + image.set_from_pixbuf(icon) + def set_speller(self): # now set the one the user selected per_type = 'contacts' diff --git a/src/groupchat_control.py b/src/groupchat_control.py index 834e709f0..ea0eff4f7 100644 --- a/src/groupchat_control.py +++ b/src/groupchat_control.py @@ -493,6 +493,7 @@ class GroupchatControl(ChatControlBase): self.encryption_menu = self.xml.get_object('encryption_menu') self.encryption_menu.set_menu_model( gui_menu_builder.get_encryption_menu(self.contact, self.type_id)) + self.set_encryption_menu_icon() gajim.ged.register_event_handler('gc-presence-received', ged.GUI1, self._nec_gc_presence_received) diff --git a/src/gtkgui_helpers.py b/src/gtkgui_helpers.py index 687daa99e..18db3efb5 100644 --- a/src/gtkgui_helpers.py +++ b/src/gtkgui_helpers.py @@ -53,9 +53,16 @@ from common import configpaths gtk_icon_theme = Gtk.IconTheme.get_default() gtk_icon_theme.append_search_path(gajim.ICONS_DIR) -def get_icon_pixmap(icon_name, size=16, quiet=False): +class Color: + BLACK = Gdk.RGBA(red=0, green=0, blue=0, alpha=1) + +def get_icon_pixmap(icon_name, size=16, color=None, quiet=False): try: - return gtk_icon_theme.load_icon(icon_name, size, 0) + iconinfo = gtk_icon_theme.lookup_icon(icon_name, size, 0) + if color: + pixbuf, was_symbolic = iconinfo.load_symbolic(*color) + return pixbuf + return iconinfo.load_icon() except GLib.GError as e: if not quiet: log.error('Unable to load icon %s: %s' % (icon_name, str(e)))