[dovecot-cvs]
dovecot/src/pop3 client.c,1.14,1.15 commands.c,1.10,1.11
cras at procontrol.fi
cras at procontrol.fi
Sun Oct 26 22:13:17 EET 2003
- Previous message: [dovecot-cvs]
dovecot/src/lib-storage/index/mbox mbox-storage.c,1.70,1.71
- Next message: [dovecot-cvs]
dovecot/src/imap cmd-copy.c,1.15,1.16 cmd-search.c,1.17,1.18
cmd-store.c,1.19,1.20 imap-fetch.c,1.16,1.17 imap-fetch.h,1.4,1.5
imap-search.c,1.4,1.5 imap-search.h,1.1,1.2 imap-sort.c,1.8,1.9
imap-thread.c,1.5,1.6
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/dovecot/src/pop3
In directory danu:/tmp/cvs-serv11799/pop3
Modified Files:
client.c commands.c
Log Message:
Removed fetch_init/fetch_next from mail-storage. search_* makes it
unnecessary
Index: client.c
===================================================================
RCS file: /home/cvs/dovecot/src/pop3/client.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- client.c 6 Aug 2003 20:15:34 -0000 1.14
+++ client.c 26 Oct 2003 20:13:15 -0000 1.15
@@ -7,6 +7,7 @@
#include "ostream.h"
#include "mail-storage.h"
#include "commands.h"
+#include "mail-search.h"
#include <stdlib.h>
@@ -39,10 +40,10 @@
static int init_mailbox(struct client *client)
{
- struct mail_fetch_context *ctx;
+ struct mail_search_arg search_arg;
+ struct mail_search_context *ctx;
struct mail *mail;
struct mailbox_status status;
- const char *messageset;
int i, all_found, failed;
if (!client->mailbox->get_status(client->mailbox,
@@ -58,12 +59,14 @@
if (client->messages_count == 0)
return TRUE;
+ memset(&search_arg, 0, sizeof(search_arg));
+ search_arg.type = SEARCH_ALL;
+
client->message_sizes = i_new(uoff_t, client->messages_count);
- messageset = t_strdup_printf("1:%u", client->messages_count);
for (i = 0; i < 2; i++) {
- ctx = client->mailbox->fetch_init(client->mailbox,
- MAIL_FETCH_SIZE, NULL,
- messageset, FALSE);
+ ctx = client->mailbox->search_init(client->mailbox, NULL,
+ &search_arg, NULL,
+ MAIL_FETCH_SIZE, NULL);
if (ctx == NULL) {
client_send_storage_error(client);
return FALSE;
@@ -71,7 +74,7 @@
client->total_size = 0;
failed = FALSE;
- while ((mail = client->mailbox->fetch_next(ctx)) != NULL) {
+ while ((mail = client->mailbox->search_next(ctx)) != NULL) {
uoff_t size = mail->get_size(mail);
if (size == (uoff_t)-1) {
@@ -84,7 +87,7 @@
client->message_sizes[mail->seq-1] = size;
}
- if (!client->mailbox->fetch_deinit(ctx, &all_found)) {
+ if (!client->mailbox->search_deinit(ctx, &all_found)) {
client_send_storage_error(client);
return FALSE;
}
Index: commands.c
===================================================================
RCS file: /home/cvs/dovecot/src/pop3/commands.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- commands.c 6 Aug 2003 20:15:34 -0000 1.10
+++ commands.c 26 Oct 2003 20:13:15 -0000 1.11
@@ -6,6 +6,7 @@
#include "str.h"
#include "message-size.h"
#include "mail-storage.h"
+#include "mail-search.h"
#include "capability.h"
#include "commands.h"
@@ -255,20 +256,25 @@
static void fetch(struct client *client, unsigned int msgnum,
uoff_t body_lines)
{
- struct mail_fetch_context *ctx;
+ struct mail_search_arg search_arg;
+ struct mail_search_context *ctx;
struct mail *mail;
struct istream *stream;
- ctx = client->mailbox->fetch_init(client->mailbox,
- MAIL_FETCH_STREAM_HEADER |
- MAIL_FETCH_STREAM_BODY, NULL,
- dec2str(msgnum+1), FALSE);
+ memset(&search_arg, 0, sizeof(search_arg));
+ search_arg.type = SEARCH_SET;
+ search_arg.value.str = dec2str(msgnum+1);
+
+ ctx = client->mailbox->search_init(client->mailbox, NULL,
+ &search_arg, NULL,
+ MAIL_FETCH_STREAM_HEADER |
+ MAIL_FETCH_STREAM_BODY, NULL);
if (ctx == NULL) {
client_send_storage_error(client);
return;
}
- mail = client->mailbox->fetch_next(ctx);
+ mail = client->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.");
@@ -284,7 +290,7 @@
client_send_line(client, ".");
}
- (void)client->mailbox->fetch_deinit(ctx, NULL);
+ (void)client->mailbox->search_deinit(ctx, NULL);
}
static int cmd_retr(struct client *client, const char *args)
@@ -333,33 +339,37 @@
static void list_uids(struct client *client, unsigned int message)
{
- struct mail_fetch_context *ctx;
+ struct mail_search_arg search_arg;
+ struct mail_search_context *ctx;
struct mail *mail;
- const char *messageset;
int found = FALSE;
if (client->messages_count == 0 && message == 0)
return;
- messageset = message == 0 ?
- t_strdup_printf("1:%u", client->messages_count) :
- t_strdup_printf("%u", message);
+ memset(&search_arg, 0, sizeof(search_arg));
+ if (message == 0)
+ search_arg.type = SEARCH_ALL;
+ else {
+ search_arg.type = SEARCH_SET;
+ search_arg.value.str = dec2str(message);
+ }
- ctx = client->mailbox->fetch_init(client->mailbox, 0, NULL,
- messageset, FALSE);
+ ctx = client->mailbox->search_init(client->mailbox, NULL,
+ &search_arg, NULL, 0, NULL);
if (ctx == NULL) {
client_send_storage_error(client);
return;
}
- while ((mail = client->mailbox->fetch_next(ctx)) != NULL) {
+ while ((mail = client->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->fetch_deinit(ctx, NULL);
+ (void)client->mailbox->search_deinit(ctx, NULL);
if (!found && message != 0)
client_send_line(client, "-ERR Message not found.");
- Previous message: [dovecot-cvs]
dovecot/src/lib-storage/index/mbox mbox-storage.c,1.70,1.71
- Next message: [dovecot-cvs]
dovecot/src/imap cmd-copy.c,1.15,1.16 cmd-search.c,1.17,1.18
cmd-store.c,1.19,1.20 imap-fetch.c,1.16,1.17 imap-fetch.h,1.4,1.5
imap-search.c,1.4,1.5 imap-search.h,1.1,1.2 imap-sort.c,1.8,1.9
imap-thread.c,1.5,1.6
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list