Mercurial > dovecot > original-hg > dovecot-1.2
diff src/pop3/client.c @ 2322:aae574ed7f4c HEAD
Broke mailbox_sync() into iterator.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 12 Jul 2004 14:35:50 +0300 |
parents | 9cc23c29aaec |
children | d141e1bfdd63 |
line wrap: on
line diff
--- a/src/pop3/client.c Mon Jul 12 14:31:34 2004 +0300 +++ b/src/pop3/client.c Mon Jul 12 14:35:50 2004 +0300 @@ -38,6 +38,18 @@ o_stream_close(client->output); } +static int sync_mailbox(struct mailbox *box) +{ + struct mailbox_sync_context *ctx; + struct mailbox_sync_rec sync_rec; + struct mailbox_status status; + + ctx = mailbox_sync_init(box, 0); + while (mailbox_sync_next(ctx, &sync_rec) > 0) + ; + return mailbox_sync_deinit(ctx, &status); +} + static int init_mailbox(struct client *client) { struct mail_search_arg search_arg; @@ -51,6 +63,10 @@ search_arg.type = SEARCH_ALL; for (i = 0; i < 2; i++) { + if (sync_mailbox(client->mailbox) < 0) { + client_send_storage_error(client); + return FALSE; + } if (mailbox_get_status(client->mailbox, STATUS_MESSAGES, &status) < 0) { client_send_storage_error(client); @@ -104,10 +120,6 @@ /* well, sync and try again */ mailbox_transaction_rollback(t); - if (mailbox_sync(client->mailbox, 0) < 0) { - client_send_storage_error(client); - return FALSE; - } } client_send_line(client, "-ERR [IN-USE] Couldn't sync mailbox.");