From 8fbfb0ae4829f216501380e2f63ed6b4cc1a3306 Mon Sep 17 00:00:00 2001 From: bertrand Date: Fri, 21 Jan 2000 22:46:46 +0000 Subject: added camel-mbox-provider.c to the mbox provider sources. 2000-01-21 bertrand * camel/providers/mbox/Makefile.am (libcamelmbox_la_SOURCES): added camel-mbox-provider.c to the mbox provider sources. * camel/providers/mbox/camel-mbox-provider.c: provider registration code. * camel/providers/mbox/camel-mbox-folder.c (_get_message_count): implemented (_append_message): implemented * camel/providers/mbox/camel-mbox-parser.c (initialize_buffer): use \0 to mark the end of the buffer. (read_next_buffer_chunk): ditto. (read_header): test the presence of a \0 instead of reading the eof field (read_message_begining): idem. (camel_mbox_parse_file): idem. Remove the eof field from the parser structure. (read_next_buffer_chunk): removed some nasty bugs again. svn path=/trunk/; revision=1604 --- camel/providers/mbox/Makefile.am | 1 + camel/providers/mbox/camel-mbox-folder.c | 120 ++++++++++++++++++++++++++++- camel/providers/mbox/camel-mbox-parser.c | 108 +++++++++++++++++++------- camel/providers/mbox/camel-mbox-parser.h | 1 + camel/providers/mbox/camel-mbox-provider.c | 48 ++++++++++++ camel/providers/mbox/camel-mbox-summary.c | 8 +- camel/providers/mbox/camel-mbox-summary.h | 1 + camel/providers/mbox/camel-mbox-utils.c | 10 ++- camel/providers/mbox/camel-mbox-utils.h | 5 +- 9 files changed, 260 insertions(+), 42 deletions(-) create mode 100644 camel/providers/mbox/camel-mbox-provider.c (limited to 'camel/providers') diff --git a/camel/providers/mbox/Makefile.am b/camel/providers/mbox/Makefile.am index 5dffdc4eff..be8bce9232 100644 --- a/camel/providers/mbox/Makefile.am +++ b/camel/providers/mbox/Makefile.am @@ -14,6 +14,7 @@ INCLUDES = -I.. -I$(srcdir)/.. -I$(includedir) \ libcamelmbox_la_SOURCES = \ camel-mbox-folder.c \ camel-mbox-parser.c \ + camel-mbox-provider.c \ camel-mbox-store.c \ camel-mbox-summary.c \ camel-mbox-utils.c diff --git a/camel/providers/mbox/camel-mbox-folder.c b/camel/providers/mbox/camel-mbox-folder.c index 64e589cba1..0392628284 100644 --- a/camel/providers/mbox/camel-mbox-folder.c +++ b/camel/providers/mbox/camel-mbox-folder.c @@ -68,8 +68,8 @@ static gboolean _delete_messages (CamelFolder *folder, CamelException *ex); static GList *_list_subfolders (CamelFolder *folder, CamelException *ex); /* static CamelMimeMessage *_get_message_by_number (CamelFolder *folder, gint number, CamelException *ex);*/ static gint _get_message_count (CamelFolder *folder, CamelException *ex); -#if 0 static gint _append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex); +#if 0 static void _expunge (CamelFolder *folder, CamelException *ex); static void _copy_message_to (CamelFolder *folder, CamelMimeMessage *message, CamelFolder *dest_folder, CamelException *ex); static const gchar *_get_message_uid (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex); @@ -209,7 +209,9 @@ _check_get_or_maybe_generate_summary_file (CamelMboxFolder *mbox_folder, CamelEx GArray *mbox_summary_info; gint mbox_file_fd; guint32 next_uid; - + guint32 file_size; + + /* test for the existence of the summary file */ summary_file_exists = (access (mbox_folder->summary_file_path, F_OK) == 0); @@ -239,6 +241,7 @@ _check_get_or_maybe_generate_summary_file (CamelMboxFolder *mbox_folder, CamelEx message_info_array = camel_mbox_parse_file (mbox_file_fd, "From - ", 0, + &file_size, &next_uid, TRUE, NULL, @@ -252,7 +255,7 @@ _check_get_or_maybe_generate_summary_file (CamelMboxFolder *mbox_folder, CamelEx next_uid = camel_mbox_write_xev (mbox_folder->folder_file_path, - message_info_array, next_uid, ex); + message_info_array, &file_size, next_uid, ex); if (camel_exception_get_id (ex)) { /* ** FIXME : free the preparsed information */ @@ -273,6 +276,7 @@ _check_get_or_maybe_generate_summary_file (CamelMboxFolder *mbox_folder, CamelEx /* store the number of messages as well as the summary array */ mbox_folder->summary->nb_message = mbox_summary_info->len; mbox_folder->summary->next_uid = next_uid; + mbox_folder->summary->mbox_file_size = file_size; mbox_folder->summary->message_info = mbox_summary_info; } else { @@ -509,6 +513,7 @@ _create (CamelFolder *folder, CamelException *ex) mbox_folder->summary = g_new (CamelMboxSummary, 1); mbox_folder->summary->nb_message = 0; mbox_folder->summary->next_uid = 1; + mbox_folder->summary->mbox_file_size = 0; mbox_folder->summary->message_info = g_array_new (FALSE, FALSE, sizeof (CamelMboxSummaryInformation)); return TRUE; @@ -872,4 +877,113 @@ _get_message_count (CamelFolder *folder, CamelException *ex) CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::get_message_count found %d messages\n", message_count); return message_count; } + + +static gint +_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex) +{ + CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(folder); + //guint new_msg_number; + CamelStream *output_stream; + guint32 file_size; + guint32 next_uid; + gint mbox_file_fd; + GArray *message_info_array; + GArray *mbox_summary_info; + + CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxFolder::append_message\n"); + + /* write the message itself */ + output_stream = camel_stream_fs_new_with_name (mbox_folder->folder_file_path, CAMEL_STREAM_FS_WRITE); + if (output_stream != NULL) { + camel_stream_seek (output_stream, mbox_folder->summary->mbox_file_size, CAMEL_STREAM_SET); + camel_stream_write_string (output_stream, "From - \n"); + camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), output_stream); + } + camel_stream_close (output_stream); + + /* at this point we have only added the message to + the file, but now, we have to add the x-evolution + field and also update the summary */ + + /* + First : parse the mbox file, but only from the + position where the message has been added, + wich happens to be the last postion in the + mbox file before we added the message. + This position is still stored in the summary + for the moment + */ + mbox_file_fd = open (mbox_folder->folder_file_path, O_RDONLY); + message_info_array = camel_mbox_parse_file (mbox_file_fd, + "From - ", + mbox_folder->summary->mbox_file_size, + &file_size, + &next_uid, + TRUE, + NULL, + 0, + ex); + + close (mbox_file_fd); + + /* + OK, this is not very efficient, we should not use the same + method as for parsing an entire mail file, + but I have no time to write a simpler parser + */ + next_uid = camel_mbox_write_xev (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 -1; + } + + mbox_summary_info = + parsed_information_to_mbox_summary (message_info_array); + + /* generate the folder md5 signature */ + md5_get_digest_from_file (mbox_folder->folder_file_path, mbox_folder->summary->md5_digest); + + /* store the number of messages as well as the summary array */ + mbox_folder->summary->nb_message += 1; + mbox_folder->summary->next_uid = next_uid; + mbox_folder->summary->mbox_file_size = file_size; + + mbox_folder->summary->message_info = + g_array_append_val (mbox_folder->summary->message_info, mbox_summary_info->data); + + g_array_free (mbox_summary_info, TRUE); + + CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxFolder::append_message\n"); + + return -1; +} + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/camel/providers/mbox/camel-mbox-parser.c b/camel/providers/mbox/camel-mbox-parser.c index 63c79a48e1..db6f5bff44 100644 --- a/camel/providers/mbox/camel-mbox-parser.c +++ b/camel/providers/mbox/camel-mbox-parser.c @@ -87,7 +87,6 @@ typedef struct { guint left_chunk_size; /* size of the left chunk in the temp buffer */ guint last_position; /* last position that can be compared to a keyword */ guint current_position; /* current position in the temp buffer */ - gboolean eof; /* did we read the entire file */ /* other */ GString *tmp_string; /* temporary string to fill the headers in */ @@ -101,6 +100,9 @@ typedef struct { static void clear_message_info (CamelMboxParserMessageInfo *preparsing_info) { + + CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxParser::clear_message_info\n"); + preparsing_info->message_position = 0; preparsing_info->size = 0; preparsing_info->from = NULL; @@ -114,7 +116,8 @@ clear_message_info (CamelMboxParserMessageInfo *preparsing_info) preparsing_info->x_evolution_offset = 0; preparsing_info->status = 0; preparsing_info->uid = 0; - + + CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxParser::clear_message_info\n"); } @@ -133,9 +136,10 @@ static CamelMboxPreParser * new_parser (int fd, const gchar *message_delimiter) { - CamelMboxPreParser *parser; + CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxParser::ew_parser\n"); + parser = g_new0 (CamelMboxPreParser, 1); parser->fd = fd; @@ -148,10 +152,11 @@ new_parser (int fd, parser->message_summary_size = MBOX_PARSER_SUMMARY_SIZE; parser->left_chunk_size = MAX (parser->message_delimiter_length, MBOX_PARSER_MAX_KW_SIZE); - parser->eof = FALSE; parser->tmp_string = g_string_sized_new (1000); + CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxParser::ew_parser\n"); + return parser; } @@ -169,11 +174,14 @@ new_parser (int fd, static void parser_free (CamelMboxPreParser *parser) { + CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxParser::parser_free\n"); + g_free (parser->buffer); g_free (parser->message_delimiter); g_string_free (parser->tmp_string, TRUE); g_free (parser); + CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxParser::parser_free\n"); } @@ -195,6 +203,8 @@ initialize_buffer (CamelMboxPreParser *parser, gint seek_res; gint buf_nb_read; + CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxParser::intialize_buffer\n"); + g_assert (parser); /* set the search start position */ @@ -214,12 +224,19 @@ initialize_buffer (CamelMboxPreParser *parser, } while ((buf_nb_read == -1) && (errno == EINTR)); /* ** check for an error here */ - parser->last_position = buf_nb_read; - - if (buf_nb_read == 0) - parser->eof =TRUE; + if (buf_nb_read < MBOX_PARSER_BUF_SIZE - parser->left_chunk_size) { + /* fill the end of the buffer with 0\ */ + memset (parser->buffer + buf_nb_read + parser->left_chunk_size, '\0', + MIN (parser->left_chunk_size, MBOX_PARSER_BUF_SIZE - buf_nb_read - parser->left_chunk_size)); + printf ("I am memsetting with 0\n"); + }; + parser->last_position = MIN (buf_nb_read + parser->left_chunk_size + 1, + MBOX_PARSER_BUF_SIZE - parser->left_chunk_size); parser->current_position = parser->left_chunk_size; + + CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxParser::intialize_buffer\n"); + } @@ -244,7 +261,9 @@ read_next_buffer_chunk (CamelMboxPreParser *parser) gint buf_nb_read; g_assert (parser); - + + CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxParser::intialize_buffer\n"); + /* read the next chunk of data in the folder file : */ /* - first, copy the last bytes from the previous chunk at the begining of the new one. */ @@ -260,13 +279,18 @@ read_next_buffer_chunk (CamelMboxPreParser *parser) } while ((buf_nb_read == -1) && (errno == EINTR)); /* ** check for an error here */ - parser->last_position = buf_nb_read; + if (buf_nb_read < MBOX_PARSER_BUF_SIZE - parser->left_chunk_size) { + /* fill the end of the buffer with 0\ */ + memset (parser->buffer + buf_nb_read + parser->left_chunk_size, '\0', + MIN (parser->left_chunk_size, MBOX_PARSER_BUF_SIZE - buf_nb_read - parser->left_chunk_size)); + }; - if (buf_nb_read == 0) - parser->eof =TRUE; + parser->last_position = MIN (buf_nb_read + parser->left_chunk_size + 1, + MBOX_PARSER_BUF_SIZE - parser->left_chunk_size); parser->current_position = 0; - + CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxParser::intialize_buffer\n"); + } @@ -276,19 +300,20 @@ read_next_buffer_chunk (CamelMboxPreParser *parser) * @parser: parser object * * goto one position forward in the buffer. If necessary, - * read the next chunk of data in the file, possibly - * raising the parser->eof flag. + * read the next chunk of data in the file. * **/ static void goto_next_char (CamelMboxPreParser *parser) { + if (parser->current_position < parser->last_position - 1) parser->current_position++; else read_next_buffer_chunk (parser); - + parser->real_position++; + } @@ -308,21 +333,21 @@ advance_n_chars (CamelMboxPreParser *parser, guint n) { gint position_to_the_end; + + CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxParser::advnce_n_chars\n"); position_to_the_end = parser->last_position - parser->current_position; if (n < position_to_the_end) parser->current_position += n; else { - printf ("Advance %d chars\n", n); - printf ("Last position = %d\n", parser->last_position); - printf ("Current position = %d\n", parser->current_position); read_next_buffer_chunk (parser); parser->current_position = n - position_to_the_end; - printf ("New position = %d\n", parser->current_position); } parser->real_position += n; + + CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxParser::advance_n_chars\n"); } @@ -352,6 +377,8 @@ new_message_detected (CamelMboxPreParser *parser) gchar c; + CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxParser::new_message_detected\n"); + /* if we were filling a message information save it in the message information array */ @@ -376,7 +403,8 @@ new_message_detected (CamelMboxPreParser *parser) (parser->current_message_info).message_position = parser->real_position; parser->is_pending_message = TRUE; - + + CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxParser::new_message_detected\n"); } @@ -413,6 +441,8 @@ read_header (CamelMboxPreParser *parser, gchar **header_content) gchar c; + CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxParser::read_header\n"); + g_assert (parser); /* reset the header buffer string */ @@ -420,10 +450,10 @@ read_header (CamelMboxPreParser *parser, gchar **header_content) buffer = parser->buffer; - while (! (parser->eof || header_end) ) { + /* read the current character */ + c = buffer[parser->current_position]; - /* read the current character */ - c = buffer[parser->current_position]; + while (! ((c == '\0') || header_end )) { if (space) { if (c == ' ' && c == '\t') @@ -455,11 +485,15 @@ read_header (CamelMboxPreParser *parser, gchar **header_content) next_char: /* read next char in the buffer */ goto_next_char (parser); + /* read the current character */ + c = buffer[parser->current_position]; } /* copy the buffer in the preparsing information structure */ *header_content = g_strndup (parser->tmp_string->str, parser->tmp_string->len); + CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxParser::read_header\n"); + } @@ -487,6 +521,8 @@ read_message_begining (CamelMboxPreParser *parser, gchar **message_summary) guint nb_line = 0; g_assert (parser); + CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxParser::read_message_begining\n"); + /* reset the header buffer string */ parser->tmp_string = g_string_truncate (parser->tmp_string, 0); @@ -495,7 +531,9 @@ read_message_begining (CamelMboxPreParser *parser, gchar **message_summary) character but there is no g_string_n_append function, so for the moment, this is a lazy implementation */ - while (! (parser->eof) && (nb_line <2) && (nb_readmessage_summary_size) && (!new_message)) { + while (! (buffer[parser->current_position] != '\0') && + (nb_line <2) && (nb_readmessage_summary_size) && + (!new_message)) { /* test if we are not at the end of the message */ @@ -503,9 +541,10 @@ read_message_begining (CamelMboxPreParser *parser, gchar **message_summary) nb_line++; goto_next_char (parser); - if ((parser->eof) || (g_strncasecmp (parser->buffer + parser->current_position, - parser->message_delimiter, - parser->message_delimiter_length) == 0)) { + if ((buffer[parser->current_position] == '\0') || + (g_strncasecmp (parser->buffer + parser->current_position, + parser->message_delimiter, + parser->message_delimiter_length) == 0)) { new_message = TRUE; continue; } else { @@ -526,6 +565,8 @@ read_message_begining (CamelMboxPreParser *parser, gchar **message_summary) } *message_summary = g_strndup (parser->tmp_string->str, parser->tmp_string->len); + + CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxParser::read_message_begining\n"); return new_message; } @@ -561,6 +602,7 @@ GArray * camel_mbox_parse_file (int fd, const gchar *message_delimiter, glong start_position, + guint32 *file_size, guint32 *next_uid, gboolean get_message_summary, camel_mbox_preparser_status_callback *status_callback, @@ -583,6 +625,8 @@ camel_mbox_parse_file (int fd, g_assert (next_uid); + CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxParser::parse_file\n"); + /* get file size */ fstat_result = fstat (fd, &stat_buf); if (fstat_result == -1) { @@ -602,7 +646,7 @@ camel_mbox_parse_file (int fd, /* the first line is indeed at the begining of a new line ... */ newline = TRUE; - while (!parser->eof) { + while (parser->buffer[parser->current_position] != '\0') { @@ -756,15 +800,21 @@ camel_mbox_parse_file (int fd, /* if there is a pending message information put it in the array */ if (parser->is_pending_message) { + parser->current_message_info.size = + parser->real_position - parser->current_message_info.message_position; + printf ("the postion of the last message : %ld\nthe size of the last message is : %ld\n", parser->current_message_info.message_position, parser->current_message_info.size); g_array_append_vals (parser->preparsed_messages, (gchar *)parser + G_STRUCT_OFFSET (CamelMboxPreParser, current_message_info), 1); } return_value = parser->preparsed_messages; + *file_size = parser->real_position; *next_uid = next_available_uid; /* free the parser */ parser_free (parser); + CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxParser::parse_file\n"); + return return_value; } diff --git a/camel/providers/mbox/camel-mbox-parser.h b/camel/providers/mbox/camel-mbox-parser.h index fdf643d90c..1c49ea55c6 100644 --- a/camel/providers/mbox/camel-mbox-parser.h +++ b/camel/providers/mbox/camel-mbox-parser.h @@ -57,6 +57,7 @@ GArray * camel_mbox_parse_file (int fd, const gchar *message_delimiter, glong start_position, + guint32 *file_size, guint32 *next_uid, gboolean get_message_summary, camel_mbox_preparser_status_callback *status_callback, diff --git a/camel/providers/mbox/camel-mbox-provider.c b/camel/providers/mbox/camel-mbox-provider.c new file mode 100644 index 0000000000..c10e42f95e --- /dev/null +++ b/camel/providers/mbox/camel-mbox-provider.c @@ -0,0 +1,48 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* camel-mbox-provider.c: mbox provider registration code */ + +/* + * Authors : + * Bertrand Guiheneuf + * + * Copyright (C) 2000 HelixCode (www.helixcode.com). + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + */ + +#include "config.h" +#include "camel-mbox-store.h" +#include "camel-provider.h" +#include "camel-log.h" + + +static CamelProvider _mbox_provider = { + (GtkType) 0, + PROVIDER_STORE, + "mbox", + "Camel default mbox provider", + "This the first full fledged local mail provider", + (GModule *) NULL +}; + + + +CamelProvider * +camel_provider_module_init () +{ + _mbox_provider.object_type = camel_mbox_store_get_type(); + return &_mbox_provider; +} diff --git a/camel/providers/mbox/camel-mbox-summary.c b/camel/providers/mbox/camel-mbox-summary.c index c8ba96fe2f..685d375fa7 100644 --- a/camel/providers/mbox/camel-mbox-summary.c +++ b/camel/providers/mbox/camel-mbox-summary.c @@ -66,8 +66,8 @@ camel_mbox_save_summary (CamelMboxSummary *summary, const gchar *filename, Camel //md5_get_digest_from_file (filename, summary->md5_digest); /* write the number of messages + the md5 signatures - + next UID */ - write (fd, summary, sizeof (guint) + sizeof (guchar) * 16 + sizeof (guint32)); + + next UID + mbox file size */ + write (fd, summary, sizeof (guint) + sizeof (guchar) * 16 + 2 * sizeof (guint32)); for (cur_msg=0; cur_msg < summary->nb_message; cur_msg++) { @@ -142,8 +142,8 @@ camel_mbox_load_summary (const gchar *filename, CamelException *ex) summary = g_new0 (CamelMboxSummary, 1); /* read the message number, the md5 signature - and the next available UID */ - read (fd, summary, sizeof (guint) + sizeof (guchar) * 16 + sizeof (guint32)); + and the next available UID + mbox file size */ + read (fd, summary, sizeof (guint) + sizeof (guchar) * 16 + 2 * sizeof (guint32)); summary->message_info = g_array_new (FALSE, FALSE, sizeof (CamelMboxSummaryInformation)); summary->message_info = g_array_set_size (summary->message_info, summary->nb_message); diff --git a/camel/providers/mbox/camel-mbox-summary.h b/camel/providers/mbox/camel-mbox-summary.h index 2d08e36164..bb7450d5e7 100644 --- a/camel/providers/mbox/camel-mbox-summary.h +++ b/camel/providers/mbox/camel-mbox-summary.h @@ -48,6 +48,7 @@ typedef struct { guint nb_message; /* number of messages in the summary */ guchar md5_digest[16]; /* md5 signature of the mbox file */ guint32 next_uid; + guint32 mbox_file_size; GArray *message_info; /* array of CamelMboxSummaryInformation */ diff --git a/camel/providers/mbox/camel-mbox-utils.c b/camel/providers/mbox/camel-mbox-utils.c index 6e4fc42faa..5d901b4d7c 100644 --- a/camel/providers/mbox/camel-mbox-utils.c +++ b/camel/providers/mbox/camel-mbox-utils.c @@ -170,7 +170,7 @@ copy_file_chunk (gint fd_src, glong nb_to_read; glong nb_read, v; - + printf ("Write %ld bytes\n", nb_bytes); nb_to_read = nb_bytes; while (nb_to_read > 0) { @@ -209,10 +209,11 @@ copy_file_chunk (gint fd_src, } -glong +guint32 camel_mbox_write_xev (gchar *mbox_file_name, GArray *summary_information, - glong next_uid, + guint32 *file_size, + guint32 next_uid, CamelException *ex) { gint cur_msg; @@ -250,7 +251,7 @@ camel_mbox_write_xev (gchar *mbox_file_name, cur_msg_info = (CamelMboxParserMessageInfo *)(summary_information->data) + cur_msg; end_of_last_message = cur_msg_info->message_position + cur_msg_info->size; - + printf ("End of last message : %ld\n", end_of_last_message); if (cur_msg_info->uid == 0) { bytes_to_copy = cur_msg_info->message_position @@ -277,6 +278,7 @@ camel_mbox_write_xev (gchar *mbox_file_name, cur_msg_info->x_evolution_offset = cur_msg_info->end_of_headers_offset; cur_msg_info->x_evolution = g_strdup_printf ("%.6s", xev_header + 12); cur_msg_info->end_of_headers_offset += 19; + *file_size += 19; } cur_msg_info->message_position += cur_offset; } diff --git a/camel/providers/mbox/camel-mbox-utils.h b/camel/providers/mbox/camel-mbox-utils.h index 25e611392e..10a8a68e24 100644 --- a/camel/providers/mbox/camel-mbox-utils.h +++ b/camel/providers/mbox/camel-mbox-utils.h @@ -46,10 +46,11 @@ camel_mbox_xev_write_header_content (gchar header_content[6], guint32 uid, guchar status); -glong +guint32 camel_mbox_write_xev (gchar *mbox_file_name, GArray *summary_information, - glong last_uid, + guint32 *file_size, + guint32 last_uid, CamelException *ex); GArray * -- cgit v1.2.3