summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2011-10-20 16:16:02 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2011-10-20 16:30:00 +0300
commitfa3be4baf0edf9c9df06ca272a19fae88c71d88b (patch)
tree91755894f2d64b7d84489c707c0fe681653eafaa /include
parentf697923aaf4a171efe5a074fc064edf415d6643f (diff)
downloadmailutils-fa3be4baf0edf9c9df06ca272a19fae88c71d88b.tar.gz
mailutils-fa3be4baf0edf9c9df06ca272a19fae88c71d88b.tar.bz2
Change attribute handling in Maildir format.
* include/mailutils/message.h (MU_MSG_ATTRIBUTE_MODIFIED) (MU_MSG_HEADER_MODIFIED,MU_MSG_BODY_MODIFIED): New flags. * libmailutils/mailbox/message.c (mu_message_is_modified): Return a bitmask from the above values. * libmailutils/property/create.c (mu_property_create_init): Return error code. * include/mailutils/sys/amd.h (_amd_data) <chattr_msg> <capabilities, prop>: New members. <uidvalidity>: Remove. * libmailutils/base/amd.c: Use MH-style proplist to keep the mailbox properties: uidvalidity, last uid and to cache its size. Store message attributes in the message header only if the mailbox implementation is unable to keep them elsewhere. Use chattr_msg method (if provided) to flush changes in message attributes. * libproto/maildir/folder.c (_maildir_list_p): Ignore .mh* and .mu* files. * libproto/mh/folder.c (_mh_list_p): Likewise. * libproto/maildir/mbox.c: Implement all Maildir flags (except P). Implement the chattr_msg method. * libproto/mh/mbox.c: Remove special handling for uidvalidity. * mh/tests/folder.at: Ignore .mu-prop in directory listings.
Diffstat (limited to 'include')
-rw-r--r--include/mailutils/message.h5
-rw-r--r--include/mailutils/sys/amd.h19
2 files changed, 21 insertions, 3 deletions
diff --git a/include/mailutils/message.h b/include/mailutils/message.h
index 605817cc8..79878ac89 100644
--- a/include/mailutils/message.h
+++ b/include/mailutils/message.h
@@ -53,6 +53,11 @@ extern void mu_message_destroy (mu_message_t *, void *owner);
extern int mu_message_create_copy (mu_message_t *to, mu_message_t from);
extern void *mu_message_get_owner (mu_message_t);
+
+#define MU_MSG_ATTRIBUTE_MODIFIED 0x01
+#define MU_MSG_HEADER_MODIFIED 0x02
+#define MU_MSG_BODY_MODIFIED 0x04
+
extern int mu_message_is_modified (mu_message_t);
extern int mu_message_clear_modified (mu_message_t);
extern int mu_message_get_mailbox (mu_message_t, mu_mailbox_t *);
diff --git a/include/mailutils/sys/amd.h b/include/mailutils/sys/amd.h
index 35c54c5f6..ce710d0e5 100644
--- a/include/mailutils/sys/amd.h
+++ b/include/mailutils/sys/amd.h
@@ -43,7 +43,13 @@
mu_monitor_wrlock (mbox->monitor); \
} while (0);
-# define MU_AMD_SIZE_FILE_NAME ".mu-size"
+#define _MU_AMD_PROP_UIDVALIDITY "uid-validity"
+#define _MU_AMD_PROP_NEXT_UID "next-uid"
+#define _MU_AMD_PROP_SIZE "size"
+
+#define _MU_AMD_PROP_FILE_NAME ".mu-prop"
+/* Legacy (2.x) size file name */
+#define _MU_AMD_SIZE_FILE_NAME ".mu-size"
struct _amd_data;
struct _amd_message
@@ -64,6 +70,10 @@ struct _amd_message
struct _amd_data *amd; /* Back pointer. */
};
+/* AMD capabilities */
+#define MU_AMD_STATUS 0x01 /* format keeps status flags */
+#define MU_AMD_IMAPBASE 0x02 /* format keeps IMAP base */
+
struct _amd_data
{
size_t msg_size; /* Size of struct _amd_message */
@@ -83,16 +93,19 @@ struct _amd_data
size_t (*next_uid) (struct _amd_data *mhd);
int (*remove) (struct _amd_data *);
int (*delete_msg) (struct _amd_data *, struct _amd_message *);
-
+ int (*chattr_msg) (struct _amd_message *, int);
+
/* List of messages: */
size_t msg_count; /* number of messages in the list */
size_t msg_max; /* maximum message buffer capacity */
struct _amd_message **msg_array;
- unsigned long uidvalidity;
+ int capabilities;
int has_new_msg; /* New messages have been appended */
char *name; /* Directory name */
+ mu_property_t prop; /* Properties: uidvalidity, nextuid, etc. */
+
/* Pool of open message streams */
struct _amd_message *msg_pool[MAX_OPEN_STREAMS];
int pool_first; /* Index to the first used entry in msg_pool */

Return to:

Send suggestions and report system problems to the System administrator.