add Phishing warning when copying url
authorPaul <paul@claws-mail.org>
Wed, 3 Jun 2020 13:22:03 +0000 (14:22 +0100)
committerPaul <paul@claws-mail.org>
Wed, 3 Jun 2020 13:22:03 +0000 (14:22 +0100)
closes RFE 4348 'display the phishing pop on "copy this libnk"' and ends continual badgering

src/textview.c

index ea20c125d55986d1a47f901df570e30e4aa6bf87..a76d88e2ea396af6d6e6b9d818214e6d935f6109 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2016 Hiroyuki Yamamoto and the Claws Mail team
+ * Copyright (C) 1999-2020 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
@@ -2976,16 +2976,16 @@ 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) {
-               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);
+               if (textview_uri_security_check(textview, uri) == 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);
+               }
        }
        if (raw_url) {
                gtk_clipboard_set_text(gtk_clipboard_get(GDK_SELECTION_PRIMARY), raw_url, -1);
                gtk_clipboard_set_text(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD), raw_url, -1);
-               g_object_set_data(G_OBJECT(textview->link_popup_menu), "raw_url",
-                         NULL);
+               g_object_set_data(G_OBJECT(textview->link_popup_menu), "raw_url", NULL);
        }
 }