aboutsummaryrefslogtreecommitdiff
path: root/src/textview.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-05-25 10:45:19 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-05-25 10:45:19 +0000
commita995a308a0ea0dbc92d14bb62d1fe1d1c87a355b (patch)
treec9a04df0673adb3d8b6df3b57a46f6a04addf523 /src/textview.c
parent67d6c453ec8126739d9588cf35bca3a5293a95fb (diff)
fixed phishing check.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@290 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src/textview.c')
-rw-r--r--src/textview.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/textview.c b/src/textview.c
index 4cf3a533..46b4f11a 100644
--- a/src/textview.c
+++ b/src/textview.c
@@ -1082,7 +1082,9 @@ static void textview_write_link(TextView *textview, const gchar *str,
gchar *bufp;
RemoteURI *r_uri;
- if (*str == '\0')
+ if (!str || *str == '\0')
+ return;
+ if (!uri)
return;
buffer = gtk_text_view_get_buffer(text);
@@ -1095,10 +1097,20 @@ static void textview_write_link(TextView *textview, const gchar *str,
} else
buf = g_strdup(str);
+ if (g_utf8_validate(buf, -1, NULL) == FALSE) {
+ g_free(buf);
+ return;
+ }
+
strcrchomp(buf);
- for (bufp = buf; g_ascii_isspace(*bufp); bufp++)
- ;
+ for (bufp = buf; *bufp != '\0'; bufp = g_utf8_next_char(bufp)) {
+ gunichar ch;
+
+ ch = g_utf8_get_char(bufp);
+ if (!g_unichar_isspace(ch))
+ break;
+ }
if (bufp > buf)
gtk_text_buffer_insert(buffer, &iter, buf, bufp - buf);
@@ -1515,18 +1527,8 @@ static gboolean textview_smooth_scroll_page(TextView *textview, gboolean up)
return TRUE;
}
-#warning FIXME_GTK2
-#if 0
-#define KEY_PRESS_EVENT_STOP() \
- if (gtk_signal_n_emissions_by_name \
- (GTK_OBJECT(widget), "key-press-event") > 0) { \
- gtk_signal_emit_stop_by_name(GTK_OBJECT(widget), \
- "key-press-event"); \
- }
-#else
#define KEY_PRESS_EVENT_STOP() \
g_signal_stop_emission_by_name(G_OBJECT(widget), "key-press-event");
-#endif
static gboolean textview_key_pressed(GtkWidget *widget, GdkEventKey *event,
TextView *textview)