aboutsummaryrefslogtreecommitdiffstats
path: root/mail/evolution-mbox-importer.c
diff options
context:
space:
mode:
authorIain Holmes <iain@src.gnome.org>2001-01-27 11:05:54 +0800
committerIain Holmes <iain@src.gnome.org>2001-01-27 11:05:54 +0800
commit62ec012904d2004a0b486b10ddfdb05b98f05c3a (patch)
treea84f8eb44661b0679f8d76b7953262c8897fa096 /mail/evolution-mbox-importer.c
parent8c1c8274963543c45ba3717d1156d9edaa78cdc2 (diff)
downloadgsoc2013-evolution-62ec012904d2004a0b486b10ddfdb05b98f05c3a.tar
gsoc2013-evolution-62ec012904d2004a0b486b10ddfdb05b98f05c3a.tar.gz
gsoc2013-evolution-62ec012904d2004a0b486b10ddfdb05b98f05c3a.tar.bz2
gsoc2013-evolution-62ec012904d2004a0b486b10ddfdb05b98f05c3a.tar.lz
gsoc2013-evolution-62ec012904d2004a0b486b10ddfdb05b98f05c3a.tar.xz
gsoc2013-evolution-62ec012904d2004a0b486b10ddfdb05b98f05c3a.tar.zst
gsoc2013-evolution-62ec012904d2004a0b486b10ddfdb05b98f05c3a.zip
Fix some compile problems and stop the blank mail appearing with the mbox
importer svn path=/trunk/; revision=7843
Diffstat (limited to 'mail/evolution-mbox-importer.c')
-rw-r--r--mail/evolution-mbox-importer.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/mail/evolution-mbox-importer.c b/mail/evolution-mbox-importer.c
index 3556f2b68f..217954472f 100644
--- a/mail/evolution-mbox-importer.c
+++ b/mail/evolution-mbox-importer.c
@@ -81,6 +81,7 @@ process_item_fn (EvolutionImporter *eimporter,
ex = camel_exception_new ();
camel_folder_thaw (importer->folder);
+ importer->frozen = FALSE;
camel_folder_sync (importer->folder, FALSE, ex);
camel_exception_free (ex);
fclose (mbi->handle);
@@ -88,7 +89,32 @@ process_item_fn (EvolutionImporter *eimporter,
return;
}
- mail_importer_add_line (importer, line, FALSE);
+ /* It's the From line, so add it and get a new line. */
+ if (strncmp (line, "From ", 5) == 0) {
+ mail_importer_add_line (importer, line, FALSE);
+
+ if (fgets (line, 4096, mbi->handle) == NULL) {
+ if (*line != '\0')
+ mail_importer_add_line (importer, line, TRUE);
+ /* Must be the end */
+
+ g_free (line);
+ line = NULL;
+ GNOME_Evolution_ImporterListener_notifyResult (listener,
+ GNOME_Evolution_ImporterListener_OK,
+ FALSE, ev);
+
+ ex = camel_exception_new ();
+ camel_folder_thaw (importer->folder);
+ importer->frozen = FALSE;
+ camel_folder_sync (importer->folder, FALSE, ex);
+ camel_exception_free (ex);
+ fclose (mbi->handle);
+ mbi->handle = NULL;
+ return;
+ }
+ }
+
while (strncmp (line, "From ", 5) != 0) {
mail_importer_add_line (importer, line, FALSE);
@@ -103,6 +129,7 @@ process_item_fn (EvolutionImporter *eimporter,
FALSE, ev);
ex = camel_exception_new ();
camel_folder_thaw (importer->folder);
+ importer->frozen = FALSE;
camel_folder_sync (importer->folder, FALSE, ex);
camel_exception_free (ex);
fclose (mbi->handle);
@@ -149,6 +176,9 @@ importer_destroy_cb (GtkObject *object,
MailImporter *importer;
importer = (MailImporter *) mbi;
+ if (importer->frozen)
+ camel_folder_thaw (importer->folder);
+
if (importer->folder)
camel_object_unref (CAMEL_OBJECT (importer->folder));
@@ -196,6 +226,7 @@ load_file_fn (EvolutionImporter *eimporter,
}
camel_folder_freeze (importer->folder);
+ importer->frozen = TRUE;
return TRUE;
}