diff options
author | Iain Holmes <iain@src.gnome.org> | 2001-08-31 07:21:56 +0800 |
---|---|---|
committer | Iain Holmes <iain@src.gnome.org> | 2001-08-31 07:21:56 +0800 |
commit | 553de94865892fa7473f55d71a2fdf266e5359b7 (patch) | |
tree | 81c1a44e612040308d61a9fd6a091e0baecd42fc /mail | |
parent | d1587991064d100b1dccfdd34b293c67b603d0d0 (diff) | |
download | gsoc2013-evolution-553de94865892fa7473f55d71a2fdf266e5359b7.tar gsoc2013-evolution-553de94865892fa7473f55d71a2fdf266e5359b7.tar.gz gsoc2013-evolution-553de94865892fa7473f55d71a2fdf266e5359b7.tar.bz2 gsoc2013-evolution-553de94865892fa7473f55d71a2fdf266e5359b7.tar.lz gsoc2013-evolution-553de94865892fa7473f55d71a2fdf266e5359b7.tar.xz gsoc2013-evolution-553de94865892fa7473f55d71a2fdf266e5359b7.tar.zst gsoc2013-evolution-553de94865892fa7473f55d71a2fdf266e5359b7.zip |
Fix the Pine and Netscape importers. Give them a nice progress reporting GUI.
Revert Jason's changes so that creating a folder works again.
svn path=/trunk/; revision=12536
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 15 | ||||
-rw-r--r-- | mail/component-factory.c | 7 | ||||
-rw-r--r-- | mail/importers/evolution-mbox-importer.c | 51 | ||||
-rw-r--r-- | mail/mail-importer.c | 2 |
4 files changed, 59 insertions, 16 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index ea685e762a..5614aa12ff 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,18 @@ +2001-08-30 Iain Holmes <iain@ximian.com> + + * importer/evolution-mbox-importer.c: (load_file_fn): Check if it's a + folder, if so, create a folder. + (process_item_fn): If it was a folder created, just finish up importing + +2001-08-29 Iain Holmes <iain@ximian.com> + + * importers/evolution-mbox-importer.c: Turn off debugging, remove + spewage. + (process_item_fn): Notify the importer if the folder isn't opened or + created yet. + (load_file_fn): Allow the function to continue if the folder is being + created. + 2001-08-30 Peter Williams <peterw@ximian.com> Due to the introduction of mail_folder_cache_remove(), we can no diff --git a/mail/component-factory.c b/mail/component-factory.c index d828757ee3..778e6b2be3 100644 --- a/mail/component-factory.c +++ b/mail/component-factory.c @@ -183,11 +183,12 @@ create_folder_done (char *uri, CamelFolder *folder, void *data) GNOME_Evolution_ShellComponentListener_Result result; CORBA_Environment ev; - if (folder) + if (folder) { result = GNOME_Evolution_ShellComponentListener_OK; - else + } else { result = GNOME_Evolution_ShellComponentListener_INVALID_URI; - + } + CORBA_exception_init (&ev); GNOME_Evolution_ShellComponentListener_notifyResult (listener, result, &ev); CORBA_Object_release (listener, &ev); diff --git a/mail/importers/evolution-mbox-importer.c b/mail/importers/evolution-mbox-importer.c index 28d1ca5e31..07dc4b7eb1 100644 --- a/mail/importers/evolution-mbox-importer.c +++ b/mail/importers/evolution-mbox-importer.c @@ -43,7 +43,7 @@ #include "e-util/e-path.h" -#define IMPORTER_DEBUG +/* #define IMPORTER_DEBUG */ #ifdef IMPORTER_DEBUG #define IN g_print ("=====> %s (%d)\n", __FUNCTION__, __LINE__) #define OUT g_print ("<==== %s (%d)\n", __FUNCTION__, __LINE__) @@ -60,6 +60,7 @@ typedef struct { char *filename; int num; CamelMimeParser *mp; + gboolean is_folder; } MboxImporter; void mail_importer_module_init (void); @@ -77,6 +78,20 @@ process_item_fn (EvolutionImporter *eimporter, gboolean done = FALSE; CamelException *ex; + if (importer->folder == NULL) { + GNOME_Evolution_ImporterListener_notifyResult (listener, + GNOME_Evolution_ImporterListener_NOT_READY, + TRUE, ev); + return; + } + + if (mbi->is_folder == TRUE) { + GNOME_Evolution_ImporterListener_notifyResult (listener, + GNOME_Evolution_ImporterListener_OK, + FALSE, ev); + return; + } + ex = camel_exception_new (); if (camel_mime_parser_step (mbi->mp, 0, 0) == HSCAN_FROM) { /* Import the next message */ @@ -117,7 +132,6 @@ process_item_fn (EvolutionImporter *eimporter, } camel_exception_free (ex); - g_print ("Notifying...\n"); GNOME_Evolution_ImporterListener_notifyResult (listener, GNOME_Evolution_ImporterListener_OK, !done, ev); @@ -200,7 +214,6 @@ folder_created_cb (BonoboListener *listener, return; } - g_warning ("%s created", fullpath); g_free (fullpath); bonobo_object_unref (BONOBO_OBJECT (listener)); } @@ -213,9 +226,10 @@ load_file_fn (EvolutionImporter *eimporter, { MboxImporter *mbi; MailImporter *importer; + gboolean delayed = FALSE; + struct stat buf; int fd; - g_warning ("%s", __FUNCTION__); mbi = (MboxImporter *) closure; importer = (MailImporter *) mbi; @@ -227,11 +241,17 @@ load_file_fn (EvolutionImporter *eimporter, return FALSE; } - mbi->mp = camel_mime_parser_new (); - camel_mime_parser_scan_from (mbi->mp, TRUE); - if (camel_mime_parser_init_with_fd (mbi->mp, fd) == -1) { - g_warning ("Unable to process spool folder"); - goto fail; + fstat (fd, &buf); + if (S_ISREG (buf.st_mode)) { + mbi->mp = camel_mime_parser_new (); + camel_mime_parser_scan_from (mbi->mp, TRUE); + if (camel_mime_parser_init_with_fd (mbi->mp, fd) == -1) { + g_warning ("Unable to process spool folder"); + goto fail; + } + mbi->is_folder = FALSE; + } else { + mbi->is_folder = TRUE; } importer->mstream = NULL; @@ -268,21 +288,26 @@ load_file_fn (EvolutionImporter *eimporter, importer); mail_importer_create_folder (parent, name, NULL, listener); + camel_exception_free (ex); + ex = camel_exception_new (); + importer->folder = mail_tool_uri_to_folder (fullpath, ex); + delayed = TRUE; g_free (parent); } camel_exception_free (ex); g_free (fullpath); } - if (importer->folder == NULL){ + if (importer->folder == NULL && delayed == FALSE){ g_print ("Bad folder\n"); goto fail; } - camel_folder_freeze (importer->folder); - importer->frozen = TRUE; + if (importer->folder != NULL) { + camel_folder_freeze (importer->folder); + importer->frozen = TRUE; + } - g_warning ("Okay, so everything is now ready to import that mbox file!"); return TRUE; fail: diff --git a/mail/mail-importer.c b/mail/mail-importer.c index d32a2d0f12..cfe7476ef2 100644 --- a/mail/mail-importer.c +++ b/mail/mail-importer.c @@ -84,8 +84,10 @@ mail_importer_create_folder (const char *parent_path, parent_path); corba_listener = bonobo_object_corba_objref (BONOBO_OBJECT (listener)); + /* Darn CORBA wanting non-NULL values for strings */ real_description = CORBA_string_dup (description ? description : ""); + CORBA_exception_init (&ev); GNOME_Evolution_Storage_asyncCreateFolder (local_storage, |