diff options
author | bertrand <bertrand@helixcode.com> | 2000-01-24 23:07:18 +0800 |
---|---|---|
committer | Bertrand Guiheneuf <bertrand@src.gnome.org> | 2000-01-24 23:07:18 +0800 |
commit | 98e15c6b5c3757241e3a4017df85ee0e42a5f947 (patch) | |
tree | fb7153111faa14d8091793ae258a2a140baf70e7 /camel/providers/mbox | |
parent | f64b3bb5f2d3f4fa6e05fcc9223aff78fd8c2f12 (diff) | |
download | gsoc2013-evolution-98e15c6b5c3757241e3a4017df85ee0e42a5f947.tar gsoc2013-evolution-98e15c6b5c3757241e3a4017df85ee0e42a5f947.tar.gz gsoc2013-evolution-98e15c6b5c3757241e3a4017df85ee0e42a5f947.tar.bz2 gsoc2013-evolution-98e15c6b5c3757241e3a4017df85ee0e42a5f947.tar.lz gsoc2013-evolution-98e15c6b5c3757241e3a4017df85ee0e42a5f947.tar.xz gsoc2013-evolution-98e15c6b5c3757241e3a4017df85ee0e42a5f947.tar.zst gsoc2013-evolution-98e15c6b5c3757241e3a4017df85ee0e42a5f947.zip |
add recipient_list to the recipients, not recipients_list. I don't know
2000-01-24 bertrand <bertrand@helixcode.com>
* camel/camel-recipient.c (camel_recipient_table_add_list):
add recipient_list to the recipients, not recipients_list.
I don't know what that variable was doing here.
2000-01-23 bertrand <bertrand@helixcode.com>
* camel/camel-store.c (camel_store_get_session):
added a public get_session method.
* camel/providers/mbox/camel-mbox-summary.c (camel_mbox_save_summary):
(camel_mbox_load_summary): load/save message sizes in the summary file
* camel/providers/mbox/camel-mbox-summary.h:
added a size field to the message information
structure.
* camel/providers/mbox/camel-mbox-utils.c (parsed_information_to_mbox_summary):
copy message size to the mbox summary information too.
* camel/camel-stream-fs.c (_seek): updated to
work with bounded fs streams.
(_write): ditto.
(_read): ditto.
* camel/camel-stream-fs.h (struct ):
added the cur_pos, inf_bound and sup_bound
members to allow for bounded fs stream.
* camel/camel-stream-fs.c (_set_bounds): new func.
(_init_with_fd_and_bounds): idem.
(_init_with_name_and_bounds): idem.
New functions to allow the usage of bounded fs streams.
The bounded fs stream allow, for example, to make a stream
from a message stored in an mbox file.
svn path=/trunk/; revision=1620
Diffstat (limited to 'camel/providers/mbox')
-rw-r--r-- | camel/providers/mbox/camel-mbox-folder.c | 74 | ||||
-rw-r--r-- | camel/providers/mbox/camel-mbox-summary.c | 12 | ||||
-rw-r--r-- | camel/providers/mbox/camel-mbox-summary.h | 3 | ||||
-rw-r--r-- | camel/providers/mbox/camel-mbox-utils.c | 2 |
4 files changed, 82 insertions, 9 deletions
diff --git a/camel/providers/mbox/camel-mbox-folder.c b/camel/providers/mbox/camel-mbox-folder.c index 54f38e1210..e47ad29215 100644 --- a/camel/providers/mbox/camel-mbox-folder.c +++ b/camel/providers/mbox/camel-mbox-folder.c @@ -25,6 +25,7 @@ #include <config.h> +#include <stdlib.h> #include <sys/types.h> #include <dirent.h> #include <sys/stat.h> @@ -70,13 +71,14 @@ static GList *_list_subfolders (CamelFolder *folder, CamelException *ex); static gint _get_message_count (CamelFolder *folder, CamelException *ex); static gint _append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex); static GList *_get_uid_list (CamelFolder *folder, CamelException *ex); -#if 0 static CamelMimeMessage *_get_message_by_uid (CamelFolder *folder, const gchar *uid, 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); #endif + static void _finalize (GtkObject *object); static void @@ -107,8 +109,9 @@ camel_mbox_folder_class_init (CamelMboxFolderClass *camel_mbox_folder_class) camel_folder_class->expunge = _expunge; camel_folder_class->copy_message_to = _copy_message_to; camel_folder_class->get_message_uid = _get_message_uid; - camel_folder_class->get_message_by_uid = _get_message_by_uid; #endif + camel_folder_class->get_message_by_uid = _get_message_by_uid; + gtk_object_class->finalize = _finalize; } @@ -1033,6 +1036,73 @@ _get_uid_list (CamelFolder *folder, CamelException *ex) +static CamelMimeMessage * +_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex) +{ + + CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(folder); + GArray *message_info_array; + CamelMboxSummaryInformation *message_info; + guint32 searched_uid; + int i; + gboolean uid_found; + CamelStreamFs *message_stream; + CamelMimeMessage *message = NULL; + CamelStore *parent_store; + + CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxFolder::get_uid_list\n"); + + searched_uid = strtoul(uid, (char **)NULL, 10); + + message_info_array = mbox_folder->summary->message_info; + i=0; + uid_found = FALSE; + + /* first, look for the message that has the searched uid */ + while ((i<message_info_array->len) && (!uid_found)) { + message_info = (CamelMboxSummaryInformation *)(message_info_array->data) + i; + uid_found = (message_info->uid == searched_uid); + i++; + } + + /* if the uid was not found, raise an exception and return */ + if (!uid_found) { + camel_exception_setv (ex, + CAMEL_EXCEPTION_FOLDER_INVALID_UID, + "uid %s not found in the folder", + uid); + CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxFolder::get_uid_list\n"); + return NULL; + } + + /* at this point, the message_info structure + contains the informations concerning the + message that was searched for */ + + /* create a stream bound to the message */ + message_stream = camel_stream_fs_new_with_name_and_bounds (mbox_folder->folder_file_path, + CAMEL_STREAM_FS_READ, + message_info->position, + message_info->position + message_info->size); + + + /* get the parent store */ + parent_store = camel_folder_get_parent_store (folder, ex); + if (camel_exception_get_id (ex)) { + gtk_object_unref (GTK_OBJECT (message_stream)); + return NULL; + } + + + message = camel_mime_message_new_with_session (camel_store_get_session (parent_store, ex)); + camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (message), CAMEL_STREAM (message_stream)); + + + + + CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxFolder::get_uid_list\n"); + return message; +} diff --git a/camel/providers/mbox/camel-mbox-summary.c b/camel/providers/mbox/camel-mbox-summary.c index 2cbb481700..2d09c61a43 100644 --- a/camel/providers/mbox/camel-mbox-summary.c +++ b/camel/providers/mbox/camel-mbox-summary.c @@ -75,10 +75,10 @@ camel_mbox_save_summary (CamelMboxSummary *summary, const gchar *filename, Camel msg_info = (CamelMboxSummaryInformation *)(summary->message_info->data) + cur_msg; - /* write message position + x-evolution offset - + uid + status */ + /* write message position + message size + + x-evolution offset + uid + status */ write (fd, (gchar *)msg_info, - sizeof (guint32) + sizeof (guint) + + sizeof (guint32) + 2 * sizeof (guint) + sizeof (guint32) + sizeof (guchar)); /* write subject */ @@ -154,10 +154,10 @@ camel_mbox_load_summary (const gchar *filename, CamelException *ex) msg_info = (CamelMboxSummaryInformation *)(summary->message_info->data) + cur_msg; - /* read message position + x-evolution offset - + uid + status */ + /* read message position + message size + + x-evolution offset + uid + status */ read (fd, (gchar *)msg_info, - sizeof (guint32) + sizeof (guint) + + sizeof (guint32) + 2 * sizeof (guint) + sizeof (guint32) + sizeof (guchar)); diff --git a/camel/providers/mbox/camel-mbox-summary.h b/camel/providers/mbox/camel-mbox-summary.h index cdfb88d63a..749a5a49f2 100644 --- a/camel/providers/mbox/camel-mbox-summary.h +++ b/camel/providers/mbox/camel-mbox-summary.h @@ -4,7 +4,7 @@ * * Author : Bertrand Guiheneuf <bertrand@helixcode.com> * - * Copyright (C) 1999 Helix Code . + * Copyright (C) 1999 Helix Code (http://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 @@ -32,6 +32,7 @@ typedef struct { guint32 position; + guint size; guint x_evolution_offset; guint32 uid; guchar status; diff --git a/camel/providers/mbox/camel-mbox-utils.c b/camel/providers/mbox/camel-mbox-utils.c index 52de0d526e..1f0285be8a 100644 --- a/camel/providers/mbox/camel-mbox-utils.c +++ b/camel/providers/mbox/camel-mbox-utils.c @@ -356,6 +356,8 @@ parsed_information_to_mbox_summary (GArray *parsed_information) cur_sum_info->position = cur_msg_info->message_position; + cur_sum_info->size = cur_msg_info->size; + cur_sum_info->x_evolution_offset = cur_msg_info->x_evolution_offset; cur_sum_info->uid = cur_msg_info->uid; |