[dovecot-cvs]
dovecot/src/pop3 client.c, 1.46, 1.47 commands.c, 1.39, 1.40
cras at dovecot.org
cras at dovecot.org
Tue Mar 15 21:01:56 EET 2005
- Previous message: [dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-copy.c,
1.33, 1.34 maildir-mail.c, 1.11, 1.12 maildir-save.c, 1.47,
1.48 maildir-storage.c, 1.92, 1.93 maildir-storage.h, 1.34,
1.35 maildir-transaction.c, 1.6, 1.7
- Next message: [dovecot-cvs] dovecot/src/imap cmd-append.c, 1.56, 1.57 cmd-copy.c,
1.27, 1.28 cmd-status.c, 1.21, 1.22 commands-util.c, 1.41,
1.42 commands-util.h, 1.21, 1.22
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /var/lib/cvs/dovecot/src/pop3
In directory talvi:/tmp/cvs-serv16056/pop3
Modified Files:
client.c commands.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: client.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/pop3/client.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- client.c 26 Dec 2004 09:12:46 -0000 1.46
+++ client.c 15 Mar 2005 19:01:53 -0000 1.47
@@ -70,9 +70,8 @@
}
client->uid_validity = status.uidvalidity;
- t = mailbox_transaction_begin(client->mailbox, FALSE);
- ctx = mailbox_search_init(t, NULL, &search_arg, NULL,
- MAIL_FETCH_VIRTUAL_SIZE, NULL);
+ t = mailbox_transaction_begin(client->mailbox, 0);
+ ctx = mailbox_search_init(t, NULL, &search_arg, NULL);
if (ctx == NULL) {
client_send_storage_error(client);
mailbox_transaction_rollback(t);
@@ -84,15 +83,16 @@
buffer_set_used_size(message_sizes_buf, 0);
failed = FALSE;
- while ((mail = mailbox_search_next(ctx)) != NULL) {
- uoff_t size = mail->get_virtual_size(mail);
+ mail = mail_alloc(t, MAIL_FETCH_VIRTUAL_SIZE, NULL);
+ while (mailbox_search_next(ctx, mail) > 0) {
+ uoff_t size = mail_get_virtual_size(mail);
if (size == (uoff_t)-1) {
failed = TRUE;
break;
}
- if ((mail->get_flags(mail) & MAIL_SEEN) != 0)
+ if ((mail_get_flags(mail) & MAIL_SEEN) != 0)
client->last_seen = mail->seq;
client->total_size += size;
@@ -101,6 +101,7 @@
client->messages_count =
message_sizes_buf->used / sizeof(uoff_t);
+ mail_free(mail);
if (mailbox_search_deinit(ctx) < 0) {
client_send_storage_error(client);
mailbox_transaction_rollback(t);
Index: commands.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/pop3/commands.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- commands.c 22 Jan 2005 16:41:55 -0000 1.39
+++ commands.c 15 Mar 2005 19:01:53 -0000 1.40
@@ -185,6 +185,7 @@
struct mail_search_context *ctx;
struct mail *mail;
uint32_t idx;
+ int ret = TRUE;
if (client->deleted_bitmask == NULL)
return TRUE;
@@ -192,18 +193,23 @@
memset(&search_arg, 0, sizeof(search_arg));
search_arg.type = SEARCH_ALL;
- ctx = mailbox_search_init(client->trans, NULL, &search_arg,
- NULL, 0, NULL);
- while ((mail = mailbox_search_next(ctx)) != NULL) {
+ ctx = mailbox_search_init(client->trans, NULL, &search_arg, NULL);
+ mail = mail_alloc(client->trans, 0, NULL);
+ while (mailbox_search_next(ctx, mail) > 0) {
idx = mail->seq - 1;
if ((client->deleted_bitmask[idx / CHAR_BIT] &
1 << (idx % CHAR_BIT)) != 0) {
- if (mail->expunge(mail) < 0)
- return FALSE;
+ if (mail_expunge(mail) < 0) {
+ ret = FALSE;
+ break;
+ }
}
}
+ mail_free(mail);
- return mailbox_search_deinit(ctx) == 0;
+ if (mailbox_search_deinit(ctx) < 0)
+ ret = FALSE;
+ return ret;
}
static int cmd_quit(struct client *client, const char *args __attr_unused__)
@@ -230,6 +236,7 @@
struct fetch_context {
struct mail_search_context *search_ctx;
+ struct mail *mail;
struct istream *stream;
uoff_t body_lines;
@@ -243,6 +250,7 @@
static void fetch_deinit(struct fetch_context *ctx)
{
(void)mailbox_search_deinit(ctx->search_ctx);
+ mail_free(ctx->mail);
i_free(ctx);
}
@@ -342,7 +350,6 @@
static void fetch(struct client *client, unsigned int msgnum, uoff_t body_lines)
{
struct fetch_context *ctx;
- struct mail *mail;
ctx = i_new(struct fetch_context, 1);
@@ -351,11 +358,15 @@
ctx->search_arg.value.seqset = &ctx->seqset;
ctx->search_ctx = mailbox_search_init(client->trans, NULL,
- &ctx->search_arg,
- NULL, MAIL_FETCH_STREAM_HEADER |
- MAIL_FETCH_STREAM_BODY, NULL);
- mail = mailbox_search_next(ctx->search_ctx);
- ctx->stream = mail == NULL ? NULL : mail->get_stream(mail, NULL, NULL);
+ &ctx->search_arg, NULL);
+ ctx->mail = mail_alloc(client->trans, MAIL_FETCH_STREAM_HEADER |
+ MAIL_FETCH_STREAM_BODY, NULL);
+
+ if (mailbox_search_next(ctx->search_ctx, ctx->mail) <= 0)
+ ctx->stream = NULL;
+ else
+ ctx->stream = mail_get_stream(ctx->mail, NULL, NULL);
+
if (ctx->stream == NULL) {
client_send_line(client, "-ERR Message not found.");
fetch_deinit(ctx);
@@ -363,9 +374,10 @@
}
if (body_lines == (uoff_t)-1 && !no_flag_updates) {
- if ((mail->get_flags(mail) & MAIL_SEEN) == 0) {
+ if ((mail_get_flags(ctx->mail) & MAIL_SEEN) == 0) {
/* mark the message seen with RETR command */
- (void)mail->update_flags(mail, MODIFY_ADD, MAIL_SEEN);
+ (void)mail_update_flags(ctx->mail,
+ MODIFY_ADD, MAIL_SEEN);
}
}
@@ -414,7 +426,7 @@
/* forget all our seen flag updates as well.. */
mailbox_transaction_rollback(client->trans);
- client->trans = mailbox_transaction_begin(client->mailbox, FALSE);
+ client->trans = mailbox_transaction_begin(client->mailbox, 0);
if (enable_last_command) {
/* remove all \Seen flags */
@@ -422,12 +434,14 @@
search_arg.type = SEARCH_ALL;
search_ctx = mailbox_search_init(client->trans, NULL,
- &search_arg, NULL, 0, NULL);
- while ((mail = mailbox_search_next(search_ctx)) != NULL) {
- if (mail->update_flags(mail, MAIL_SEEN,
- MODIFY_REMOVE) < 0)
+ &search_arg, NULL);
+ mail = mail_alloc(client->trans, 0, NULL);
+ while (mailbox_search_next(search_ctx, mail) > 0) {
+ if (mail_update_flags(mail, MAIL_SEEN,
+ MODIFY_REMOVE) < 0)
break;
}
+ mail_free(mail);
(void)mailbox_search_deinit(search_ctx);
}
@@ -460,6 +474,7 @@
struct cmd_uidl_context {
struct mail_search_context *search_ctx;
+ struct mail *mail;
unsigned int message;
struct mail_search_arg search_arg;
@@ -476,7 +491,6 @@
{ '\0', NULL }
};
struct var_expand_table *tab;
- struct mail *mail;
string_t *str;
int ret, found = FALSE;
@@ -485,10 +499,9 @@
tab[0].value = t_strdup_printf("%u", client->uid_validity);
str = str_new(default_pool, 128);
-
- while ((mail = mailbox_search_next(ctx->search_ctx)) != NULL) {
+ while (mailbox_search_next(ctx->search_ctx, ctx->mail) > 0) {
if (client->deleted) {
- uint32_t idx = mail->seq - 1;
+ uint32_t idx = ctx->mail->seq - 1;
if (client->deleted_bitmask[idx / CHAR_BIT] &
(1 << (idx % CHAR_BIT)))
continue;
@@ -497,20 +510,20 @@
t_push();
if ((uidl_keymask & UIDL_UID) != 0)
- tab[1].value = dec2str(mail->uid);
+ tab[1].value = dec2str(ctx->mail->uid);
if ((uidl_keymask & UIDL_MD5) != 0) {
- tab[2].value =
- mail->get_special(mail, MAIL_FETCH_HEADER_MD5);
+ tab[2].value = mail_get_special(ctx->mail,
+ MAIL_FETCH_HEADER_MD5);
}
if ((uidl_keymask & UIDL_FILE_NAME) != 0) {
tab[3].value =
- mail->get_special(mail,
- MAIL_FETCH_UIDL_FILE_NAME);
+ mail_get_special(ctx->mail,
+ MAIL_FETCH_UIDL_FILE_NAME);
}
str_truncate(str, 0);
str_printfa(str, ctx->message == 0 ? "%u " : "+OK %u ",
- mail->seq);
+ ctx->mail->seq);
var_expand(str, uidl_format, tab);
ret = client_send_line(client, "%s", str_c(str));
@@ -528,6 +541,7 @@
str_free(str);
/* finished */
+ mail_free(ctx->mail);
(void)mailbox_search_deinit(ctx->search_ctx);
client->cmd = NULL;
@@ -567,8 +581,8 @@
wanted_fields |= MAIL_FETCH_HEADER_MD5;
ctx->search_ctx = mailbox_search_init(client->trans, NULL,
- &ctx->search_arg, NULL,
- wanted_fields, NULL);
+ &ctx->search_arg, NULL);
+ ctx->mail = mail_alloc(client->trans, wanted_fields, NULL);
if (message == 0) {
client->cmd = cmd_uidl_callback;
client->cmd_context = ctx;
- Previous message: [dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-copy.c,
1.33, 1.34 maildir-mail.c, 1.11, 1.12 maildir-save.c, 1.47,
1.48 maildir-storage.c, 1.92, 1.93 maildir-storage.h, 1.34,
1.35 maildir-transaction.c, 1.6, 1.7
- Next message: [dovecot-cvs] dovecot/src/imap cmd-append.c, 1.56, 1.57 cmd-copy.c,
1.27, 1.28 cmd-status.c, 1.21, 1.22 commands-util.c, 1.41,
1.42 commands-util.h, 1.21, 1.22
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list