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/ChangeLog | 6 +++++- mail/component-factory.c | 30 ++++++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 3e7c9a1f69..161c15ca21 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,8 +1,12 @@ 2000-06-28 Dan Winship + * 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. + * main.c (init_corba): Call od_assert_using_oaf() or od_assert_using_goad() as appropriate to make sure people didn't - someone trick the build system. + somehow trick the build system. 2000-06-28 Jeffrey Stedfast 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