diff --git a/src/client/conversation-viewer/conversation-contact-popover.vala b/src/client/conversation-viewer/conversation-contact-popover.vala index f7a95523..3f2dc10c 100644 --- a/src/client/conversation-viewer/conversation-contact-popover.vala +++ b/src/client/conversation-viewer/conversation-contact-popover.vala @@ -41,6 +41,9 @@ public class Conversation.ContactPopover : Gtk.Popover { private GLib.Cancellable load_cancellable = new GLib.Cancellable(); + [GtkChild] + private Gtk.Grid contact_pane; + [GtkChild] private Gtk.Image avatar; @@ -65,6 +68,15 @@ public class Conversation.ContactPopover : Gtk.Popover { [GtkChild] private Gtk.ModelButton load_remote_button; + [GtkChild] + private Gtk.Grid deceptive_pane; + + [GtkChild] + private Gtk.Label forged_email_label; + + [GtkChild] + private Gtk.Label actual_email_label; + private GLib.SimpleActionGroup actions = new GLib.SimpleActionGroup(); @@ -125,40 +137,52 @@ public class Conversation.ContactPopover : Gtk.Popover { } private void update() { - string display_name = this.contact.display_name; - this.contact_name.set_text(display_name); + if (!this.mailbox.is_spoofed()) { + this.contact_pane.show(); + this.deceptive_pane.hide(); - if (!this.contact.display_name_is_email) { - this.contact_address.set_text(this.mailbox.address); + string display_name = this.contact.display_name; + this.contact_name.set_text(display_name); + + if (!this.contact.display_name_is_email) { + this.contact_address.set_text(this.mailbox.address); + } else { + this.contact_name.vexpand = true; + this.contact_name.valign = FILL; + this.contact_address.hide(); + } + + bool is_desktop = this.contact.is_desktop_contact; + + bool starred = false; + bool unstarred = false; + if (is_desktop) { + starred = this.contact.is_favourite; + unstarred = !this.contact.is_favourite; + } + this.starred_button.set_visible(starred); + this.unstarred_button.set_visible(unstarred); + + this.open_button.set_visible(is_desktop); + this.save_button.set_visible(!is_desktop); + this.load_remote_button.set_visible(!is_desktop); + + GLib.SimpleAction load_remote = (GLib.SimpleAction) + actions.lookup_action(ACTION_LOAD_REMOTE); + load_remote.set_state( + new GLib.Variant.boolean( + is_desktop || this.contact.load_remote_resources + ) + ); } else { - this.contact_name.vexpand = true; - this.contact_name.valign = FILL; - this.contact_address.hide(); + this.deceptive_pane.show(); + this.contact_pane.hide(); + + this.forged_email_label.label = Geary.String.reduce_whitespace( + this.mailbox.name + ); + this.actual_email_label.label = this.mailbox.address; } - - bool is_desktop = this.contact.is_desktop_contact; - - bool starred = false; - bool unstarred = false; - if (is_desktop) { - starred = this.contact.is_favourite; - unstarred = !this.contact.is_favourite; - } - this.starred_button.set_visible(starred); - this.unstarred_button.set_visible(unstarred); - - - this.open_button.set_visible(is_desktop); - this.save_button.set_visible(!is_desktop); - this.load_remote_button.set_visible(!is_desktop); - - GLib.SimpleAction load_remote = (GLib.SimpleAction) - actions.lookup_action(ACTION_LOAD_REMOTE); - load_remote.set_state( - new GLib.Variant.boolean( - is_desktop || this.contact.load_remote_resources - ) - ); } private async void open() { diff --git a/src/client/conversation-viewer/conversation-message.vala b/src/client/conversation-viewer/conversation-message.vala index ce8588d0..d423ba55 100644 --- a/src/client/conversation-viewer/conversation-message.vala +++ b/src/client/conversation-viewer/conversation-message.vala @@ -146,9 +146,10 @@ public class ConversationMessage : Gtk.Grid, Geary.BaseInterface { // reduce the chance of the user of being tricked by // malware. primary.set_text(display_address); - this.displayed = new Geary.RFC822.MailboxAddress( - null, this.source.address - ); + // Use the source as the displayed address so that the + // contact popover uses the spoofed mailbox and + // displays it as being spoofed. + this.displayed = this.source; } else if (this.contact.is_trusted) { // The contact's name can be trusted, so no need to // display the email address diff --git a/ui/conversation-contact-popover.ui b/ui/conversation-contact-popover.ui index ca98a8fc..c899fb09 100644 --- a/ui/conversation-contact-popover.ui +++ b/ui/conversation-contact-popover.ui @@ -9,82 +9,69 @@ True False - 10 - 10 - 10 - 10 vertical - + True False - 6 - 12 - - - True - True - end - center - con.star - none - - - True - False - non-starred-symbolic - - - - - 2 - 0 - - - - - True - True - end - center - con.unstar - none - - - True - False - starred-symbolic - - - - - 3 - 0 - - - - - True - False - 48 - - - 0 - 0 - - + 10 + 10 + 10 + 10 + vertical True False - vertical + 6 + 12 - + + True + True + end + center + con.star + none + + + True + False + non-starred-symbolic + + + + + 2 + 0 + + + + + True + True + end + center + con.unstar + none + + + True + False + starred-symbolic + + + + + 3 + 0 + + + + True False - start - end - True + 48 0 @@ -92,30 +79,152 @@ - + True False - start - start - 2 - False - True - middle - + vertical + + + True + False + start + end + True + + + 0 + 0 + + + + + True + False + start + start + 2 + False + True + middle + + + + 0 + 1 + + - 0 - 1 + 1 + 0 - 1 + 0 0 + + + True + False + + + 0 + 1 + + + + + True + True + True + con.new-conversation + New Conversation… + + + 0 + 2 + + + + + True + True + True + con.copy-email + Copy Email Address + + + 0 + 3 + + + + + True + False + + + 0 + 4 + + + + + True + True + True + con.save + Save in Contacts… + + + 0 + 7 + + + + + True + True + True + con.show-conversations + Show Conversations + + + 0 + 5 + + + + + True + True + True + con.open + Open in Contacts + + + 0 + 6 + + + + + True + True + True + con.load-remote + Always Load Remote Images + + + 0 + 8 + + 0 @@ -123,103 +232,129 @@ - - True + False + 10 + 10 + 10 + 10 + vertical + 6 + + + True + False + 12 + + + True + False + 36 + dialog-warning-symbolic + + + 0 + 0 + + + + + True + False + Deceptive email address + + + + 1 + 0 + + + + + 0 + 0 + + + + + True + False + + + 0 + 1 + + + + + True + False + This email address is: + 0 + + + 0 + 2 + + + + + True + False + + + + 0 + 3 + + + + + True + False + But was forged as: + 0 + + + 0 + 4 + + + + + True + False + + + + 0 + 5 + + + + + True + False + The sender may not be trustworthy + 0 + + + 0 + 6 + + 0 1 - - - True - True - True - con.new-conversation - _New Conversation… - - - 0 - 2 - - - - - True - True - True - con.copy-email - Copy Email _Address - - - 0 - 3 - - - - - True - False - - - 0 - 4 - - - - - True - True - True - con.save - Save in Contacts… - - - 0 - 7 - - - - - True - True - True - con.show-conversations - Show Conversations - - - 0 - 5 - - - - - True - True - True - con.open - Open in Contacts - - - 0 - 6 - - - - - True - True - True - con.load-remote - Always Load Remote Images - - - 0 - 8 - -