aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--camel/ChangeLog17
-rw-r--r--camel/camel-medium.c30
-rw-r--r--camel/providers/local/camel-maildir-summary.c38
3 files changed, 67 insertions, 18 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 8f55e500a9..c9f3e2bf80 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,20 @@
+2000-12-11 Not Zed <NotZed@HelixCode.com>
+
+ * camel-medium.c (camel_medium_set_header): Hrm, we actually want
+ to call set_header, not add_header here, probably explains some
+ duplicate X-Evolution headers i was trying to track down. Also
+ changed the api to handle a NULL value == remove the header.
+
+ * providers/local/camel-maildir-summary.c
+ (maildir_summary_decode_x_evolution): Always return error, we dont
+ use x-evolution for maildir.
+ (maildir_summary_encode_x_evolution): Always return a NULL string,
+ likewise.
+ (maildir_summary_add): Hook in here, since the _new function
+ doesn't have access to any flags from the caller. If we have
+ flags, then update the filename again. Not ideal, but should
+ work.
+
2000-12-08 JP Rosevear <jpr@helixcode.com>
* tests/message/Makefile.am: Remove test3 from build until the files
diff --git a/camel/camel-medium.c b/camel/camel-medium.c
index 3c5954e40f..ebda9c470d 100644
--- a/camel/camel-medium.c
+++ b/camel/camel-medium.c
@@ -123,18 +123,17 @@ add_header (CamelMedium *medium, const gchar *header_name,
* headers. No we dont, order isn't important! Z
**/
void
-camel_medium_add_header (CamelMedium *medium, const gchar *header_name,
- const void *header_value)
+camel_medium_add_header (CamelMedium *medium, const gchar *header_name, const void *header_value)
{
g_return_if_fail (CAMEL_IS_MEDIUM (medium));
g_return_if_fail (header_name != NULL);
g_return_if_fail (header_value != NULL);
- CM_CLASS (medium)->add_header (medium, header_name, header_value);
+ CM_CLASS (medium)->add_header(medium, header_name, header_value);
}
static void
-set_header (CamelMedium *medium, const gchar *header_name, const void *header_value)
+set_header (CamelMedium *medium, const char *header_name, const void *header_value)
{
g_warning("No %s::set_header implemented, setting %s", camel_type_to_name(CAMEL_OBJECT_GET_TYPE(medium)), header_name);
}
@@ -146,20 +145,23 @@ set_header (CamelMedium *medium, const gchar *header_name, const void *header_va
* @header_value: value of the header
*
* Sets the value of a header. Any other occurances of the header
- * will be removed.
+ * will be removed. Setting a %NULL header can be used to remove
+ * the header also.
**/
void
-camel_medium_set_header (CamelMedium *medium, const gchar *header_name, const void *header_value)
+camel_medium_set_header (CamelMedium *medium, const char *header_name, const void *header_value)
{
g_return_if_fail (CAMEL_IS_MEDIUM (medium));
g_return_if_fail (header_name != NULL);
- g_return_if_fail (header_value != NULL);
- CM_CLASS (medium)->add_header (medium, header_name, header_value);
+ if (header_value == NULL)
+ CM_CLASS(medium)->remove_header(medium, header_name);
+ else
+ CM_CLASS(medium)->set_header(medium, header_name, header_value);
}
static void
-remove_header (CamelMedium *medium, const gchar *header_name)
+remove_header(CamelMedium *medium, const char *header_name)
{
g_warning("No %s::remove_header implemented, removing %s", camel_type_to_name(CAMEL_OBJECT_GET_TYPE(medium)), header_name);
}
@@ -173,17 +175,17 @@ remove_header (CamelMedium *medium, const gchar *header_name)
* header are removed.
**/
void
-camel_medium_remove_header (CamelMedium *medium, const gchar *header_name)
+camel_medium_remove_header(CamelMedium *medium, const char *header_name)
{
g_return_if_fail (CAMEL_IS_MEDIUM (medium));
g_return_if_fail (header_name != NULL);
- CM_CLASS (medium)->remove_header (medium, header_name);
+ CM_CLASS(medium)->remove_header(medium, header_name);
}
static const void *
-get_header (CamelMedium *medium, const gchar *header_name)
+get_header(CamelMedium *medium, const char *header_name)
{
g_warning("No %s::get_header implemented, getting %s", camel_type_to_name(CAMEL_OBJECT_GET_TYPE(medium)), header_name);
return NULL;
@@ -202,7 +204,7 @@ get_header (CamelMedium *medium, const gchar *header_name)
* Return value: the value of the named header, or %NULL
**/
const void *
-camel_medium_get_header (CamelMedium *medium, const gchar *header_name)
+camel_medium_get_header(CamelMedium *medium, const char *header_name)
{
g_return_val_if_fail (CAMEL_IS_MEDIUM (medium), NULL);
g_return_val_if_fail (header_name != NULL, NULL);
@@ -216,7 +218,7 @@ camel_medium_get_header (CamelMedium *medium, const gchar *header_name)
static CamelDataWrapper *
-get_content_object (CamelMedium *medium)
+get_content_object(CamelMedium *medium)
{
return medium->content;
}
diff --git a/camel/providers/local/camel-maildir-summary.c b/camel/providers/local/camel-maildir-summary.c
index 8bf630efe5..8d421d5fdd 100644
--- a/camel/providers/local/camel-maildir-summary.c
+++ b/camel/providers/local/camel-maildir-summary.c
@@ -46,9 +46,11 @@ static void message_info_free(CamelFolderSummary *, CamelMessageInfo *mi);
static int maildir_summary_load(CamelLocalSummary *cls, int forceindex, CamelException *ex);
static int maildir_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, CamelException *ex);
static int maildir_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex);
-/*static int maildir_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, CamelMessageInfo *info, CamelFolderChangeInfo *, CamelException *ex);*/
+static CamelMessageInfo *maildir_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *, CamelException *ex);
static char *maildir_summary_next_uid_string(CamelFolderSummary *s);
+static int maildir_summary_decode_x_evolution(CamelLocalSummary *cls, const char *xev, CamelMessageInfo *mi);
+static char *maildir_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelMessageInfo *mi);
static void camel_maildir_summary_class_init (CamelMaildirSummaryClass *class);
static void camel_maildir_summary_init (CamelMaildirSummary *gspaper);
@@ -100,7 +102,9 @@ camel_maildir_summary_class_init (CamelMaildirSummaryClass *class)
lklass->load = maildir_summary_load;
lklass->check = maildir_summary_check;
lklass->sync = maildir_summary_sync;
- /*lklass->add = maildir_summary_add;*/
+ lklass->add = maildir_summary_add;
+ lklass->encode_x_evolution = maildir_summary_encode_x_evolution;
+ lklass->decode_x_evolution = maildir_summary_decode_x_evolution;
}
static void
@@ -215,8 +219,34 @@ int camel_maildir_summary_name_to_info(CamelMessageInfo *info, const char *name)
return 0;
}
-/* FIXME: We need to also provide an encode/decode X-Evolution function, as the default
- is no good for us, and can screw up the uid info */
+/* for maildir, x-evolution isn't used, so dont try and get anything out of it */
+static int maildir_summary_decode_x_evolution(CamelLocalSummary *cls, const char *xev, CamelMessageInfo *mi)
+{
+ return -1;
+}
+
+static char *maildir_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelMessageInfo *mi)
+{
+ return NULL;
+}
+
+/* FIXME:
+ both 'new' and 'add' will try and set the filename, this is not ideal ...
+*/
+static CamelMessageInfo *maildir_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *changes, CamelException *ex)
+{
+ CamelMessageInfo *mi;
+
+ mi = ((CamelLocalSummaryClass *) parent_class)->add(cls, msg, info, changes, ex);
+ if (mi) {
+ if (info) {
+ camel_maildir_info_set_filename(mi, camel_maildir_summary_info_to_name(mi));
+ d(printf("Setting filename to %s\n", camel_maildir_info_filename(mi)));
+ }
+ }
+
+ return mi;
+}
static CamelMessageInfo *message_info_new(CamelFolderSummary * s, struct _header_raw *h)
{