[dovecot-cvs] dovecot/src/lib-storage mail-search.c,1.7,1.8 mail-search.h,1.5,1.6 mail-sort.c,1.7,1.8 mail-sort.h,1.3,1.4 mail-storage.c,1.6,1.7 mail-storage.h,1.26,1.27

cras at procontrol.fi cras at procontrol.fi
Sun Jan 5 15:09:55 EET 2003


Update of /home/cvs/dovecot/src/lib-storage
In directory danu:/tmp/cvs-serv25916/src/lib-storage

Modified Files:
	mail-search.c mail-search.h mail-sort.c mail-sort.h 
	mail-storage.c mail-storage.h 
Log Message:
Naming style changes, finally got tired of most of the typedefs. Also the
previous enum -> macro change reverted so that we don't use the highest bit
anymore, that's incompatible with old indexes so they will be rebuilt.



Index: mail-search.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/mail-search.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- mail-search.c	2 Jan 2003 08:09:27 -0000	1.7
+++ mail-search.c	5 Jan 2003 13:09:52 -0000	1.8
@@ -3,16 +3,17 @@
 #include "lib.h"
 #include "mail-search.h"
 
-typedef struct {
-	Pool pool;
+struct search_build_data {
+	pool_t pool;
 	const char *error;
-} SearchBuildData;
+};
 
-static MailSearchArg *search_arg_new(Pool pool, MailSearchArgType type)
+static struct mail_search_arg *
+search_arg_new(pool_t pool, enum mail_search_arg_type type)
 {
-	MailSearchArg *arg;
+	struct mail_search_arg *arg;
 
-	arg = p_new(pool, MailSearchArg, 1);
+	arg = p_new(pool, struct mail_search_arg, 1);
 	arg->type = type;
 
 	return arg;
@@ -21,10 +22,11 @@
 #define ARG_NEW(type, value) \
 	arg_new(data, args, next_sarg, type, value)
 
-static int arg_new(SearchBuildData *data, ImapArg **args,
-		   MailSearchArg **next_sarg, MailSearchArgType type, int value)
+static int arg_new(struct search_build_data *data, struct imap_arg **args,
+		   struct mail_search_arg **next_sarg,
+		   enum mail_search_arg_type type, int value)
 {
-	MailSearchArg *sarg;
+	struct mail_search_arg *sarg;
 
 	*next_sarg = sarg = search_arg_new(data->pool, type);
 	if (value == 0)
@@ -66,11 +68,12 @@
 	return TRUE;
 }
 
-static int search_arg_build(SearchBuildData *data, ImapArg **args,
-			    MailSearchArg **next_sarg)
+static int search_arg_build(struct search_build_data *data,
+			    struct imap_arg **args,
+			    struct mail_search_arg **next_sarg)
 {
-	MailSearchArg **subargs;
-	ImapArg *arg;
+	struct mail_search_arg **subargs;
+	struct imap_arg *arg;
 	char *str;
 
 	if ((*args)->type == IMAP_ARG_EOL) {
@@ -87,7 +90,7 @@
 	}
 
 	if (arg->type == IMAP_ARG_LIST) {
-		ImapArg *listargs = IMAP_ARG_LIST(arg)->args;
+		struct imap_arg *listargs = IMAP_ARG_LIST(arg)->args;
 
 		*next_sarg = search_arg_new(data->pool, SEARCH_SUB);
 		subargs = &(*next_sarg)->value.subargs;
@@ -348,11 +351,11 @@
 	return FALSE;
 }
 
-MailSearchArg *mail_search_args_build(Pool pool, ImapArg *args,
-				      const char **error)
+struct mail_search_arg *
+mail_search_args_build(pool_t pool, struct imap_arg *args, const char **error)
 {
-        SearchBuildData data;
-	MailSearchArg *first_sarg, **sargs;
+        struct search_build_data data;
+	struct mail_search_arg *first_sarg, **sargs;
 
 	data.pool = pool;
 	data.error = NULL;
@@ -371,7 +374,7 @@
 	return first_sarg;
 }
 
-void mail_search_args_reset(MailSearchArg *args)
+void mail_search_args_reset(struct mail_search_arg *args)
 {
 	while (args != NULL) {
 		if (args->type == SEARCH_OR || args->type == SEARCH_SUB)
@@ -382,10 +385,10 @@
 	}
 }
 
-static void search_arg_foreach(MailSearchArg *arg, MailSearchForeachFunc func,
-			       void *context)
+static void search_arg_foreach(struct mail_search_arg *arg,
+			       MailSearchForeachFunc func, void *context)
 {
-	MailSearchArg *subarg;
+	struct mail_search_arg *subarg;
 
 	if (arg->result != 0)
 		return;
@@ -438,8 +441,8 @@
 	}
 }
 
-int mail_search_args_foreach(MailSearchArg *args, MailSearchForeachFunc func,
-			     void *context)
+int mail_search_args_foreach(struct mail_search_arg *args,
+			     MailSearchForeachFunc func, void *context)
 {
 	int result;
 
@@ -459,10 +462,10 @@
 	return result;
 }
 
-static void search_arg_analyze(MailSearchArg *arg, int *have_headers,
+static void search_arg_analyze(struct mail_search_arg *arg, int *have_headers,
 			       int *have_body, int *have_text)
 {
-	MailSearchArg *subarg;
+	struct mail_search_arg *subarg;
 
 	if (arg->result != 0)
 		return;
@@ -504,7 +507,7 @@
 	}
 }
 
-void mail_search_args_analyze(MailSearchArg *args, int *have_headers,
+void mail_search_args_analyze(struct mail_search_arg *args, int *have_headers,
 			      int *have_body, int *have_text)
 {
 	*have_headers = *have_body = *have_text = FALSE;

Index: mail-search.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/mail-search.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- mail-search.h	3 Nov 2002 08:39:43 -0000	1.5
+++ mail-search.h	5 Jan 2003 13:09:52 -0000	1.6
@@ -4,7 +4,7 @@
 #include "imap-parser.h"
 #include "mail-storage.h"
 
-typedef enum {
+enum mail_search_arg_type {
 	SEARCH_OR,
 	SEARCH_SUB,
 
@@ -49,14 +49,14 @@
 	/* our shortcuts for headers */
         SEARCH_IN_REPLY_TO,
         SEARCH_MESSAGE_ID
-} MailSearchArgType;
+};
 
-struct _MailSearchArg {
-	MailSearchArg *next;
+struct mail_search_arg {
+	struct mail_search_arg *next;
 
-	MailSearchArgType type;
+	enum mail_search_arg_type type;
 	union {
-		MailSearchArg *subargs;
+		struct mail_search_arg *subargs;
 		const char *str;
 	} value;
 
@@ -67,23 +67,24 @@
 	int result;
 };
 
-typedef void (*MailSearchForeachFunc)(MailSearchArg *arg, void *context);
+typedef void (*MailSearchForeachFunc)(struct mail_search_arg *arg,
+				      void *context);
 
 /* Builds search arguments based on IMAP arguments. */
-MailSearchArg *mail_search_args_build(Pool pool, ImapArg *args,
-				      const char **error);
+struct mail_search_arg *
+mail_search_args_build(pool_t pool, struct imap_arg *args, const char **error);
 
 /* Reset the results in search arguments */
-void mail_search_args_reset(MailSearchArg *args);
+void mail_search_args_reset(struct mail_search_arg *args);
 
 /* goes through arguments in list that don't have a result yet.
    Returns 1 = search matched, -1 = search unmatched, 0 = don't know yet */
-int mail_search_args_foreach(MailSearchArg *args, MailSearchForeachFunc func,
-			     void *context);
+int mail_search_args_foreach(struct mail_search_arg *args,
+			     MailSearchForeachFunc func, void *context);
 
 /* Fills have_headers, have_body and have_text based on if such search
    argument exists that needs to be checked. */
-void mail_search_args_analyze(MailSearchArg *args, int *have_headers,
+void mail_search_args_analyze(struct mail_search_arg *args, int *have_headers,
 			      int *have_body, int *have_text);
 
 #endif

Index: mail-sort.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/mail-sort.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- mail-sort.c	4 Jan 2003 17:26:30 -0000	1.7
+++ mail-sort.c	5 Jan 2003 13:09:52 -0000	1.8
@@ -10,27 +10,27 @@
 
 #include <stdlib.h>
 
-struct _MailSortContext {
-	MailSortType output[MAX_SORT_PROGRAM_SIZE];
-	MailSortType common_mask;
+struct mail_sort_context {
+	enum mail_sort_type output[MAX_SORT_PROGRAM_SIZE];
+	enum mail_sort_type common_mask;
 
-	MailSortFuncs funcs;
+	struct mail_sort_funcs funcs;
 	void *func_context;
 
-	Buffer *sort_buffer;
-	Pool temp_pool;
+	buffer_t *sort_buffer;
+	pool_t temp_pool;
 
 	time_t last_arrival, last_date;
 	uoff_t last_size;
 	char *last_cc, *last_from, *last_subject, *last_to;
 };
 
-static void mail_sort_flush(MailSortContext *ctx);
+static void mail_sort_flush(struct mail_sort_context *ctx);
 
-static MailSortType
-mail_sort_normalize(const MailSortType *input, Buffer *output)
+static enum mail_sort_type
+mail_sort_normalize(const enum mail_sort_type *input, buffer_t *output)
 {
-        MailSortType type, mask = 0;
+        enum mail_sort_type type, mask = 0;
 	int pos, reverse;
 
 	reverse = FALSE;
@@ -59,11 +59,11 @@
 	return mask;
 }
 
-static MailSortType
-mail_sort_get_common_mask(const MailSortType *input,
-			  MailSortType **output)
+static enum mail_sort_type
+mail_sort_get_common_mask(const enum mail_sort_type *input,
+			  enum mail_sort_type **output)
 {
-	MailSortType mask = 0;
+	enum mail_sort_type mask = 0;
 
 	while (*input == **output && *input != MAIL_SORT_END) {
 		if (*input != MAIL_SORT_REVERSE)
@@ -74,16 +74,17 @@
 	return mask;
 }
 
-MailSortContext *mail_sort_init(const MailSortType *input, MailSortType *output,
-				MailSortFuncs funcs, void *context)
+struct mail_sort_context *
+mail_sort_init(const enum mail_sort_type *input, enum mail_sort_type *output,
+	       struct mail_sort_funcs funcs, void *context)
 {
-	MailSortContext *ctx;
-	MailSortType norm_input[MAX_SORT_PROGRAM_SIZE];
-	MailSortType norm_output[MAX_SORT_PROGRAM_SIZE];
-	Buffer *buf;
+	struct mail_sort_context *ctx;
+	enum mail_sort_type norm_input[MAX_SORT_PROGRAM_SIZE];
+	enum mail_sort_type norm_output[MAX_SORT_PROGRAM_SIZE];
+	buffer_t *buf;
 	int i;
 
-	ctx = i_new(MailSortContext, 1);
+	ctx = i_new(struct mail_sort_context, 1);
 
 	t_push();
 	buf = buffer_create_data(data_stack_pool,
@@ -114,7 +115,7 @@
 	return ctx;
 }
 
-void mail_sort_deinit(MailSortContext *ctx)
+void mail_sort_deinit(struct mail_sort_context *ctx)
 {
 	mail_sort_flush(ctx);
 	buffer_free(ctx->sort_buffer);
@@ -140,7 +141,7 @@
 	return strcasecmp(s1, s2);
 }
 
-static int subject_cmp(Pool pool, const char *s1, const char *s2)
+static int subject_cmp(pool_t pool, const char *s1, const char *s2)
 {
 	int ret;
 
@@ -155,7 +156,8 @@
 	return ret;
 }
 
-static void mail_sort_check_flush(MailSortContext *ctx, unsigned int id)
+static void mail_sort_check_flush(struct mail_sort_context *ctx,
+				  unsigned int id)
 {
 	const char *str;
 	time_t t;
@@ -233,7 +235,7 @@
 		mail_sort_flush(ctx);
 }
 
-void mail_sort_input(MailSortContext *ctx, unsigned int id)
+void mail_sort_input(struct mail_sort_context *ctx, unsigned int id)
 {
 	if (ctx->common_mask != 0)
 		mail_sort_check_flush(ctx, id);
@@ -241,14 +243,14 @@
 	buffer_append(ctx->sort_buffer, &id, sizeof(id));
 }
 
-static MailSortContext *mail_sort_qsort_context;
+static struct mail_sort_context *mail_sort_qsort_context;
 
 static int mail_sort_qsort_func(const void *p1, const void *p2)
 {
 	const unsigned int *i1 = p1;
 	const unsigned int *i2 = p2;
-	MailSortType *output = mail_sort_qsort_context->output;
-        MailSortFuncs *funcs = &mail_sort_qsort_context->funcs;
+	enum mail_sort_type *output = mail_sort_qsort_context->output;
+        struct mail_sort_funcs *funcs = &mail_sort_qsort_context->funcs;
 	void *ctx = mail_sort_qsort_context->func_context;
 	int ret, reverse = FALSE;
 
@@ -315,7 +317,7 @@
 	return ret != 0 ? ret : (*i1 < *i2 ? -1 : 1);
 }
 
-static void mail_sort_flush(MailSortContext *ctx)
+static void mail_sort_flush(struct mail_sort_context *ctx)
 {
 	unsigned int *arr;
 	size_t count;

Index: mail-sort.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/mail-sort.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- mail-sort.h	17 Dec 2002 04:28:41 -0000	1.3
+++ mail-sort.h	5 Jan 2003 13:09:52 -0000	1.4
@@ -6,7 +6,7 @@
 /* Maximum size for sort program, 2x for reverse + END */
 #define MAX_SORT_PROGRAM_SIZE (2*7 + 1)
 
-enum _MailSortType {
+enum mail_sort_type {
 	MAIL_SORT_ARRIVAL	= 0x0010,
 	MAIL_SORT_CC		= 0x0020,
 	MAIL_SORT_DATE		= 0x0040,
@@ -20,20 +20,18 @@
 	MAIL_SORT_END		= 0x0000 /* ends sort program */
 };
 
-typedef struct _MailSortContext MailSortContext;
-
-typedef struct {
+struct mail_sort_funcs {
 	/* arrival, date */
-	time_t (*input_time)(MailSortType type, unsigned int id,
+	time_t (*input_time)(enum mail_sort_type type, unsigned int id,
 			     void *context);
 	/* size */
-	uoff_t (*input_uofft)(MailSortType type, unsigned int id,
+	uoff_t (*input_uofft)(enum mail_sort_type type, unsigned int id,
 			      void *context);
 	/* cc, from, to. Return the mailbox of the first address. */
-	const char *(*input_mailbox)(MailSortType type, unsigned int id,
+	const char *(*input_mailbox)(enum mail_sort_type type, unsigned int id,
 				     void *context);
 	/* subject */
-	const char *(*input_str)(MailSortType type, unsigned int id,
+	const char *(*input_str)(enum mail_sort_type type, unsigned int id,
 				 void *context);
 
 	/* done parsing this message, free all resources */
@@ -41,18 +39,19 @@
 
 	/* result callback */
 	void (*output)(unsigned int *data, size_t count, void *context);
-} MailSortFuncs;
+};
 
 /* input and output are arrays of sort programs ending with MAIL_SORT_END.
    input specifies the order in which the messages are arriving to sorting.
    It may be just MAIL_SORT_END if the order is random. The better the ordering
    is known, the less memory is used. */
-MailSortContext *mail_sort_init(const MailSortType *input, MailSortType *output,
-				MailSortFuncs funcs, void *context);
-void mail_sort_deinit(MailSortContext *ctx);
+struct mail_sort_context *
+mail_sort_init(const enum mail_sort_type *input, enum mail_sort_type *output,
+	       struct mail_sort_funcs funcs, void *context);
+void mail_sort_deinit(struct mail_sort_context *ctx);
 
 /* id is either UID or sequence number of message, whichever is preferred
    in MailSortFuncs parameters. */
-void mail_sort_input(MailSortContext *ctx, unsigned int id);
+void mail_sort_input(struct mail_sort_context *ctx, unsigned int id);
 
 #endif

Index: mail-storage.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/mail-storage.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- mail-storage.c	2 Jan 2003 10:21:41 -0000	1.6
+++ mail-storage.c	5 Jan 2003 13:09:52 -0000	1.7
@@ -10,20 +10,18 @@
 /* Message to show to users when critical error occurs */
 #define CRITICAL_MSG "Internal error [%Y-%m-%d %H:%M:%S]"
 
-typedef struct _MailStorageList MailStorageList;
-
-struct _MailStorageList {
-	MailStorageList *next;
-	MailStorage *storage;
+struct mail_storage_list {
+	struct mail_storage_list *next;
+	struct mail_storage *storage;
 };
 
-static MailStorageList *storages = NULL;
+static struct mail_storage_list *storages = NULL;
 
-void mail_storage_class_register(MailStorage *storage_class)
+void mail_storage_class_register(struct mail_storage *storage_class)
 {
-	MailStorageList *list, **pos;
+	struct mail_storage_list *list, **pos;
 
-	list = i_new(MailStorageList, 1);
+	list = i_new(struct mail_storage_list, 1);
 	list->storage = storage_class;
 
 	/* append it after the list, so the autodetection order is correct */
@@ -33,9 +31,9 @@
 	*pos = list;
 }
 
-void mail_storage_class_unregister(MailStorage *storage_class)
+void mail_storage_class_unregister(struct mail_storage *storage_class)
 {
-	MailStorageList **list, *next;
+	struct mail_storage_list **list, *next;
 
 	for (list = &storages; *list != NULL; list = &(*list)->next) {
 		if ((*list)->storage == storage_class) {
@@ -49,10 +47,10 @@
 	}
 }
 
-MailStorage *mail_storage_create(const char *name, const char *data,
-				 const char *user)
+struct mail_storage *mail_storage_create(const char *name, const char *data,
+					 const char *user)
 {
-	MailStorageList *list;
+	struct mail_storage_list *list;
 
 	i_assert(name != NULL);
 
@@ -64,10 +62,10 @@
 	return NULL;
 }
 
-MailStorage *mail_storage_create_default(const char *user)
+struct mail_storage *mail_storage_create_default(const char *user)
 {
-	MailStorageList *list;
-	MailStorage *storage;
+	struct mail_storage_list *list;
+	struct mail_storage *storage;
 
 	for (list = storages; list != NULL; list = list->next) {
 		storage = list->storage->create(NULL, user);
@@ -78,9 +76,9 @@
 	return NULL;
 }
 
-static MailStorage *mail_storage_autodetect(const char *data)
+static struct mail_storage *mail_storage_autodetect(const char *data)
 {
-	MailStorageList *list;
+	struct mail_storage_list *list;
 
 	for (list = storages; list != NULL; list = list->next) {
 		if (list->storage->autodetect(data))
@@ -90,9 +88,10 @@
 	return NULL;
 }
 
-MailStorage *mail_storage_create_with_data(const char *data, const char *user)
+struct mail_storage *mail_storage_create_with_data(const char *data,
+						   const char *user)
 {
-	MailStorage *storage;
+	struct mail_storage *storage;
 	const char *p, *name;
 
 	if (data == NULL || *data == '\0')
@@ -115,7 +114,7 @@
 	return storage;
 }
 
-void mail_storage_destroy(MailStorage *storage)
+void mail_storage_destroy(struct mail_storage *storage)
 {
 	i_assert(storage != NULL);
 
@@ -123,7 +122,7 @@
 	i_free(storage);
 }
 
-void mail_storage_clear_error(MailStorage *storage)
+void mail_storage_clear_error(struct mail_storage *storage)
 {
 	i_free(storage->error);
 	storage->error = NULL;
@@ -131,7 +130,7 @@
 	storage->syntax_error = FALSE;
 }
 
-void mail_storage_set_error(MailStorage *storage, const char *fmt, ...)
+void mail_storage_set_error(struct mail_storage *storage, const char *fmt, ...)
 {
 	va_list va;
 
@@ -147,7 +146,8 @@
 	}
 }
 
-void mail_storage_set_syntax_error(MailStorage *storage, const char *fmt, ...)
+void mail_storage_set_syntax_error(struct mail_storage *storage,
+				   const char *fmt, ...)
 {
 	va_list va;
 
@@ -163,7 +163,7 @@
 	}
 }
 
-void mail_storage_set_internal_error(MailStorage *storage)
+void mail_storage_set_internal_error(struct mail_storage *storage)
 {
 	struct tm *tm;
 	char str[256];
@@ -175,7 +175,8 @@
 	storage->syntax_error = FALSE;
 }
 
-void mail_storage_set_critical(MailStorage *storage, const char *fmt, ...)
+void mail_storage_set_critical(struct mail_storage *storage,
+			       const char *fmt, ...)
 {
 	va_list va;
 
@@ -194,14 +195,15 @@
 	}
 }
 
-const char *mail_storage_get_last_error(MailStorage *storage, int *syntax)
+const char *mail_storage_get_last_error(struct mail_storage *storage,
+					int *syntax)
 {
 	if (syntax != NULL)
 		*syntax = storage->syntax_error;
 	return storage->error;
 }
 
-int mail_storage_is_inconsistency_error(Mailbox *box)
+int mail_storage_is_inconsistency_error(struct mailbox *box)
 {
 	return box->inconsistent;
 }

Index: mail-storage.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/mail-storage.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- mail-storage.h	2 Jan 2003 13:00:57 -0000	1.26
+++ mail-storage.h	5 Jan 2003 13:09:52 -0000	1.27
@@ -2,9 +2,8 @@
 #define __MAIL_STORAGE_H
 
 #include "imap-util.h"
-#include "imap-parser.h"
 
-typedef enum {
+enum mailbox_flags {
 	MAILBOX_NOSELECT	= 0x01,
 	MAILBOX_CHILDREN	= 0x02,
 	MAILBOX_NOCHILDREN	= 0x04,
@@ -13,9 +12,9 @@
 	MAILBOX_UNMARKED	= 0x20,
 
 	MAILBOX_READONLY	= 0x40
-} MailboxFlags;
+};
 
-typedef enum {
+enum mailbox_status_items {
 	STATUS_MESSAGES		= 0x01,
 	STATUS_RECENT		= 0x02,
 	STATUS_UIDNEXT		= 0x04,
@@ -23,52 +22,51 @@
 	STATUS_UNSEEN		= 0x10,
 	STATUS_FIRST_UNSEEN_SEQ	= 0x20,
 	STATUS_CUSTOM_FLAGS	= 0x40
-} MailboxStatusItems;
+};
 
-typedef enum {
+enum mailbox_name_status {
 	MAILBOX_NAME_EXISTS,
 	MAILBOX_NAME_VALID,
 	MAILBOX_NAME_INVALID,
 	MAILBOX_NAME_NOINFERIORS
-} MailboxNameStatus;
+};
 
-typedef enum {
+enum modify_type {
 	MODIFY_ADD,
 	MODIFY_REMOVE,
 	MODIFY_REPLACE
-} ModifyType;
+};
 
-typedef struct _MailStorage MailStorage;
-typedef struct _Mailbox Mailbox;
-typedef struct _MailboxStatus MailboxStatus;
-typedef struct _MailStorageCallbacks MailStorageCallbacks;
-typedef struct _MailFetchData MailFetchData;
-typedef struct _MailFetchBodyData MailFetchBodyData;
-typedef struct _MailSearchArg MailSearchArg;
-typedef enum _MailSortType MailSortType;
+struct mail_storage;
+struct mail_storage_callbacks;
+struct mailbox_status;
+struct mail_fetch_data;
+struct mail_search_arg;
+enum mail_sort_type;
 
-typedef void (*MailboxFunc)(MailStorage *storage, const char *name,
-			    MailboxFlags flags, void *context);
+typedef void (*MailboxFunc)(struct mail_storage *storage, const char *name,
+			    enum mailbox_flags flags, void *context);
 
 /* All methods returning int return either TRUE or FALSE. */
-struct _MailStorage {
+struct mail_storage {
 	char *name;
 
 	char hierarchy_sep;
 
 	/* Create new instance */
-	MailStorage *(*create)(const char *data, const char *user);
+	struct mail_storage *(*create)(const char *data, const char *user);
 
 	/* Free this instance */
-	void (*free)(MailStorage *storage);
+	void (*free)(struct mail_storage *storage);
 
 	/* Returns TRUE if this storage would accept the given data
 	   as a valid parameter to create(). */
 	int (*autodetect)(const char *data);
 
 	/* Set storage callback functions to use. */
-	void (*set_callbacks)(MailStorage *storage,
-			      MailStorageCallbacks *callbacks, void *context);
+	void (*set_callbacks)(struct mail_storage *storage,
+			      struct mail_storage_callbacks *callbacks,
+			      void *context);
 
 	/* Open a mailbox. If readonly is TRUE, mailbox must not be
 	   modified in any way even when it's asked. If fast is TRUE,
@@ -77,15 +75,16 @@
 
 	   Note that append and copy may open the selected mailbox again
 	   with possibly different readonly-state. */
-	Mailbox *(*open_mailbox)(MailStorage *storage, const char *name,
-				 int readonly, int fast);
+	struct mailbox *(*open_mailbox)(struct mail_storage *storage,
+					const char *name,
+					int readonly, int fast);
 
 	/* name is allowed to contain multiple new hierarchy levels. */
-	int (*create_mailbox)(MailStorage *storage, const char *name);
+	int (*create_mailbox)(struct mail_storage *storage, const char *name);
 
 	/* Only the specified mailbox is deleted, ie. folders under the
 	   specified mailbox must not be deleted. */
-	int (*delete_mailbox)(MailStorage *storage, const char *name);
+	int (*delete_mailbox)(struct mail_storage *storage, const char *name);
 
 	/* If the name has inferior hierarchical names, then the inferior
 	   hierarchical names MUST also be renamed (ie. foo -> bar renames
@@ -94,29 +93,32 @@
 
 	   If oldname is case-insensitively "INBOX", the mails are moved
 	   into new folder but the INBOX folder must not be deleted. */
-	int (*rename_mailbox)(MailStorage *storage, const char *oldname,
+	int (*rename_mailbox)(struct mail_storage *storage, const char *oldname,
 			      const char *newname);
 
 	/* Execute specified function for all mailboxes matching given
 	   mask. The mask is in RFC2060 LIST format. */
-	int (*find_mailboxes)(MailStorage *storage, const char *mask,
+	int (*find_mailboxes)(struct mail_storage *storage, const char *mask,
 			      MailboxFunc func, void *context);
 
 	/* Subscribe/unsubscribe mailbox. There should be no error when
 	   subscribing to already subscribed mailbox. Subscribing to
 	   unexisting mailboxes is optional. */
-	int (*set_subscribed)(MailStorage *storage, const char *name, int set);
+	int (*set_subscribed)(struct mail_storage *storage,
+			      const char *name, int set);
 
 	/* Exactly like find_mailboxes(), but list only subscribed mailboxes. */
-	int (*find_subscribed)(MailStorage *storage, const char *mask,
+	int (*find_subscribed)(struct mail_storage *storage, const char *mask,
 			       MailboxFunc func, void *context);
 
 	/* Returns mailbox name status */
-	int (*get_mailbox_name_status)(MailStorage *storage, const char *name,
-				       MailboxNameStatus *status);
+	int (*get_mailbox_name_status)(struct mail_storage *storage,
+				       const char *name,
+				       enum mailbox_name_status *status);
 
 	/* Returns the error message of last occured error. */
-	const char *(*get_last_error)(MailStorage *storage, int *syntax_error);
+	const char *(*get_last_error)(struct mail_storage *storage,
+				      int *syntax_error);
 
 /* private: */
 	char *dir; /* root directory */
@@ -126,67 +128,72 @@
 	char *user; /* name of user accessing the storage */
 	char *error;
 
-	MailStorageCallbacks *callbacks;
+	struct mail_storage_callbacks *callbacks;
 	void *callback_context;
 
 	unsigned int syntax_error:1; /* Give a BAD reply instead of NO */
 };
 
-struct _Mailbox {
+struct mailbox {
 	char *name;
 
-	MailStorage *storage;
+	struct mail_storage *storage;
 
 	/* Close the box. Returns FALSE if some cleanup errors occured, but
 	   the mailbox was closed anyway. */
-	int (*close)(Mailbox *box);
+	int (*close)(struct mailbox *box);
 
 	/* Gets the mailbox status information. */
-	int (*get_status)(Mailbox *box, MailboxStatusItems items,
-			  MailboxStatus *status);
+	int (*get_status)(struct mailbox *box, enum mailbox_status_items items,
+			  struct mailbox_status *status);
 
 	/* Synchronize the mailbox. If sync_expunges is FALSE, everything
 	   but expunges are synced. */
-	int (*sync)(Mailbox *box, int sync_expunges);
+	int (*sync)(struct mailbox *box, int sync_expunges);
 
 	/* Expunge all mails with \Deleted flag. If notify is TRUE, call
 	   expunge callbacks. Also always does full syncing. */
-	int (*expunge)(Mailbox *box, int notify);
+	int (*expunge)(struct mailbox *box, int notify);
 
 	/* Update mail flags, calling update_flags callbacks. */
-	int (*update_flags)(Mailbox *box, const char *messageset, int uidset,
-			    MailFlags flags, const char *custom_flags[],
-			    ModifyType modify_type, int notify, int *all_found);
+	int (*update_flags)(struct mailbox *box,
+			    const char *messageset, int uidset,
+			    enum mail_flags flags, const char *custom_flags[],
+			    enum modify_type modify_type, int notify,
+			    int *all_found);
 
 	/* Copy mails to another mailbox. */
-	int (*copy)(Mailbox *box, Mailbox *destbox,
+	int (*copy)(struct mailbox *box, struct mailbox *destbox,
 		    const char *messageset, int uidset);
 
 	/* Fetch wanted mail data. The results are written into output stream
 	   in RFC2060 FETCH format. */
-	int (*fetch)(Mailbox *box, MailFetchData *fetch_data,
-		     OStream *output, int *all_found);
+	int (*fetch)(struct mailbox *box, struct mail_fetch_data *fetch_data,
+		     struct ostream *output, int *all_found);
 
 	/* Search wanted mail data. args contains the search criteria.
 	   Results are written into output stream in RFC2060 SEARCH format.
 	   If charset is NULL, the given search strings are matched without
 	   any conversion. */
-	int (*search)(Mailbox *box, const char *charset, MailSearchArg *args,
-		      MailSortType *sorting, OStream *output, int uid_result);
+	int (*search)(struct mailbox *box, const char *charset,
+		      struct mail_search_arg *args,
+		      enum mail_sort_type *sorting,
+		      struct ostream *output, int uid_result);
 
 	/* Save a new mail into mailbox. timezone_offset specifies the
 	   timezone in minutes which internal_date was originally given
 	   with. */
-	int (*save)(Mailbox *box, MailFlags flags, const char *custom_flags[],
+	int (*save)(struct mailbox *box, enum mail_flags flags,
+		    const char *custom_flags[],
 		    time_t internal_date, int timezone_offset,
-		    IStream *data, uoff_t data_size);
+		    struct istream *data, uoff_t data_size);
 
 	/* Returns TRUE if mailbox is now in inconsistent state, meaning that
 	   the message IDs etc. may have changed - only way to recover this
 	   would be to fully close the mailbox and reopen it. With IMAP
 	   connection this would mean a forced disconnection since we can't
 	   do forced CLOSE. */
-	int (*is_inconsistency_error)(Mailbox *box);
+	int (*is_inconsistency_error)(struct mailbox *box);
 
 /* public: */
 	unsigned int readonly:1;
@@ -195,7 +202,7 @@
 	unsigned int inconsistent:1;
 };
 
-struct _MailboxStatus {
+struct mailbox_status {
 	unsigned int messages;
 	unsigned int recent;
 	unsigned int unseen;
@@ -212,33 +219,38 @@
 	const char **custom_flags;
 };
 
-struct _MailStorageCallbacks {
+struct mail_storage_callbacks {
 	/* Alert: Not enough disk space */
-	void (*alert_no_diskspace)(Mailbox *mailbox, void *context);
+	void (*alert_no_diskspace)(struct mailbox *mailbox, void *context);
 	/* "* OK <text>" */
-	void (*notify_ok)(Mailbox *mailbox, const char *text, void *context);
+	void (*notify_ok)(struct mailbox *mailbox, const char *text,
+			  void *context);
 	/* "* NO <text>" */
-	void (*notify_no)(Mailbox *mailbox, const char *text, void *context);
+	void (*notify_no)(struct mailbox *mailbox, const char *text,
+			  void *context);
 
 	/* EXPUNGE */
-	void (*expunge)(Mailbox *mailbox, unsigned int seq, void *context);
+	void (*expunge)(struct mailbox *mailbox, unsigned int seq,
+			void *context);
 	/* FETCH FLAGS */
-	void (*update_flags)(Mailbox *mailbox, unsigned int seq,
-			     unsigned int uid, MailFlags flags,
+	void (*update_flags)(struct mailbox *mailbox, unsigned int seq,
+			     unsigned int uid, enum mail_flags flags,
 			     const char *custom_flags[],
 			     unsigned int custom_flags_count, void *context);
 
 	/* EXISTS, RECENT */
-	void (*new_messages)(Mailbox *mailbox, unsigned int messages_count,
+	void (*new_messages)(struct mailbox *mailbox,
+			     unsigned int messages_count,
 			     unsigned int recent_count, void *context);
 	/* FLAGS, PERMANENTFLAGS */
-	void (*new_custom_flags)(Mailbox *mailbox, const char *custom_flags[],
+	void (*new_custom_flags)(struct mailbox *mailbox,
+				 const char *custom_flags[],
 				 unsigned int custom_flags_count,
 				 void *context);
 
 };
 
-struct _MailFetchData {
+struct mail_fetch_data {
 	const char *messageset;
 	unsigned int uidset:1;
 
@@ -253,11 +265,11 @@
 	unsigned int rfc822_text:1;
 	unsigned int uid:1;
 
-	MailFetchBodyData *body_sections;
+	struct mail_fetch_body_data *body_sections;
 };
 
-struct _MailFetchBodyData {
-	MailFetchBodyData *next;
+struct mail_fetch_body_data {
+	struct mail_fetch_body_data *next;
 
 	const char *section; /* NOTE: always uppercased */
 	uoff_t skip, max_size; /* if you don't want max_size,
@@ -271,31 +283,33 @@
 
 /* Register mail storage class with given name - all methods that are NULL
    are set to default methods */
-void mail_storage_class_register(MailStorage *storage_class);
-void mail_storage_class_unregister(MailStorage *storage_class);
+void mail_storage_class_register(struct mail_storage *storage_class);
+void mail_storage_class_unregister(struct mail_storage *storage_class);
 
 /* Create a new instance of registered mail storage class with given
    storage-specific data. If data is NULL, it tries to use defaults.
    May return NULL if anything fails. */
-MailStorage *mail_storage_create(const char *name, const char *data,
-				 const char *user);
-void mail_storage_destroy(MailStorage *storage);
+struct mail_storage *mail_storage_create(const char *name, const char *data,
+					 const char *user);
+void mail_storage_destroy(struct mail_storage *storage);
 
-MailStorage *mail_storage_create_default(const char *user);
-MailStorage *mail_storage_create_with_data(const char *data, const char *user);
+struct mail_storage *mail_storage_create_default(const char *user);
+struct mail_storage *mail_storage_create_with_data(const char *data,
+						   const char *user);
 
 /* Set error message in storage. Critical errors are logged with i_error(),
    but user sees only "internal error" message. */
-void mail_storage_clear_error(MailStorage *storage);
-void mail_storage_set_error(MailStorage *storage, const char *fmt, ...)
-	__attr_format__(2, 3);
-void mail_storage_set_syntax_error(MailStorage *storage, const char *fmt, ...)
-	__attr_format__(2, 3);
-void mail_storage_set_critical(MailStorage *storage, const char *fmt, ...)
-	__attr_format__(2, 3);
-void mail_storage_set_internal_error(MailStorage *storage);
+void mail_storage_clear_error(struct mail_storage *storage);
+void mail_storage_set_error(struct mail_storage *storage,
+			    const char *fmt, ...) __attr_format__(2, 3);
+void mail_storage_set_syntax_error(struct mail_storage *storage,
+				   const char *fmt, ...) __attr_format__(2, 3);
+void mail_storage_set_critical(struct mail_storage *storage,
+			       const char *fmt, ...) __attr_format__(2, 3);
+void mail_storage_set_internal_error(struct mail_storage *storage);
 
-const char *mail_storage_get_last_error(MailStorage *storage, int *syntax);
-int mail_storage_is_inconsistency_error(Mailbox *box);
+const char *mail_storage_get_last_error(struct mail_storage *storage,
+					int *syntax);
+int mail_storage_is_inconsistency_error(struct mailbox *box);
 
 #endif




More information about the dovecot-cvs mailing list