[dovecot-cvs] dovecot/src/lib-storage mail-storage-private.h, NONE,
1.1 Makefile.am, 1.9, 1.10 mail-save.c, 1.5, 1.6 mail-save.h,
1.1, 1.2 mail-search.h, 1.11, 1.12 mail-storage.c, 1.20,
1.21 mail-storage.h, 1.62, 1.63 proxy-mail-storage.c, 1.3,
1.4 proxy-mail-storage.h, 1.1, 1.2 proxy-mail.c, 1.3,
1.4 proxy-mailbox.c, 1.4, 1.5 proxy-mailbox.h, 1.1, 1.2
cras at procontrol.fi
cras at procontrol.fi
Tue Apr 27 23:25:57 EEST 2004
- Previous message: [dovecot-cvs]
dovecot/src/lib-storage/index/mbox istream-raw-mbox.c, NONE,
1.1 istream-raw-mbox.h, NONE, 1.1 mbox-from.c, NONE,
1.1 mbox-from.h, NONE, 1.1 mbox-sync-header.c, NONE,
1.1 mbox-sync-parse.c, NONE, 1.1 mbox-sync-private.h, NONE,
1.1 mbox-sync-rewrite.c, NONE, 1.1 mbox-sync-update.c, NONE,
1.1 mbox-sync.c, NONE, 1.1 Makefile.am, 1.1.1.1,
1.2 mbox-expunge.c, 1.33, 1.34 mbox-list.c, 1.22,
1.23 mbox-save.c, 1.45, 1.46
- Next message: [dovecot-cvs] dovecot configure.in,1.152,1.153
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/dovecot/src/lib-storage
In directory talvi:/tmp/cvs-serv29236/src/lib-storage
Modified Files:
Makefile.am mail-save.c mail-save.h mail-search.h
mail-storage.c mail-storage.h proxy-mail-storage.c
proxy-mail-storage.h proxy-mail.c proxy-mailbox.c
proxy-mailbox.h
Added Files:
mail-storage-private.h
Log Message:
importing new index code. mbox still broken.
--- NEW FILE: mail-storage-private.h ---
#ifndef __MAIL_STORAGE_PRIVATE_H
#define __MAIL_STORAGE_PRIVATE_H
#include "mail-storage.h"
struct mail_storage {
char *name;
char *namespace;
char hierarchy_sep;
struct mail_storage *(*create)(const char *data, const char *user,
const char *namespace,
char hierarchy_sep);
void (*destroy)(struct mail_storage *storage);
int (*autodetect)(const char *data);
void (*set_callbacks)(struct mail_storage *storage,
struct mail_storage_callbacks *callbacks,
void *context);
struct mailbox *(*mailbox_open)(struct mail_storage *storage,
const char *name,
enum mailbox_open_flags flags);
int (*mailbox_create)(struct mail_storage *storage, const char *name,
int directory);
int (*mailbox_delete)(struct mail_storage *storage, const char *name);
int (*mailbox_rename)(struct mail_storage *storage, const char *oldname,
const char *newname);
struct mailbox_list_context *
(*mailbox_list_init)(struct mail_storage *storage,
const char *mask,
enum mailbox_list_flags flags);
struct mailbox_list *
(*mailbox_list_next)(struct mailbox_list_context *ctx);
int (*mailbox_list_deinit)(struct mailbox_list_context *ctx);
int (*set_subscribed)(struct mail_storage *storage,
const char *name, int set);
int (*get_mailbox_name_status)(struct mail_storage *storage,
const char *name,
enum mailbox_name_status *status);
const char *(*get_last_error)(struct mail_storage *storage,
int *syntax_error_r);
/* private: */
char *error;
unsigned int syntax_error:1; /* Give a BAD reply instead of NO */
};
struct mailbox {
char *name;
struct mail_storage *storage;
int (*is_readonly)(struct mailbox *box);
int (*allow_new_custom_flags)(struct mailbox *box);
int (*close)(struct mailbox *box);
int (*get_status)(struct mailbox *box, enum mailbox_status_items items,
struct mailbox_status *status);
int (*sync)(struct mailbox *box, enum mailbox_sync_flags flags);
void (*auto_sync)(struct mailbox *box, enum mailbox_sync_flags flags,
unsigned int min_newmail_notify_interval);
struct mailbox_transaction_context *
(*transaction_begin)(struct mailbox *box, int hide);
int (*transaction_commit)(struct mailbox_transaction_context *t);
void (*transaction_rollback)(struct mailbox_transaction_context *t);
struct mail *(*fetch)(struct mailbox_transaction_context *t,
uint32_t seq,
enum mail_fetch_field wanted_fields);
int (*get_uids)(struct mailbox *box, uint32_t uid1, uint32_t uid2,
uint32_t *seq1_r, uint32_t *seq2_r);
int (*search_get_sorting)(struct mailbox *box,
enum mail_sort_type *sort_program);
struct mail_search_context *
(*search_init)(struct mailbox_transaction_context *t,
const char *charset,
struct mail_search_arg *args,
const enum mail_sort_type *sort_program,
enum mail_fetch_field wanted_fields,
const char *const wanted_headers[]);
int (*search_deinit)(struct mail_search_context *ctx);
struct mail *(*search_next)(struct mail_search_context *ctx);
int (*save)(struct mailbox_transaction_context *t,
const struct mail_full_flags *flags,
time_t received_date, int timezone_offset,
const char *from_envelope, struct istream *data);
int (*copy)(struct mailbox_transaction_context *t, struct mail *mail);
int (*is_inconsistent)(struct mailbox *box);
};
struct mailbox_list_context {
struct mail_storage *storage;
};
struct mailbox_transaction_context {
struct mailbox *box;
};
struct mail_search_context {
struct mailbox *box;
};
/* Set error message in storage. Critical errors are logged with i_error(),
but user sees only "internal error" message. */
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);
#endif
Index: Makefile.am
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/Makefile.am,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- Makefile.am 26 Jul 2003 23:53:05 -0000 1.9
+++ Makefile.am 27 Apr 2004 20:25:54 -0000 1.10
@@ -20,6 +20,7 @@
mail-save.h \
mail-search.h \
mail-storage.h \
+ mail-storage-private.h \
mailbox-tree.h \
proxy-mail.h \
proxy-mail-storage.h \
Index: mail-save.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/mail-save.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- mail-save.c 9 Nov 2003 18:26:25 -0000 1.5
+++ mail-save.c 27 Apr 2004 20:25:54 -0000 1.6
@@ -4,7 +4,7 @@
#include "istream.h"
#include "ostream.h"
#include "message-parser.h"
-#include "mail-storage.h"
+#include "mail-storage-private.h"
#include "mail-save.h"
static int write_with_crlf(struct ostream *output, const void *v_data,
@@ -94,16 +94,14 @@
{
struct message_header_parser_ctx *hdr_ctx;
struct message_header_line *hdr;
- int ret, failed = FALSE;
+ int ret = 0;
hdr_ctx = message_parse_header_init(input, NULL);
while ((hdr = message_parse_header_next(hdr_ctx)) != NULL) {
ret = header_callback(hdr->name, write_func, context);
if (ret <= 0) {
- if (ret < 0) {
- failed = TRUE;
+ if (ret < 0)
break;
- }
continue;
}
@@ -118,16 +116,17 @@
write_func(output, "\n", 1);
}
}
- if (!failed) {
+
+ if (ret >= 0) {
if (header_callback(NULL, write_func, context) < 0)
- failed = TRUE;
+ ret = -1;
/* end of headers */
write_func(output, "\n", 1);
}
message_parse_header_deinit(hdr_ctx);
- return !failed;
+ return ret < 0 ? -1 : 0;
}
int mail_storage_save(struct mail_storage *storage, const char *path,
@@ -143,9 +142,9 @@
write_func = crlf ? write_with_crlf : write_with_lf;
if (header_callback != NULL) {
- if (!save_headers(input, output, header_callback,
- context, write_func))
- return FALSE;
+ if (save_headers(input, output, header_callback,
+ context, write_func) < 0)
+ return -1;
}
failed = FALSE;
@@ -186,5 +185,19 @@
}
}
- return !failed;
+ return failed ? -1 : 0;
+}
+
+int mail_storage_copy(struct mailbox_transaction_context *t, struct mail *mail)
+{
+ struct istream *input;
+
+ input = mail->get_stream(mail, NULL, NULL);
+ if (input == NULL)
+ return -1;
+
+ return mailbox_save(t, mail->get_flags(mail),
+ mail->get_received_date(mail), 0,
+ mail->get_special(mail, MAIL_FETCH_FROM_ENVELOPE),
+ input);
}
Index: mail-save.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/mail-save.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- mail-save.h 7 May 2003 12:06:47 -0000 1.1
+++ mail-save.h 27 Apr 2004 20:25:54 -0000 1.2
@@ -11,4 +11,6 @@
struct istream *input, struct ostream *output, int crlf,
header_callback_t *header_callback, void *context);
+int mail_storage_copy(struct mailbox_transaction_context *t, struct mail *mail);
+
#endif
Index: mail-search.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/mail-search.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- mail-search.h 26 Oct 2003 19:41:09 -0000 1.11
+++ mail-search.h 27 Apr 2004 20:25:54 -0000 1.12
@@ -5,10 +5,9 @@
SEARCH_OR,
SEARCH_SUB,
- /* message sets */
+ /* sequence sets */
SEARCH_ALL,
- SEARCH_SET,
- SEARCH_UID,
+ SEARCH_SEQSET,
/* flags */
SEARCH_ANSWERED,
@@ -40,12 +39,18 @@
SEARCH_TEXT
};
+struct mail_search_seqset {
+ uint32_t seq1, seq2;
+ struct mail_search_seqset *next;
+};
+
struct mail_search_arg {
struct mail_search_arg *next;
enum mail_search_arg_type type;
- union {
+ struct {
struct mail_search_arg *subargs;
+ struct mail_search_seqset *seqset;
const char *str;
} value;
Index: mail-storage.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/mail-storage.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- mail-storage.c 26 Apr 2004 20:48:04 -0000 1.20
+++ mail-storage.c 27 Apr 2004 20:25:54 -0000 1.21
@@ -1,8 +1,8 @@
-/* Copyright (C) 2002 Timo Sirainen */
+/* Copyright (C) 2002-2003 Timo Sirainen */
#include "lib.h"
#include "ioloop.h"
-#include "mail-storage.h"
+#include "mail-storage-private.h"
#include <stdlib.h>
#include <time.h>
@@ -25,7 +25,6 @@
struct client_workaround_list client_workaround_list[] = {
{ "oe6-fetch-no-newmail", WORKAROUND_OE6_FETCH_NO_NEWMAIL },
- { "oe6-fetch-redundant-msgset", WORKAROUND_OE6_FETCH_REDUNDANT_MSGSET },
{ "outlook-idle", WORKAROUND_OUTLOOK_IDLE },
{ NULL, 0 }
};
@@ -93,7 +92,7 @@
if ((*list)->storage == storage_class) {
next = (*list)->next;
- (*list)->storage->free((*list)->storage);
+ mail_storage_destroy((*list)->storage);
i_free(*list);
*list = next;
@@ -184,7 +183,7 @@
{
i_assert(storage != NULL);
- storage->free(storage);
+ storage->destroy(storage);
}
void mail_storage_clear_error(struct mail_storage *storage)
@@ -262,10 +261,193 @@
}
}
+char mail_storage_get_hierarchy_sep(struct mail_storage *storage)
+{
+ return storage->hierarchy_sep;
+}
+
+void mail_storage_set_callbacks(struct mail_storage *storage,
+ struct mail_storage_callbacks *callbacks,
+ void *context)
+{
+ storage->set_callbacks(storage, callbacks, context);
+}
+
+int mail_storage_mailbox_create(struct mail_storage *storage, const char *name,
+ int directory)
+{
+ return storage->mailbox_create(storage, name, directory);
+}
+
+int mail_storage_mailbox_delete(struct mail_storage *storage, const char *name)
+{
+ return storage->mailbox_delete(storage, name);
+}
+
+int mail_storage_mailbox_rename(struct mail_storage *storage,
+ const char *oldname, const char *newname)
+{
+ return storage->mailbox_rename(storage, oldname, newname);
+}
+
+struct mailbox_list_context *
+mail_storage_mailbox_list_init(struct mail_storage *storage,
+ const char *mask,
+ enum mailbox_list_flags flags)
+{
+ return storage->mailbox_list_init(storage, mask, flags);
+}
+
+struct mailbox_list *
+mail_storage_mailbox_list_next(struct mailbox_list_context *ctx)
+{
+ return ctx->storage->mailbox_list_next(ctx);
+}
+
+int mail_storage_mailbox_list_deinit(struct mailbox_list_context *ctx)
+{
+ return ctx->storage->mailbox_list_deinit(ctx);
+}
+
+int mail_storage_set_subscribed(struct mail_storage *storage,
+ const char *name, int set)
+{
+ return storage->set_subscribed(storage, name, set);
+}
+
+int mail_storage_get_mailbox_name_status(struct mail_storage *storage,
+ const char *name,
+ enum mailbox_name_status *status)
+{
+ return storage->get_mailbox_name_status(storage, name, status);
+}
+
const char *mail_storage_get_last_error(struct mail_storage *storage,
- int *syntax)
+ int *syntax_error_r)
{
- if (syntax != NULL)
- *syntax = storage->syntax_error;
+ *syntax_error_r = storage->syntax_error;
return storage->error;
}
+
+struct mailbox *mailbox_open(struct mail_storage *storage,
+ const char *name, enum mailbox_open_flags flags)
+{
+ return storage->mailbox_open(storage, name, flags);
+}
+
+int mailbox_close(struct mailbox *box)
+{
+ return box->close(box);
+}
+
+struct mail_storage *mailbox_get_storage(struct mailbox *box)
+{
+ return box->storage;
+}
+
+const char *mailbox_get_name(struct mailbox *box)
+{
+ return box->name;
+}
+
+int mailbox_is_readonly(struct mailbox *box)
+{
+ return box->is_readonly(box);
+}
+
+int mailbox_allow_new_custom_flags(struct mailbox *box)
+{
+ return box->allow_new_custom_flags(box);
+}
+
+int mailbox_get_status(struct mailbox *box,
+ enum mailbox_status_items items,
+ struct mailbox_status *status)
+{
+ return box->get_status(box, items, status);
+}
+
+int mailbox_sync(struct mailbox *box, enum mailbox_sync_flags flags)
+{
+ return box->sync(box, flags);
+}
+
+void mailbox_auto_sync(struct mailbox *box, enum mailbox_sync_flags flags,
+ unsigned int min_newmail_notify_interval)
+{
+ box->auto_sync(box, flags, min_newmail_notify_interval);
+}
+
+struct mail *mailbox_fetch(struct mailbox_transaction_context *t, uint32_t seq,
+ enum mail_fetch_field wanted_fields)
+{
+ return t->box->fetch(t, seq, wanted_fields);
+}
+
+int mailbox_get_uids(struct mailbox *box, uint32_t uid1, uint32_t uid2,
+ uint32_t *seq1_r, uint32_t *seq2_r)
+{
+ return box->get_uids(box, uid1, uid2, seq1_r, seq2_r);
+}
+
+int mailbox_search_get_sorting(struct mailbox *box,
+ enum mail_sort_type *sort_program)
+{
+ return box->search_get_sorting(box, sort_program);
+}
+
+struct mail_search_context *
+mailbox_search_init(struct mailbox_transaction_context *t,
+ const char *charset, struct mail_search_arg *args,
+ const enum mail_sort_type *sort_program,
+ enum mail_fetch_field wanted_fields,
+ const char *const wanted_headers[])
+{
+ return t->box->search_init(t, charset, args, sort_program,
+ wanted_fields, wanted_headers);
+}
+
+int mailbox_search_deinit(struct mail_search_context *ctx)
+{
+ return ctx->box->search_deinit(ctx);
+}
+
+struct mail *mailbox_search_next(struct mail_search_context *ctx)
+{
+ return ctx->box->search_next(ctx);
+}
+
+struct mailbox_transaction_context *
+mailbox_transaction_begin(struct mailbox *box, int hide)
+{
+ return box->transaction_begin(box, hide);
+}
+
+int mailbox_transaction_commit(struct mailbox_transaction_context *t)
+{
+ return t->box->transaction_commit(t);
+}
+
+void mailbox_transaction_rollback(struct mailbox_transaction_context *t)
+{
+ t->box->transaction_rollback(t);
+}
+
+int mailbox_save(struct mailbox_transaction_context *t,
+ const struct mail_full_flags *flags,
+ time_t received_date, int timezone_offset,
+ const char *from_envelope, struct istream *data)
+{
+ return t->box->save(t, flags, received_date, timezone_offset,
+ from_envelope, data);
+}
+
+int mailbox_copy(struct mailbox_transaction_context *t, struct mail *mail)
+{
+ return t->box->copy(t, mail);
+}
+
+int mailbox_is_inconsistent(struct mailbox *box)
+{
+ return box->is_inconsistent(box);
+}
Index: mail-storage.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/mail-storage.h,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- mail-storage.h 26 Oct 2003 20:13:15 -0000 1.62
+++ mail-storage.h 27 Apr 2004 20:25:54 -0000 1.63
@@ -3,7 +3,7 @@
struct message_size;
-#include "imap-util.h"
+#include "mail-types.h"
enum mailbox_open_flags {
MAILBOX_OPEN_READONLY = 0x01,
@@ -47,14 +47,6 @@
MAILBOX_NAME_NOINFERIORS
};
-enum mailbox_lock_type {
- MAILBOX_LOCK_UNLOCK = 0x00,
- MAILBOX_LOCK_READ = 0x01,
- MAILBOX_LOCK_FLAGS = 0x02,
- MAILBOX_LOCK_EXPUNGE = 0x04,
- MAILBOX_LOCK_SAVE = 0x08
-};
-
enum mail_sort_type {
/* Maximum size for sort program, 2x for reverse + END */
#define MAX_SORT_PROGRAM_SIZE (2*7 + 1)
@@ -92,20 +84,19 @@
/* specials: */
MAIL_FETCH_IMAP_BODY = 0x1000,
MAIL_FETCH_IMAP_BODYSTRUCTURE = 0x2000,
- MAIL_FETCH_IMAP_ENVELOPE = 0x4000
+ MAIL_FETCH_IMAP_ENVELOPE = 0x4000,
+ MAIL_FETCH_FROM_ENVELOPE = 0x8000
};
enum mailbox_sync_flags {
- MAILBOX_SYNC_NONE = 0x00,
- MAILBOX_SYNC_FULL = 0x01,
- MAILBOX_SYNC_FAST = 0x02,
- MAILBOX_SYNC_FLAG_NO_EXPUNGES = 0x04
+ MAILBOX_SYNC_FLAG_FAST = 0x01,
+ MAILBOX_SYNC_FLAG_NO_EXPUNGES = 0x02,
+ MAILBOX_SYNC_AUTO_STOP = 0x04
};
enum client_workarounds {
WORKAROUND_OE6_FETCH_NO_NEWMAIL = 0x01,
- WORKAROUND_OE6_FETCH_REDUNDANT_MSGSET = 0x02,
- WORKAROUND_OUTLOOK_IDLE = 0x04
+ WORKAROUND_OUTLOOK_IDLE = 0x02
};
struct mail_storage;
@@ -115,230 +106,250 @@
struct mail_search_arg;
struct fetch_context;
struct search_context;
+struct mail;
+struct mailbox;
+struct mailbox_list_context;
+struct mailbox_transaction_context;
-/* All methods returning int return either TRUE or FALSE. */
-struct mail_storage {
- char *name;
- char *namespace;
+struct mailbox_list {
+ const char *name;
+ enum mailbox_flags flags;
+};
- char hierarchy_sep;
+struct mailbox_status {
+ uint32_t messages;
+ uint32_t recent;
+ uint32_t unseen;
- /* Create new instance. 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 *(*create)(const char *data, const char *user,
- const char *namespace,
- char hierarchy_sep);
+ uint32_t uidvalidity;
+ uint32_t uidnext;
- /* Free this instance */
- void (*free)(struct mail_storage *storage);
+ uint32_t first_unseen_seq;
- /* Returns TRUE if this storage would accept the given data
- as a valid parameter to create(). */
- int (*autodetect)(const char *data);
+ unsigned int diskspace_full:1;
- /* Set storage callback functions to use. */
- void (*set_callbacks)(struct mail_storage *storage,
- struct mail_storage_callbacks *callbacks,
- void *context);
+ /* may be allocated from data stack */
+ unsigned int custom_flags_count;
+ const char **custom_flags;
+};
- /* Open a mailbox. If readonly is TRUE, mailbox must not be
- modified in any way even when it's asked. If fast is TRUE,
- any extra time consuming operations shouldn't be performed
- (eg. when opening mailbox just for STATUS).
+struct mail_storage_callbacks {
+ /* Alert: Not enough disk space */
+ void (*alert_no_diskspace)(struct mailbox *mailbox, void *context);
+ /* "* OK <text>" */
+ void (*notify_ok)(struct mailbox *mailbox, const char *text,
+ void *context);
+ /* "* NO <text>" */
+ void (*notify_no)(struct mailbox *mailbox, const char *text,
+ void *context);
- Note that append and copy may open the selected mailbox again
- with possibly different readonly-state. */
- struct mailbox *(*open_mailbox)(struct mail_storage *storage,
- const char *name,
- enum mailbox_open_flags flags);
+ /* EXPUNGE */
+ void (*expunge)(struct mailbox *mailbox, unsigned int seq,
+ void *context);
+ /* FETCH FLAGS */
+ void (*update_flags)(struct mailbox *mailbox, unsigned int seq,
+ const struct mail_full_flags *flags,
+ void *context);
- /* name is allowed to contain multiple new hierarchy levels.
- If directory is TRUE, the mailbox should be created so that it
- can contain children. The mailbox itself doesn't have to be
- created as long as it shows in LIST. */
- int (*create_mailbox)(struct mail_storage *storage, const char *name,
- int directory);
+ /* EXISTS, RECENT */
+ void (*new_messages)(struct mailbox *mailbox,
+ unsigned int messages_count,
+ unsigned int recent_count, void *context);
+ /* FLAGS, PERMANENTFLAGS */
+ void (*new_custom_flags)(struct mailbox *mailbox,
+ const char *custom_flags[],
+ unsigned int custom_flags_count,
+ void *context);
- /* Only the specified mailbox is deleted, ie. folders under the
- specified mailbox must not be deleted. */
- 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
- also foo/bar -> bar/bar). newname may contain multiple new
- hierarchies.
+extern enum client_workarounds client_workarounds;
+extern int full_filesystem_access;
- If oldname is case-insensitively "INBOX", the mails are moved
- into new folder but the INBOX folder must not be deleted. */
- int (*rename_mailbox)(struct mail_storage *storage, const char *oldname,
- const char *newname);
+void mail_storage_init(void);
+void mail_storage_deinit(void);
- /* 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. */
- struct mailbox_list_context *
- (*list_mailbox_init)(struct mail_storage *storage,
- const char *mask,
- enum mailbox_list_flags flags);
- /* 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);
+/* register all mail storages */
+void mail_storage_register_all(void);
- /* Subscribe/unsubscribe mailbox. There should be no error when
- subscribing to already subscribed mailbox. Subscribing to
- unexisting mailboxes is optional. */
- int (*set_subscribed)(struct mail_storage *storage,
- const char *name, int set);
+/* Register mail storage class with given name - all methods that are NULL
+ are set to default methods */
+void mail_storage_class_register(struct mail_storage *storage_class);
+void mail_storage_class_unregister(struct mail_storage *storage_class);
- /* Returns mailbox name status */
- int (*get_mailbox_name_status)(struct mail_storage *storage,
- const char *name,
- enum mailbox_name_status *status);
+/* 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.
- /* Returns the error message of last occured error. */
- const char *(*get_last_error)(struct mail_storage *storage,
- int *syntax_error);
+ 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,
+ const char *namespace, char hierarchy_sep);
+void mail_storage_destroy(struct mail_storage *storage);
-/* private: */
- char *dir; /* root directory */
- char *inbox_file; /* INBOX file for mbox */
- char *index_dir;
- char *control_dir;
+struct mail_storage *
+mail_storage_create_default(const char *user,
+ const char *namespace, char hierarchy_sep);
+struct mail_storage *
+mail_storage_create_with_data(const char *data, const char *user,
+ const char *namespace, char hierarchy_sep);
- char *user; /* name of user accessing the storage */
- char *error;
+char mail_storage_get_hierarchy_sep(struct mail_storage *storage);
- struct mail_storage_callbacks *callbacks;
- void *callback_context;
+/* Set storage callback functions to use. */
+void mail_storage_set_callbacks(struct mail_storage *storage,
+ struct mail_storage_callbacks *callbacks,
+ void *context);
- unsigned int syntax_error:1; /* Give a BAD reply instead of NO */
-};
+/* name is allowed to contain multiple new hierarchy levels.
+ If directory is TRUE, the mailbox should be created so that it
+ can contain children. The mailbox itself doesn't have to be
+ created as long as it shows in LIST. */
+int mail_storage_mailbox_create(struct mail_storage *storage, const char *name,
+ int directory);
+/* Only the specified mailbox is deleted, ie. folders under the
+ specified mailbox must not be deleted. */
+int mail_storage_mailbox_delete(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
+ also foo/bar -> bar/bar). newname may contain multiple new
+ hierarchies.
-struct mailbox {
- char *name;
+ If oldname is case-insensitively "INBOX", the mails are moved
+ into new folder but the INBOX folder must not be deleted. */
+int mail_storage_mailbox_rename(struct mail_storage *storage,
+ const char *oldname, const char *newname);
- struct mail_storage *storage;
+/* 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. */
+struct mailbox_list_context *
+mail_storage_mailbox_list_init(struct mail_storage *storage,
+ const char *mask,
+ enum mailbox_list_flags flags);
+/* Get next mailbox. Returns the mailbox name */
+struct mailbox_list *
+mail_storage_mailbox_list_next(struct mailbox_list_context *ctx);
+/* Deinitialize mailbox list request. Returns FALSE if some error
+ occured while listing. */
+int mail_storage_mailbox_list_deinit(struct mailbox_list_context *ctx);
- /* Returns TRUE if mailbox is read-only. */
- int (*is_readonly)(struct mailbox *box);
+/* Subscribe/unsubscribe mailbox. There should be no error when
+ subscribing to already subscribed mailbox. Subscribing to
+ unexisting mailboxes is optional. */
+int mail_storage_set_subscribed(struct mail_storage *storage,
+ const char *name, int set);
- /* Returns TRUE if mailbox supports adding custom flags. */
- int (*allow_new_custom_flags)(struct mailbox *box);
+/* Returns mailbox name status */
+int mail_storage_get_mailbox_name_status(struct mail_storage *storage,
+ const char *name,
+ enum mailbox_name_status *status);
- /* Close the box. Returns FALSE if some cleanup errors occured, but
- the mailbox was closed anyway. */
- int (*close)(struct mailbox *box);
+/* Returns the error message of last occured error. */
+const char *mail_storage_get_last_error(struct mail_storage *storage,
+ int *syntax_error_r);
- /* Explicitly lock the mailbox. If not used, all the methods below
- use the minimum locking requirements. This allows you to for
- example use the update_flags() method in struct mail. The mailbox
- stays locked until you unlock it. Note that if you call a method
- which wants more locks than you've given here, the call will fail
- (to avoid deadlocks). */
- int (*lock)(struct mailbox *box, enum mailbox_lock_type lock_type);
+/* Open a mailbox. If readonly is TRUE, mailbox must not be
+ modified in any way even when it's asked. If fast is TRUE,
+ any extra time consuming operations shouldn't be performed
+ (eg. when opening mailbox just for STATUS).
- /* Gets the mailbox status information. */
- int (*get_status)(struct mailbox *box, enum mailbox_status_items items,
- struct mailbox_status *status);
+ Note that append and copy may open the selected mailbox again
+ with possibly different readonly-state. */
+struct mailbox *mailbox_open(struct mail_storage *storage,
+ const char *name, enum mailbox_open_flags flags);
+/* Close the box. Returns FALSE if some cleanup errors occured, but
+ the mailbox was closed anyway. */
+int mailbox_close(struct mailbox *box);
- /* Synchronize the mailbox. */
- int (*sync)(struct mailbox *box, enum mailbox_sync_flags flags);
+/* Returns storage of given mailbox */
+struct mail_storage *mailbox_get_storage(struct mailbox *box);
- /* Synchronize mailbox in background. It's done until this function is
- called with flags = MAILBOX_SYNC_NONE. */
- void (*auto_sync)(struct mailbox *box, enum mailbox_sync_flags flags,
- unsigned int min_newmail_notify_interval);
+/* Returns name of given mailbox */
+const char *mailbox_get_name(struct mailbox *box);
- /* Simplified fetching for a single UID or sequence. Must be called
- between fetch_init() .. fetch_deinit() or
- search_init() .. search_deinit() */
- struct mail *(*fetch_uid)(struct mailbox *box, unsigned int uid,
- enum mail_fetch_field wanted_fields);
- struct mail *(*fetch_seq)(struct mailbox *box, unsigned int seq,
- enum mail_fetch_field wanted_fields);
+/* Returns TRUE if mailbox is read-only. */
+int mailbox_is_readonly(struct mailbox *box);
- /* Modify sort_program to specify a sort program acceptable for
- search_init(). If mailbox supports no sorting, it's simply set to
- {MAIL_SORT_END}. */
- int (*search_get_sorting)(struct mailbox *box,
- enum mail_sort_type *sort_program);
- /* Initialize new search request. Search arguments are given so that
- the storage can optimize the searching as it wants.
+/* Returns TRUE if mailbox currently supports adding custom flags. */
+int mailbox_allow_new_custom_flags(struct mailbox *box);
- If sort_program is non-NULL, it requests that the returned messages
- are sorted by the given criteria. sort_program must have gone
- through search_get_sorting().
+/* Gets the mailbox status information. */
+int mailbox_get_status(struct mailbox *box,
+ enum mailbox_status_items items,
+ struct mailbox_status *status);
- wanted_fields and wanted_headers aren't required, but they can be
- used for optimizations. */
- struct mail_search_context *
- (*search_init)(struct mailbox *box, const char *charset,
- struct mail_search_arg *args,
- const enum mail_sort_type *sort_program,
- enum mail_fetch_field wanted_fields,
- const char *const wanted_headers[]);
- /* Deinitialize search request. all_found is set to TRUE if all of the
- messages in search range were found. */
- int (*search_deinit)(struct mail_search_context *ctx, int *all_found);
- /* Search the next message. Returned mail object can be used until
- the next call to search_next() or search_deinit(). */
- struct mail *(*search_next)(struct mail_search_context *ctx);
+/* Synchronize the mailbox. */
+int mailbox_sync(struct mailbox *box, enum mailbox_sync_flags flags);
- /* Initialize saving one or more mails. If transaction is TRUE, all
- the saved mails are deleted if an error occurs or save_deinit()
- is called with rollback TRUE. */
- struct mail_save_context *(*save_init)(struct mailbox *box,
- int transaction);
- /* Deinitialize saving. rollback has effect only if save_init() was
- called with transaction being TRUE. If rollback is FALSE but
- committing the changes fails, all the commits are rollbacked if
- possible. */
- int (*save_deinit)(struct mail_save_context *ctx, int rollback);
- /* Save a mail into mailbox. timezone_offset specifies the timezone in
- minutes in which received_date was originally given with. */
- int (*save_next)(struct mail_save_context *ctx,
- const struct mail_full_flags *flags,
- time_t received_date, int timezone_offset,
- struct istream *data);
+/* Synchronize mailbox in background. It's done until this function is
+ called with flags = MAILBOX_SYNC_AUTO_STOP. */
+void mailbox_auto_sync(struct mailbox *box, enum mailbox_sync_flags flags,
+ unsigned int min_newmail_notify_interval);
- /* Initialize copying operation to this mailbox. The actual copying
- can be done by fetching or searching mails and calling mail's
- copy() method. */
- struct mail_copy_context *(*copy_init)(struct mailbox *box);
- /* Finish copying. */
- int (*copy_deinit)(struct mail_copy_context *ctx, int rollback);
- /* Copy given message. */
- int (*copy)(struct mail *mail, struct mail_copy_context *ctx);
+struct mailbox_transaction_context *
+mailbox_transaction_begin(struct mailbox *box, int hide);
+int mailbox_transaction_commit(struct mailbox_transaction_context *t);
+void mailbox_transaction_rollback(struct mailbox_transaction_context *t);
- /* Initialize expunging operation to this mailbox. If expunge_all
- is TRUE, all messages are returned rather than just deleted. */
- struct mail_expunge_context *
- (*expunge_init)(struct mailbox *box,
- enum mail_fetch_field wanted_fields,
- int expunge_all);
- /* Finish expunging. */
- int (*expunge_deinit)(struct mail_expunge_context *ctx);
- /* Fetch next mail. */
- struct mail *(*expunge_fetch_next)(struct mail_expunge_context *ctx);
+/* Simplified fetching for a single sequence. */
+struct mail *mailbox_fetch(struct mailbox_transaction_context *t, uint32_t seq,
+ enum mail_fetch_field wanted_fields);
- /* 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)(struct mailbox *box);
-};
+/* Convert uid range to sequence range. */
+int mailbox_get_uids(struct mailbox *box, uint32_t uid1, uint32_t uid2,
+ uint32_t *seq1_r, uint32_t *seq2_r);
+
+/* Modify sort_program to specify a sort program acceptable for
+ search_init(). If mailbox supports no sorting, it's simply set to
+ {MAIL_SORT_END}. */
+int mailbox_search_get_sorting(struct mailbox *box,
+ enum mail_sort_type *sort_program);
+/* Initialize new search request. Search arguments are given so that
+ the storage can optimize the searching as it wants.
+
+ If sort_program is non-NULL, it requests that the returned messages
+ are sorted by the given criteria. sort_program must have gone
+ through search_get_sorting().
+
+ wanted_fields and wanted_headers aren't required, but they can be
+ used for optimizations. */
+struct mail_search_context *
+mailbox_search_init(struct mailbox_transaction_context *t,
+ const char *charset, struct mail_search_arg *args,
+ const enum mail_sort_type *sort_program,
+ enum mail_fetch_field wanted_fields,
+ const char *const wanted_headers[]);
+/* Deinitialize search request. */
+int mailbox_search_deinit(struct mail_search_context *ctx);
+/* Search the next message. Returned mail object can be used until
+ the next call to search_next() or search_deinit(). */
+struct mail *mailbox_search_next(struct mail_search_context *ctx);
+
+/* Save a mail into mailbox. timezone_offset specifies the timezone in
+ minutes in which received_date was originally given with. To use
+ current time, set received_date to (time_t)-1. */
+int mailbox_save(struct mailbox_transaction_context *t,
+ const struct mail_full_flags *flags,
+ time_t received_date, int timezone_offset,
+ const char *from_envelope, struct istream *data);
+/* Copy given message. */
+int mailbox_copy(struct mailbox_transaction_context *t, struct mail *mail);
+
+/* 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 mailbox_is_inconsistent(struct mailbox *box);
struct mail {
/* always set */
struct mailbox *box;
- unsigned int seq;
- unsigned int uid;
+ uint32_t seq, uid;
+ unsigned int expunged:1;
unsigned int has_nuls:1; /* message data is known to contain NULs */
unsigned int has_no_nuls:1; /* -''- known to not contain NULs */
@@ -378,116 +389,8 @@
const struct mail_full_flags *flags,
enum modify_type modify_type);
- /* Expunge this message. Note that the actual message may or may not
- be really expunged until expunge_deinit() is called. In any case,
- after this call you must not try to access this mail, or any other
- mail you've previously fetched.
-
- Since you can't be sure when the message is really expunged, you
- can't be sure what it's sequence number is from client's point of
- view. seq_r is set to that sequence number.
-
- This call is allowed only for mails fetched with
- expunge_fetch_next(). Otherwise the sequence number updates would
- get too tricky. */
- int (*expunge)(struct mail *mail, struct mail_expunge_context *ctx,
- unsigned int *seq_r, int notify);
-};
-
-struct mailbox_list {
- const char *name;
- enum mailbox_flags flags;
-};
-
-struct mailbox_status {
- unsigned int messages;
- unsigned int recent;
- unsigned int unseen;
-
- unsigned int uidvalidity;
- unsigned int uidnext;
-
- unsigned int first_unseen_seq;
-
- unsigned int diskspace_full:1;
-
- /* may be allocated from data stack */
- unsigned int custom_flags_count;
- const char **custom_flags;
-};
-
-struct mail_storage_callbacks {
- /* Alert: Not enough disk space */
- void (*alert_no_diskspace)(struct mailbox *mailbox, void *context);
- /* "* OK <text>" */
- void (*notify_ok)(struct mailbox *mailbox, const char *text,
- void *context);
- /* "* NO <text>" */
- void (*notify_no)(struct mailbox *mailbox, const char *text,
- void *context);
-
- /* EXPUNGE */
- void (*expunge)(struct mailbox *mailbox, unsigned int seq,
- void *context);
- /* FETCH FLAGS */
- void (*update_flags)(struct mailbox *mailbox,
- unsigned int seq, unsigned int uid,
- const struct mail_full_flags *flags,
- void *context);
-
- /* EXISTS, RECENT */
- void (*new_messages)(struct mailbox *mailbox,
- unsigned int messages_count,
- unsigned int recent_count, void *context);
- /* FLAGS, PERMANENTFLAGS */
- void (*new_custom_flags)(struct mailbox *mailbox,
- const char *custom_flags[],
- unsigned int custom_flags_count,
- void *context);
-
+ /* Expunge this message. Sequence numbers don't change until commit. */
+ int (*expunge)(struct mail *mail);
};
-extern enum client_workarounds client_workarounds;
-extern int full_filesystem_access;
-
-void mail_storage_init(void);
-void mail_storage_deinit(void);
-
-/* register all mail storages */
-void mail_storage_register_all(void);
-
-/* Register mail storage class with given name - all methods that are NULL
- are set to default methods */
-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. */
-struct mail_storage *
-mail_storage_create(const char *name, const char *data, const char *user,
- const char *namespace, char hierarchy_sep);
-void mail_storage_destroy(struct mail_storage *storage);
-
-struct mail_storage *
-mail_storage_create_default(const char *user,
- const char *namespace, char hierarchy_sep);
-struct mail_storage *
-mail_storage_create_with_data(const char *data, const char *user,
- const char *namespace, char hierarchy_sep);
-
-/* Set error message in storage. Critical errors are logged with i_error(),
- but user sees only "internal error" message. */
-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(struct mail_storage *storage,
- int *syntax);
-
#endif
Index: proxy-mail-storage.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/proxy-mail-storage.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- proxy-mail-storage.c 6 Jan 2004 03:23:56 -0000 1.3
+++ proxy-mail-storage.c 27 Apr 2004 20:25:54 -0000 1.4
@@ -3,11 +3,11 @@
#include "lib.h"
#include "proxy-mail-storage.h"
-static void _free(struct mail_storage *storage)
+static void _destroy(struct mail_storage *storage)
{
struct proxy_mail_storage *s = (struct proxy_mail_storage *) storage;
- s->storage->free(s->storage);
+ return s->storage->destroy(s->storage);
}
static void _set_callbacks(struct mail_storage *storage,
@@ -19,45 +19,45 @@
s->storage->set_callbacks(s->storage, callbacks, context);
}
-static struct mailbox *_open_mailbox(struct mail_storage *storage,
+static struct mailbox *_mailbox_open(struct mail_storage *storage,
const char *name,
enum mailbox_open_flags flags)
{
struct proxy_mail_storage *s = (struct proxy_mail_storage *) storage;
- return s->storage->open_mailbox(s->storage, name, flags);
+ return s->storage->mailbox_open(s->storage, name, flags);
}
-static int _create_mailbox(struct mail_storage *storage, const char *name,
+static int _mailbox_create(struct mail_storage *storage, const char *name,
int only_hierarchy)
{
struct proxy_mail_storage *s = (struct proxy_mail_storage *) storage;
- return s->storage->create_mailbox(s->storage, name, only_hierarchy);
+ return s->storage->mailbox_create(s->storage, name, only_hierarchy);
}
-static int _delete_mailbox(struct mail_storage *storage, const char *name)
+static int _mailbox_delete(struct mail_storage *storage, const char *name)
{
struct proxy_mail_storage *s = (struct proxy_mail_storage *) storage;
- return s->storage->delete_mailbox(s->storage, name);
+ return s->storage->mailbox_delete(s->storage, name);
}
-static int _rename_mailbox(struct mail_storage *storage, const char *oldname,
+static int _mailbox_rename(struct mail_storage *storage, const char *oldname,
const char *newname)
{
struct proxy_mail_storage *s = (struct proxy_mail_storage *) storage;
- return s->storage->rename_mailbox(s->storage, oldname, newname);
+ return s->storage->mailbox_rename(s->storage, oldname, newname);
}
static struct mailbox_list_context *
-_list_mailbox_init(struct mail_storage *storage, const char *mask,
+_mailbox_list_init(struct mail_storage *storage, const char *mask,
enum mailbox_list_flags flags)
{
struct proxy_mail_storage *s = (struct proxy_mail_storage *) storage;
- return s->storage->list_mailbox_init(s->storage, mask, flags);
+ return s->storage->mailbox_list_init(s->storage, mask, flags);
}
static int _set_subscribed(struct mail_storage *storage,
@@ -97,16 +97,16 @@
ps->create = storage->create;
ps->autodetect = storage->autodetect;
- ps->list_mailbox_deinit = storage->list_mailbox_deinit;
- ps->list_mailbox_next = storage->list_mailbox_next;
+ ps->mailbox_list_deinit = storage->mailbox_list_deinit;
+ ps->mailbox_list_next = storage->mailbox_list_next;
- ps->free = _free;
+ ps->destroy = _destroy;
ps->set_callbacks = _set_callbacks;
- ps->open_mailbox = _open_mailbox;
- ps->create_mailbox = _create_mailbox;
- ps->delete_mailbox = _delete_mailbox;
- ps->rename_mailbox = _rename_mailbox;
- ps->list_mailbox_init = _list_mailbox_init;
+ ps->mailbox_open = _mailbox_open;
+ ps->mailbox_create = _mailbox_create;
+ ps->mailbox_delete = _mailbox_delete;
+ ps->mailbox_rename = _mailbox_rename;
+ ps->mailbox_list_init = _mailbox_list_init;
ps->set_subscribed = _set_subscribed;
ps->get_mailbox_name_status = _get_mailbox_name_status;
ps->get_last_error = _get_last_error;
Index: proxy-mail-storage.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/proxy-mail-storage.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- proxy-mail-storage.h 26 Jul 2003 18:23:10 -0000 1.1
+++ proxy-mail-storage.h 27 Apr 2004 20:25:54 -0000 1.2
@@ -1,7 +1,7 @@
#ifndef __PROXY_MAIL_STORAGE_H
#define __PROXY_MAIL_STORAGE_H
-#include "mail-storage.h"
+#include "mail-storage-private.h"
struct proxy_mail_storage {
struct mail_storage proxy_storage;
Index: proxy-mail.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/proxy-mail.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- proxy-mail.c 26 Oct 2003 18:05:42 -0000 1.3
+++ proxy-mail.c 27 Apr 2004 20:25:54 -0000 1.4
@@ -61,7 +61,8 @@
return p->mail->get_special(p->mail, field);
}
-static int _update_flags(struct mail *mail, const struct mail_full_flags *flags,
+static int _update_flags(struct mail *mail,
+ const struct mail_full_flags *flags,
enum modify_type modify_type)
{
struct proxy_mail *p = (struct proxy_mail *) mail;
@@ -69,12 +70,11 @@
return p->mail->update_flags(p->mail, flags, modify_type);
}
-static int _expunge(struct mail *mail, struct mail_expunge_context *ctx,
- unsigned int *seq_r, int notify)
+static int _expunge(struct mail *mail)
{
struct proxy_mail *p = (struct proxy_mail *) mail;
- return p->mail->expunge(p->mail, ctx, seq_r, notify);
+ return p->mail->expunge(p->mail);
}
void proxy_mail_init(struct proxy_mail *proxy, struct mail *mail)
Index: proxy-mailbox.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/proxy-mailbox.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- proxy-mailbox.c 26 Oct 2003 20:13:15 -0000 1.4
+++ proxy-mailbox.c 27 Apr 2004 20:25:54 -0000 1.5
@@ -3,6 +3,7 @@
#include "lib.h"
#include "proxy-mailbox.h"
+#if 0
static int _is_readonly(struct mailbox *box)
{
struct proxy_mailbox *p = (struct proxy_mailbox *) box;
@@ -24,13 +25,6 @@
return p->box->close(p->box);
}
-static int _lock(struct mailbox *box, enum mailbox_lock_type lock_type)
-{
- struct proxy_mailbox *p = (struct proxy_mailbox *) box;
-
- return p->box->lock(p->box, lock_type);
-}
-
static int _get_status(struct mailbox *box, enum mailbox_status_items items,
struct mailbox_status *status)
{
@@ -54,20 +48,21 @@
p->box->auto_sync(p->box, flags, min_newmail_notify_interval);
}
-static struct mail *_fetch_uid(struct mailbox *box, unsigned int uid,
- enum mail_fetch_field wanted_fields)
+static struct mail *_fetch(struct mailbox_transaction_context *t, uint32_t seq,
+ enum mail_fetch_field wanted_fields)
{
- struct proxy_mailbox *p = (struct proxy_mailbox *) box;
+ struct proxy_mailbox *p = (struct proxy_mailbox *) t->box;
- return p->box->fetch_uid(p->box, uid, wanted_fields);
+ return box->fetch(t, seq, wanted_fields);
}
-static struct mail *_fetch_seq(struct mailbox *box, unsigned int seq,
- enum mail_fetch_field wanted_fields)
+static int _get_uids(struct mailbox_transaction_context *t,
+ uint32_t uid1, uint32_t uid2,
+ uint32_t *seq1_r, uint32_t *seq2_r)
{
- struct proxy_mailbox *p = (struct proxy_mailbox *) box;
+ struct proxy_mailbox *p = (struct proxy_mailbox *) t->box;
- return p->box->fetch_uid(p->box, seq, wanted_fields);
+ return p->box->get_uids(p->box, uid1, uid2, seq1_r, seq2_r);
}
static int _search_get_sorting(struct mailbox *box,
@@ -91,35 +86,19 @@
wanted_fields, wanted_headers);
}
-static struct mail_save_context *
-_save_init(struct mailbox *box, int transaction)
-{
- struct proxy_mailbox *p = (struct proxy_mailbox *) box;
-
- return p->box->save_init(p->box, transaction);
-}
-
-static struct mail_copy_context *_copy_init(struct mailbox *box)
-{
- struct proxy_mailbox *p = (struct proxy_mailbox *) box;
-
- return p->box->copy_init(p->box);
-}
-
-static struct mail_expunge_context *
-_expunge_init(struct mailbox *box, enum mail_fetch_field wanted_fields,
- int expunge_all)
+static struct mailbox_transaction_context *
+_transaction_begin(struct mailbox *box)
{
struct proxy_mailbox *p = (struct proxy_mailbox *) box;
- return p->box->expunge_init(p->box, wanted_fields, expunge_all);
+ return p->box->transaction_begin(p->box);
}
-static int _is_inconsistency_error(struct mailbox *box)
+static int _is_inconsistent(struct mailbox *box)
{
struct proxy_mailbox *p = (struct proxy_mailbox *) box;
- return p->box->is_inconsistency_error(p->box);
+ return p->box->is_inconsistent(p->box);
}
void proxy_mailbox_init(struct proxy_mailbox *proxy, struct mailbox *box)
@@ -131,27 +110,27 @@
pb->name = box->name;
pb->storage = box->storage;
- pb->search_deinit = box->search_deinit;
- pb->search_next = box->search_next;
- pb->save_deinit = box->save_deinit;
- pb->save_next = box->save_next;
- pb->copy_deinit = box->copy_deinit;
- pb->expunge_deinit = box->expunge_deinit;
- pb->expunge_fetch_next = box->expunge_fetch_next;
-
pb->is_readonly = _is_readonly;
pb->allow_new_custom_flags = _allow_new_custom_flags;
pb->close = _close;
- pb->lock = _lock;
pb->get_status = _get_status;
pb->sync = _sync;
pb->auto_sync = _auto_sync;
- pb->fetch_uid = _fetch_uid;
- pb->fetch_seq = _fetch_seq;
+ pb->fetch = box->fetch;
+ pb->get_uids = box->get_uids;
+
pb->search_get_sorting = _search_get_sorting;
- pb->search_init = _search_init;
- pb->save_init = _save_init;
- pb->copy_init = _copy_init;
- pb->expunge_init = _expunge_init;
- pb->is_inconsistency_error = _is_inconsistency_error;
+ pb->search_init = box->search_init;
+ pb->search_next = box->search_next;
+ pb->search_deinit = box->search_deinit;
+
+ pb->transaction_begin = _transaction_begin;
+ pb->transaction_commit = box->transaction_commit;
+ pb->transaction_rollback = box->transaction_rollback;
+
+ pb->save = box->save;
+ pb->copy = box->copy;
+
+ pb->is_inconsistent = _is_inconsistent;
}
+#endif
Index: proxy-mailbox.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/proxy-mailbox.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- proxy-mailbox.h 26 Jul 2003 18:23:10 -0000 1.1
+++ proxy-mailbox.h 27 Apr 2004 20:25:54 -0000 1.2
@@ -1,7 +1,7 @@
#ifndef __PROXY_MAILBOX_H
#define __PROXY_MAILBOX_H
-#include "mail-storage.h"
+#include "mail-storage-private.h"
struct proxy_mailbox {
struct mailbox proxy_box;
- Previous message: [dovecot-cvs]
dovecot/src/lib-storage/index/mbox istream-raw-mbox.c, NONE,
1.1 istream-raw-mbox.h, NONE, 1.1 mbox-from.c, NONE,
1.1 mbox-from.h, NONE, 1.1 mbox-sync-header.c, NONE,
1.1 mbox-sync-parse.c, NONE, 1.1 mbox-sync-private.h, NONE,
1.1 mbox-sync-rewrite.c, NONE, 1.1 mbox-sync-update.c, NONE,
1.1 mbox-sync.c, NONE, 1.1 Makefile.am, 1.1.1.1,
1.2 mbox-expunge.c, 1.33, 1.34 mbox-list.c, 1.22,
1.23 mbox-save.c, 1.45, 1.46
- Next message: [dovecot-cvs] dovecot configure.in,1.152,1.153
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list