[Commits] [SCM] claws branch, master, updated. 3.18.0-62-gf38052f97

wwp at claws-mail.org wwp at claws-mail.org
Thu Sep 2 12:52:46 UTC 2021


The branch, master has been updated
       via  f38052f971fdb9842930f7dee4a3e29c3a4f1490 (commit)
      from  2017d00797cc73c76aa8466a16093bfd1432fc15 (commit)

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


- Log -----------------------------------------------------------------
commit f38052f971fdb9842930f7dee4a3e29c3a4f1490
Author: wwp <subscript at free.fr>
Date:   Thu Sep 2 14:47:40 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 d8f053680..473edee86 100644
--- a/src/uri_opener.c
+++ b/src/uri_opener.c
@@ -236,7 +236,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_misc_set_alignment(GTK_MISC(label), 0, 0.5);
 	gtk_box_pack_start(GTK_BOX(vbox1), label, FALSE, TRUE, 0);
 	
@@ -292,9 +293,27 @@ 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) {
+			GdkColor color;
+
+			gtkut_convert_int_to_gdk_color(prefs_common.color[COL_LOG_ERROR], &color);
+			label = g_markup_printf_escaped("<span color=\"%s\"><b>%s</b></span>\n%s",
+						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);
 
@@ -375,9 +394,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