From 6b132fe48a5fe75643cbff31b26f3d78e66da796 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Thu, 29 Aug 2002 12:04:34 +0000 Subject: Change the case sensitive search of subject to expect case insensitive 2002-08-29 Not Zed * tests/folder/test3.c: Change the case sensitive search of subject to expect case insensitive results, as the behaviour has changed. (main): Made the search content before sync nonfatal. its something that needs to be fixed but not practical concern in evolution. * camel-block-file.c (block_file_validate_root): Only spit out the invalid root warnings if the file isn't empty. * camel-text-index.c (text_index_compress_nosync): Swap the path as well when we compress. * camel-mime-parser.c (folder_scan_content): Treat the end of file as a boundary if we're scanning From lines, and drop the last \n. (folder_scan_init_with_fd): Dont pre-read from the fd, and init eof. (folder_scan_init_with_stream): Similar. (folder_read): Handle eof, and set eof on 0 read. (folder_seek): Dont pre-read after a seek, and reset eof flag. (camel_mime_parser_init_with_fd): Fix doco, no pre-read occurs anymore. (camel_mime_parser_init_with_stream): Same. * providers/local/camel-mbox-summary.c (camel_mbox_summary_sync_mbox): Add a \n to end of content of each message, not at start. * providers/local/camel-mbox-folder.c (mbox_append_message): Instead of appending "\nFrom " to a mailbox, start with "From ", and append a \n after the message always. For better mutt/elm compatability. Also, unlock after we've stat'd. (mbox_append_message): Set the message's from_pos exactly as the mbox size. svn path=/trunk/; revision=17921 --- camel/providers/local/camel-mbox-folder.c | 21 ++++++++++----------- camel/providers/local/camel-mbox-summary.c | 12 ++++++++++++ 2 files changed, 22 insertions(+), 11 deletions(-) (limited to 'camel/providers') diff --git a/camel/providers/local/camel-mbox-folder.c b/camel/providers/local/camel-mbox-folder.c index 120f72e0bf..8d1fdfd543 100644 --- a/camel/providers/local/camel-mbox-folder.c +++ b/camel/providers/local/camel-mbox-folder.c @@ -217,7 +217,7 @@ mbox_append_message(CamelFolder *folder, CamelMimeMessage * message, const Camel } /* and we need to set the frompos/XEV explicitly */ - ((CamelMboxMessageInfo *)mi)->frompos = mbs->folder_size?mbs->folder_size+1:0; + ((CamelMboxMessageInfo *)mi)->frompos = mbs->folder_size; #if 0 xev = camel_local_summary_encode_x_evolution((CamelLocalSummary *)folder->summary, mi); if (xev) { @@ -228,24 +228,20 @@ mbox_append_message(CamelFolder *folder, CamelMimeMessage * message, const Camel } #endif - /* we must write this to the non-filtered stream ... prepend a \n if not at the start of the file */ + /* we must write this to the non-filtered stream ... */ fromline = camel_mbox_summary_build_from(((CamelMimePart *)message)->headers); - if (camel_stream_printf(output_stream, mbs->folder_size==0?"%s":"\n%s", fromline) == -1) + if (camel_stream_write(output_stream, fromline, strlen(fromline)) == -1) goto fail_write; - /* and write the content to the filtering stream, that translated '\nFrom' into '\n>From' */ + /* and write the content to the filtering stream, that translates '\nFrom' into '\n>From' */ filter_stream = (CamelStream *) camel_stream_filter_new_with_stream(output_stream); filter_from = (CamelMimeFilter *) camel_mime_filter_from_new(); camel_stream_filter_add((CamelStreamFilter *) filter_stream, filter_from); - if (camel_data_wrapper_write_to_stream((CamelDataWrapper *)message, filter_stream) == -1) + if (camel_data_wrapper_write_to_stream((CamelDataWrapper *)message, filter_stream) == -1 + || camel_stream_write(filter_stream, "\n", 1) == -1 + || camel_stream_close(filter_stream) == -1) goto fail_write; - if (camel_stream_close(filter_stream) == -1) - goto fail_write; - - /* unlock as soon as we can */ - camel_local_folder_unlock(lf); - /* filter stream ref's the output stream itself, so we need to unref it too */ camel_object_unref((CamelObject *)filter_from); camel_object_unref((CamelObject *)filter_stream); @@ -259,6 +255,9 @@ mbox_append_message(CamelFolder *folder, CamelMimeMessage * message, const Camel ((CamelFolderSummary *)mbs)->time = st.st_mtime; } + /* unlock as soon as we can */ + camel_local_folder_unlock(lf); + if (camel_folder_change_info_changed(lf->changes)) { camel_object_trigger_event((CamelObject *)folder, "folder_changed", lf->changes); camel_folder_change_info_clear(lf->changes); diff --git a/camel/providers/local/camel-mbox-summary.c b/camel/providers/local/camel-mbox-summary.c index f68709fc73..564914aa59 100644 --- a/camel/providers/local/camel-mbox-summary.c +++ b/camel/providers/local/camel-mbox-summary.c @@ -941,8 +941,10 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh lastdel = TRUE; } else { /* otherwise, the message is staying, copy its From_ line across */ +#if 0 if (i>0) write(fdout, "\n", 1); +#endif info->frompos = lseek(fdout, 0, SEEK_CUR); fromline = camel_mime_parser_from_line(mp); write(fdout, fromline, strlen(fromline)); @@ -993,6 +995,14 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh goto error; } } + + if (write(fdout, "\n", 1) != 1) { + camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, + _("Error writing to temp mailbox: %s"), + strerror(errno)); + goto error; + } + d(printf("we are now at %d, from = %d\n", (int)camel_mime_parser_tell(mp), (int)camel_mime_parser_tell_start_from(mp))); camel_mime_parser_unstep(mp); @@ -1001,9 +1011,11 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh } } +#if 0 /* if last was deleted, append the \n we removed */ if (lastdel && count > 0) write(fdout, "\n", 1); +#endif camel_object_unref((CamelObject *)mp); -- cgit