[dovecot-cvs]
dovecot/src/pop3 client.c, 1.15, 1.16 commands.c, 1.11,
1.12 mail-storage-callbacks.c, 1.2, 1.3
cras at procontrol.fi
cras at procontrol.fi
Tue Apr 27 23:25:57 EEST 2004
- Previous message: [dovecot-cvs]
dovecot/src/lib-storage/subscription-file Makefile.am, 1.1.1.1,
1.2 subscription-file.c, 1.22, 1.23 subscription-file.h, 1.6, 1.7
- Next message: [dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-mail.c,
NONE, 1.1 maildir-sync.c, NONE, 1.1 maildir-transaction.c,
NONE, 1.1 maildir-uidlist.c, NONE, 1.1 maildir-uidlist.h, NONE,
1.1 maildir-util.c, NONE, 1.1 Makefile.am, 1.1.1.1,
1.2 maildir-copy.c, 1.29, 1.30 maildir-list.c, 1.25,
1.26 maildir-save.c, 1.30, 1.31 maildir-storage.c, 1.66,
1.67 maildir-storage.h, 1.19, 1.20 maildir-expunge.c, 1.14, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/dovecot/src/pop3
In directory talvi:/tmp/cvs-serv29236/src/pop3
Modified Files:
client.c commands.c mail-storage-callbacks.c
Log Message:
importing new index code. mbox still broken.
Index: client.c
===================================================================
RCS file: /home/cvs/dovecot/src/pop3/client.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- client.c 26 Oct 2003 20:13:15 -0000 1.15
+++ client.c 27 Apr 2004 20:25:55 -0000 1.16
@@ -41,14 +41,15 @@
static int init_mailbox(struct client *client)
{
struct mail_search_arg search_arg;
+ struct mailbox_transaction_context *t;
struct mail_search_context *ctx;
struct mail *mail;
struct mailbox_status status;
- int i, all_found, failed;
+ int i, failed;
- if (!client->mailbox->get_status(client->mailbox,
- STATUS_MESSAGES | STATUS_UIDVALIDITY,
- &status)) {
+ if (mailbox_get_status(client->mailbox,
+ STATUS_MESSAGES | STATUS_UIDVALIDITY,
+ &status) < 0) {
client_send_storage_error(client);
return FALSE;
}
@@ -62,19 +63,21 @@
memset(&search_arg, 0, sizeof(search_arg));
search_arg.type = SEARCH_ALL;
+ t = mailbox_transaction_begin(client->mailbox, FALSE);
+
client->message_sizes = i_new(uoff_t, client->messages_count);
for (i = 0; i < 2; i++) {
- ctx = client->mailbox->search_init(client->mailbox, NULL,
- &search_arg, NULL,
- MAIL_FETCH_SIZE, NULL);
+ ctx = mailbox_search_init(t, NULL, &search_arg, NULL,
+ MAIL_FETCH_SIZE, NULL);
if (ctx == NULL) {
client_send_storage_error(client);
+ mailbox_transaction_rollback(t);
return FALSE;
}
client->total_size = 0;
failed = FALSE;
- while ((mail = client->mailbox->search_next(ctx)) != NULL) {
+ while ((mail = mailbox_search_next(ctx)) != NULL) {
uoff_t size = mail->get_size(mail);
if (size == (uoff_t)-1) {
@@ -87,20 +90,23 @@
client->message_sizes[mail->seq-1] = size;
}
- if (!client->mailbox->search_deinit(ctx, &all_found)) {
+ if (mailbox_search_deinit(ctx) < 0) {
client_send_storage_error(client);
+ mailbox_transaction_rollback(t);
return FALSE;
}
- if (!failed && all_found)
+ if (!failed)
return TRUE;
/* well, sync and try again */
- if (!client->mailbox->sync(client->mailbox, TRUE)) {
+ if (mailbox_sync(client->mailbox, 0) < 0) {
client_send_storage_error(client);
+ mailbox_transaction_rollback(t);
return FALSE;
}
}
+ mailbox_transaction_commit(t);
client_send_line(client, "-ERR [IN-USE] Couldn't sync mailbox.");
return FALSE;
@@ -124,11 +130,11 @@
client->last_input = ioloop_time;
client->storage = storage;
- storage->set_callbacks(storage, &mail_storage_callbacks, client);
+ mail_storage_set_callbacks(storage, &mail_storage_callbacks, client);
flags = getenv("MMAP_INVALIDATE") != NULL ?
MAILBOX_OPEN_MMAP_INVALIDATE : 0;
- client->mailbox = storage->open_mailbox(storage, "INBOX", flags);
+ client->mailbox = mailbox_open(storage, "INBOX", flags);
if (client->mailbox == NULL) {
client_send_line(client, "-ERR No INBOX for user.");
return NULL;
@@ -152,7 +158,7 @@
o_stream_flush(client->output);
if (client->mailbox != NULL)
- client->mailbox->close(client->mailbox);
+ mailbox_close(client->mailbox);
mail_storage_destroy(client->storage);
i_free(client->message_sizes);
@@ -195,14 +201,14 @@
{
const char *error;
- if (client->mailbox->is_inconsistency_error(client->mailbox)) {
+ if (mailbox_is_inconsistent(client->mailbox)) {
client_send_line(client, "-ERR Mailbox is in inconsistent "
"state, please relogin.");
client_disconnect(client);
return;
}
- error = client->storage->get_last_error(client->storage, NULL);
+ error = mail_storage_get_last_error(client->storage, NULL);
client_send_line(client, "-ERR %s", error != NULL ? error :
"BUG: Unknown error");
}
Index: commands.c
===================================================================
RCS file: /home/cvs/dovecot/src/pop3/commands.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- commands.c 26 Oct 2003 20:13:15 -0000 1.11
+++ commands.c 27 Apr 2004 20:25:55 -0000 1.12
@@ -142,34 +142,39 @@
static int expunge_mails(struct client *client, struct mailbox *box)
{
- struct mail_expunge_context *ctx;
+ struct mail_search_arg search_arg;
+ struct mailbox_transaction_context *t;
+ struct mail_search_context *ctx;
struct mail *mail;
- unsigned int i, j;
+ uint32_t i;
int failed = FALSE;
- /* NOTE: if there's any external expunges, they'll get synced here.
- Currently we update only the deleted_bitmask[] so we don't end up
- expunging wrong messages, but message_sizes[] isn't updated. */
- ctx = box->expunge_init(box, 0, TRUE);
- if (ctx == NULL)
+ memset(&search_arg, 0, sizeof(search_arg));
+ search_arg.type = SEARCH_ALL;
+
+ t = mailbox_transaction_begin(box, FALSE);
+ ctx = mailbox_search_init(t, NULL, &search_arg, NULL,
+ MAIL_FETCH_SIZE, NULL);
+ if (ctx == NULL) {
+ mailbox_transaction_rollback(t);
return FALSE;
+ }
- i = j = 0;
- while ((mail = box->expunge_fetch_next(ctx)) != NULL) {
- if ((client->deleted_bitmask[i] & (1 << j)) != 0) {
- if (!mail->expunge(mail, ctx, NULL, FALSE)) {
+ while ((mail = mailbox_search_next(ctx)) != NULL) {
+ i = mail->seq-1;
+ if ((client->deleted_bitmask[i >> CHAR_BIT] &
+ (1 << (i % CHAR_BIT))) != 0) {
+ if (mail->expunge(mail) < 0) {
failed = TRUE;
break;
}
}
- if (++j == CHAR_BIT) {
- j = 0; i++;
- }
}
- if (!box->expunge_deinit(ctx))
+ if (mailbox_search_deinit(ctx) < 0)
return FALSE;
+ mailbox_transaction_commit(t);
return !failed;
}
@@ -257,24 +262,29 @@
uoff_t body_lines)
{
struct mail_search_arg search_arg;
+ struct mail_search_seqset seqset;
+ struct mailbox_transaction_context *t;
struct mail_search_context *ctx;
struct mail *mail;
struct istream *stream;
+ seqset.seq1 = seqset.seq2 = msgnum+1;
+
memset(&search_arg, 0, sizeof(search_arg));
- search_arg.type = SEARCH_SET;
- search_arg.value.str = dec2str(msgnum+1);
+ search_arg.type = SEARCH_SEQSET;
+ search_arg.value.seqset = &seqset;
- ctx = client->mailbox->search_init(client->mailbox, NULL,
- &search_arg, NULL,
- MAIL_FETCH_STREAM_HEADER |
- MAIL_FETCH_STREAM_BODY, NULL);
+ t = mailbox_transaction_begin(client->mailbox, FALSE);
+ ctx = mailbox_search_init(t, NULL, &search_arg, NULL,
+ MAIL_FETCH_STREAM_HEADER |
+ MAIL_FETCH_STREAM_BODY, NULL);
if (ctx == NULL) {
+ mailbox_transaction_rollback(t);
client_send_storage_error(client);
return;
}
- mail = client->mailbox->search_next(ctx);
+ mail = mailbox_search_next(ctx);
stream = mail == NULL ? NULL : mail->get_stream(mail, NULL, NULL);
if (stream == NULL)
client_send_line(client, "-ERR Message not found.");
@@ -290,7 +300,8 @@
client_send_line(client, ".");
}
- (void)client->mailbox->search_deinit(ctx, NULL);
+ (void)mailbox_search_deinit(ctx);
+ (void)mailbox_transaction_commit(t);
}
static int cmd_retr(struct client *client, const char *args)
@@ -340,6 +351,8 @@
static void list_uids(struct client *client, unsigned int message)
{
struct mail_search_arg search_arg;
+ struct mail_search_seqset seqset;
+ struct mailbox_transaction_context *t;
struct mail_search_context *ctx;
struct mail *mail;
int found = FALSE;
@@ -351,25 +364,28 @@
if (message == 0)
search_arg.type = SEARCH_ALL;
else {
- search_arg.type = SEARCH_SET;
- search_arg.value.str = dec2str(message);
+ seqset.seq1 = seqset.seq2 = message;
+ search_arg.type = SEARCH_SEQSET;
+ search_arg.value.seqset = &seqset;
}
- ctx = client->mailbox->search_init(client->mailbox, NULL,
- &search_arg, NULL, 0, NULL);
+ t = mailbox_transaction_begin(client->mailbox, FALSE);
+ ctx = mailbox_search_init(t, NULL, &search_arg, NULL, 0, NULL);
if (ctx == NULL) {
+ mailbox_transaction_rollback(t);
client_send_storage_error(client);
return;
}
- while ((mail = client->mailbox->search_next(ctx)) != NULL) {
+ while ((mail = mailbox_search_next(ctx)) != NULL) {
client_send_line(client, message == 0 ?
"%u %u.%u" : "+OK %u %u.%u",
mail->seq, client->uidvalidity, mail->uid);
found = TRUE;
}
- (void)client->mailbox->search_deinit(ctx, NULL);
+ (void)mailbox_search_deinit(ctx);
+ (void)mailbox_transaction_commit(t);
if (!found && message != 0)
client_send_line(client, "-ERR Message not found.");
Index: mail-storage-callbacks.c
===================================================================
RCS file: /home/cvs/dovecot/src/pop3/mail-storage-callbacks.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- mail-storage-callbacks.c 26 Jul 2003 16:33:22 -0000 1.2
+++ mail-storage-callbacks.c 27 Apr 2004 20:25:55 -0000 1.3
@@ -54,7 +54,6 @@
static void update_flags(struct mailbox *mailbox __attr_unused__,
unsigned int seq __attr_unused__,
- unsigned int uid __attr_unused__,
const struct mail_full_flags *flags __attr_unused__,
void *context __attr_unused__)
{
- Previous message: [dovecot-cvs]
dovecot/src/lib-storage/subscription-file Makefile.am, 1.1.1.1,
1.2 subscription-file.c, 1.22, 1.23 subscription-file.h, 1.6, 1.7
- Next message: [dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-mail.c,
NONE, 1.1 maildir-sync.c, NONE, 1.1 maildir-transaction.c,
NONE, 1.1 maildir-uidlist.c, NONE, 1.1 maildir-uidlist.h, NONE,
1.1 maildir-util.c, NONE, 1.1 Makefile.am, 1.1.1.1,
1.2 maildir-copy.c, 1.29, 1.30 maildir-list.c, 1.25,
1.26 maildir-save.c, 1.30, 1.31 maildir-storage.c, 1.66,
1.67 maildir-storage.h, 1.19, 1.20 maildir-expunge.c, 1.14, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list