[dovecot-cvs] dovecot/src/lib-storage mail-storage-private.h, 1.10,
1.11 mail-storage.c, 1.32, 1.33 mail-storage.h, 1.85, 1.86
cras at dovecot.org
cras at dovecot.org
Wed Dec 29 21:10:28 EET 2004
Update of /var/lib/cvs/dovecot/src/lib-storage
In directory talvi:/tmp/cvs-serv29231/src/lib-storage
Modified Files:
mail-storage-private.h mail-storage.c mail-storage.h
Log Message:
Added mail_debug setting. Moved full_filesystem_access from global variable
to flag in mail_create*() functions.
Index: mail-storage-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/mail-storage-private.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- mail-storage-private.h 26 Dec 2004 09:12:41 -0000 1.10
+++ mail-storage-private.h 29 Dec 2004 19:10:26 -0000 1.11
@@ -7,10 +7,11 @@
char *name;
char hierarchy_sep;
- struct mail_storage *(*create)(const char *data, const char *user);
+ struct mail_storage *(*create)(const char *data, const char *user,
+ enum mail_storage_flags flags);
void (*destroy)(struct mail_storage *storage);
- int (*autodetect)(const char *data);
+ int (*autodetect)(const char *data, enum mail_storage_flags flags);
void (*set_callbacks)(struct mail_storage *storage,
struct mail_storage_callbacks *callbacks,
@@ -46,6 +47,7 @@
/* private: */
char *error;
+ enum mail_storage_flags flags;
unsigned int syntax_error:1; /* Give a BAD reply instead of NO */
};
Index: mail-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/mail-storage.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- mail-storage.c 26 Dec 2004 09:12:41 -0000 1.32
+++ mail-storage.c 29 Dec 2004 19:10:26 -0000 1.33
@@ -19,11 +19,9 @@
};
static struct mail_storage_list *storages = NULL;
-int full_filesystem_access = FALSE;
void mail_storage_init(void)
{
- full_filesystem_access = getenv("FULL_FILESYSTEM_ACCESS") != NULL;
}
void mail_storage_deinit(void)
@@ -69,7 +67,8 @@
}
struct mail_storage *
-mail_storage_create(const char *name, const char *data, const char *user)
+mail_storage_create(const char *name, const char *data, const char *user,
+ enum mail_storage_flags flags)
{
struct mail_storage_list *list;
@@ -77,20 +76,20 @@
for (list = storages; list != NULL; list = list->next) {
if (strcasecmp(list->storage->name, name) == 0)
- return list->storage->create(data, user);
+ return list->storage->create(data, user, flags);
}
return NULL;
}
struct mail_storage *
-mail_storage_create_default(const char *user)
+mail_storage_create_default(const char *user, enum mail_storage_flags flags)
{
struct mail_storage_list *list;
struct mail_storage *storage;
for (list = storages; list != NULL; list = list->next) {
- storage = list->storage->create(NULL, user);
+ storage = list->storage->create(NULL, user, flags);
if (storage != NULL)
return storage;
}
@@ -98,12 +97,13 @@
return NULL;
}
-static struct mail_storage *mail_storage_autodetect(const char *data)
+static struct mail_storage *
+mail_storage_autodetect(const char *data, enum mail_storage_flags flags)
{
struct mail_storage_list *list;
for (list = storages; list != NULL; list = list->next) {
- if (list->storage->autodetect(data))
+ if (list->storage->autodetect(data, flags))
return list->storage;
}
@@ -111,13 +111,14 @@
}
struct mail_storage *
-mail_storage_create_with_data(const char *data, const char *user)
+mail_storage_create_with_data(const char *data, const char *user,
+ enum mail_storage_flags flags)
{
struct mail_storage *storage;
const char *p, *name;
if (data == NULL || *data == '\0')
- return mail_storage_create_default(user);
+ return mail_storage_create_default(user, flags);
/* check if we're in the form of mailformat:data
(eg. maildir:Maildir) */
@@ -126,11 +127,11 @@
if (*p == ':') {
name = t_strdup_until(data, p);
- storage = mail_storage_create(name, p+1, user);
+ storage = mail_storage_create(name, p+1, user, flags);
} else {
- storage = mail_storage_autodetect(data);
+ storage = mail_storage_autodetect(data, flags);
if (storage != NULL)
- storage = storage->create(data, user);
+ storage = storage->create(data, user, flags);
}
return storage;
Index: mail-storage.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/mail-storage.h,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -d -r1.85 -r1.86
--- mail-storage.h 26 Dec 2004 09:12:41 -0000 1.85
+++ mail-storage.h 29 Dec 2004 19:10:26 -0000 1.86
@@ -5,6 +5,13 @@
#include "mail-types.h"
+enum mail_storage_flags {
+ /* Print debugging information while initializing the storage */
+ MAIL_STORAGE_FLAG_DEBUG = 0x01,
+ /* Allow full filesystem access with absolute or relative paths. */
+ MAIL_STORAGE_FLAG_FULL_FS_ACCESS = 0x02
+};
+
enum mailbox_open_flags {
MAILBOX_OPEN_READONLY = 0x01,
MAILBOX_OPEN_FAST = 0x02,
@@ -156,8 +163,6 @@
typedef void mailbox_notify_callback_t(struct mailbox *box, void *context);
-extern int full_filesystem_access;
-
void mail_storage_init(void);
void mail_storage_deinit(void);
@@ -176,12 +181,15 @@
If namespace is non-NULL, all mailbox names are expected to begin with it.
hierarchy_sep overrides the default separator if it's not '\0'. */
struct mail_storage *
-mail_storage_create(const char *name, const char *data, const char *user);
+mail_storage_create(const char *name, const char *data, const char *user,
+ enum mail_storage_flags flags);
void mail_storage_destroy(struct mail_storage *storage);
-struct mail_storage *mail_storage_create_default(const char *user);
struct mail_storage *
-mail_storage_create_with_data(const char *data, const char *user);
+mail_storage_create_default(const char *user, enum mail_storage_flags flags);
+struct mail_storage *
+mail_storage_create_with_data(const char *data, const char *user,
+ enum mail_storage_flags flags);
char mail_storage_get_hierarchy_sep(struct mail_storage *storage);
More information about the dovecot-cvs
mailing list