aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-tools.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2003-06-11 12:28:04 +0800
committerMichael Zucci <zucchi@src.gnome.org>2003-06-11 12:28:04 +0800
commitf9257aeb4c12c759b5e3419a8ae94f5b2e1a3ad6 (patch)
tree399e2f955530305301fd81cfb2612ccffb048647 /mail/mail-tools.c
parentaaa0d1aba42fcaa048846c2420c069875d850915 (diff)
downloadgsoc2013-evolution-f9257aeb4c12c759b5e3419a8ae94f5b2e1a3ad6.tar
gsoc2013-evolution-f9257aeb4c12c759b5e3419a8ae94f5b2e1a3ad6.tar.gz
gsoc2013-evolution-f9257aeb4c12c759b5e3419a8ae94f5b2e1a3ad6.tar.bz2
gsoc2013-evolution-f9257aeb4c12c759b5e3419a8ae94f5b2e1a3ad6.tar.lz
gsoc2013-evolution-f9257aeb4c12c759b5e3419a8ae94f5b2e1a3ad6.tar.xz
gsoc2013-evolution-f9257aeb4c12c759b5e3419a8ae94f5b2e1a3ad6.tar.zst
gsoc2013-evolution-f9257aeb4c12c759b5e3419a8ae94f5b2e1a3ad6.zip
** See bug #22542
2003-06-11 Not Zed <NotZed@Ximian.com> ** See bug #22542 * component-factory.c (storage_create_folder): If we're creating a folder on a vstore, popup a vFolder editor rather than failing. 2003-06-05 Not Zed <NotZed@Ximian.com> ** Part of #42691. * importers/Makefile.am (BUILT_SOURCES): added server_DATA. * Makefile.am (%.server.in): create a proper implicit rule for temporary .in file. 2003-06-04 Not Zed <NotZed@Ximian.com> ** See bug #43974 * mail-tools.c (mail_tool_do_movemail): use a proper CamelURL to decode the uri, not hacky strcmp stuff. * mail-account-gui.c (extract_values): if we have an conf_entry, ignore username, hostname, and path ones, as these are handled implicitly in the url itself. Came about because of the fix for #42838. svn path=/trunk/; revision=21407
Diffstat (limited to 'mail/mail-tools.c')
-rw-r--r--mail/mail-tools.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/mail/mail-tools.c b/mail/mail-tools.c
index 43c67a2fb7..a0943e510b 100644
--- a/mail/mail-tools.c
+++ b/mail/mail-tools.c
@@ -125,27 +125,33 @@ mail_tool_get_local_movemail_path (const unsigned char *uri)
return path;
}
-/* why is this function so stupidly complex when allthe work is done elsehwere? */
char *
mail_tool_do_movemail (const char *source_url, CamelException *ex)
{
char *dest_path;
- const char *source;
struct stat sb;
-
- g_return_val_if_fail (strncmp (source_url, "mbox:", 5) == 0, NULL);
+ CamelURL *uri;
+
+ uri = camel_url_new(source_url, ex);
+ if (uri == NULL)
+ return NULL;
+
+ if (strcmp(uri->protocol, "mbox") != 0) {
+ /* FIXME: use right text here post 1.4 */
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_URL_INVALID,
+ _("Could not parse URL `%s'"),
+ source_url);
+ camel_url_free(uri);
+ return NULL;
+ }
/* Set up our destination. */
dest_path = mail_tool_get_local_movemail_path (source_url);
- /* Skip over "mbox:" plus host part (if any) of url. */
- source = source_url + 5;
- if (!strncmp (source, "//", 2))
- source = strchr (source + 2, '/');
-
/* Movemail from source (source_url) to dest_path */
- camel_movemail (source, dest_path, ex);
-
+ camel_movemail (uri->path, dest_path, ex);
+ camel_url_free(uri);
+
if (stat (dest_path, &sb) < 0 || sb.st_size == 0) {
unlink (dest_path); /* Clean up the movemail.foo file. */
g_free (dest_path);