aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorSuman Manjunath <msuman@src.gnome.org>2009-01-13 11:41:19 +0800
committerSuman Manjunath <msuman@src.gnome.org>2009-01-13 11:41:19 +0800
commit84aa765a197eacbb8e09fc0af2e1e00937ae6178 (patch)
tree22518ef0a77615fac5bbe695b2443f77fe69b8ae /mail
parent1df00c7d517794881faefd45b3ae230a6b0d8204 (diff)
downloadgsoc2013-evolution-84aa765a197eacbb8e09fc0af2e1e00937ae6178.tar.gz
gsoc2013-evolution-84aa765a197eacbb8e09fc0af2e1e00937ae6178.tar.zst
gsoc2013-evolution-84aa765a197eacbb8e09fc0af2e1e00937ae6178.zip
Patch from Felix Riemann <friemann@svn.gnome.org> ** Fix for bug #563867 (Unescape "&amp;" when passing the link to browsers).
svn path=/trunk/; revision=37063
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog10
-rw-r--r--mail/em-folder-view.c33
-rw-r--r--mail/em-popup.c4
-rw-r--r--mail/em-utils.c31
-rw-r--r--mail/em-utils.h3
5 files changed, 48 insertions, 33 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 64f16ef863..ea7e85313f 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,13 @@
+2009-01-13 Felix Riemann <friemann@svn.gnome.org>
+
+ ** Fix for bug #563867
+
+ * em-folder-view.c (emp_uri_popup_link_copy):
+ * em-popup.c (emp_uri_popup_link_open):
+ * em-utils.c (em_utils_url_unescape_amp):
+ * em-utils.h:
+ Unescape "&amp;" when passing the link to browsers.
+
2009-01-12 Srinivasa Ragavan <sragavan@novell.com>
** Fix for bug #566653
diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c
index 301f612193..c9b05344fc 100644
--- a/mail/em-folder-view.c
+++ b/mail/em-folder-view.c
@@ -2734,37 +2734,6 @@ emfv_format_link_clicked(EMFormatHTMLDisplay *efhd, const char *uri, EMFolderVie
}
}
-static gchar *
-url_unescape_amp (const gchar *url)
-{
- gchar *buff;
- int i, j, amps;
-
- if (!url)
- return NULL;
-
- amps = 0;
- for (i = 0; url [i]; i++) {
- if (url [i] == '&' && strncmp (url + i, "&amp;", 5) == 0)
- amps++;
- }
-
- buff = g_strdup (url);
-
- if (!amps)
- return buff;
-
- for (i = 0, j = 0; url [i]; i++, j++) {
- buff [j] = url [i];
-
- if (url [i] == '&' && strncmp (url + i, "&amp;", 5) == 0)
- i += 4;
- }
- buff [j] = 0;
-
- return buff;
-}
-
static void
emp_uri_popup_link_copy(EPopup *ep, EPopupItem *pitem, void *data)
{
@@ -2772,7 +2741,7 @@ emp_uri_popup_link_copy(EPopup *ep, EPopupItem *pitem, void *data)
struct _EMFolderViewPrivate *p = emfv->priv;
g_free(p->selection_uri);
- p->selection_uri = url_unescape_amp(pitem->user_data);
+ p->selection_uri = em_utils_url_unescape_amp(pitem->user_data);
gtk_selection_owner_set(p->invisible, GDK_SELECTION_PRIMARY, gtk_get_current_event_time());
gtk_selection_owner_set(p->invisible, GDK_SELECTION_CLIPBOARD, gtk_get_current_event_time());
diff --git a/mail/em-popup.c b/mail/em-popup.c
index b6b7b23884..2c18d60041 100644
--- a/mail/em-popup.c
+++ b/mail/em-popup.c
@@ -585,9 +585,11 @@ static void
emp_uri_popup_link_open(EPopup *ep, EPopupItem *item, void *data)
{
EMPopupTargetURI *t = (EMPopupTargetURI *)ep->target;
+ gchar *unescaped_uri = em_utils_url_unescape_amp (t->uri);
/* FIXME Pass a parent window. */
- e_show_uri (NULL, t->uri);
+ e_show_uri (NULL, unescaped_uri);
+ g_free (unescaped_uri);
}
static void
diff --git a/mail/em-utils.c b/mail/em-utils.c
index bb92d7ad03..f65edb0e40 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -2442,3 +2442,34 @@ em_utils_show_info_silent (GtkWidget *widget)
g_signal_connect(widget, "response", G_CALLBACK(error_response), NULL);
e_activity_handler_make_error (handler, "mail", E_LOG_WARNINGS, widget);
}
+
+gchar *
+em_utils_url_unescape_amp (const gchar *url)
+{
+ gchar *buff;
+ int i, j, amps;
+
+ if (!url)
+ return NULL;
+
+ amps = 0;
+ for (i = 0; url [i]; i++) {
+ if (url [i] == '&' && strncmp (url + i, "&amp;", 5) == 0)
+ amps++;
+ }
+
+ buff = g_strdup (url);
+
+ if (!amps)
+ return buff;
+
+ for (i = 0, j = 0; url [i]; i++, j++) {
+ buff [j] = url [i];
+
+ if (url [i] == '&' && strncmp (url + i, "&amp;", 5) == 0)
+ i += 4;
+ }
+ buff [j] = 0;
+
+ return buff;
+}
diff --git a/mail/em-utils.h b/mail/em-utils.h
index 0bce56d7f3..e02d575abd 100644
--- a/mail/em-utils.h
+++ b/mail/em-utils.h
@@ -117,6 +117,9 @@ const char *em_utils_snoop_type(struct _CamelMimePart *part);
/* clears flag 'get_password_canceled' at every known accounts, so if needed, get_password will show dialog */
void em_utils_clear_get_password_canceled_accounts_flag (void);
+/* Unescapes &amp; back to a real & in URIs */
+gchar *em_utils_url_unescape_amp (const gchar *url);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */