[Commits] [SCM] claws branch, gtk3, updated. 4.0.0-102-g8dfa8ce7b

wwp at claws-mail.org wwp at claws-mail.org
Thu Sep 2 12:53:01 UTC 2021


The branch, gtk3 has been updated
       via  8dfa8ce7b3e9bbb15cb3a452a6c0dfa1a62fd744 (commit)
      from  7e9c97707e10bdd7b18387e4c65431b746bb4a48 (commit)

Summary of changes:
 src/uri_opener.c | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)


- Log -----------------------------------------------------------------
commit 8dfa8ce7b3e9bbb15cb3a452a6c0dfa1a62fd744
Author: wwp <subscript at free.fr>
Date:   Thu Sep 2 14:52:56 2021 +0200

    URL list: show phishing attempts links in red (in fact using log window's error color,
    which is customizable as a hidden pref).

diff --git a/src/uri_opener.c b/src/uri_opener.c
index 34326d9a5..d9d7b4331 100644
--- a/src/uri_opener.c
+++ b/src/uri_opener.c
@@ -234,7 +234,8 @@ static void uri_opener_create(void)
 
 	urilist = uri_opener_list_view_create();
 	
-	label = gtk_label_new(_("Please select the URL to open."));
+	label = gtk_label_new(_("Please select the URL to open.\n"
+							"Possible phishing attempts are shown in red, if any."));
 	gtk_label_set_xalign(GTK_LABEL(label), 0.0);
 	gtk_box_pack_start(GTK_BOX(vbox1), label, FALSE, TRUE, 0);
 	
@@ -291,9 +292,24 @@ static void uri_opener_list_view_insert_uri(GtkWidget *list_view,
 	gchar *visible = textview_get_visible_uri(opener.msgview->mimeview->textview, uri);
 	
 	gchar *label = NULL;
-	
-	if (visible && strcmp(visible, uri->uri))
-		label = g_markup_printf_escaped("<b>%s</b>\n%s", visible, uri->uri);
+
+	if (visible && strcmp(visible, uri->uri)) {
+		gboolean phishing_attempt = TRUE;
+		if (strcmp(visible, uri->uri) != 0 && is_uri_string(visible)) {
+		    gchar *uri_path;
+		    gchar *visible_uri_path;
+
+		    uri_path = get_uri_path(uri->uri);
+		    visible_uri_path = get_uri_path(visible);
+		    if (path_cmp(uri_path, visible_uri_path) != 0)
+			    phishing_attempt = FALSE;
+	    }
+		if (phishing_attempt) {
+			label = g_markup_printf_escaped("<span color=\"%s\"><b>%s</b></span>\n%s",
+						gtkut_gdk_rgba_to_string(&prefs_common.color[COL_LOG_ERROR]), visible, uri->uri);
+		} else
+			label = g_markup_printf_escaped("<b>%s</b>\n%s", visible, uri->uri);
+	}
 	else
 		label = g_markup_printf_escaped("\n%s", uri->uri);
 
@@ -374,9 +390,9 @@ static gboolean key_pressed(GtkWidget *widget, GdkEventKey *event, gpointer data
 		if ((event->keyval == GDK_KEY_c || event->keyval == GDK_KEY_x) &&
 				(event->state & GDK_CONTROL_MASK)) {
 			uri_opener_list_copy_cb(NULL, NULL);
-            return TRUE;
+			return TRUE;
 		}
-    }
+	}
 
 	return FALSE;
 }

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list