2004-11-14 [colin] 0.9.12cvs146.9
authorColin Leroy <colin@colino.net>
Sun, 14 Nov 2004 19:14:35 +0000 (19:14 +0000)
committerColin Leroy <colin@colino.net>
Sun, 14 Nov 2004 19:14:35 +0000 (19:14 +0000)
* src/textview.c
Fix uri_security_check
Patch by Alfons

ChangeLog-gtk2.claws
PATCHSETS
configure.ac
src/textview.c

index 948c7521f3fab02ccb065ec19fa529160228c8fd..ed1c85eba29a05484bf6b9b8bc4ab851d1b6cc1e 100644 (file)
@@ -1,3 +1,9 @@
+2004-11-14 [colin]     0.9.12cvs146.9
+
+       * src/textview.c
+               Fix uri_security_check
+               Patch by Alfons
+
 2004-11-13 [paul]      0.9.12cvs146.8
 
        * src/folder.c
index 14979659b923cff98423e26f7937035db8aabd62..6632d291968bb3f73ba7197b42b269adbb20fcfb 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.382.2.62 -r 1.382.2.63 src/compose.c; cvs diff -u -r 1.179.2.12 -r 1.179.2.13 src/imap.c; cvs diff -u -r 1.4.2.2 -r 1.4.2.3 src/matcher_parser.h; cvs diff -u -r 1.25.2.5 -r 1.25.2.6 src/matcher_parser_parse.y; cvs diff -u -r 1.59.2.8 -r 1.59.2.9 src/prefs_filtering.c; cvs diff -u -r 1.1.4.7 -r 1.1.4.8 src/prefs_filtering_action.c; cvs diff -u -r 1.3.2.9 -r 1.3.2.10 src/prefs_themes.c; cvs diff -u -r 1.30.2.5 -r 1.30.2.6 src/prefs_toolbar.c; cvs diff -u -r 1.36.2.14 -r 1.36.2.15 src/common/utils.c; ) > 0.9.12cvs146.6.patchset
 ( cvs diff -u -r 1.382.2.63 -r 1.382.2.64 src/compose.c; cvs diff -u -r 1.5.2.3 -r 1.5.2.4 src/exporthtml.c; cvs diff -u -r 1.1.4.3 -r 1.1.4.4 src/exportldif.c; cvs diff -u -r 1.213.2.20 -r 1.213.2.21 src/folder.c; cvs diff -u -r 1.179.2.13 -r 1.179.2.14 src/imap.c; cvs diff -u -r 1.1.2.3 -r 1.1.2.4 src/imap_gtk.c; cvs diff -u -r 1.115.2.22 -r 1.115.2.23 src/main.c; cvs diff -u -r 1.274.2.23 -r 1.274.2.24 src/mainwindow.c; cvs diff -u -r 1.94.2.32 -r 1.94.2.33 src/messageview.c; cvs diff -u -r 1.2.2.3 -r 1.2.2.4 src/mh_gtk.c; cvs diff -u -r 1.3.2.10 -r 1.3.2.11 src/prefs_themes.c; cvs diff -u -r 1.49.2.19 -r 1.49.2.20 src/procmime.c; cvs diff -u -r 1.5.2.2 -r 1.5.2.3 src/setup.c; cvs diff -u -r 1.395.2.39 -r 1.395.2.40 src/summaryview.c; ) > 0.9.12cvs146.7.patchset
 ( cvs diff -u -r 1.213.2.21 -r 1.213.2.22 src/folder.c; cvs diff -u -r 1.49.2.20 -r 1.49.2.21 src/procmime.c; ) > 0.9.12cvs146.8.patchset
+( cvs diff -u -r 1.96.2.34 -r 1.96.2.35 src/textview.c; ) > 0.9.12cvs146.9.patchset
index 121e5a57f7008b10c17d7a047216e2158a30ab87..e1b3c3f6a74401ab343a40334b1092795ee6740d 100644 (file)
@@ -13,7 +13,7 @@ INTERFACE_AGE=0
 BINARY_AGE=0
 EXTRA_VERSION=146
 EXTRA_RELEASE=
-EXTRA_GTK2_VERSION=.8
+EXTRA_GTK2_VERSION=.9
 
 if test \( $EXTRA_VERSION -eq 0 \) -o \( "x$EXTRA_RELEASE" != "x" \); then
     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}${EXTRA_RELEASE}${EXTRA_GTK2_VERSION}
index 9658e8f8cc4c9b225c41c5360e47fac0e64486fc..ba97f5076b9b1dc80d443a93bb81ebf4a75321dc 100644 (file)
@@ -1824,70 +1824,6 @@ static gint textview_key_pressed(GtkWidget *widget, GdkEventKey *event,
        return TRUE;
 }
 
-/*!
- *\brief    Check to see if a web URL has been disguised as a different
- *          URL (possible with HTML email).
- *
- *\param    uri The uri to check
- *
- *\param    textview The TextView the URL is contained in
- *
- *\return   gboolean TRUE if the URL is ok, or if the user chose to open
- *          it anyway, otherwise FALSE          
- */
-static gboolean uri_security_check(RemoteURI *uri, TextView *textview) 
-{
-       gchar *clicked_str;
-       gboolean retval = TRUE;
-
-       if (g_ascii_strncasecmp(uri->uri, "http:", 5) &&
-           g_ascii_strncasecmp(uri->uri, "https:", 6) &&
-           g_ascii_strncasecmp(uri->uri, "www.", 4)) 
-               return retval;
-
-       clicked_str = gtk_editable_get_chars(GTK_EDITABLE(textview->text),
-                                            uri->start,
-                                            uri->end);
-       if (clicked_str == NULL)
-               return TRUE;
-
-       if (strcmp(clicked_str, uri->uri) &&
-           (!g_ascii_strncasecmp(clicked_str, "http:",  5) ||
-            !g_ascii_strncasecmp(clicked_str, "https:", 6) ||
-            !g_ascii_strncasecmp(clicked_str, "www.",   4))) {
-               gchar *str;
-               retval = FALSE;
-
-               /* allow uri->uri    == http://somewhere.com
-                  and   clicked_str ==        somewhere.com */
-               str = g_strconcat("http://", clicked_str, NULL);
-
-               if (!g_ascii_strcasecmp(str, uri->uri))
-                       retval = TRUE;
-               g_free(str);
-       }
-
-       if (retval == FALSE) {
-               gchar *msg = NULL;
-               AlertValue resp;
-
-               msg = g_strdup_printf(_("The real URL (%s) is different from\n"
-                                       "the apparent URL (%s).  \n"
-                                       "Open it anyway?"),
-                                       uri->uri, clicked_str);
-               resp = alertpanel_with_type(_("Warning"), 
-                                 msg,
-                                 _("Yes"), 
-                                 _("No"),
-                                 NULL, NULL, ALERT_WARNING);
-               g_free(msg);
-               if (resp == G_ALERTDEFAULT)
-                       retval = TRUE;
-       } 
-       g_free(clicked_str);
-       return retval;
-}
-
 static gboolean textview_motion_notify(GtkWidget *widget,
                                       GdkEventMotion *event,
                                       TextView *textview)
@@ -2163,12 +2099,19 @@ static gboolean textview_uri_security_check(TextView *textview, RemoteURI *uri)
 {
        gchar *visible_str;
        gboolean retval = TRUE;
+       GtkTextBuffer *buffer;
+       GtkTextIter start, end;
 
        if (is_uri_string(uri->uri) == FALSE)
                return TRUE;
 
-       visible_str = gtk_editable_get_chars(GTK_EDITABLE(textview->text),
-                                            uri->start, uri->end);
+       buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview->text));
+
+       gtk_text_buffer_get_iter_at_offset(buffer, &start, uri->start);
+       gtk_text_buffer_get_iter_at_offset(buffer, &end,   uri->end);
+
+       visible_str = gtk_text_buffer_get_text(buffer, &start, &end, FALSE);
+
        if (visible_str == NULL)
                return TRUE;