[dovecot-cvs] dovecot/src/lib-storage mail-storage.c,1.11,1.12 mail-storage.h,1.37,1.38

cras at procontrol.fi cras at procontrol.fi
Wed Feb 19 21:55:29 EET 2003


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

Modified Files:
	mail-storage.c mail-storage.h 
Log Message:
Rewrote LIST, LSUB and subscription file handling. LIST replies aren't
sorted anymore by default, it can be enabled with client_workarounds =
list-sort.



Index: mail-storage.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/mail-storage.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- mail-storage.c	11 Feb 2003 20:10:20 -0000	1.11
+++ mail-storage.c	19 Feb 2003 19:55:27 -0000	1.12
@@ -23,6 +23,7 @@
 
 struct client_workaround_list client_workaround_list[] = {
 	{ "oe6-fetch-no-newmail", WORKAROUND_OE6_FETCH_NO_NEWMAIL },
+	{ "list-sort", WORKAROUND_LIST_SORT },
 	{ NULL, 0 }
 };
 
@@ -48,11 +49,13 @@
 
 		list = client_workaround_list;
 		for (; list->name != NULL; list++) {
-			if (strcasecmp(*str, list->name) == 0)
+			if (strcasecmp(*str, list->name) == 0) {
 				client_workarounds |= list->num;
-			else
-				i_fatal("Unknown client workaround: %s", *str);
+				break;
+			}
 		}
+		if (list->name == NULL)
+			i_fatal("Unknown client workaround: %s", *str);
 	}
 }
 

Index: mail-storage.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/mail-storage.h,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- mail-storage.h	14 Feb 2003 14:39:58 -0000	1.37
+++ mail-storage.h	19 Feb 2003 19:55:27 -0000	1.38
@@ -5,6 +5,11 @@
 
 #include "imap-util.h"
 
+enum mailbox_list_flags {
+	MAILBOX_LIST_SUBSCRIBED	= 0x01, /* show only subscribed */
+	MAILBOX_LIST_NO_FLAGS	= 0x02  /* don't set mailbox_flags */
+};
+
 enum mailbox_flags {
 	MAILBOX_NOSELECT	= 0x01,
 	MAILBOX_CHILDREN	= 0x02,
@@ -86,7 +91,8 @@
 };
 
 enum client_workarounds {
-	WORKAROUND_OE6_FETCH_NO_NEWMAIL	= 0x01
+	WORKAROUND_OE6_FETCH_NO_NEWMAIL	= 0x01,
+	WORKAROUND_LIST_SORT		= 0x02
 };
 
 struct mail_full_flags {
@@ -98,15 +104,12 @@
 
 struct mail_storage;
 struct mail_storage_callbacks;
+struct mailbox_list;
 struct mailbox_status;
 struct mail_search_arg;
 struct fetch_context;
 struct search_context;
 
-typedef void mailbox_list_callback_t(struct mail_storage *storage,
-				     const char *name, enum mailbox_flags flags,
-				     void *context);
-
 /* All methods returning int return either TRUE or FALSE. */
 struct mail_storage {
 	char *name;
@@ -156,10 +159,22 @@
 	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)(struct mail_storage *storage, const char *mask,
-			      mailbox_list_callback_t *callback, void *context);
+	/* Initialize new mailbox list request. mask may contain '%' and '*'
+	   wildcards as defined in RFC2060. Matching against "INBOX" is
+	   case-insensitive, but anything else is not. *sorted is set to TRUE
+	   if the output will contain parent mailboxes always before their
+	   children. */
+	struct mailbox_list_context *
+		(*list_mailbox_init)(struct mail_storage *storage,
+				     const char *mask,
+				     enum mailbox_list_flags flags,
+				     int *sorted);
+	/* Deinitialize mailbox list request. Returns FALSE if some error
+	   occured while listing. */
+	int (*list_mailbox_deinit)(struct mailbox_list_context *ctx);
+	/* Get next mailbox. Returns the mailbox name */
+	struct mailbox_list *
+		(*list_mailbox_next)(struct mailbox_list_context *ctx);
 
 	/* Subscribe/unsubscribe mailbox. There should be no error when
 	   subscribing to already subscribed mailbox. Subscribing to
@@ -167,11 +182,6 @@
 	int (*set_subscribed)(struct mail_storage *storage,
 			      const char *name, int set);
 
-	/* Exactly like find_mailboxes(), but list only subscribed mailboxes. */
-	int (*find_subscribed)(struct mail_storage *storage, const char *mask,
-			       mailbox_list_callback_t *callback,
-			       void *context);
-
 	/* Returns mailbox name status */
 	int (*get_mailbox_name_status)(struct mail_storage *storage,
 				       const char *name,
@@ -354,6 +364,11 @@
 	/* Get the any of the "special" fields. */
 	const char *(*get_special)(struct mail *mail,
 				   enum mail_fetch_field field);
+};
+
+struct mailbox_list {
+	const char *name;
+        enum mailbox_flags flags;
 };
 
 struct mailbox_status {




More information about the dovecot-cvs mailing list