From fa3be4baf0edf9c9df06ca272a19fae88c71d88b Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Thu, 20 Oct 2011 16:16:02 +0300 Subject: 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) : New members. : 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. --- include/mailutils/sys/amd.h | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'include/mailutils/sys/amd.h') 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 */ -- cgit v1.2.1