aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog12
-rw-r--r--mail/evolution-mbox-importer.c33
-rw-r--r--mail/evolution-outlook-importer.c10
-rw-r--r--mail/mail-importer.h6
4 files changed, 53 insertions, 8 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 61a812139d..e84f8975d2 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,15 @@
+2001-01-26 Iain Holmes <iain@ximian.com>
+
+ * evolution-outlook-importer.c (load_file_fn): Replace fsetpos with
+ fseek and use a long instead of fpos_t.
+ (process_item_fn): Same.
+
+ * mail-importer.h: Add a frozen item to tell when the folder is frozen.
+
+ * evolution-mbox-importer.c (process_item_fn): Fix the blank message.
+ Set the frozen element.
+ (importer_destroy_cb): Thaw the folder if frozen.
+
2001-01-26 Dan Winship <danw@ximian.com>
* mail-identify.c (mail_identify_mime_part): Fix an uninitialized
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;
}
diff --git a/mail/evolution-outlook-importer.c b/mail/evolution-outlook-importer.c
index 04b2e8a3b0..47f88aceb8 100644
--- a/mail/evolution-outlook-importer.c
+++ b/mail/evolution-outlook-importer.c
@@ -45,7 +45,7 @@ typedef struct {
char *filename;
gboolean oe4; /* Is file OE4 or not? */
FILE *handle;
- fpos_t pos;
+ long pos;
off_t size;
gboolean busy;
@@ -80,7 +80,7 @@ process_item_fn (EvolutionImporter *eimporter,
oe_msg_segmentheader *header;
gboolean more = TRUE;
char *cb, *sfull, *s;
- fpos_t end_pos = 0;
+ long end_pos = 0;
int i;
if (oli->busy == TRUE) {
@@ -134,7 +134,7 @@ process_item_fn (EvolutionImporter *eimporter,
mail_importer_add_line (importer, "\n", TRUE);
oli->pos = end_pos;
- fsetpos (oli->handle, &oli->pos);
+ fseek (oli->handle, oli->pos, SEEK_SET);
g_free (header);
g_free (sfull);
@@ -221,7 +221,7 @@ load_file_fn (EvolutionImporter *eimporter,
OutlookImporter *oli;
MailImporter *importer;
struct stat buf;
- fpos_t pos = 0x54;
+ long pos = 0x54;
oli = (OutlookImporter *) closure;
importer = (MailImporter *) oli;
@@ -249,7 +249,7 @@ load_file_fn (EvolutionImporter *eimporter,
oli->size = buf.st_size;
/* Set the fposition to the begining */
- fsetpos (oli->handle, &pos);
+ fseek (oli->handle, pos, SEEK_SET);
oli->pos = pos;
importer->mstream = NULL;
diff --git a/mail/mail-importer.h b/mail/mail-importer.h
index 5286888287..0c46c7c78c 100644
--- a/mail/mail-importer.h
+++ b/mail/mail-importer.h
@@ -30,8 +30,10 @@
typedef struct _MailImporter MailImporter;
struct _MailImporter {
- CamelFolder *folder;
- CamelStreamMem *mstream;
+ CamelFolder *folder;
+ CamelStreamMem *mstream;
+
+ gboolean frozen; /* Is folder frozen? */
};
void mail_importer_init (void);