aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog23
-rw-r--r--camel/camel-mime-message.c189
-rw-r--r--camel/camel-mime-message.h34
-rw-r--r--camel/camel-mime-part.h3
4 files changed, 243 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 6b2f783adf..2d72005746 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+1999-05-13 bertrand <Bertrand.Guiheneuf@inria.fr>
+
+ * camel/camel-mime-message.h:
+ a bunch of get/set header field
+ method done. Does nothing yet though.
+
+ * camel/camel-mime-message.[ch] :
+ new file.
+
+1999-05-12 bertrand <Bertrand.Guiheneuf@inria.fr>
+
+ * camel/camel-mime-part.h (struct ):
+ disposition is now a full GMimeContentField
+ object.
+
+ * camel/gmime-content-field.c: new file
+ handle "type/subtype ;parameter=value ; parameter=value ..."
+ BNF grammar elements
+ (gmime_content_field_write_to_file): new func
+
+ * camel/gmime-utils.c (gmime_write_header_pair_to_file):
+ namespace change
+
1999-05-11 bertrand <Bertrand.Guiheneuf@inria.fr>
* camel/camel-mime-part.c (_write_to_file):
diff --git a/camel/camel-mime-message.c b/camel/camel-mime-message.c
index 8e00bc8211..b3ce5be357 100644
--- a/camel/camel-mime-message.c
+++ b/camel/camel-mime-message.c
@@ -1,5 +1,5 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camelMimeMessage.c : Abstract class for a mime_message */
+/* camelMimeMessage.c : class for a mime_message */
/*
@@ -13,7 +13,7 @@
*
* 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 MESSAGEICULAR PURPOSE. See the
+ * 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
@@ -30,8 +30,24 @@
static CamelMimePartClass *parent_class=NULL;
+static GString *received_date_str;
+static GString *sent_date_str;
+static GString *reply_to_str;
+static GString *subject_str;
+static GString *from_str;
+
+static void _set_received_date (CamelMimeMessage *mime_message, GString *received_date);
+static GString *_get_received_date (CamelMimeMessage *mime_message);
+static GString *_get_sent_date (CamelMimeMessage *mime_message);
+static void _set_reply_to (CamelMimeMessage *mime_message, GString *reply_to);
+static GString *_get_reply_to (CamelMimeMessage *mime_message);
+static void _set_subject (CamelMimeMessage *mime_message, GString *subject);
+static GString *_get_subject (CamelMimeMessage *mime_message);
+static void _set_from (CamelMimeMessage *mime_message, GString *from);
+static GString *_get_from (CamelMimeMessage *mime_message);
+
/* Returns the class for a CamelMimeMessage */
-#define CMP_CLASS(so) CAMEL_MIME_MESSAGE_CLASS (GTK_OBJECT(so)->klass)
+#define CMM_CLASS(so) CAMEL_MIME_MESSAGE_CLASS (GTK_OBJECT(so)->klass)
@@ -39,9 +55,24 @@ static void
camel_mime_message_class_init (CamelMimeMessageClass *camel_mime_message_class)
{
parent_class = gtk_type_class (camel_mime_part_get_type ());
+
+ received_date_str = g_string_new("");
+ sent_date_str = g_string_new("");
+ reply_to_str = g_string_new("Reply-To");
+ subject_str = g_string_new("Subject");
+ from_str = g_string_new("From");
/* virtual method definition */
-
+ camel_mime_message_class->set_received_date = _set_received_date;
+ camel_mime_message_class->get_received_date = _get_received_date;
+ camel_mime_message_class->get_sent_date = _get_sent_date;
+ camel_mime_message_class->set_reply_to = _set_reply_to;
+ camel_mime_message_class->get_reply_to = _get_reply_to;
+ camel_mime_message_class->set_subject = _set_subject;
+ camel_mime_message_class->get_subject = _get_subject;
+ camel_mime_message_class->set_from = _set_from;
+ camel_mime_message_class->get_from = _get_from;
+
/* virtual method overload */
}
@@ -76,3 +107,153 @@ camel_mime_message_get_type (void)
}
+
+
+/* two utils func */
+
+static void
+_set_field (CamelMimeMessage *mime_message, GString *name, GString *value, GString **variable)
+{
+ if (variable) {
+ if (*variable) G_string_free (*variable, TRUE);
+ *variable = value;
+ }
+}
+
+static GString *
+_get_field (CamelMimeMessage *mime_message, GString *name, GString *variable)
+{
+ return variable;
+}
+
+
+
+
+
+static void
+_set_received_date (CamelMimeMessage *mime_message, GString *received_date)
+{
+ _set_field (mime_message, received_date_str, received_date, &(mime_message->received_date));
+}
+
+void
+set_received_date (CamelMimeMessage *mime_message, GString *received_date)
+{
+ CMM_CLASS (mime_message)->set_received_date (mime_message, received_date);
+}
+
+
+static GString *
+_get_received_date (CamelMimeMessage *mime_message)
+{
+ return _get_field (mime_message, received_date_str, mime_message->received_date);
+}
+
+GString *
+get_received_date (CamelMimeMessage *mime_message)
+{
+ return CMM_CLASS (mime_message)->get_received_date (mime_message);
+}
+
+
+
+
+
+
+static GString *
+_get_sent_date (CamelMimeMessage *mime_message)
+{
+ return _get_field (mime_message, sent_date_str, mime_message->sent_date);
+}
+
+GString *
+get_sent_date (CamelMimeMessage *mime_message)
+{
+ return CMM_CLASS (mime_message)->get_sent_date (mime_message);
+}
+
+
+
+
+
+static void
+_set_reply_to (CamelMimeMessage *mime_message, GString *reply_to)
+{
+ _set_field (mime_message, reply_to_str, reply_to, &(mime_message->reply_to));
+}
+
+void
+set_reply_to (CamelMimeMessage *mime_message, GString *reply_to)
+{
+ CMM_CLASS (mime_message)->set_reply_to (mime_message, reply_to);
+}
+
+
+static GString *
+_get_reply_to (CamelMimeMessage *mime_message)
+{
+ return _get_field (mime_message, reply_to_str, mime_message->reply_to);
+}
+
+GString *
+get_reply_to (CamelMimeMessage *mime_message)
+{
+ return CMM_CLASS (mime_message)->get_reply_to (mime_message);
+}
+
+
+
+
+static void
+_set_subject (CamelMimeMessage *mime_message, GString *subject)
+{
+ _set_field (mime_message, subject_str, subject, &(mime_message->subject));
+}
+
+void
+set_subject (CamelMimeMessage *mime_message, GString *subject)
+{
+ CMM_CLASS (mime_message)->set_subject (mime_message, subject);
+}
+
+
+static GString *
+_get_subject (CamelMimeMessage *mime_message)
+{
+ return _get_field (mime_message, subject_str, mime_message->subject);
+}
+
+GString *
+get_subject (CamelMimeMessage *mime_message)
+{
+ return CMM_CLASS (mime_message)->get_subject (mime_message);
+}
+
+
+
+
+static void
+_set_from (CamelMimeMessage *mime_message, GString *from)
+{
+ _set_field (mime_message, from_str, from, &(mime_message->from));
+}
+
+void
+set_from (CamelMimeMessage *mime_message, GString *from)
+{
+ CMM_CLASS (mime_message)->set_from (mime_message, from);
+}
+
+
+static GString *
+_get_from (CamelMimeMessage *mime_message)
+{
+ return _get_field (mime_message, from_str, mime_message->from);
+}
+
+GString *
+get_from (CamelMimeMessage *mime_message)
+{
+ return CMM_CLASS (mime_message)->get_from (mime_message);
+}
+
diff --git a/camel/camel-mime-message.h b/camel/camel-mime-message.h
index 4773e04ed0..cee58e28b1 100644
--- a/camel/camel-mime-message.h
+++ b/camel/camel-mime-message.h
@@ -12,7 +12,7 @@
*
* 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 MESSAGEICULAR PURPOSE. See the
+ * 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
@@ -33,6 +33,8 @@ extern "C" {
#include <gtk/gtk.h>
#include "camel-mime-part.h"
+#include "camel-folder.h"
+#include "camel-session.h"
@@ -45,7 +47,27 @@ extern "C" {
typedef struct
{
+ CamelMimePart *parent_class;
+ /* header fields */
+ GString *received_date;
+ GString *sent_date;
+
+ GString *subject;
+ GString *reply_to;
+
+ GString *from;
+ GHashTable *recipients;
+ /* -> each value is a GList of address strings */
+ /* each key is a recipient type string in lower-case */
+
+ /* other fields */
+ GHashTable *flags; /* boolean values */
+ gboolean expunged;
+ guint message_number; /* set by folder object when retrieving message */
+ CamelFolder *folder;
+ CamelSession *session;
+
} CamelMimeMessage;
@@ -54,6 +76,16 @@ typedef struct {
CamelDataWrapperClass parent_class;
/* Virtual methods */
+ void (*set_received_date) (CamelMimeMessage *mime_message, GString *received_date);
+ GString * (*get_received_date) (CamelMimeMessage *mime_message);
+ GString * (*get_sent_date) (CamelMimeMessage *mime_message);
+ void (*set_reply_to) (CamelMimeMessage *mime_message, GString *reply_to);
+ GString * (*get_reply_to) (CamelMimeMessage *mime_message);
+ void (*set_subject) (CamelMimeMessage *mime_message, GString *subject);
+ GString * (*get_subject) (CamelMimeMessage *mime_message);
+ void (*set_from) (CamelMimeMessage *mime_message, GString *from);
+ GString * (*get_from) (CamelMimeMessage *mime_message);
+
} CamelMimeMessageClass;
diff --git a/camel/camel-mime-part.h b/camel/camel-mime-part.h
index 0e6f1a0b4d..3fdb75dee7 100644
--- a/camel/camel-mime-part.h
+++ b/camel/camel-mime-part.h
@@ -42,7 +42,8 @@ extern "C" {
#define IS_CAMEL_MIME_PART(o) (GTK_CHECK_TYPE((o), CAMEL_MIME_PART_TYPE))
-
+/* Do not change these values directly, you
+ would regret it one day */
typedef struct
{
CamelDataWrapper parent_object;