diff options
author | bertrand <Bertrand.Guiheneuf@aful.org> | 1999-09-08 20:20:30 +0800 |
---|---|---|
committer | Bertrand Guiheneuf <bertrand@src.gnome.org> | 1999-09-08 20:20:30 +0800 |
commit | 4a3be146661da5d5267af57482ba0a22656166f5 (patch) | |
tree | e568418440f75991d60aaab55ec28a5556d19a07 /camel/providers/MH | |
parent | 58b233790e34380b6c548ac07f7082ccafaf643f (diff) | |
download | gsoc2013-evolution-4a3be146661da5d5267af57482ba0a22656166f5.tar.gz gsoc2013-evolution-4a3be146661da5d5267af57482ba0a22656166f5.tar.zst gsoc2013-evolution-4a3be146661da5d5267af57482ba0a22656166f5.zip |
impemented.
1999-09-08 bertrand <Bertrand.Guiheneuf@aful.org>
* camel/providers/MH/camel-mh-folder.c
(_get_message_by_uid): impemented.
* camel/camel-folder.c:
(camel_folder_get_message_uid_by_number):
const'ified uid.
(camel_folder_get_message_by_uid): idem
removed stupid camel_folder_get_message_uid_by_number
method.
svn path=/trunk/; revision=1215
Diffstat (limited to 'camel/providers/MH')
-rw-r--r-- | camel/providers/MH/camel-mh-folder.c | 65 | ||||
-rw-r--r-- | camel/providers/MH/mh-uid.c | 1 | ||||
-rw-r--r-- | camel/providers/MH/mh-utils.c | 2 |
3 files changed, 67 insertions, 1 deletions
diff --git a/camel/providers/MH/camel-mh-folder.c b/camel/providers/MH/camel-mh-folder.c index 1afc441cad..231c79039a 100644 --- a/camel/providers/MH/camel-mh-folder.c +++ b/camel/providers/MH/camel-mh-folder.c @@ -39,6 +39,7 @@ #include "camel-folder-summary.h" #include "gmime-utils.h" #include "mh-utils.h" +#include "mh-uid.h" static CamelFolderClass *parent_class=NULL; @@ -738,6 +739,70 @@ _copy_message_to (CamelFolder *folder, CamelMimeMessage *message, CamelFolder *d +/** UID **/ + +static const gchar * +_get_message_uid (CamelFolder *folder, CamelMimeMessage *message) +{ + +} + + +static CamelMimeMessage * +_get_message_by_uid (CamelFolder *folder, const gchar *uid) +{ + CamelMhFolder *mh_folder = CAMEL_MH_FOLDER (folder); + GArray *uid_array; + gboolean found = FALSE; + MhUidCouple *uid_couple; + gint file_number; + gchar *filename; + CamelMimeMessage *message = NULL; + CamelStream *input_stream; + int i; + + /* + * because they are constructed with md5 + * signatures, all MH uids are 16 bytes long + */ + if (strlen (uid) != 16) return NULL; + + uid_array = mh_folder->uid_array; + uid_couple = (MhUidCouple *)uid_array->data; + + found = !strncmp (uid, uid_couple->uid, 16 * sizeof (guchar)); + for (i=0; (i<uid_array->len) && (!found); i++) { + uid_couple++; + found = !strncmp (uid, uid_couple->uid, 16 * sizeof (guchar)); + } + if (found) { + /* physically retrieve the message */ + file_number = uid_couple->file_number; + filename = g_strdup_printf ("%d", file_number); + input_stream = camel_stream_buffered_fs_new_with_name (filename, CAMEL_STREAM_BUFFERED_FS_READ); + + if (input_stream != NULL) { +#warning use session field here + message = camel_mime_message_new_with_session ( (CamelSession *)NULL); + camel_data_wrapper_construct_from_stream ( CAMEL_DATA_WRAPPER (message), input_stream); + gtk_object_unref (GTK_OBJECT (input_stream)); + + /* set message UID in CamelMimeMessage */ + message->message_uid = g_strdup (uid); + + } + g_free (filename); + } + + return message; + +} + +static GList * +_get_uid_list (CamelFolder *folder) +{ + return NULL; +} diff --git a/camel/providers/MH/mh-uid.c b/camel/providers/MH/mh-uid.c index f0a3e93417..1c71f10fb6 100644 --- a/camel/providers/MH/mh-uid.c +++ b/camel/providers/MH/mh-uid.c @@ -24,6 +24,7 @@ #include <config.h> #include "mh-uid.h" +#include "camel-log.h" #include "camel-stream.h" #include "camel-stream-fs.h" #include "camel-stream-buffered-fs.h" diff --git a/camel/providers/MH/mh-utils.c b/camel/providers/MH/mh-utils.c index bc708a98ee..51bb84bc65 100644 --- a/camel/providers/MH/mh-utils.c +++ b/camel/providers/MH/mh-utils.c @@ -20,7 +20,7 @@ * USA */ -#include "config.h" +#include <config.h> #include "mh-utils.h" #include <sys/stat.h> |