From a1a0a6bc4c8b444afe9ba4ee3feaec28192252ae Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Mon, 20 Aug 2001 21:49:09 +0000 Subject: Modify the url and set the protocol to mbox rather than hacking it and 2001-08-20 Jeffrey Stedfast * component-factory.c (create_folder): Modify the url and set the protocol to mbox rather than hacking it and prepending mbox: to the uri. * mail-local.c (get_folder): Don't prepend the folder_name with the store's path because the hash key is folder_name, not /folder_name. svn path=/trunk/; revision=12325 --- mail/component-factory.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'mail/component-factory.c') diff --git a/mail/component-factory.c b/mail/component-factory.c index 21e2a5ed30..d391092901 100644 --- a/mail/component-factory.c +++ b/mail/component-factory.c @@ -177,18 +177,18 @@ static void create_folder_done (char *uri, CamelFolder *folder, void *data) { GNOME_Evolution_ShellComponentListener listener = data; - CORBA_Environment ev; GNOME_Evolution_ShellComponentListener_Result result; - + CORBA_Environment ev; + if (folder) result = GNOME_Evolution_ShellComponentListener_OK; else result = GNOME_Evolution_ShellComponentListener_INVALID_URI; - - CORBA_exception_init(&ev); - GNOME_Evolution_ShellComponentListener_notifyResult(listener, result, &ev); - CORBA_Object_release(listener, &ev); - CORBA_exception_free(&ev); + + CORBA_exception_init (&ev); + GNOME_Evolution_ShellComponentListener_notifyResult (listener, result, &ev); + CORBA_Object_release (listener, &ev); + CORBA_exception_free (&ev); } static void @@ -198,20 +198,27 @@ create_folder (EvolutionShellComponent *shell_component, const GNOME_Evolution_ShellComponentListener listener, void *closure) { - char *uri; CORBA_Environment ev; + CamelURL *url; + char *uri; + + CORBA_exception_init (&ev); - CORBA_exception_init(&ev); - if (!strcmp (type, "mail")) { - /* This makes the uri start with mbox://file://, which - looks silly but turns into a CamelURL that has - url->provider of "mbox" */ - uri = g_strdup_printf ("mbox://%s", physical_uri); + url = physical_uri ? camel_url_new (physical_uri, NULL) : NULL; + + if (url && !strcmp (type, "mail")) { + camel_url_set_protocol (url, "mbox"); + uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL); mail_create_folder (uri, create_folder_done, CORBA_Object_duplicate (listener, &ev)); + g_free (uri); } else { GNOME_Evolution_ShellComponentListener_notifyResult ( listener, GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE, &ev); } + + if (url) + camel_url_free (url); + CORBA_exception_free (&ev); } -- cgit