diff options
author | Dan Winship <danw@src.gnome.org> | 2000-03-29 02:01:34 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2000-03-29 02:01:34 +0800 |
commit | c3b6d117ee155a571d8c4da01b81b6855e26e6f6 (patch) | |
tree | 792ae21c9ea6b66faa9413ec6631e250d60064b4 /camel | |
parent | ed8e120bf0d4a9ce00235fcf62a8e82856aa39c4 (diff) | |
download | gsoc2013-evolution-c3b6d117ee155a571d8c4da01b81b6855e26e6f6.tar.gz gsoc2013-evolution-c3b6d117ee155a571d8c4da01b81b6855e26e6f6.tar.zst gsoc2013-evolution-c3b6d117ee155a571d8c4da01b81b6855e26e6f6.zip |
Make this work when the inbox file doesn't yet exist.
* providers/mbox/camel-mbox-folder.c
(_check_get_or_maybe_generate_summary_file): Make this work when
the inbox file doesn't yet exist.
svn path=/trunk/; revision=2215
Diffstat (limited to 'camel')
-rw-r--r-- | camel/ChangeLog | 6 | ||||
-rw-r--r-- | camel/providers/mbox/camel-mbox-folder.c | 58 |
2 files changed, 40 insertions, 24 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 4ce430fe5f..b94ab8d079 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,9 @@ +2000-03-28 Dan Winship <danw@helixcode.com> + + * providers/mbox/camel-mbox-folder.c + (_check_get_or_maybe_generate_summary_file): Make this work when + the inbox file doesn't yet exist. + 2000-03-27 Dan Winship <danw@helixcode.com> * providers/mbox/camel-mbox-folder.c (_append_message): uncomment diff --git a/camel/providers/mbox/camel-mbox-folder.c b/camel/providers/mbox/camel-mbox-folder.c index 2dbbc32a86..b376f67fbd 100644 --- a/camel/providers/mbox/camel-mbox-folder.c +++ b/camel/providers/mbox/camel-mbox-folder.c @@ -248,29 +248,39 @@ _check_get_or_maybe_generate_summary_file (CamelMboxFolder *mbox_folder, * about the messages. */ mbox_file_fd = open (mbox_folder->folder_file_path, O_RDONLY); - message_info_array = - camel_mbox_parse_file (mbox_file_fd, "From ", 0, - &file_size, &next_uid, TRUE, - NULL, 0, ex); - close (mbox_file_fd); - if (camel_exception_get_id (ex)) - return; - - next_uid = camel_mbox_write_xev (mbox_folder, mbox_folder->folder_file_path, - message_info_array, &file_size, next_uid, ex); - - if (camel_exception_get_id (ex)) { - /* ** FIXME : free the preparsed information */ - return; - } + if (mbox_file_fd != -1) { + message_info_array = + camel_mbox_parse_file (mbox_file_fd, "From ", + 0, &file_size, + &next_uid, TRUE, + NULL, 0, ex); + close (mbox_file_fd); + if (camel_exception_get_id (ex)) + return; - summ = CAMEL_MBOX_SUMMARY (gtk_object_new (camel_mbox_summary_get_type (), NULL)); - summ->message_info = - parsed_information_to_mbox_summary (message_info_array); - summ->nb_message = summ->message_info->len; - summ->next_uid = next_uid; - summ->mbox_file_size = file_size; - /* **FIXME : Free the parsed information structure */ + next_uid = camel_mbox_write_xev (mbox_folder, + mbox_folder->folder_file_path, + message_info_array, + &file_size, + next_uid, ex); + if (camel_exception_get_id (ex)) { + /* ** FIXME : free the preparsed information */ + return; + } + + summ = CAMEL_MBOX_SUMMARY (gtk_object_new (camel_mbox_summary_get_type (), NULL)); + summ->message_info = parsed_information_to_mbox_summary (message_info_array); + summ->nb_message = summ->message_info->len; + summ->next_uid = next_uid; + summ->mbox_file_size = file_size; + /* **FIXME : Free the parsed information structure */ + } else { + summ = CAMEL_MBOX_SUMMARY (gtk_object_new (camel_mbox_summary_get_type (), NULL)); + summ->message_info = g_array_new (FALSE, FALSE, sizeof (CamelMboxSummaryInformation)); + summ->nb_message = 0; + summ->next_uid = 0; + summ->mbox_file_size = 0; + } folder->summary = CAMEL_FOLDER_SUMMARY (summ); } @@ -860,7 +870,7 @@ _append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), output_stream); } camel_stream_close (output_stream); - gtk_object_unref(output_stream); + gtk_object_unref (GTK_OBJECT (output_stream)); /* at this point we have saved the message to a temporary file, now, we have to add the x-evolution @@ -898,7 +908,7 @@ _append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException method as for parsing an entire mail file, but I have no time to write a simpler parser */ - next_uid = camel_mbox_write_xev (folder, tmp_message_filename, + next_uid = camel_mbox_write_xev (mbox_folder, tmp_message_filename, message_info_array, &tmp_file_size, next_uid, ex); if (camel_exception_get_id (ex)) { |