[dovecot-cvs] dovecot/src/imap cmd-append.c, 1.55, 1.56 cmd-copy.c,
1.26, 1.27 cmd-search.c, 1.23, 1.24 cmd-store.c, 1.31,
1.32 common.h, 1.19, 1.20 imap-expunge.c, 1.5,
1.6 imap-fetch-body.c, 1.17, 1.18 imap-fetch.c, 1.37,
1.38 imap-fetch.h, 1.14, 1.15 imap-sort.c, 1.19,
1.20 imap-sync.c, 1.9, 1.10 imap-thread.c, 1.14, 1.15 main.c,
1.61, 1.62 namespace.c, 1.6, 1.7
cras at dovecot.org
cras at dovecot.org
Tue Mar 15 21:01:54 EET 2005
- Previous message: [dovecot-cvs] dovecot/src/lib-storage Makefile.am, 1.12,
1.13 mail-copy.c, 1.3, 1.4 mail-copy.h, 1.1,
1.2 mail-storage-private.h, 1.13, 1.14 mail-storage.c, 1.35,
1.36 mail-storage.h, 1.90, 1.91 mail.c, NONE,
1.1 proxy-mail-storage.c, 1.6, NONE proxy-mail-storage.h, 1.2,
NONE proxy-mail.c, 1.8, NONE proxy-mail.h, 1.1,
NONE proxy-mailbox.c, 1.15, NONE proxy-mailbox.h, 1.3, NONE
- Next message: [dovecot-cvs] dovecot/src/lib-storage/index index-fetch.c, 1.55,
1.56 index-mail-headers.c, 1.41, 1.42 index-mail.c, 1.71,
1.72 index-mail.h, 1.28, 1.29 index-search.c, 1.99,
1.100 index-storage.c, 1.69, 1.70 index-storage.h, 1.88,
1.89 index-transaction.c, 1.11, 1.12
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /var/lib/cvs/dovecot/src/imap
In directory talvi:/tmp/cvs-serv16056/imap
Modified Files:
cmd-append.c cmd-copy.c cmd-search.c cmd-store.c common.h
imap-expunge.c imap-fetch-body.c imap-fetch.c imap-fetch.h
imap-sort.c imap-sync.c imap-thread.c main.c namespace.c
Log Message:
Major mail-storage API changes. It's now a bit cleaner and much more plugin
friendly. Removed proxy_mailbox* stuff, they were difficult to use and
there's now much easier way to replace them.
Index: cmd-append.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-append.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- cmd-append.c 12 Feb 2005 09:36:23 -0000 1.55
+++ cmd-append.c 15 Mar 2005 19:01:51 -0000 1.56
@@ -396,7 +396,8 @@
status.keywords_count);
}
ctx->t = ctx->box == NULL ? NULL :
- mailbox_transaction_begin(ctx->box, FALSE);
+ mailbox_transaction_begin(ctx->box,
+ MAILBOX_TRANSACTION_FLAG_EXTERNAL);
}
io_remove(client->io);
Index: cmd-copy.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-copy.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- cmd-copy.c 5 Feb 2005 18:07:26 -0000 1.26
+++ cmd-copy.c 15 Mar 2005 19:01:51 -0000 1.27
@@ -12,22 +12,15 @@
struct mail_search_context *search_ctx;
struct mailbox_transaction_context *src_trans;
struct mail *mail;
- string_t *dest_str;
int ret;
- src_trans = mailbox_transaction_begin(srcbox, FALSE);
- search_ctx = mailbox_search_init(src_trans, NULL, search_args, NULL,
- MAIL_FETCH_STREAM_HEADER |
- MAIL_FETCH_STREAM_BODY, NULL);
- if (search_ctx == NULL) {
- mailbox_transaction_rollback(src_trans);
- return -1;
- }
-
- dest_str = t_str_new(128);
+ src_trans = mailbox_transaction_begin(srcbox, 0);
+ search_ctx = mailbox_search_init(src_trans, NULL, search_args, NULL);
+ mail = mail_alloc(src_trans, MAIL_FETCH_STREAM_HEADER |
+ MAIL_FETCH_STREAM_BODY, NULL);
ret = 1;
- while ((mail = mailbox_search_next(search_ctx)) != NULL) {
+ while (mailbox_search_next(search_ctx, mail) > 0) {
if (mail->expunged) {
ret = 0;
break;
@@ -36,8 +29,8 @@
ret = -1;
break;
}
-
}
+ mail_free(mail);
if (mailbox_search_deinit(search_ctx) < 0)
ret = -1;
@@ -89,7 +82,8 @@
}
}
- t = mailbox_transaction_begin(destbox, FALSE);
+ t = mailbox_transaction_begin(destbox,
+ MAILBOX_TRANSACTION_FLAG_EXTERNAL);
ret = fetch_and_copy(t, client->mailbox, search_arg);
if (ret <= 0)
Index: cmd-search.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-search.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- cmd-search.c 5 Feb 2005 18:07:26 -0000 1.23
+++ cmd-search.c 15 Mar 2005 19:01:51 -0000 1.24
@@ -14,23 +14,23 @@
struct client *client = cmd->client;
struct mail_search_context *ctx;
struct mailbox_transaction_context *trans;
- const struct mail *mail;
+ struct mail *mail;
string_t *str;
int ret, uid, first = TRUE;
str = t_str_new(STRBUF_SIZE);
uid = cmd->uid;
- trans = mailbox_transaction_begin(client->mailbox, FALSE);
- ctx = mailbox_search_init(trans, charset, sargs,
- NULL, 0, NULL);
+ trans = mailbox_transaction_begin(client->mailbox, 0);
+ ctx = mailbox_search_init(trans, charset, sargs, NULL);
if (ctx == NULL) {
mailbox_transaction_rollback(trans);
return FALSE;
}
str_append(str, "* SEARCH");
- while ((mail = mailbox_search_next(ctx)) != NULL) {
+ mail = mail_alloc(trans, 0, NULL);
+ while ((ret = mailbox_search_next(ctx, mail)) > 0) {
if (str_len(str) >= STRBUF_SIZE-MAX_INT_STRLEN) {
/* flush */
o_stream_send(client->output,
@@ -41,6 +41,7 @@
str_printfa(str, " %u", uid ? mail->uid : mail->seq);
}
+ mail_free(mail);
ret = mailbox_search_deinit(ctx);
Index: cmd-store.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-store.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- cmd-store.c 5 Feb 2005 18:07:26 -0000 1.31
+++ cmd-store.c 15 Mar 2005 19:01:51 -0000 1.32
@@ -85,28 +85,30 @@
if (search_arg == NULL)
return TRUE;
- t = mailbox_transaction_begin(box, silent);
+ t = mailbox_transaction_begin(box, !silent ? 0 :
+ MAILBOX_TRANSACTION_FLAG_HIDE);
keywords = keywords_list != NULL || modify_type == MODIFY_REPLACE ?
mailbox_keywords_create(t, keywords_list) : NULL;
- search_ctx = mailbox_search_init(t, NULL, search_arg, NULL,
- MAIL_FETCH_FLAGS, NULL);
+ search_ctx = mailbox_search_init(t, NULL, search_arg, NULL);
failed = FALSE;
- while ((mail = mailbox_search_next(search_ctx)) != NULL) {
+ mail = mail_alloc(t, MAIL_FETCH_FLAGS, NULL);
+ while (mailbox_search_next(search_ctx, mail) > 0) {
if (modify_type == MODIFY_REPLACE || flags != 0) {
- if (mail->update_flags(mail, modify_type, flags) < 0) {
+ if (mail_update_flags(mail, modify_type, flags) < 0) {
failed = TRUE;
break;
}
}
if (modify_type == MODIFY_REPLACE || keywords != NULL) {
- if (mail->update_keywords(mail, modify_type,
- keywords) < 0) {
+ if (mail_update_keywords(mail, modify_type,
+ keywords) < 0) {
failed = TRUE;
break;
}
}
}
+ mail_free(mail);
if (keywords != NULL)
mailbox_keywords_free(t, keywords);
Index: common.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/common.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- common.h 14 Mar 2005 21:17:58 -0000 1.19
+++ common.h 15 Mar 2005 19:01:51 -0000 1.20
@@ -37,7 +37,7 @@
extern string_t *capability_string;
-extern void (*hook_mail_storage_created)(struct mail_storage **storage);
+extern void (*hook_mail_storage_created)(struct mail_storage *storage);
extern void (*hook_client_created)(struct client **client);
#endif
Index: imap-expunge.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/imap-expunge.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- imap-expunge.c 24 Sep 2004 11:47:30 -0000 1.5
+++ imap-expunge.c 15 Mar 2005 19:01:51 -0000 1.6
@@ -18,17 +18,19 @@
search_arg.type = SEARCH_DELETED;
search_arg.next = next_search_arg;
- t = mailbox_transaction_begin(box, FALSE);
- ctx = mailbox_search_init(t, NULL, &search_arg, NULL, 0, NULL);
+ t = mailbox_transaction_begin(box, 0);
+ ctx = mailbox_search_init(t, NULL, &search_arg, NULL);
if (ctx == NULL)
failed = TRUE;
else {
- while ((mail = mailbox_search_next(ctx)) != NULL) {
- if (mail->expunge(mail) < 0) {
+ mail = mail_alloc(t, 0, NULL);
+ while (mailbox_search_next(ctx, mail) > 0) {
+ if (mail_expunge(mail) < 0) {
failed = TRUE;
break;
}
}
+ mail_free(mail);
}
if (mailbox_search_deinit(ctx) < 0)
Index: imap-fetch-body.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/imap-fetch-body.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- imap-fetch-body.c 5 Feb 2005 18:07:26 -0000 1.17
+++ imap-fetch-body.c 15 Mar 2005 19:01:51 -0000 1.18
@@ -304,8 +304,8 @@
struct message_size hdr_size, body_size;
ctx->cur_input =
- mail->get_stream(mail, &hdr_size,
- body->section[0] == 'H' ? NULL : &body_size);
+ mail_get_stream(mail, &hdr_size,
+ body->section[0] == 'H' ? NULL : &body_size);
if (ctx->cur_input == NULL)
return -1;
@@ -419,7 +419,7 @@
{
const struct imap_fetch_body_data *body = context;
- ctx->cur_input = mail->get_stream(mail, NULL, NULL);
+ ctx->cur_input = mail_get_stream(mail, NULL, NULL);
if (ctx->cur_input == NULL)
return -1;
@@ -436,7 +436,7 @@
struct message_size size;
uoff_t old_offset;
- ctx->cur_input = mail->get_headers(mail, body->header_ctx);
+ ctx->cur_input = mail_get_headers(mail, body->header_ctx);
if (ctx->cur_input == NULL)
return -1;
@@ -463,7 +463,7 @@
const char *path;
unsigned int num;
- part = mail->get_parts(mail);
+ part = mail_get_parts(mail);
if (part == NULL)
return -1;
@@ -526,7 +526,7 @@
return 1;
}
- ctx->cur_input = mail->get_stream(mail, NULL, NULL);
+ ctx->cur_input = mail_get_stream(mail, NULL, NULL);
if (ctx->cur_input == NULL)
return -1;
@@ -831,7 +831,7 @@
{
uoff_t size;
- size = mail->get_virtual_size(mail);
+ size = mail_get_virtual_size(mail);
if (size == (uoff_t)-1)
return -1;
@@ -845,7 +845,7 @@
struct message_size hdr_size, body_size;
const char *str;
- ctx->cur_input = mail->get_stream(mail, &hdr_size, &body_size);
+ ctx->cur_input = mail_get_stream(mail, &hdr_size, &body_size);
if (ctx->cur_input == NULL)
return -1;
@@ -874,7 +874,7 @@
struct message_size hdr_size;
const char *str;
- ctx->cur_input = mail->get_stream(mail, &hdr_size, NULL);
+ ctx->cur_input = mail_get_stream(mail, &hdr_size, NULL);
if (ctx->cur_input == NULL)
return -1;
@@ -899,7 +899,7 @@
struct message_size hdr_size, body_size;
const char *str;
- ctx->cur_input = mail->get_stream(mail, &hdr_size, &body_size);
+ ctx->cur_input = mail_get_stream(mail, &hdr_size, &body_size);
if (ctx->cur_input == NULL)
return -1;
Index: imap-fetch.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/imap-fetch.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- imap-fetch.c 11 Feb 2005 18:14:59 -0000 1.37
+++ imap-fetch.c 15 Mar 2005 19:01:51 -0000 1.38
@@ -149,11 +149,13 @@
mailbox_header_lookup_init(ctx->box, data);
}
- ctx->trans = mailbox_transaction_begin(ctx->box, TRUE);
+ ctx->trans = mailbox_transaction_begin(ctx->box,
+ MAILBOX_TRANSACTION_FLAG_HIDE);
ctx->select_counter = ctx->client->select_counter;
+ ctx->mail = mail_alloc(ctx->trans, ctx->fetch_data,
+ ctx->all_headers_ctx);
ctx->search_ctx =
- mailbox_search_init(ctx->trans, NULL, search_arg, NULL,
- ctx->fetch_data, ctx->all_headers_ctx);
+ mailbox_search_init(ctx->trans, NULL, search_arg, NULL);
}
int imap_fetch(struct imap_fetch_context *ctx)
@@ -199,9 +201,10 @@
ctx->cur_input = NULL;
}
- ctx->cur_mail = mailbox_search_next(ctx->search_ctx);
- if (ctx->cur_mail == NULL)
+ if (mailbox_search_next(ctx->search_ctx,
+ ctx->mail) <= 0)
break;
+ ctx->cur_mail = ctx->mail;
str_printfa(ctx->cur_str, "* %u FETCH (",
ctx->cur_mail->seq);
@@ -275,6 +278,9 @@
ctx->cur_input = NULL;
}
+ if (ctx->mail != NULL)
+ mail_free(ctx->mail);
+
if (ctx->search_ctx != NULL) {
if (mailbox_search_deinit(ctx->search_ctx) < 0)
ctx->failed = TRUE;
@@ -298,7 +304,7 @@
{
const char *body;
- body = mail->get_special(mail, MAIL_FETCH_IMAP_BODY);
+ body = mail_get_special(mail, MAIL_FETCH_IMAP_BODY);
if (body == NULL)
return -1;
@@ -332,7 +338,7 @@
{
const char *bodystructure;
- bodystructure = mail->get_special(mail, MAIL_FETCH_IMAP_BODYSTRUCTURE);
+ bodystructure = mail_get_special(mail, MAIL_FETCH_IMAP_BODYSTRUCTURE);
if (bodystructure == NULL)
return -1;
@@ -365,7 +371,7 @@
{
const char *envelope;
- envelope = mail->get_special(mail, MAIL_FETCH_IMAP_ENVELOPE);
+ envelope = mail_get_special(mail, MAIL_FETCH_IMAP_ENVELOPE);
if (envelope == NULL)
return -1;
@@ -398,13 +404,13 @@
enum mail_flags flags;
const char *const *keywords;
- flags = mail->get_flags(mail);
- keywords = mail->get_keywords(mail);
+ flags = mail_get_flags(mail);
+ keywords = mail_get_keywords(mail);
if (ctx->flags_update_seen && (flags & MAIL_SEEN) == 0) {
/* Add \Seen flag */
flags |= MAIL_SEEN;
- if (mail->update_flags(mail, MODIFY_ADD, MAIL_SEEN) < 0)
+ if (mail_update_flags(mail, MODIFY_ADD, MAIL_SEEN) < 0)
return -1;
} else if (ctx->flags_show_only_seen_changes) {
return 1;
@@ -431,7 +437,7 @@
{
time_t time;
- time = mail->get_received_date(mail);
+ time = mail_get_received_date(mail);
if (time == (time_t)-1)
return -1;
Index: imap-fetch.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/imap-fetch.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- imap-fetch.h 11 Feb 2005 18:14:59 -0000 1.14
+++ imap-fetch.h 15 Mar 2005 19:01:51 -0000 1.15
@@ -28,6 +28,7 @@
struct mailbox_transaction_context *trans;
struct mail_search_context *search_ctx;
+ struct mail *mail;
enum mail_fetch_field fetch_data;
buffer_t *all_headers_buf;
Index: imap-sort.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/imap-sort.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- imap-sort.c 5 Feb 2005 18:07:26 -0000 1.19
+++ imap-sort.c 15 Mar 2005 19:01:51 -0000 1.20
@@ -30,6 +30,7 @@
struct sort_context {
struct mail_search_context *search_ctx;
struct mailbox_transaction_context *t;
+ struct mail *other_mail;
enum mail_sort_type sort_program[MAX_SORT_PROGRAM_SIZE];
enum mail_sort_type common_mask, cache_mask;
@@ -228,15 +229,9 @@
wanted_headers);
/* initialize searching */
- ctx->t = mailbox_transaction_begin(client->mailbox, FALSE);
- ctx->search_ctx =
- mailbox_search_init(ctx->t, charset, args, norm_prog,
- wanted_fields, headers_ctx);
- if (ctx->search_ctx == NULL) {
- mailbox_transaction_rollback(ctx->t);
- mailbox_header_lookup_deinit(headers_ctx);
- return -1;
- }
+ ctx->t = mailbox_transaction_begin(client->mailbox, 0);
+ ctx->search_ctx = mailbox_search_init(ctx->t, charset, args, norm_prog);
+ ctx->other_mail = mail_alloc(ctx->t, wanted_fields, headers_ctx);
ctx->box = client->mailbox;
ctx->output = client->output;
@@ -248,9 +243,13 @@
ctx->id_is_uid = cmd->uid;
- while ((mail = mailbox_search_next(ctx->search_ctx)) != NULL)
+ mail = mail_alloc(ctx->t, wanted_fields, headers_ctx);
+ while (mailbox_search_next(ctx->search_ctx, mail) > 0)
mail_sort_input(ctx, mail);
+ mail_free(mail);
+ mail_free(ctx->other_mail);
+
mail_sort_flush(ctx);
ret = mailbox_search_deinit(ctx->search_ctx);
@@ -291,7 +290,7 @@
struct message_address *addr;
const char *str;
- str = mail->get_header(mail, field);
+ str = mail_get_header(mail, field);
if (str == NULL)
return NULL;
@@ -309,7 +308,7 @@
int changed = FALSE;
if (ctx->common_mask & MAIL_SORT_ARRIVAL) {
- t = mail->get_received_date(mail);
+ t = mail_get_received_date(mail);
if (t != ctx->last_arrival) {
ctx->last_arrival = t;
changed = TRUE;
@@ -329,7 +328,7 @@
}
if (ctx->common_mask & MAIL_SORT_DATE) {
- t = mail->get_date(mail, NULL);
+ t = mail_get_date(mail, NULL);
if (t != ctx->last_date) {
ctx->last_date = t;
changed = TRUE;
@@ -349,7 +348,7 @@
}
if (ctx->common_mask & MAIL_SORT_SIZE) {
- size = mail->get_virtual_size(mail);
+ size = mail_get_virtual_size(mail);
if (size != ctx->last_size) {
ctx->last_size = size;
changed = TRUE;
@@ -357,7 +356,7 @@
}
if (ctx->common_mask & MAIL_SORT_SUBJECT) {
- str = mail->get_header(mail, "subject");
+ str = mail_get_header(mail, "subject");
if (str != NULL) {
str = imap_get_base_subject_cased(
pool_datastack_create(), str, NULL);
@@ -409,7 +408,7 @@
if (ctx->common_mask & MAIL_SORT_ARRIVAL)
t = ctx->last_arrival;
else
- t = mail->get_received_date(mail);
+ t = mail_get_received_date(mail);
memcpy(buf + pos, &t, sizeof(t)); pos += sizeof(t);
}
@@ -417,7 +416,7 @@
if (ctx->common_mask & MAIL_SORT_DATE)
t = ctx->last_date;
else
- t = mail->get_date(mail, NULL);
+ t = mail_get_date(mail, NULL);
memcpy(buf + pos, &t, sizeof(t)); pos += sizeof(t);
}
@@ -425,7 +424,7 @@
if (ctx->common_mask & MAIL_SORT_SIZE)
size = ctx->last_size;
else
- size = mail->get_virtual_size(mail);
+ size = mail_get_virtual_size(mail);
memcpy(buf + pos, &size, sizeof(size)); pos += sizeof(size);
}
@@ -476,7 +475,7 @@
if (ctx->common_mask & MAIL_SORT_SUBJECT)
str = ctx->last_subject;
else {
- str = mail->get_header(mail, "subject");
+ str = mail_get_header(mail, "subject");
if (str != NULL) {
str = imap_get_base_subject_cased(
@@ -507,7 +506,10 @@
if (mailbox_get_uids(ctx->box, id, id, &seq, &seq) < 0)
return NULL;
}
- return mailbox_fetch(ctx->t, seq, 0);
+
+ if (mail_set_seq(ctx->other_mail, seq) < 0)
+ return NULL;
+ return ctx->other_mail;
}
@@ -524,9 +526,9 @@
switch (type) {
case MAIL_SORT_ARRIVAL:
- return mail->get_received_date(mail);
+ return mail_get_received_date(mail);
case MAIL_SORT_DATE:
- t = mail->get_date(mail, NULL);
+ t = mail_get_date(mail, NULL);
if (t == (time_t)-1)
t = 0;
return t;
@@ -554,7 +556,7 @@
i_assert(type == MAIL_SORT_SIZE);
- return mail->get_virtual_size(mail);
+ return mail_get_virtual_size(mail);
}
/* use memcpy() to avoid any alignment problems */
@@ -578,7 +580,7 @@
switch (type) {
case MAIL_SORT_SUBJECT:
- str = mail->get_header(mail, "subject");
+ str = mail_get_header(mail, "subject");
if (str == NULL)
return NULL;
Index: imap-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/imap-sync.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- imap-sync.c 14 Mar 2005 21:17:58 -0000 1.9
+++ imap-sync.c 15 Mar 2005 19:01:51 -0000 1.10
@@ -18,6 +18,7 @@
struct mailbox_transaction_context *t;
struct mailbox_sync_context *sync_ctx;
+ struct mail *mail;
struct mailbox_sync_rec sync_rec;
uint32_t seq;
@@ -40,7 +41,8 @@
ctx->box = box;
ctx->sync_ctx = mailbox_sync_init(box, flags);
- ctx->t = mailbox_transaction_begin(box, FALSE);
+ ctx->t = mailbox_transaction_begin(box, 0);
+ ctx->mail = mail_alloc(ctx->t, MAIL_FETCH_FLAGS, 0);
ctx->messages_count = client->messages_count;
return ctx;
}
@@ -49,6 +51,8 @@
{
struct mailbox_status status;
+ mail_free(ctx->mail);
+
if (mailbox_sync_deinit(ctx->sync_ctx, &status) < 0 || ctx->failed) {
mailbox_transaction_rollback(ctx->t);
i_free(ctx);
@@ -80,7 +84,6 @@
int imap_sync_more(struct imap_sync_context *ctx)
{
- struct mail *mail;
enum mail_flags flags;
const char *const *keywords;
string_t *str;
@@ -110,11 +113,13 @@
ctx->seq = ctx->sync_rec.seq1;
for (; ctx->seq <= ctx->sync_rec.seq2; ctx->seq++) {
- mail = mailbox_fetch(ctx->t, ctx->seq,
- MAIL_FETCH_FLAGS);
+ if (mail_set_seq(ctx->mail, ctx->seq) < 0) {
+ t_pop();
+ return -1;
+ }
- flags = mail->get_flags(mail);
- keywords = mail->get_keywords(mail);
+ flags = mail_get_flags(ctx->mail);
+ keywords = mail_get_keywords(ctx->mail);
str_truncate(str, 0);
str_printfa(str, "* %u FETCH (FLAGS (",
Index: imap-thread.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/imap-thread.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- imap-thread.c 5 Feb 2005 18:07:26 -0000 1.14
+++ imap-thread.c 15 Mar 2005 19:01:51 -0000 1.15
@@ -73,6 +73,7 @@
struct mailbox_transaction_context *t;
struct mailbox *box;
struct ostream *output;
+ struct mail *mail;
pool_t pool;
pool_t temp_pool;
@@ -117,19 +118,10 @@
i_fatal("Only REFERENCES threading supported");
ctx = t_new(struct thread_context, 1);
- headers_ctx = mailbox_header_lookup_init(client->mailbox,
- wanted_headers);
/* initialize searching */
- ctx->t = mailbox_transaction_begin(client->mailbox, FALSE);
- ctx->search_ctx =
- mailbox_search_init(ctx->t, charset, args, NULL,
- MAIL_FETCH_DATE, headers_ctx);
- if (ctx->search_ctx == NULL) {
- mailbox_transaction_rollback(ctx->t);
- mailbox_header_lookup_deinit(headers_ctx);
- return -1;
- }
+ ctx->t = mailbox_transaction_begin(client->mailbox, 0);
+ ctx->search_ctx = mailbox_search_init(ctx->t, charset, args, NULL);
ctx->box = client->mailbox;
ctx->output = client->output;
@@ -142,11 +134,16 @@
ctx->msgid_hash = hash_create(default_pool, ctx->temp_pool,
APPROX_MSG_COUNT*2, str_hash,
(hash_cmp_callback_t *)strcmp);
-
ctx->id_is_uid = cmd->uid;
- while ((mail = mailbox_search_next(ctx->search_ctx)) != NULL)
+
+ headers_ctx = mailbox_header_lookup_init(client->mailbox,
+ wanted_headers);
+ mail = mail_alloc(ctx->t, MAIL_FETCH_DATE, headers_ctx);
+ while (mailbox_search_next(ctx->search_ctx, mail) > 0)
mail_thread_input(ctx, mail);
+ mail_free(mail);
+
o_stream_send_str(client->output, "* THREAD");
mail_thread_finish(ctx);
o_stream_send_str(client->output, "\r\n");
@@ -447,18 +444,18 @@
t_push();
- sent_date = mail->get_date(mail, NULL);
+ sent_date = mail_get_date(mail, NULL);
if (sent_date == (time_t)-1)
sent_date = 0;
- message_id = mail->get_header(mail, "message-id");
+ message_id = mail_get_header(mail, "message-id");
node = update_message(ctx, get_msgid(&message_id), sent_date,
ctx->id_is_uid ? mail->uid : mail->seq);
/* link references */
- references = mail->get_header(mail, "references");
+ references = mail_get_header(mail, "references");
if (!link_references(ctx, node, references)) {
- in_reply_to = mail->get_header(mail, "in-reply-to");
+ in_reply_to = mail_get_header(mail, "in-reply-to");
refid = in_reply_to == NULL ? NULL : get_msgid(&in_reply_to);
if (refid != NULL)
@@ -661,8 +658,10 @@
static void gather_base_subjects(struct thread_context *ctx)
{
- struct mail *mail;
+ static const char *wanted_headers[] = { "subject", NULL };
+ struct mailbox_header_lookup_ctx *headers_ctx;
struct node *node;
+ const char *subject;
unsigned int id;
uint32_t seq;
@@ -670,6 +669,9 @@
hash_create(default_pool, ctx->temp_pool, ctx->root_count * 2,
str_hash, (hash_cmp_callback_t *)strcmp);
+ headers_ctx = mailbox_header_lookup_init(ctx->box, wanted_headers);
+ ctx->mail = mail_alloc(ctx->t, 0, headers_ctx);
+
node = ctx->root_node.first_child;
for (; node != NULL; node = node->next) {
if (!NODE_IS_DUMMY(node))
@@ -689,15 +691,16 @@
seq = 0;
}
- mail = seq == 0 ? NULL : mailbox_fetch(ctx->t, seq, 0);
-
- if (mail != NULL) {
+ if (seq != 0 && mail_set_seq(ctx->mail, seq) == 0) {
t_push();
- add_base_subject(ctx, mail->get_header(mail, "subject"),
- node);
+ subject = mail_get_header(ctx->mail, "subject");
+ add_base_subject(ctx, subject, node);
t_pop();
}
}
+
+ mail_free(ctx->mail);
+ mailbox_header_lookup_deinit(headers_ctx);
}
static void reset_children_parent(struct node *parent)
Index: main.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/main.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- main.c 14 Mar 2005 21:17:58 -0000 1.61
+++ main.c 15 Mar 2005 19:01:51 -0000 1.62
@@ -45,7 +45,7 @@
static char log_prefix[128]; /* syslog() needs this to be permanent */
static pool_t namespace_pool;
-void (*hook_mail_storage_created)(struct mail_storage **storage) = NULL;
+void (*hook_mail_storage_created)(struct mail_storage *storage) = NULL;
void (*hook_client_created)(struct client **client) = NULL;
string_t *capability_string;
Index: namespace.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/namespace.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- namespace.c 29 Dec 2004 19:10:26 -0000 1.6
+++ namespace.c 15 Mar 2005 19:01:51 -0000 1.7
@@ -22,7 +22,7 @@
}
if (hook_mail_storage_created != NULL)
- hook_mail_storage_created(&ns->storage);
+ hook_mail_storage_created(ns->storage);
}
static struct namespace *
- Previous message: [dovecot-cvs] dovecot/src/lib-storage Makefile.am, 1.12,
1.13 mail-copy.c, 1.3, 1.4 mail-copy.h, 1.1,
1.2 mail-storage-private.h, 1.13, 1.14 mail-storage.c, 1.35,
1.36 mail-storage.h, 1.90, 1.91 mail.c, NONE,
1.1 proxy-mail-storage.c, 1.6, NONE proxy-mail-storage.h, 1.2,
NONE proxy-mail.c, 1.8, NONE proxy-mail.h, 1.1,
NONE proxy-mailbox.c, 1.15, NONE proxy-mailbox.h, 1.3, NONE
- Next message: [dovecot-cvs] dovecot/src/lib-storage/index index-fetch.c, 1.55,
1.56 index-mail-headers.c, 1.41, 1.42 index-mail.c, 1.71,
1.72 index-mail.h, 1.28, 1.29 index-search.c, 1.99,
1.100 index-storage.c, 1.69, 1.70 index-storage.h, 1.88,
1.89 index-transaction.c, 1.11, 1.12
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list