aboutsummaryrefslogtreecommitdiff
path: root/libsylph
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2007-05-18 02:26:45 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2007-05-18 02:26:45 +0000
commitd86665625571fd744f58bdc8e228c3e3545287c0 (patch)
tree63e38313c8d050547510da62d78412ef0c2d3517 /libsylph
parent17f520fefb4f4c8c9715cf30f7e0062567132428 (diff)
URI encode mailto: to protect '+'.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1709 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph')
-rw-r--r--libsylph/utils.c20
-rw-r--r--libsylph/utils.h1
2 files changed, 21 insertions, 0 deletions
diff --git a/libsylph/utils.c b/libsylph/utils.c
index 56e7fccd..0379342b 100644
--- a/libsylph/utils.c
+++ b/libsylph/utils.c
@@ -1845,6 +1845,26 @@ gchar *uriencode_for_filename(const gchar *filename)
return enc;
}
+gchar *uriencode_for_mailto(const gchar *mailto)
+{
+ const gchar *p = mailto;
+ gchar *enc, *outp;
+
+ outp = enc = g_malloc(strlen(mailto) * 3 + 1);
+
+ for (p = mailto; *p != '\0'; p++) {
+ if (*p == '+') {
+ *outp++ = '%';
+ get_hex_str(outp, *p);
+ outp += 2;
+ } else
+ *outp++ = *p;
+ }
+
+ *outp = '\0';
+ return enc;
+}
+
gint scan_mailto_url(const gchar *mailto, gchar **to, gchar **cc, gchar **bcc,
gchar **subject, gchar **inreplyto, gchar **body)
{
diff --git a/libsylph/utils.h b/libsylph/utils.h
index d7f68b91..25978160 100644
--- a/libsylph/utils.h
+++ b/libsylph/utils.h
@@ -363,6 +363,7 @@ void decode_xdigit_encoded_str (gchar *decoded,
const gchar *encoded);
gchar *encode_uri (const gchar *filename);
gchar *uriencode_for_filename (const gchar *filename);
+gchar *uriencode_for_mailto (const gchar *mailto);
gint scan_mailto_url (const gchar *mailto,
gchar **to,
gchar **cc,