talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit f621772662b9dd24243f7d732b143c52b420d7de
parent b3e778157ae5fef89ff37ebf4d49726aec63bb7b
Author: paul <paul@claws-mail.org>
Date:   Fri,  3 Sep 2021 12:03:08 +0100

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

Diffstat:
Msrc/textview.c | 19++++++++++++-------
Msrc/textview.h | 5+++--
Msrc/uri_opener.c | 8+++++---
3 files changed, 20 insertions(+), 12 deletions(-)

diff --git 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 @@ -2821,7 +2821,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) { @@ -2870,7 +2870,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; @@ -2895,8 +2895,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" @@ -2905,9 +2910,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, - _("_Cancel"), _("_Open URL"), NULL, ALERTFOCUS_FIRST, + _("_Cancel"), open_or_cp_btn, NULL, ALERTFOCUS_FIRST, FALSE, NULL, ALERT_WARNING); g_free(msg); if (aval == G_ALERTALTERNATE) @@ -2949,7 +2954,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", @@ -2969,7 +2974,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 @@ -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 @@ -1,6 +1,6 @@ /* * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2019 Colin Leroy 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 @@ -416,7 +416,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()); } @@ -445,7 +446,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()); }