[dovecot-cvs] dovecot/src/lib-storage/index index-copy.c,1.23,1.24 index-expunge.c,1.13,1.14 index-fetch-section.c,1.29,1.30 index-fetch.c,1.38,1.39 index-fetch.h,1.13,1.14 index-mailbox-check.c,1.1,1.2 index-messageset.c,1.9,1.10 index-messageset.h,1.3,1.4 Message-Id: <20030105130956.6E41C23995@danu.procontrol.fi>
cras at procontrol.fi
cras at procontrol.fi
Sun Jan 5 15:09:56 EET 2003
- Previous message: [dovecot-cvs] dovecot/src/lib-index/mbox mbox-append.c,1.36,1.37 mbox-from.c,1.9,1.10 mbox-index.c,1.58,1.59 mbox-index.h,1.22,1.23 mbox-lock.c,1.21,1.22 mbox-lock.h,1.4,1.5 mbox-open.c,1.19,1.20 mbox-rebuild.c,1.21,1.22 mbox-rewrite.c,1.49,1.50 Message-Id: <20030105130956.46D5023994@danu.procontrol.fi>
- Next message: [dovecot-cvs] dovecot/src/lib-mail message-address.c,NONE,1.1 message-address.h,NONE,1.1 message-date.c,NONE,1.1 message-date.h,NONE,1.1 message-tokenize.c,NONE,1.1 message-tokenize.h,NONE,1.1 Makefile.am,1.6,1.7 message-body-search.c,1.8,1.9 Message-Id: <20030105130956.8F2DA23997@danu.procontrol.fi>
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/dovecot/src/lib-storage/index
In directory danu:/tmp/cvs-serv25916/src/lib-storage/index
Modified Files:
index-copy.c index-expunge.c index-fetch-section.c
index-fetch.c index-fetch.h index-mailbox-check.c
index-messageset.c index-messageset.h index-msgcache.c
index-save.c index-search.c index-sort.c index-sort.h
index-status.c index-storage.c index-storage.h index-sync.c
index-update-flags.c
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: index-copy.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-copy.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- index-copy.c 6 Dec 2002 01:09:23 -0000 1.23
+++ index-copy.c 5 Jan 2003 13:09:52 -0000 1.24
@@ -8,19 +8,19 @@
#include <unistd.h>
-typedef struct {
- Mailbox *dest;
+struct copy_context {
+ struct mailbox *dest;
const char **custom_flags;
int copy_inside_mailbox;
-} CopyContext;
+};
-static int copy_func(MailIndex *index, MailIndexRecord *rec,
+static int copy_func(struct mail_index *index, struct mail_index_record *rec,
unsigned int client_seq __attr_unused__,
unsigned int idx_seq __attr_unused__, void *context)
{
- CopyContext *ctx = context;
- IndexMailbox *dest_ibox = NULL;
- IStream *input;
+ struct copy_context *ctx = context;
+ struct index_mailbox *dest_ibox = NULL;
+ struct istream *input;
time_t internal_date;
int failed, deleted;
@@ -30,7 +30,7 @@
if (ctx->copy_inside_mailbox) {
/* kludgy.. */
- dest_ibox = (IndexMailbox *) ctx->dest;
+ dest_ibox = (struct index_mailbox *) ctx->dest;
dest_ibox->delay_save_unlocking = TRUE;
}
@@ -46,12 +46,12 @@
return !failed;
}
-int index_storage_copy(Mailbox *box, Mailbox *destbox,
+int index_storage_copy(struct mailbox *box, struct mailbox *destbox,
const char *messageset, int uidset)
{
- IndexMailbox *ibox = (IndexMailbox *) box;
- CopyContext ctx;
- MailLockType lock_type;
+ struct index_mailbox *ibox = (struct index_mailbox *) box;
+ struct copy_context ctx;
+ enum mail_lock_type lock_type;
int failed;
if (destbox->readonly) {
Index: index-expunge.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-expunge.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- index-expunge.c 25 Nov 2002 19:02:50 -0000 1.13
+++ index-expunge.c 5 Jan 2003 13:09:52 -0000 1.14
@@ -3,10 +3,10 @@
#include "lib.h"
#include "index-storage.h"
-int index_expunge_seek_first(IndexMailbox *ibox, unsigned int *seq,
- MailIndexRecord **rec)
+int index_expunge_seek_first(struct index_mailbox *ibox, unsigned int *seq,
+ struct mail_index_record **rec)
{
- MailIndexHeader *hdr;
+ struct mail_index_header *hdr;
i_assert(ibox->index->lock_type == MAIL_LOCK_EXCLUSIVE);
@@ -43,7 +43,8 @@
return TRUE;
}
-int index_expunge_mail(IndexMailbox *ibox, MailIndexRecord *rec,
+int index_expunge_mail(struct index_mailbox *ibox,
+ struct mail_index_record *rec,
unsigned int seq, int notify)
{
if (!ibox->index->expunge(ibox->index, rec, seq, FALSE))
@@ -51,7 +52,7 @@
if (seq <= ibox->synced_messages_count) {
if (notify) {
- MailStorage *storage = ibox->box.storage;
+ struct mail_storage *storage = ibox->box.storage;
storage->callbacks->expunge(&ibox->box, seq,
storage->callback_context);
}
@@ -61,9 +62,9 @@
return TRUE;
}
-int index_storage_expunge(Mailbox *box, int notify)
+int index_storage_expunge(struct mailbox *box, int notify)
{
- IndexMailbox *ibox = (IndexMailbox *) box;
+ struct index_mailbox *ibox = (struct index_mailbox *) box;
int failed;
if (box->readonly) {
Index: index-fetch-section.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-fetch-section.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- index-fetch-section.c 4 Jan 2003 17:34:02 -0000 1.29
+++ index-fetch-section.c 5 Jan 2003 13:09:52 -0000 1.30
@@ -11,15 +11,15 @@
#include <ctype.h>
#include <unistd.h>
-typedef struct {
- String *dest;
- OStream *output;
+struct fetch_header_field_context {
+ string_t *dest;
+ struct ostream *output;
uoff_t dest_size;
uoff_t skip, max_size;
const char *const *fields;
int (*match_func) (const char *const *, const unsigned char *, size_t);
-} FetchHeaderFieldContext;
+};
/* For FETCH[HEADER.FIELDS*] we need to modify the header data before sending
it. We can either save it in memory and then send it, or we can parse it
@@ -30,7 +30,7 @@
#define UNSIGNED_CRLF (const unsigned char *) "\r\n"
-ImapCacheField index_fetch_body_get_cache(const char *section)
+enum imap_cache_field index_fetch_body_get_cache(const char *section)
{
if (*section >= '0' && *section <= '9')
return IMAP_CACHE_MESSAGE_PART | IMAP_CACHE_MESSAGE_OPEN;
@@ -50,11 +50,13 @@
}
/* fetch BODY[] or BODY[TEXT] */
-static int fetch_body(MailIndexRecord *rec, MailFetchBodyData *sect,
- FetchContext *ctx, const char *prefix, int fetch_header)
+static int fetch_body(struct mail_index_record *rec,
+ struct mail_fetch_body_data *sect,
+ struct fetch_context *ctx,
+ const char *prefix, int fetch_header)
{
- MessageSize size;
- IStream *input;
+ struct message_size size;
+ struct istream *input;
const char *str;
int cr_skipped;
@@ -151,7 +153,7 @@
return FALSE;
}
-static int fetch_header_append(FetchHeaderFieldContext *ctx,
+static int fetch_header_append(struct fetch_header_field_context *ctx,
const unsigned char *str, size_t size)
{
if (ctx->skip > 0) {
@@ -181,13 +183,13 @@
return ctx->dest_size < ctx->max_size;
}
-static void fetch_header_field(MessagePart *part __attr_unused__,
+static void fetch_header_field(struct message_part *part __attr_unused__,
const unsigned char *name, size_t name_len,
const unsigned char *value __attr_unused__,
size_t value_len __attr_unused__,
void *context)
{
- FetchHeaderFieldContext *ctx = context;
+ struct fetch_header_field_context *ctx = context;
const unsigned char *field_start, *field_end, *cr, *p;
/* see if we want this field. */
@@ -225,8 +227,8 @@
(void)fetch_header_append(ctx, UNSIGNED_CRLF, 2);
}
-static int fetch_header_fields(IStream *input, const char *section,
- FetchHeaderFieldContext *ctx)
+static int fetch_header_fields(struct istream *input, const char *section,
+ struct fetch_header_field_context *ctx)
{
if (strncasecmp(section, "HEADER.FIELDS ", 14) == 0) {
ctx->fields = get_fields_array(section + 14);
@@ -257,11 +259,12 @@
}
/* fetch wanted headers from given data */
-static int fetch_header_from(IStream *input, OStream *output,
- const char *prefix, MessageSize *size,
- const char *section, MailFetchBodyData *sect)
+static int fetch_header_from(struct istream *input, struct ostream *output,
+ const char *prefix, struct message_size *size,
+ const char *section,
+ struct mail_fetch_body_data *sect)
{
- FetchHeaderFieldContext ctx;
+ struct fetch_header_field_context ctx;
const char *str;
uoff_t start_offset;
int failed;
@@ -337,11 +340,11 @@
}
/* fetch BODY[HEADER...] */
-static int fetch_header(MailFetchBodyData *sect, FetchContext *ctx,
- const char *prefix)
+static int fetch_header(struct mail_fetch_body_data *sect,
+ struct fetch_context *ctx, const char *prefix)
{
- MessageSize hdr_size;
- IStream *input;
+ struct message_size hdr_size;
+ struct istream *input;
if (!imap_msgcache_get_rfc822(ctx->cache, &input, &hdr_size, NULL))
return FALSE;
@@ -350,11 +353,12 @@
sect->section, sect);
}
-/* Find MessagePart for section (eg. 1.3.4) */
-static MessagePart *part_find(MailFetchBodyData *sect, FetchContext *ctx,
- const char **section)
+/* Find message_part for section (eg. 1.3.4) */
+static struct message_part *
+part_find(struct mail_fetch_body_data *sect, struct fetch_context *ctx,
+ const char **section)
{
- MessagePart *part;
+ struct message_part *part;
const char *path;
unsigned int num;
@@ -397,10 +401,11 @@
}
/* fetch BODY[1.2] or BODY[1.2.TEXT] */
-static int fetch_part_body(MessagePart *part, MailFetchBodyData *sect,
- FetchContext *ctx, const char *prefix)
+static int fetch_part_body(struct message_part *part,
+ struct mail_fetch_body_data *sect,
+ struct fetch_context *ctx, const char *prefix)
{
- IStream *input;
+ struct istream *input;
const char *str;
uoff_t skip_pos;
@@ -423,11 +428,11 @@
}
/* fetch BODY[1.2.MIME|HEADER...] */
-static int fetch_part_header(MessagePart *part, const char *section,
- MailFetchBodyData *sect, FetchContext *ctx,
- const char *prefix)
+static int fetch_part_header(struct message_part *part, const char *section,
+ struct mail_fetch_body_data *sect,
+ struct fetch_context *ctx, const char *prefix)
{
- IStream *input;
+ struct istream *input;
if (!imap_msgcache_get_data(ctx->cache, &input))
return FALSE;
@@ -437,10 +442,10 @@
section, sect);
}
-static int fetch_part(MailFetchBodyData *sect, FetchContext *ctx,
- const char *prefix)
+static int fetch_part(struct mail_fetch_body_data *sect,
+ struct fetch_context *ctx, const char *prefix)
{
- MessagePart *part;
+ struct message_part *part;
const char *section;
part = part_find(sect, ctx, §ion);
@@ -458,8 +463,9 @@
return FALSE;
}
-int index_fetch_body_section(MailIndexRecord *rec, MailFetchBodyData *sect,
- FetchContext *ctx)
+int index_fetch_body_section(struct mail_index_record *rec,
+ struct mail_fetch_body_data *sect,
+ struct fetch_context *ctx)
{
const char *prefix;
Index: index-fetch.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-fetch.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- index-fetch.c 22 Dec 2002 07:50:49 -0000 1.38
+++ index-fetch.c 5 Jan 2003 13:09:52 -0000 1.39
@@ -14,7 +14,8 @@
#include <unistd.h>
-static int index_fetch_internaldate(MailIndexRecord *rec, FetchContext *ctx)
+static int index_fetch_internaldate(struct mail_index_record *rec,
+ struct fetch_context *ctx)
{
time_t date;
@@ -31,7 +32,8 @@
}
}
-static int index_fetch_body(MailIndexRecord *rec, FetchContext *ctx)
+static int index_fetch_body(struct mail_index_record *rec,
+ struct fetch_context *ctx)
{
const char *body;
@@ -47,7 +49,8 @@
}
}
-static int index_fetch_bodystructure(MailIndexRecord *rec, FetchContext *ctx)
+static int index_fetch_bodystructure(struct mail_index_record *rec,
+ struct fetch_context *ctx)
{
const char *bodystructure;
@@ -63,7 +66,8 @@
}
}
-static int index_fetch_envelope(MailIndexRecord *rec, FetchContext *ctx)
+static int index_fetch_envelope(struct mail_index_record *rec,
+ struct fetch_context *ctx)
{
const char *envelope;
@@ -79,7 +83,8 @@
}
}
-static int index_fetch_rfc822_size(MailIndexRecord *rec, FetchContext *ctx)
+static int index_fetch_rfc822_size(struct mail_index_record *rec,
+ struct fetch_context *ctx)
{
uoff_t size;
@@ -95,9 +100,10 @@
return TRUE;
}
-static void index_fetch_flags(MailIndexRecord *rec, FetchContext *ctx)
+static void index_fetch_flags(struct mail_index_record *rec,
+ struct fetch_context *ctx)
{
- MailFlags flags;
+ enum mail_flags flags;
flags = rec->msg_flags;
if (rec->uid >= ctx->index->first_recent_uid)
@@ -110,15 +116,17 @@
ctx->custom_flags_count));
}
-static void index_fetch_uid(MailIndexRecord *rec, FetchContext *ctx)
+static void index_fetch_uid(struct mail_index_record *rec,
+ struct fetch_context *ctx)
{
str_printfa(ctx->str, "UID %u ", rec->uid);
}
-static int index_fetch_send_rfc822(MailIndexRecord *rec, FetchContext *ctx)
+static int index_fetch_send_rfc822(struct mail_index_record *rec,
+ struct fetch_context *ctx)
{
- MessageSize hdr_size, body_size;
- IStream *input;
+ struct message_size hdr_size, body_size;
+ struct istream *input;
const char *str;
if (!imap_msgcache_get_rfc822(ctx->cache, &input,
@@ -142,11 +150,11 @@
return message_send(ctx->output, input, &body_size, 0, (uoff_t)-1);
}
-static int index_fetch_send_rfc822_header(MailIndexRecord *rec,
- FetchContext *ctx)
+static int index_fetch_send_rfc822_header(struct mail_index_record *rec,
+ struct fetch_context *ctx)
{
- MessageSize hdr_size;
- IStream *input;
+ struct message_size hdr_size;
+ struct istream *input;
const char *str;
if (!imap_msgcache_get_rfc822(ctx->cache, &input, &hdr_size, NULL)) {
@@ -167,10 +175,11 @@
return message_send(ctx->output, input, &hdr_size, 0, (uoff_t)-1);
}
-static int index_fetch_send_rfc822_text(MailIndexRecord *rec, FetchContext *ctx)
+static int index_fetch_send_rfc822_text(struct mail_index_record *rec,
+ struct fetch_context *ctx)
{
- MessageSize body_size;
- IStream *input;
+ struct message_size body_size;
+ struct istream *input;
const char *str;
if (!imap_msgcache_get_rfc822(ctx->cache, &input, NULL, &body_size)) {
@@ -191,10 +200,10 @@
return message_send(ctx->output, input, &body_size, 0, (uoff_t)-1);
}
-static ImapCacheField index_get_cache(MailFetchData *fetch_data)
+static enum imap_cache_field index_get_cache(struct mail_fetch_data *fetch_data)
{
- MailFetchBodyData *sect;
- ImapCacheField field;
+ struct mail_fetch_body_data *sect;
+ enum imap_cache_field field;
field = 0;
if (fetch_data->body)
@@ -224,9 +233,10 @@
return field;
}
-static int fetch_msgcache_open(FetchContext *ctx, MailIndexRecord *rec)
+static int fetch_msgcache_open(struct fetch_context *ctx,
+ struct mail_index_record *rec)
{
- ImapCacheField fields;
+ enum imap_cache_field fields;
fields = index_get_cache(ctx->fetch_data);
if (fields == 0)
@@ -235,14 +245,13 @@
return index_msgcache_open(ctx->cache, ctx->index, rec, fields);
}
-static int index_fetch_mail(MailIndex *index __attr_unused__,
- MailIndexRecord *rec,
- unsigned int client_seq,
- unsigned int idx_seq,
+static int index_fetch_mail(struct mail_index *index __attr_unused__,
+ struct mail_index_record *rec,
+ unsigned int client_seq, unsigned int idx_seq,
void *context)
{
- FetchContext *ctx = context;
- MailFetchBodyData *sect;
+ struct fetch_context *ctx = context;
+ struct mail_fetch_body_data *sect;
size_t len, orig_len;
int failed, data_written, fetch_flags;
@@ -339,12 +348,12 @@
return !failed;
}
-int index_storage_fetch(Mailbox *box, MailFetchData *fetch_data,
- OStream *output, int *all_found)
+int index_storage_fetch(struct mailbox *box, struct mail_fetch_data *fetch_data,
+ struct ostream *output, int *all_found)
{
- IndexMailbox *ibox = (IndexMailbox *) box;
- FetchContext ctx;
- MailFetchBodyData *sect;
+ struct index_mailbox *ibox = (struct index_mailbox *) box;
+ struct fetch_context ctx;
+ struct mail_fetch_body_data *sect;
int ret;
memset(&ctx, 0, sizeof(ctx));
Index: index-fetch.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-fetch.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- index-fetch.h 21 Dec 2002 22:02:58 -0000 1.13
+++ index-fetch.h 5 Jan 2003 13:09:52 -0000 1.14
@@ -1,24 +1,25 @@
#ifndef __INDEX_FETCH_H
#define __INDEX_FETCH_H
-typedef struct {
- Mailbox *box;
- MailStorage *storage;
- ImapMessageCache *cache;
- MailIndex *index;
+struct fetch_context {
+ struct mailbox *box;
+ struct mail_storage *storage;
+ struct imap_message_cache *cache;
+ struct mail_index *index;
const char **custom_flags;
unsigned int custom_flags_count;
- MailFetchData *fetch_data;
- OStream *output;
- String *str;
+ struct mail_fetch_data *fetch_data;
+ struct ostream *output;
+ string_t *str;
int update_seen, failed;
int first;
-} FetchContext;
+};
-ImapCacheField index_fetch_body_get_cache(const char *section);
-int index_fetch_body_section(MailIndexRecord *rec, MailFetchBodyData *sect,
- FetchContext *ctx);
+enum imap_cache_field index_fetch_body_get_cache(const char *section);
+int index_fetch_body_section(struct mail_index_record *rec,
+ struct mail_fetch_body_data *sect,
+ struct fetch_context *ctx);
#endif
Index: index-mailbox-check.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-mailbox-check.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- index-mailbox-check.c 12 Nov 2002 05:27:30 -0000 1.1
+++ index-mailbox-check.c 5 Jan 2003 13:09:52 -0000 1.2
@@ -9,9 +9,10 @@
static int check_interval = -1;
-static void check_timeout(void *context, Timeout timeout __attr_unused__)
+static void check_timeout(void *context,
+ struct timeout *timeout __attr_unused__)
{
- IndexMailbox *ibox = context;
+ struct index_mailbox *ibox = context;
struct stat st;
if (ioloop_time - ibox->last_check < check_interval)
@@ -25,7 +26,7 @@
}
}
-void index_mailbox_check_add(IndexMailbox *ibox, const char *path)
+void index_mailbox_check_add(struct index_mailbox *ibox, const char *path)
{
const char *str;
struct stat st;
@@ -45,7 +46,7 @@
ibox->check_to = timeout_add(1000, check_timeout, ibox);
}
-void index_mailbox_check_remove(IndexMailbox *ibox)
+void index_mailbox_check_remove(struct index_mailbox *ibox)
{
if (ibox->check_to != NULL)
timeout_remove(ibox->check_to);
Index: index-messageset.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-messageset.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- index-messageset.c 2 Jan 2003 10:21:41 -0000 1.9
+++ index-messageset.c 5 Jan 2003 13:09:52 -0000 1.10
@@ -22,12 +22,12 @@
return num;
}
-static int mail_index_foreach(MailIndex *index,
+static int mail_index_foreach(struct mail_index *index,
unsigned int seq, unsigned int seq2,
MsgsetForeachFunc func, void *context)
{
- MailIndexRecord *rec;
- const ModifyLogExpunge *expunges;
+ struct mail_index_record *rec;
+ const struct modify_log_expunge *expunges;
unsigned int idx_seq, expunges_before, temp;
int expunges_found;
@@ -90,7 +90,7 @@
return !expunges_found && seq > seq2 ? 1 : 2;
}
-static int mail_index_messageset_foreach(MailIndex *index,
+static int mail_index_messageset_foreach(struct mail_index *index,
const char *messageset,
unsigned int messages_count,
MsgsetForeachFunc func, void *context,
@@ -175,12 +175,12 @@
return all_found ? 1 : 2;
}
-static int mail_index_uid_foreach(MailIndex *index,
+static int mail_index_uid_foreach(struct mail_index *index,
unsigned int uid, unsigned int uid2,
MsgsetForeachFunc func, void *context)
{
- MailIndexRecord *rec;
- const ModifyLogExpunge *expunges;
+ struct mail_index_record *rec;
+ const struct modify_log_expunge *expunges;
unsigned int client_seq, idx_seq, expunges_before, temp;
int expunges_found;
@@ -234,12 +234,13 @@
return expunges_found ? 2 : 1;
}
-static int mail_index_uidset_foreach(MailIndex *index, const char *uidset,
+static int mail_index_uidset_foreach(struct mail_index *index,
+ const char *uidset,
unsigned int messages_count,
MsgsetForeachFunc func, void *context,
const char **error)
{
- MailIndexRecord *rec;
+ struct mail_index_record *rec;
const char *input;
unsigned int uid, uid2;
int ret, all_found;
@@ -309,7 +310,7 @@
return all_found ? 1 : 2;
}
-int index_messageset_foreach(IndexMailbox *ibox,
+int index_messageset_foreach(struct index_mailbox *ibox,
const char *messageset, int uidset,
MsgsetForeachFunc func, void *context)
{
Index: index-messageset.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-messageset.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- index-messageset.h 29 Sep 2002 16:19:53 -0000 1.3
+++ index-messageset.h 5 Jan 2003 13:09:52 -0000 1.4
@@ -4,14 +4,15 @@
#include "index-storage.h"
/* If FALSE is returned, the loop is stopped. */
-typedef int (*MsgsetForeachFunc)(MailIndex *index, MailIndexRecord *rec,
+typedef int (*MsgsetForeachFunc)(struct mail_index *index,
+ struct mail_index_record *rec,
unsigned int client_seq, unsigned int idx_seq,
void *context);
/* Returns 1 if all were found, 2 if some messages were deleted,
0 func returned FALSE, -1 if internal error occured or -2 if messageset
was invalid. */
-int index_messageset_foreach(IndexMailbox *ibox,
+int index_messageset_foreach(struct index_mailbox *ibox,
const char *messageset, int uidset,
MsgsetForeachFunc func, void *context);
Index: index-msgcache.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-msgcache.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- index-msgcache.c 6 Dec 2002 01:09:23 -0000 1.13
+++ index-msgcache.c 5 Jan 2003 13:09:52 -0000 1.14
@@ -11,21 +11,22 @@
#include <unistd.h>
-typedef struct {
- MailIndex *index;
- MailIndexRecord *rec;
+struct index_msgcache_context {
+ struct mail_index *index;
+ struct mail_index_record *rec;
time_t internal_date;
-} IndexMsgcacheContext;
+};
-int index_msgcache_open(ImapMessageCache *cache, MailIndex *index,
- MailIndexRecord *rec, ImapCacheField fields)
+int index_msgcache_open(struct imap_message_cache *cache,
+ struct mail_index *index, struct mail_index_record *rec,
+ enum imap_cache_field fields)
{
- IndexMsgcacheContext *ctx;
+ struct index_msgcache_context *ctx;
uoff_t vp_header_size, vp_body_size, full_virtual_size;
const uoff_t *uoff_p;
size_t size;
- ctx = t_new(IndexMsgcacheContext, 1);
+ ctx = t_new(struct index_msgcache_context, 1);
ctx->index = index;
ctx->rec = rec;
ctx->internal_date = (time_t)-1;
@@ -71,27 +72,28 @@
full_virtual_size, ctx);
}
-static IStream *index_msgcache_open_mail(void *context)
+static struct istream *index_msgcache_open_mail(void *context)
{
- IndexMsgcacheContext *ctx = context;
+ struct index_msgcache_context *ctx = context;
int deleted;
return ctx->index->open_mail(ctx->index, ctx->rec,
&ctx->internal_date, &deleted);
}
-static IStream *index_msgcache_stream_rewind(IStream *input,
- void *context __attr_unused__)
+static struct istream *
+index_msgcache_stream_rewind(struct istream *input,
+ void *context __attr_unused__)
{
i_stream_seek(input, 0);
return input;
}
-static const char *index_msgcache_get_cached_field(ImapCacheField field,
- void *context)
+static const char *
+index_msgcache_get_cached_field(enum imap_cache_field field, void *context)
{
- IndexMsgcacheContext *ctx = context;
- MailDataField data_field;
+ struct index_msgcache_context *ctx = context;
+ enum mail_data_field data_field;
const time_t *time_p;
const char *ret;
size_t size;
@@ -131,10 +133,11 @@
return ret;
}
-static MessagePart *index_msgcache_get_cached_parts(Pool pool, void *context)
+static struct message_part *
+index_msgcache_get_cached_parts(pool_t pool, void *context)
{
- IndexMsgcacheContext *ctx = context;
- MessagePart *part;
+ struct index_msgcache_context *ctx = context;
+ struct message_part *part;
const void *part_data;
size_t part_size;
@@ -150,7 +153,7 @@
part = message_part_deserialize(pool, part_data, part_size);
if (part == NULL) {
index_set_corrupted(ctx->index,
- "Corrupted cached MessagePart data");
+ "Corrupted cached message_part data");
return NULL;
}
@@ -159,7 +162,7 @@
static time_t index_msgcache_get_internal_date(void *context)
{
- IndexMsgcacheContext *ctx = context;
+ struct index_msgcache_context *ctx = context;
if (ctx->internal_date != (time_t)-1)
return ctx->internal_date;
@@ -167,7 +170,7 @@
return ctx->index->get_internal_date(ctx->index, ctx->rec);
}
-ImapMessageCacheIface index_msgcache_iface = {
+struct imap_message_cache_iface index_msgcache_iface = {
index_msgcache_open_mail,
index_msgcache_stream_rewind,
index_msgcache_get_cached_field,
Index: index-save.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-save.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- index-save.c 6 Dec 2002 01:09:23 -0000 1.22
+++ index-save.c 5 Jan 2003 13:09:52 -0000 1.23
@@ -9,7 +9,7 @@
#include <stdlib.h>
#include <unistd.h>
-static int write_with_crlf(OStream *output, const unsigned char *data,
+static int write_with_crlf(struct ostream *output, const unsigned char *data,
size_t size)
{
size_t i, start;
@@ -40,7 +40,7 @@
return size;
}
-static int write_with_lf(OStream *output, const unsigned char *data,
+static int write_with_lf(struct ostream *output, const unsigned char *data,
size_t size)
{
size_t i, start;
@@ -70,10 +70,11 @@
return size;
}
-int index_storage_save(MailStorage *storage, const char *path,
- IStream *input, OStream *output, uoff_t data_size)
+int index_storage_save(struct mail_storage *storage, const char *path,
+ struct istream *input, struct ostream *output,
+ uoff_t data_size)
{
- int (*write_func)(OStream *, const unsigned char *, size_t);
+ int (*write_func)(struct ostream *, const unsigned char *, size_t);
const unsigned char *data;
size_t size;
ssize_t ret;
Index: index-search.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-search.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- index-search.c 4 Jan 2003 17:26:30 -0000 1.57
+++ index-search.c 5 Jan 2003 13:09:52 -0000 1.58
@@ -4,7 +4,7 @@
#include "istream.h"
#include "ostream.h"
#include "mmap-util.h"
-#include "rfc822-date.h"
+#include "message-date.h"
#include "message-size.h"
#include "message-body-search.h"
#include "message-header-search.h"
@@ -28,32 +28,32 @@
#define TXT_UNKNOWN_CHARSET "[BADCHARSET] Unknown charset"
#define TXT_INVALID_SEARCH_KEY "Invalid search key"
-typedef struct {
- Pool hdr_pool;
- IndexMailbox *ibox;
- MailIndexRecord *rec;
+struct search_index_context {
+ pool_t hdr_pool;
+ struct index_mailbox *ibox;
+ struct mail_index_record *rec;
unsigned int client_seq;
int cached;
const char *charset;
const char *error;
-} SearchIndexContext;
+};
-typedef struct {
- SearchIndexContext *index_context;
- MailSearchArg *args;
+struct search_header_context {
+ struct search_index_context *index_context;
+ struct mail_search_arg *args;
int custom_header;
const unsigned char *name, *value;
size_t name_len, value_len;
-} SearchHeaderContext;
+};
-typedef struct {
- SearchIndexContext *index_ctx;
- IStream *input;
- MessagePart *part;
-} SearchBodyContext;
+struct search_body_context {
+ struct search_index_context *index_ctx;
+ struct istream *input;
+ struct message_part *part;
+};
-static MailSortType sort_unsorted[] = { MAIL_SORT_END };
+static enum mail_sort_type sort_unsorted[] = { MAIL_SORT_END };
static int msgset_contains(const char *set, unsigned int match_num,
unsigned int max_num)
@@ -122,8 +122,8 @@
return num;
}
-static int search_keyword(MailIndex *index, MailIndexRecord *rec,
- const char *value)
+static int search_keyword(struct mail_index *index,
+ struct mail_index_record *rec, const char *value)
{
const char **custom_flags;
int i;
@@ -144,9 +144,11 @@
}
/* Returns >0 = matched, 0 = not matched, -1 = unknown */
-static int search_arg_match_index(IndexMailbox *ibox, MailIndexRecord *rec,
+static int search_arg_match_index(struct index_mailbox *ibox,
+ struct mail_index_record *rec,
unsigned int client_seq,
- MailSearchArgType type, const char *value)
+ enum mail_search_arg_type type,
+ const char *value)
{
switch (type) {
case SEARCH_ALL:
@@ -179,9 +181,9 @@
}
}
-static void search_index_arg(MailSearchArg *arg, void *context)
+static void search_index_arg(struct mail_search_arg *arg, void *context)
{
- SearchIndexContext *ctx = context;
+ struct search_index_context *ctx = context;
switch (search_arg_match_index(ctx->ibox, ctx->rec, ctx->client_seq,
arg->type, arg->value.str)) {
@@ -197,7 +199,8 @@
}
}
-static ImapMessageCache *search_open_cache(SearchIndexContext *ctx)
+static struct imap_message_cache *
+search_open_cache(struct search_index_context *ctx)
{
if (!ctx->cached) {
(void)index_msgcache_open(ctx->ibox->cache,
@@ -208,8 +211,9 @@
}
/* Returns >0 = matched, 0 = not matched, -1 = unknown */
-static int search_arg_match_cached(SearchIndexContext *ctx,
- MailSearchArgType type, const char *value)
+static int search_arg_match_cached(struct search_index_context *ctx,
+ enum mail_search_arg_type type,
+ const char *value)
{
time_t internal_date, search_time;
uoff_t virtual_size, search_size;
@@ -259,9 +263,9 @@
}
}
-static void search_cached_arg(MailSearchArg *arg, void *context)
+static void search_cached_arg(struct mail_search_arg *arg, void *context)
{
- SearchIndexContext *ctx = context;
+ struct search_index_context *ctx = context;
switch (search_arg_match_cached(ctx, arg->type,
arg->value.str)) {
@@ -277,7 +281,7 @@
}
}
-static int search_sent(MailSearchArgType type, const char *search_value,
+static int search_sent(enum mail_search_arg_type type, const char *search_value,
const char *sent_value)
{
time_t search_time, sent_time;
@@ -291,7 +295,7 @@
/* NOTE: Latest IMAP4rev1 draft specifies that timezone is ignored
in searches. */
- if (!rfc822_parse_date(sent_value, &sent_time, &timezone_offset))
+ if (!message_date_parse(sent_value, &sent_time, &timezone_offset))
return 0;
switch (type) {
@@ -307,8 +311,9 @@
}
}
-static HeaderSearchContext *search_header_context(SearchIndexContext *ctx,
- MailSearchArg *arg)
+static struct header_search_context *
+search_header_context(struct search_index_context *ctx,
+ struct mail_search_arg *arg)
{
int unknown_charset;
@@ -334,12 +339,12 @@
}
/* Returns >0 = matched, 0 = not matched, -1 = unknown */
-static int search_arg_match_envelope(SearchIndexContext *ctx,
- MailSearchArg *arg)
+static int search_arg_match_envelope(struct search_index_context *ctx,
+ struct mail_search_arg *arg)
{
- MailIndex *index = ctx->ibox->index;
- ImapEnvelopeField env_field;
- HeaderSearchContext *hdr_search_ctx;
+ struct mail_index *index = ctx->ibox->index;
+ enum imap_envelope_field env_field;
+ struct header_search_context *hdr_search_ctx;
const char *envelope, *field;
int ret;
@@ -382,7 +387,7 @@
envelope = index->lookup_field(index, ctx->rec, DATA_FIELD_ENVELOPE);
if (envelope != NULL) {
ret = imap_envelope_parse(envelope, env_field,
- IMAP_ENVELOPE_RESULT_STRING,
+ IMAP_ENVELOPE_RESULT_TYPE_STRING,
&field) ? 1 : -1;
} else {
index->cache_fields_later(index, DATA_FIELD_ENVELOPE);
@@ -426,9 +431,9 @@
return ret;
}
-static void search_envelope_arg(MailSearchArg *arg, void *context)
+static void search_envelope_arg(struct mail_search_arg *arg, void *context)
{
- SearchIndexContext *ctx = context;
+ struct search_index_context *ctx = context;
switch (search_arg_match_envelope(ctx, arg)) {
case -1:
@@ -443,10 +448,10 @@
}
}
-static void search_header_arg(MailSearchArg *arg, void *context)
+static void search_header_arg(struct mail_search_arg *arg, void *context)
{
- SearchHeaderContext *ctx = context;
- HeaderSearchContext *hdr_search_ctx;
+ struct search_header_context *ctx = context;
+ struct header_search_context *hdr_search_ctx;
size_t len;
int ret;
@@ -520,12 +525,12 @@
ARG_SET_RESULT(arg, ret);
}
-static void search_header(MessagePart *part __attr_unused__,
+static void search_header(struct message_part *part __attr_unused__,
const unsigned char *name, size_t name_len,
const unsigned char *value, size_t value_len,
void *context)
{
- SearchHeaderContext *ctx = context;
+ struct search_header_context *ctx = context;
if ((name_len > 0 && ctx->custom_header) ||
(name_len == 4 && memcasecmp(name, "Date", 4) == 0) ||
@@ -544,9 +549,9 @@
}
}
-static void search_body(MailSearchArg *arg, void *context)
+static void search_body(struct mail_search_arg *arg, void *context)
{
- SearchBodyContext *ctx = context;
+ struct search_body_context *ctx = context;
int ret, unknown_charset;
if (ctx->index_ctx->error != NULL)
@@ -568,9 +573,10 @@
}
}
-static int search_arg_match_text(MailSearchArg *args, SearchIndexContext *ctx)
+static int search_arg_match_text(struct mail_search_arg *args,
+ struct search_index_context *ctx)
{
- IStream *input;
+ struct istream *input;
int have_headers, have_body, have_text;
/* first check what we need to use */
@@ -579,7 +585,7 @@
return TRUE;
if (have_headers || have_text) {
- SearchHeaderContext hdr_ctx;
+ struct search_header_context hdr_ctx;
if (!imap_msgcache_get_data(search_open_cache(ctx), &input))
return FALSE;
@@ -598,7 +604,7 @@
}
if (have_text || have_body) {
- SearchBodyContext body_ctx;
+ struct search_body_context body_ctx;
memset(&body_ctx, 0, sizeof(body_ctx));
body_ctx.index_ctx = ctx;
@@ -638,7 +644,8 @@
}
}
-static void search_get_sequid(IndexMailbox *ibox, MailSearchArg *args,
+static void search_get_sequid(struct index_mailbox *ibox,
+ struct mail_search_arg *args,
unsigned int *first_seq, unsigned int *last_seq,
unsigned int *first_uid, unsigned int *last_uid)
{
@@ -662,11 +669,12 @@
}
}
-static int search_limit_by_flags(IndexMailbox *ibox, MailSearchArg *args,
+static int search_limit_by_flags(struct index_mailbox *ibox,
+ struct mail_search_arg *args,
unsigned int *first_uid,
unsigned int *last_uid)
{
- MailIndexHeader *hdr;
+ struct mail_index_header *hdr;
unsigned int uid;
hdr = ibox->index->header;
@@ -715,9 +723,10 @@
return *first_uid <= *last_uid;
}
-static unsigned int client_seq_to_uid(MailIndex *index, unsigned int seq)
+static unsigned int client_seq_to_uid(struct mail_index *index,
+ unsigned int seq)
{
- MailIndexRecord *rec;
+ struct mail_index_record *rec;
unsigned int expunges_before;
(void)mail_modifylog_seq_get_expunges(index->modifylog, seq, seq,
@@ -728,7 +737,8 @@
return rec == NULL ? 0 : rec->uid;
}
-static int search_get_uid_range(IndexMailbox *ibox, MailSearchArg *args,
+static int search_get_uid_range(struct index_mailbox *ibox,
+ struct mail_search_arg *args,
unsigned int *first_uid,
unsigned int *last_uid)
{
@@ -775,14 +785,15 @@
return TRUE;
}
-static int search_messages(IndexMailbox *ibox, const char *charset,
- MailSearchArg *args, MailSortContext *sort_ctx,
- OStream *output, int uid_result)
+static int search_messages(struct index_mailbox *ibox, const char *charset,
+ struct mail_search_arg *args,
+ struct mail_sort_context *sort_ctx,
+ struct ostream *output, int uid_result)
{
- SearchIndexContext ctx;
- MailIndexRecord *rec;
- MailSearchArg *arg;
- const ModifyLogExpunge *expunges;
+ struct search_index_context ctx;
+ struct mail_index_record *rec;
+ struct mail_search_arg *arg;
+ const struct modify_log_expunge *expunges;
unsigned int first_uid, last_uid, client_seq, expunges_before;
const char *str;
int found, failed;
@@ -870,12 +881,14 @@
return ctx.error == NULL;
}
-int index_storage_search(Mailbox *box, const char *charset, MailSearchArg *args,
- MailSortType *sorting, OStream *output, int uid_result)
+int index_storage_search(struct mailbox *box, const char *charset,
+ struct mail_search_arg *args,
+ enum mail_sort_type *sorting,
+ struct ostream *output, int uid_result)
{
- IndexMailbox *ibox = (IndexMailbox *) box;
- MailSortContext *sort_ctx;
- IndexSortContext index_sort_ctx;
+ struct index_mailbox *ibox = (struct index_mailbox *) box;
+ struct mail_sort_context *sort_ctx;
+ struct index_sort_context index_sort_ctx;
int failed;
if (!index_storage_sync_and_lock(ibox, TRUE, MAIL_LOCK_SHARED))
Index: index-sort.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-sort.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- index-sort.c 2 Jan 2003 09:06:33 -0000 1.5
+++ index-sort.c 5 Jan 2003 13:09:52 -0000 1.6
@@ -2,15 +2,15 @@
#include "lib.h"
#include "ostream.h"
-#include "rfc822-date.h"
+#include "message-date.h"
#include "imap-envelope.h"
#include "imap-message-cache.h"
#include "mail-index.h"
#include "index-storage.h"
#include "index-sort.h"
-static ImapMessageCache *search_open_cache(IndexSortContext *ctx,
- unsigned int uid)
+static struct imap_message_cache *
+search_open_cache(struct index_sort_context *ctx, unsigned int uid)
{
if (ctx->last_uid != uid) {
ctx->cached = FALSE;
@@ -33,10 +33,11 @@
return ctx->ibox->cache;
}
-static uoff_t _input_uofft(MailSortType type, unsigned int id, void *context)
+static uoff_t _input_uofft(enum mail_sort_type type,
+ unsigned int id, void *context)
{
- IndexSortContext *ctx = context;
- ImapMessageCache *cache;
+ struct index_sort_context *ctx = context;
+ struct imap_message_cache *cache;
if (type != MAIL_SORT_SIZE) {
i_unreached();
@@ -47,11 +48,11 @@
return cache == NULL ? 0 : imap_msgcache_get_virtual_size(cache);
}
-static const char *_input_mailbox(MailSortType type, unsigned int id,
+static const char *_input_mailbox(enum mail_sort_type type, unsigned int id,
void *context)
{
- IndexSortContext *ctx = context;
- ImapEnvelopeField env_field;
+ struct index_sort_context *ctx = context;
+ enum imap_envelope_field env_field;
const char *envelope, *str;
switch (type) {
@@ -76,16 +77,17 @@
return NULL;
if (!imap_envelope_parse(envelope, env_field,
- IMAP_ENVELOPE_RESULT_FIRST_MAILBOX, &str))
+ IMAP_ENVELOPE_RESULT_TYPE_FIRST_MAILBOX, &str))
return NULL;
return str;
}
-static const char *_input_str(MailSortType type, unsigned int id, void *context)
+static const char *_input_str(enum mail_sort_type type,
+ unsigned int id, void *context)
{
- IndexSortContext *ctx = context;
- ImapEnvelopeField env_field;
+ struct index_sort_context *ctx = context;
+ enum imap_envelope_field env_field;
const char *envelope, *str;
switch (type) {
@@ -107,16 +109,17 @@
return NULL;
if (!imap_envelope_parse(envelope, env_field,
- IMAP_ENVELOPE_RESULT_STRING, &str))
+ IMAP_ENVELOPE_RESULT_TYPE_STRING, &str))
return NULL;
return str;
}
-static time_t _input_time(MailSortType type, unsigned int id, void *context)
+static time_t _input_time(enum mail_sort_type type,
+ unsigned int id, void *context)
{
- IndexSortContext *ctx = context;
- ImapMessageCache *cache;
+ struct index_sort_context *ctx = context;
+ struct imap_message_cache *cache;
const char *str;
time_t time;
int timezone_offset;
@@ -131,7 +134,7 @@
if (str == NULL)
return 0;
- if (!rfc822_parse_date(str, &time, &timezone_offset))
+ if (!message_date_parse(str, &time, &timezone_offset))
return 0;
return time - timezone_offset*60;
@@ -143,14 +146,14 @@
static void _input_reset(void *context)
{
- IndexSortContext *ctx = context;
+ struct index_sort_context *ctx = context;
ctx->cached = FALSE;
}
static void _output(unsigned int *data, size_t count, void *context)
{
- IndexSortContext *ctx = context;
+ struct index_sort_context *ctx = context;
size_t i;
for (i = 0; i < count; i++) {
@@ -161,7 +164,7 @@
}
}
-MailSortFuncs index_sort_funcs = {
+struct mail_sort_funcs index_sort_funcs = {
_input_time,
_input_uofft,
_input_mailbox,
Index: index-sort.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-sort.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- index-sort.h 6 Dec 2002 01:09:23 -0000 1.2
+++ index-sort.h 5 Jan 2003 13:09:52 -0000 1.3
@@ -4,16 +4,16 @@
#include "mail-storage.h"
#include "mail-sort.h"
-typedef struct {
- IndexMailbox *ibox;
- OStream *output;
+struct index_sort_context {
+ struct index_mailbox *ibox;
+ struct ostream *output;
unsigned int last_uid;
- MailIndexRecord *rec;
+ struct mail_index_record *rec;
unsigned int cached:1;
-} IndexSortContext;
+};
-extern MailSortFuncs index_sort_funcs;
+extern struct mail_sort_funcs index_sort_funcs;
#endif
Index: index-status.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-status.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- index-status.c 21 Dec 2002 10:59:23 -0000 1.22
+++ index-status.c 5 Jan 2003 13:09:52 -0000 1.23
@@ -5,10 +5,10 @@
#include "mail-index-util.h"
#include "index-storage.h"
-static unsigned int get_first_unseen_seq(MailIndex *index)
+static unsigned int get_first_unseen_seq(struct mail_index *index)
{
- MailIndexHeader *hdr;
- MailIndexRecord *rec;
+ struct mail_index_header *hdr;
+ struct mail_index_record *rec;
unsigned int seq, lowwater_uid;
hdr = mail_index_get_header(index);
@@ -56,7 +56,7 @@
}
static void
-get_custom_flags(MailCustomFlags *mcf, MailboxStatus *status)
+get_custom_flags(struct mail_custom_flags *mcf, struct mailbox_status *status)
{
const char **flags;
unsigned int i;
@@ -69,13 +69,14 @@
status->custom_flags[i] = t_strdup(flags[i]);
}
-int index_storage_get_status(Mailbox *box, MailboxStatusItems items,
- MailboxStatus *status)
+int index_storage_get_status(struct mailbox *box,
+ enum mailbox_status_items items,
+ struct mailbox_status *status)
{
- IndexMailbox *ibox = (IndexMailbox *) box;
- MailIndexHeader *hdr;
+ struct index_mailbox *ibox = (struct index_mailbox *) box;
+ struct mail_index_header *hdr;
- memset(status, 0, sizeof(MailboxStatus));
+ memset(status, 0, sizeof(struct mailbox_status));
/* if we're doing STATUS for selected mailbox, we have to sync it
first or STATUS reply may give different data */
Index: index-storage.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-storage.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- index-storage.c 22 Dec 2002 08:18:29 -0000 1.23
+++ index-storage.c 5 Jan 2003 13:09:52 -0000 1.24
@@ -13,22 +13,20 @@
#define LOCK_NOTIFY_INTERVAL 30
-typedef struct _IndexList IndexList;
-
-struct _IndexList {
- IndexList *next;
+struct index_list {
+ struct index_list *next;
- MailIndex *index;
+ struct mail_index *index;
int refcount;
};
-static IndexList *indexes = NULL;
+static struct index_list *indexes = NULL;
-void index_storage_add(MailIndex *index)
+void index_storage_add(struct mail_index *index)
{
- IndexList *list;
+ struct index_list *list;
- list = i_new(IndexList, 1);
+ list = i_new(struct index_list, 1);
list->refcount = 1;
list->index = index;
@@ -36,9 +34,9 @@
indexes = list;
}
-MailIndex *index_storage_lookup_ref(const char *path)
+struct mail_index *index_storage_lookup_ref(const char *path)
{
- IndexList *list;
+ struct index_list *list;
struct stat st1, st2;
if (stat(path, &st1) < 0)
@@ -58,9 +56,9 @@
return NULL;
}
-void index_storage_unref(MailIndex *index)
+void index_storage_unref(struct mail_index *index)
{
- IndexList **list, *rec;
+ struct index_list **list, *rec;
for (list = &indexes; *list != NULL; list = &(*list)->next) {
rec = *list;
@@ -78,7 +76,7 @@
i_unreached();
}
-static MailDataField get_data_fields(const char *fields)
+static enum mail_data_field get_data_fields(const char *fields)
{
static const char *field_names[] = {
"Location",
@@ -91,7 +89,7 @@
};
const char *const *arr;
- MailDataField ret;
+ enum mail_data_field ret;
int i;
if (fields == NULL || *fields == '\0')
@@ -117,9 +115,9 @@
return ret;
}
-static MailDataField get_default_cache_fields(void)
+static enum mail_data_field get_default_cache_fields(void)
{
- static MailDataField ret = 0;
+ static enum mail_data_field ret = 0;
static int ret_set = FALSE;
if (ret_set)
@@ -130,9 +128,9 @@
return ret;
}
-static MailDataField get_never_cache_fields(void)
+static enum mail_data_field get_never_cache_fields(void)
{
- static MailDataField ret = 0;
+ static enum mail_data_field ret = 0;
static int ret_set = FALSE;
if (ret_set)
@@ -143,11 +141,11 @@
return ret;
}
-static void lock_notify(MailLockNotifyType notify_type,
+static void lock_notify(enum mail_lock_notify_type notify_type,
unsigned int secs_left, void *context)
{
- IndexMailbox *ibox = context;
- MailStorage *storage = ibox->box.storage;
+ struct index_mailbox *ibox = context;
+ struct mail_storage *storage = ibox->box.storage;
const char *str;
time_t now;
@@ -187,7 +185,8 @@
}
}
-int index_storage_lock(IndexMailbox *ibox, MailLockType lock_type)
+int index_storage_lock(struct index_mailbox *ibox,
+ enum mail_lock_type lock_type)
{
int ret;
@@ -205,16 +204,17 @@
return TRUE;
}
-IndexMailbox *index_storage_init(MailStorage *storage, Mailbox *box,
- MailIndex *index, const char *name,
- int readonly, int fast)
+struct index_mailbox *
+index_storage_init(struct mail_storage *storage, struct mailbox *box,
+ struct mail_index *index, const char *name,
+ int readonly, int fast)
{
- IndexMailbox *ibox;
+ struct index_mailbox *ibox;
i_assert(name != NULL);
do {
- ibox = i_new(IndexMailbox, 1);
+ ibox = i_new(struct index_mailbox, 1);
ibox->box = *box;
ibox->box.storage = storage;
@@ -257,9 +257,9 @@
return NULL;
}
-int index_storage_close(Mailbox *box)
+int index_storage_close(struct mailbox *box)
{
- IndexMailbox *ibox = (IndexMailbox *) box;
+ struct index_mailbox *ibox = (struct index_mailbox *) box;
index_mailbox_check_remove(ibox);
imap_msgcache_free(ibox->cache);
@@ -272,15 +272,16 @@
return TRUE;
}
-void index_storage_set_callbacks(MailStorage *storage,
- MailStorageCallbacks *callbacks,
+void index_storage_set_callbacks(struct mail_storage *storage,
+ struct mail_storage_callbacks *callbacks,
void *context)
{
- memcpy(storage->callbacks, callbacks, sizeof(MailStorageCallbacks));
+ memcpy(storage->callbacks, callbacks,
+ sizeof(struct mail_storage_callbacks));
storage->callback_context = context;
}
-int mail_storage_set_index_error(IndexMailbox *ibox)
+int mail_storage_set_index_error(struct index_mailbox *ibox)
{
switch (ibox->index->get_last_error(ibox->index)) {
case MAIL_INDEX_ERROR_NONE:
@@ -309,7 +310,8 @@
return FALSE;
}
-int index_mailbox_fix_custom_flags(IndexMailbox *ibox, MailFlags *flags,
+int index_mailbox_fix_custom_flags(struct index_mailbox *ibox,
+ enum mail_flags *flags,
const char *custom_flags[])
{
int ret;
@@ -329,10 +331,10 @@
}
}
-unsigned int index_storage_get_recent_count(MailIndex *index)
+unsigned int index_storage_get_recent_count(struct mail_index *index)
{
- MailIndexHeader *hdr;
- MailIndexRecord *rec;
+ struct mail_index_header *hdr;
+ struct mail_index_record *rec;
unsigned int seq;
hdr = mail_index_get_header(index);
Index: index-storage.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-storage.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- index-storage.h 6 Dec 2002 01:09:23 -0000 1.25
+++ index-storage.h 5 Jan 2003 13:09:52 -0000 1.26
@@ -5,20 +5,18 @@
#include "mail-index.h"
#include "imap-message-cache.h"
-typedef struct _IndexMailbox IndexMailbox;
-
-struct _IndexMailbox {
- Mailbox box;
+struct index_mailbox {
+ struct mailbox box;
/* expunge messages marked as deleted, requires index to be
exclusively locked */
- int (*expunge_locked)(IndexMailbox *ibox, int notify);
+ int (*expunge_locked)(struct index_mailbox *ibox, int notify);
- MailIndex *index;
- ImapMessageCache *cache;
+ struct mail_index *index;
+ struct imap_message_cache *cache;
char *check_path;
- Timeout check_to;
+ struct timeout *check_to;
time_t check_file_stamp;
time_t last_check;
@@ -30,61 +28,70 @@
unsigned int delay_save_unlocking:1; /* For COPYing inside mailbox */
};
-extern ImapMessageCacheIface index_msgcache_iface;
+extern struct imap_message_cache_iface index_msgcache_iface;
-int mail_storage_set_index_error(IndexMailbox *ibox);
-int index_storage_lock(IndexMailbox *ibox, MailLockType lock_type);
+int mail_storage_set_index_error(struct index_mailbox *ibox);
+int index_storage_lock(struct index_mailbox *ibox,
+ enum mail_lock_type lock_type);
-void index_storage_add(MailIndex *index);
-MailIndex *index_storage_lookup_ref(const char *path);
-void index_storage_unref(MailIndex *index);
+void index_storage_add(struct mail_index *index);
+struct mail_index *index_storage_lookup_ref(const char *path);
+void index_storage_unref(struct mail_index *index);
-IndexMailbox *index_storage_init(MailStorage *storage, Mailbox *box,
- MailIndex *index, const char *name,
- int readonly, int fast);
-int index_storage_close(Mailbox *box);
+struct index_mailbox *
+index_storage_init(struct mail_storage *storage, struct mailbox *box,
+ struct mail_index *index, const char *name,
+ int readonly, int fast);
+int index_storage_close(struct mailbox *box);
-int index_storage_sync_and_lock(IndexMailbox *ibox, int sync_size,
- MailLockType data_lock_type);
-int index_storage_sync_modifylog(IndexMailbox *ibox, int hide_deleted);
+int index_storage_sync_and_lock(struct index_mailbox *ibox, int sync_size,
+ enum mail_lock_type data_lock_type);
+int index_storage_sync_modifylog(struct index_mailbox *ibox, int hide_deleted);
-int index_mailbox_fix_custom_flags(IndexMailbox *ibox, MailFlags *flags,
+int index_mailbox_fix_custom_flags(struct index_mailbox *ibox,
+ enum mail_flags *flags,
const char *custom_flags[]);
-unsigned int index_storage_get_recent_count(MailIndex *index);
+unsigned int index_storage_get_recent_count(struct mail_index *index);
-int index_expunge_seek_first(IndexMailbox *ibox, unsigned int *seq,
- MailIndexRecord **rec);
-int index_expunge_mail(IndexMailbox *ibox, MailIndexRecord *rec,
+int index_expunge_seek_first(struct index_mailbox *ibox, unsigned int *seq,
+ struct mail_index_record **rec);
+int index_expunge_mail(struct index_mailbox *ibox,
+ struct mail_index_record *rec,
unsigned int seq, int notify);
-int index_storage_save(MailStorage *storage, const char *path,
- IStream *input, OStream *output, uoff_t data_size);
+int index_storage_save(struct mail_storage *storage, const char *path,
+ struct istream *input, struct ostream *output,
+ uoff_t data_size);
-int index_msgcache_open(ImapMessageCache *cache, MailIndex *index,
- MailIndexRecord *rec, ImapCacheField fields);
+int index_msgcache_open(struct imap_message_cache *cache,
+ struct mail_index *index, struct mail_index_record *rec,
+ enum imap_cache_field fields);
-void index_mailbox_check_add(IndexMailbox *ibox, const char *path);
-void index_mailbox_check_remove(IndexMailbox *ibox);
+void index_mailbox_check_add(struct index_mailbox *ibox, const char *path);
+void index_mailbox_check_remove(struct index_mailbox *ibox);
-/* Mailbox methods: */
-void index_storage_set_callbacks(MailStorage *storage,
- MailStorageCallbacks *callbacks,
+/* mailbox methods: */
+void index_storage_set_callbacks(struct mail_storage *storage,
+ struct mail_storage_callbacks *callbacks,
void *context);
-int index_storage_copy(Mailbox *box, Mailbox *destbox,
+int index_storage_copy(struct mailbox *box, struct mailbox *destbox,
const char *messageset, int uidset);
-int index_storage_expunge(Mailbox *box, int notify);
-int index_storage_get_status(Mailbox *box, MailboxStatusItems items,
- MailboxStatus *status);
-int index_storage_sync(Mailbox *box, int sync_expunges);
-int index_storage_update_flags(Mailbox *box, const char *messageset, int uidset,
- MailFlags flags, const char *custom_flags[],
- ModifyType modify_type, int notify,
+int index_storage_expunge(struct mailbox *box, int notify);
+int index_storage_get_status(struct mailbox *box,
+ enum mailbox_status_items items,
+ struct mailbox_status *status);
+int index_storage_sync(struct mailbox *box, int sync_expunges);
+int index_storage_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);
-int index_storage_fetch(Mailbox *box, MailFetchData *fetch_data,
- OStream *output, int *all_found);
-int index_storage_search(Mailbox *box, const char *charset, MailSearchArg *args,
- MailSortType *sorting, OStream *output,
- int uid_result);
+int index_storage_fetch(struct mailbox *box, struct mail_fetch_data *fetch_data,
+ struct ostream *output, int *all_found);
+int index_storage_search(struct mailbox *box, const char *charset,
+ struct mail_search_arg *args,
+ enum mail_sort_type *sorting,
+ struct ostream *output, int uid_result);
#endif
Index: index-sync.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-sync.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- index-sync.c 25 Nov 2002 19:02:50 -0000 1.21
+++ index-sync.c 5 Jan 2003 13:09:52 -0000 1.22
@@ -7,9 +7,9 @@
#include "mail-modifylog.h"
#include "mail-custom-flags.h"
-static void index_storage_sync_size(IndexMailbox *ibox)
+static void index_storage_sync_size(struct index_mailbox *ibox)
{
- MailStorage *storage = ibox->box.storage;
+ struct mail_storage *storage = ibox->box.storage;
unsigned int messages, recent;
if (storage->callbacks->new_messages == NULL)
@@ -29,11 +29,11 @@
}
}
-int index_storage_sync_and_lock(IndexMailbox *ibox, int sync_size,
- MailLockType data_lock_type)
+int index_storage_sync_and_lock(struct index_mailbox *ibox, int sync_size,
+ enum mail_lock_type data_lock_type)
{
- MailStorage *storage = ibox->box.storage;
- MailIndex *index = ibox->index;
+ struct mail_storage *storage = ibox->box.storage;
+ struct mail_index *index = ibox->index;
int changes, set_shared_lock;
set_shared_lock = ibox->index->lock_type != MAIL_LOCK_EXCLUSIVE;
@@ -86,12 +86,12 @@
return TRUE;
}
-int index_storage_sync_modifylog(IndexMailbox *ibox, int hide_deleted)
+int index_storage_sync_modifylog(struct index_mailbox *ibox, int hide_deleted)
{
- const ModifyLogRecord *log1, *log2, *log, *first_flag_log;
- MailIndexRecord *rec;
- MailFlags flags;
- MailStorageCallbacks *sc;
+ const struct modify_log_record *log1, *log2, *log, *first_flag_log;
+ struct mail_index_record *rec;
+ enum mail_flags flags;
+ struct mail_storage_callbacks *sc;
void *sc_context;
const char **custom_flags;
unsigned int count1, count2, total_count, seq, seq_count, i, messages;
@@ -205,9 +205,9 @@
return TRUE;
}
-int index_storage_sync(Mailbox *box, int sync_expunges)
+int index_storage_sync(struct mailbox *box, int sync_expunges)
{
- IndexMailbox *ibox = (IndexMailbox *) box;
+ struct index_mailbox *ibox = (struct index_mailbox *) box;
int ret;
ibox->last_check = ioloop_time;
Index: index-update-flags.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-update-flags.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- index-update-flags.c 25 Nov 2002 19:02:50 -0000 1.15
+++ index-update-flags.c 5 Jan 2003 13:09:52 -0000 1.16
@@ -5,20 +5,20 @@
#include "index-messageset.h"
#include "mail-custom-flags.h"
-typedef struct {
- IndexMailbox *ibox;
- MailFlags flags;
- ModifyType modify_type;
+struct update_context {
+ struct index_mailbox *ibox;
+ enum mail_flags flags;
+ enum modify_type modify_type;
int notify;
-} UpdateContext;
+};
-static int update_func(MailIndex *index, MailIndexRecord *rec,
+static int update_func(struct mail_index *index, struct mail_index_record *rec,
unsigned int client_seq, unsigned int idx_seq,
void *context)
{
- UpdateContext *ctx = context;
- MailStorage *storage;
- MailFlags flags;
+ struct update_context *ctx = context;
+ struct mail_storage *storage;
+ enum mail_flags flags;
const char **custom_flags;
switch (ctx->modify_type) {
@@ -60,13 +60,15 @@
return TRUE;
}
-int index_storage_update_flags(Mailbox *box, const char *messageset, int uidset,
- MailFlags flags, const char *custom_flags[],
- ModifyType modify_type, int notify,
+int index_storage_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)
{
- IndexMailbox *ibox = (IndexMailbox *) box;
- UpdateContext ctx;
+ struct index_mailbox *ibox = (struct index_mailbox *) box;
+ struct update_context ctx;
int ret;
if (box->readonly) {
- Previous message: [dovecot-cvs] dovecot/src/lib-index/mbox mbox-append.c,1.36,1.37 mbox-from.c,1.9,1.10 mbox-index.c,1.58,1.59 mbox-index.h,1.22,1.23 mbox-lock.c,1.21,1.22 mbox-lock.h,1.4,1.5 mbox-open.c,1.19,1.20 mbox-rebuild.c,1.21,1.22 mbox-rewrite.c,1.49,1.50 Message-Id: <20030105130956.46D5023994@danu.procontrol.fi>
- Next message: [dovecot-cvs] dovecot/src/lib-mail message-address.c,NONE,1.1 message-address.h,NONE,1.1 message-date.c,NONE,1.1 message-date.h,NONE,1.1 message-tokenize.c,NONE,1.1 message-tokenize.h,NONE,1.1 Makefile.am,1.6,1.7 message-body-search.c,1.8,1.9 Message-Id: <20030105130956.8F2DA23997@danu.procontrol.fi>
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list