[Commits] [SCM] claws branch, master, updated. 3.18.0-71-gd59f6d4b3

paul at claws-mail.org paul at claws-mail.org
Fri Sep 3 11:34:30 UTC 2021


The branch, master has been updated
       via  d59f6d4b3b6389360c67e9ea53adcbc5a277a885 (commit)
      from  78638a992ae6f00f8ea5173d76f802aad4183764 (commit)

Summary of changes:
 src/textview.c   | 19 ++++++++++++-------
 src/textview.h   |  5 +++--
 src/uri_opener.c |  9 +++++----
 3 files changed, 20 insertions(+), 13 deletions(-)


- Log -----------------------------------------------------------------
commit d59f6d4b3b6389360c67e9ea53adcbc5a277a885
Author: Paul <paul at claws-mail.org>
Date:   Fri Sep 3 12:34:26 2021 +0100

    make phishing warning show correct text depending on copy url or open url action

diff --git a/src/textview.c b/src/textview.c
index 3cdf5d911..bd319c169 100644
--- a/src/textview.c
+++ b/src/textview.c
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2020 the Claws Mail team and Hiroyuki Yamamoto
+ * Copyright (C) 1999-2021 the Claws Mail team and Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -2826,7 +2826,7 @@ static gboolean textview_uri_button_pressed(GtkTextTag *tag, GObject *obj,
 			return TRUE;
 		} else if (g_ascii_strncasecmp(uri->uri, "file:", 5)) {
 			if (bevent->button == 1 &&
-			    textview_uri_security_check(textview, uri) == TRUE) 
+			    textview_uri_security_check(textview, uri, FALSE) == TRUE) 
 					open_uri(uri->uri,
 						 prefs_common_get_uri_cmd());
 			else if (bevent->button == 3 && !qlink) {
@@ -2879,7 +2879,7 @@ gchar *textview_get_visible_uri		(TextView 	*textview,
  *\return   gboolean TRUE if the URL is ok, or if the user chose to open
  *          it anyway, otherwise FALSE          
  */
-gboolean textview_uri_security_check(TextView *textview, ClickableText *uri)
+gboolean textview_uri_security_check(TextView *textview, ClickableText *uri, gboolean copied)
 {
 	gchar *visible_str;
 	gboolean retval = TRUE;
@@ -2904,8 +2904,13 @@ gboolean textview_uri_security_check(TextView *textview, ClickableText *uri)
 	}
 
 	if (retval == FALSE) {
+		gchar *open_or_cp;
+		gchar *open_or_cp_btn;
 		gchar *msg;
 		AlertValue aval;
+		
+		open_or_cp = copied? _("Copy it anyway?") : _("Open it anyway?");
+		open_or_cp_btn = copied? _("Co_py URL") : _("_Open URL");
 
 		msg = g_markup_printf_escaped("%s\n\n"
 						"<b>%s</b> %s\n\n"
@@ -2914,9 +2919,9 @@ gboolean textview_uri_security_check(TextView *textview, ClickableText *uri)
 						_("The real URL is different from the displayed URL."),
 						_("Displayed URL:"), visible_str,
 						_("Real URL:"), uri->uri,
-						_("Open it anyway?"));
+						open_or_cp);
 		aval = alertpanel_full(_("Phishing attempt warning"), msg,
-				       GTK_STOCK_CANCEL, _("_Open URL"), NULL, ALERTFOCUS_FIRST,
+				       GTK_STOCK_CANCEL, open_or_cp_btn, NULL, ALERTFOCUS_FIRST,
 							 FALSE, NULL, ALERT_WARNING);
 		g_free(msg);
 		if (aval == G_ALERTALTERNATE)
@@ -2958,7 +2963,7 @@ static void open_uri_cb (GtkAction *action, TextView *textview)
 					   "raw_url");
 
 	if (uri) {
-		if (textview_uri_security_check(textview, uri) == TRUE) 
+		if (textview_uri_security_check(textview, uri, FALSE) == TRUE) 
 			open_uri(uri->uri,
 				 prefs_common_get_uri_cmd());
 		g_object_set_data(G_OBJECT(textview->link_popup_menu), "menu_button",
@@ -2978,7 +2983,7 @@ static void copy_uri_cb	(GtkAction *action, TextView *textview)
 	const gchar *raw_url =  g_object_get_data(G_OBJECT(textview->link_popup_menu),
 					   "raw_url");
 	if (uri) {
-		if (textview_uri_security_check(textview, uri) == TRUE) {
+		if (textview_uri_security_check(textview, uri, TRUE) == TRUE) {
 			gtk_clipboard_set_text(gtk_clipboard_get(GDK_SELECTION_PRIMARY), uri->uri, -1);
 			gtk_clipboard_set_text(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD), uri->uri, -1);
 			g_object_set_data(G_OBJECT(textview->link_popup_menu), "menu_button", NULL);
diff --git a/src/textview.h b/src/textview.h
index 71fc91422..12531378c 100644
--- a/src/textview.h
+++ b/src/textview.h
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2015 Hiroyuki Yamamoto and the Claws Mail team
+ * Copyright (C) 1999-2021 the Claws Mail team and Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -125,7 +125,8 @@ void textview_get_selection_offsets	(TextView 	*textview,
 					 gint 		*sel_start, 
 					 gint		*sel_end);
 gboolean textview_uri_security_check	(TextView 	*textview, 
-					 ClickableText 	*uri);
+					 ClickableText 	*uri,
+					 gboolean	 copied);
 gchar *textview_get_visible_uri		(TextView 	*textview, 
 					 ClickableText 	*uri);
 
diff --git a/src/uri_opener.c b/src/uri_opener.c
index d3c3584a2..f6e161792 100644
--- a/src/uri_opener.c
+++ b/src/uri_opener.c
@@ -1,7 +1,6 @@
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2012 Colin Leroy <colin at colino.net> and 
- * the Claws Mail team
+ * Copyright (C) 1999-2021 Colin Leroy and the Claws Mail team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -422,7 +421,8 @@ static void uri_opener_double_clicked(GtkTreeView		*list_view,
 	if (!uri)
 		return;
 
-	if (textview_uri_security_check(opener.msgview->mimeview->textview, uri) == TRUE) 
+	if (textview_uri_security_check(opener.msgview->mimeview->textview, uri,
+					FALSE) == TRUE) 
 		open_uri(uri->uri,
 			 prefs_common_get_uri_cmd());
 }
@@ -451,7 +451,8 @@ static void uri_opener_open_cb(GtkWidget *widget,
 		if (!uri)
 			continue;
 
-		if (textview_uri_security_check(opener.msgview->mimeview->textview, uri) == TRUE) 
+		if (textview_uri_security_check(opener.msgview->mimeview->textview, uri,
+						FALSE) == TRUE) 
 			open_uri(uri->uri,
 				 prefs_common_get_uri_cmd());
 	}

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list