From 53fec3133a553d6a20e446f3dcace2643ab10742 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Thu, 17 Feb 2000 22:13:16 +0000 Subject: New function g_url_to_string to convert a Gurl back into a char * svn path=/trunk/; revision=1833 --- camel/url-util.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'camel/url-util.c') diff --git a/camel/url-util.c b/camel/url-util.c index 91779873cb..39294e0d36 100644 --- a/camel/url-util.c +++ b/camel/url-util.c @@ -35,7 +35,10 @@ * ";AUTH=mech" addition comes from RFC 2384, "POP URL Scheme". */ -/* XXX TODO: recover the words between #'s or ?'s after the path */ +/* XXX TODO: + * recover the words between #'s or ?'s after the path + * % escapes + */ #include #include @@ -129,6 +132,25 @@ Gurl *g_url_new (const gchar* url_string) return g_url; } +gchar * +g_url_to_string (const Gurl *url, gboolean show_passwd) +{ + return g_strdup_printf("%s%s%s%s%s%s%s%s%s%s%s%s%s", + url->protocol ? url->protocol : "", + url->protocol ? "://" : "", + url->user ? url->user : "", + url->authmech ? ";auth=" : "", + url->authmech ? url->authmech : "", + url->passwd && show_passwd ? ":" : "", + url->passwd && show_passwd ? url->passwd : "", + url->user ? "@" : "", + url->host, + url->port ? ":" : "", + url->port ? url->port : "", + url->path ? "/" : "", + url->path ? url->path : ""); +} + void g_url_free (Gurl *url) { -- cgit v1.2.3