aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-02-18 06:13:16 +0800
committerDan Winship <danw@src.gnome.org>2000-02-18 06:13:16 +0800
commit53fec3133a553d6a20e446f3dcace2643ab10742 (patch)
tree0abdb45001c12e75789482e10609e2eb3a2b96e6
parentca0431d8dac70782d8f07fd07510b2288715afcd (diff)
downloadgsoc2013-evolution-53fec3133a553d6a20e446f3dcace2643ab10742.tar.gz
gsoc2013-evolution-53fec3133a553d6a20e446f3dcace2643ab10742.tar.zst
gsoc2013-evolution-53fec3133a553d6a20e446f3dcace2643ab10742.zip
New function g_url_to_string to convert a Gurl back into a char *
svn path=/trunk/; revision=1833
-rw-r--r--ChangeLog5
-rw-r--r--camel/url-util.c24
-rw-r--r--camel/url-util.h1
3 files changed, 29 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 225367aa40..cb212ec2b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2000-02-17 Dan Winship <danw@helixcode.com>
+
+ * camel/url-util.c (g_url_to_string): New function to convert
+ a Gurl back into a char *.
+
2000-02-17 bertrand <Bertrand.Guiheneuf@aful.org>
* camel/camel-formatter.c (handle_text_plain):
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 <string.h>
#include <config.h>
@@ -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)
{
diff --git a/camel/url-util.h b/camel/url-util.h
index 67cc420eb2..86fd1e26ac 100644
--- a/camel/url-util.h
+++ b/camel/url-util.h
@@ -51,6 +51,7 @@ typedef struct {
I chose not to use it */
Gurl *g_url_new (const gchar *url_string);
+gchar *g_url_to_string (const Gurl *url, gboolean show_password);
void g_url_free (Gurl *url);
#ifdef __cplusplus