From 7fe829bb5225f3dbabd3db34ebf0068f4a43638d Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Wed, 28 Jun 2000 23:12:50 +0000 Subject: Refuse to create folders not of type "mail", and correctly create an empty * component-factory.c (create_folder): Refuse to create folders not of type "mail", and correctly create an empty "mbox" folder for new folders in /local. svn path=/trunk/; revision=3781 --- mail/component-factory.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'mail/component-factory.c') diff --git a/mail/component-factory.c b/mail/component-factory.c index a48ada7327..c6d6f47e19 100644 --- a/mail/component-factory.c +++ b/mail/component-factory.c @@ -109,13 +109,35 @@ create_folder (EvolutionShellComponent *shell_component, void *closure) { CORBA_Environment ev; + CamelStore *store; + CamelFolder *folder; + CamelException ex; + Evolution_ShellComponentListener_Result result; + + camel_exception_init (&ex); + if (strcmp (type, "mail") != 0) + result = Evolution_ShellComponentListener_UNSUPPORTED_TYPE; + else { + char *camel_url = g_strdup_printf ("mbox://%s", physical_uri); + + store = camel_session_get_store (session, camel_url, &ex); + g_free (camel_url); + if (!camel_exception_is_set (&ex)) { + folder = camel_store_get_folder (store, "mbox", + TRUE, &ex); + gtk_object_unref (GTK_OBJECT (store)); + } + if (!camel_exception_is_set (&ex)) { + gtk_object_unref (GTK_OBJECT (folder)); + result = Evolution_ShellComponentListener_OK; + } else + result = Evolution_ShellComponentListener_INVALID_URI; + } - /* FIXME: Implement. */ + camel_exception_clear (&ex); CORBA_exception_init (&ev); - - Evolution_ShellComponentListener_report_result (listener, Evolution_ShellComponentListener_OK, &ev); - + Evolution_ShellComponentListener_report_result (listener, result, &ev); CORBA_exception_free (&ev); } -- cgit v1.2.3