aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbertrand <Bertrand.Guiheneuf@aful.org>1999-09-08 20:20:30 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>1999-09-08 20:20:30 +0800
commit4a3be146661da5d5267af57482ba0a22656166f5 (patch)
treee568418440f75991d60aaab55ec28a5556d19a07
parent58b233790e34380b6c548ac07f7082ccafaf643f (diff)
downloadgsoc2013-evolution-4a3be146661da5d5267af57482ba0a22656166f5.tar
gsoc2013-evolution-4a3be146661da5d5267af57482ba0a22656166f5.tar.gz
gsoc2013-evolution-4a3be146661da5d5267af57482ba0a22656166f5.tar.bz2
gsoc2013-evolution-4a3be146661da5d5267af57482ba0a22656166f5.tar.lz
gsoc2013-evolution-4a3be146661da5d5267af57482ba0a22656166f5.tar.xz
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
-rw-r--r--ChangeLog10
-rw-r--r--camel/camel-folder.c24
-rw-r--r--camel/camel-folder.h10
-rw-r--r--camel/camel-mime-message.h2
-rw-r--r--camel/providers/MH/camel-mh-folder.c65
-rw-r--r--camel/providers/MH/mh-uid.c1
-rw-r--r--camel/providers/MH/mh-utils.c2
7 files changed, 94 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index e1c8944feb..c1075dbe3e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,12 +1,20 @@
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_has_uid_capability):
(camel_folder_get_message_uid):
(camel_folder_get_message_uid_by_number):
(camel_folder_get_message_by_uid):
(camel_folder_get_uid_list):
Documented UID methods.
-
+ (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.
+
* tests/ui-tests/store_listing.c (close_all):
close all open folders and stores. (necessary
for UID list saving ).
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index 652306c740..524252da1c 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -56,9 +56,8 @@ static gint _append_message (CamelFolder *folder, CamelMimeMessage *message);
static const GList *_list_permanent_flags (CamelFolder *folder);
static void _copy_message_to (CamelFolder *folder, CamelMimeMessage *message, CamelFolder *dest_folder);
-static gchar *_get_message_uid (CamelFolder *folder, CamelMimeMessage *message);
-static gchar *_get_message_uid_by_number (CamelFolder *folder, gint message_number);
-static CamelMimeMessage *_get_message_by_uid (CamelFolder *folder, gchar *uid);
+static const gchar *_get_message_uid (CamelFolder *folder, CamelMimeMessage *message);
+static CamelMimeMessage *_get_message_by_uid (CamelFolder *folder, const gchar *uid);
static GList *_get_uid_list (CamelFolder *folder);
@@ -97,7 +96,6 @@ camel_folder_class_init (CamelFolderClass *camel_folder_class)
camel_folder_class->list_permanent_flags = _list_permanent_flags;
camel_folder_class->copy_message_to;
camel_folder_class->get_message_uid = _get_message_uid;
- camel_folder_class->get_message_uid_by_number = _get_message_uid_by_number;
camel_folder_class->get_message_by_uid = _get_message_by_uid;
camel_folder_class->get_uid_list = _get_uid_list;
@@ -1026,7 +1024,7 @@ camel_folder_has_uid_capability (CamelFolder *folder)
-static gchar *
+static const gchar *
_get_message_uid (CamelFolder *folder, CamelMimeMessage *message)
{
return NULL;
@@ -1044,7 +1042,7 @@ _get_message_uid (CamelFolder *folder, CamelMimeMessage *message)
*
* Return value: The UID of the message in the folder
**/
-gchar *
+const gchar *
camel_folder_get_message_uid (CamelFolder *folder, CamelMimeMessage *message)
{
if (!folder->has_uid_capability) return NULL;
@@ -1052,7 +1050,9 @@ camel_folder_get_message_uid (CamelFolder *folder, CamelMimeMessage *message)
}
-static gchar *
+
+/* the next two func are left there temporarily */
+static const gchar *
_get_message_uid_by_number (CamelFolder *folder, gint message_number)
{
return NULL;
@@ -1070,16 +1070,16 @@ _get_message_uid_by_number (CamelFolder *folder, gint message_number)
*
* Return value:
**/
-gchar *
+const gchar *
camel_folder_get_message_uid_by_number (CamelFolder *folder, gint message_number)
{
- if (!folder->has_uid_capability) return NULL;
- return CF_CLASS (folder)->get_message_uid_by_number (folder, message_number);
+ //if (!folder->has_uid_capability) return NULL;
+ //return CF_CLASS (folder)->get_message_uid_by_number (folder, message_number);
}
static CamelMimeMessage *
-_get_message_by_uid (CamelFolder *folder, gchar *uid)
+_get_message_by_uid (CamelFolder *folder, const gchar *uid)
{
return NULL;
}
@@ -1097,7 +1097,7 @@ _get_message_by_uid (CamelFolder *folder, gchar *uid)
* Return value: Message corresponding to the UID
**/
CamelMimeMessage *
-camel_folder_get_message_by_uid (CamelFolder *folder, gchar *uid)
+camel_folder_get_message_by_uid (CamelFolder *folder, const gchar *uid)
{
if (!folder->has_uid_capability) return NULL;
return CF_CLASS (folder)->get_message_by_uid (folder, uid);
diff --git a/camel/camel-folder.h b/camel/camel-folder.h
index 443186803e..0d30351d9d 100644
--- a/camel/camel-folder.h
+++ b/camel/camel-folder.h
@@ -113,9 +113,8 @@ typedef struct {
const GList * (*list_permanent_flags) (CamelFolder *folder);
void (*copy_message_to) (CamelFolder *folder, CamelMimeMessage *message, CamelFolder *dest_folder);
- gchar * (*get_message_uid) (CamelFolder *folder, CamelMimeMessage *message);
- gchar * (*get_message_uid_by_number) (CamelFolder *folder, gint message_number);
- CamelMimeMessage * (*get_message_by_uid) (CamelFolder *folder, gchar *uid);
+ const gchar * (*get_message_uid) (CamelFolder *folder, CamelMimeMessage *message);
+ CamelMimeMessage * (*get_message_by_uid) (CamelFolder *folder, const gchar *uid);
GList * (*get_uid_list) (CamelFolder *folder);
} CamelFolderClass;
@@ -154,9 +153,8 @@ CamelFolderSummary *camel_folder_get_summary (CamelFolder *folder);
gboolean camel_folder_has_uid_capability (CamelFolder *folder);
-gchar * camel_folder_get_message_uid (CamelFolder *folder, CamelMimeMessage *message);
-gchar * camel_folder_get_message_uid_by_number (CamelFolder *folder, gint message_number);
-CamelMimeMessage *camel_folder_get_message_by_uid (CamelFolder *folder, gchar *uid);
+const gchar * camel_folder_get_message_uid (CamelFolder *folder, CamelMimeMessage *message);
+CamelMimeMessage *camel_folder_get_message_by_uid (CamelFolder *folder, const gchar *uid);
GList *camel_folder_get_uid_list (CamelFolder *folder);
#ifdef __cplusplus
diff --git a/camel/camel-mime-message.h b/camel/camel-mime-message.h
index 15238782e5..e43c2fc859 100644
--- a/camel/camel-mime-message.h
+++ b/camel/camel-mime-message.h
@@ -71,6 +71,8 @@ struct _CamelMimeMessage
gboolean expunged;
guint message_number; /* set by folder object when retrieving message */
+ gchar *message_uid;
+
CamelFolder *folder;
CamelSession *session;
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>