Commit 9c57918e 9c57918efb596b918322bd6ba8aeeabc2cfd6a57 by Alain Magloire

A small cleanup of the IMAP code.

	* mailbox/folder_imap.c (imap_body):  Destry the cache header
	if it was previously set on a SCAN.
	* mailbox/mbx_imap.c (delete_to_string): New function, to generate
	a string of IMAP message numbers.
	(imap_expunge): use delete_to_string;
	(attribute_string): Removed.
	(flags_string): Removed.
	(flags_to_string): Replace attribute_string() and flags_string().
	(message_operation): Rename to fetch_operation.
	* mailbox/include/imap0.h(struct _f_imap): field func and id
	removed, never used.
1 parent cf69f401
2001-10-11 Alain Magloire
A small cleanup of the IMAP code.
* mailbox/folder_imap.c (imap_body): Destry the cache header
if it was previously set on a SCAN.
* mailbox/mbx_imap.c (delete_to_string): New function, to generate
a string of IMAP message numbers.
(imap_expunge): use delete_to_string;
(attribute_string): Removed.
(flags_string): Removed.
(flags_to_string): Replace attribute_string() and flags_string().
(message_operation): Rename to fetch_operation.
* mailbox/include/imap0.h(struct _f_imap): field func and id
removed, never used.
2001-10-11 Alain Magloire
* mailbox/folder_imap.c (imap_quoted_string): Free the buffer.
(imap_string): Free the buffer.
(imap_body): Check if we already have the fheader header.
......@@ -7,14 +23,15 @@
2001-10-11 Alain Magloire
In order to boost performance, when doing the scan we use
the approach of downloading part of the header of the total
set of messages. The it was done before is that the headers
were ask one by one per message. This was causing performance
delay because we were doing a lot of small transaction on
In order to boost performance, when doing the scan, we use
the approach of downloading a subset of the header from all
of messages. The way it was done before was that the headers
were requested one by one per message. This was causing performance
issues because we were doing a lot of small transactions on
the TCP/IP stack. By bundling the entire thing in one request
there was much less transcation and the speed was increase
by a factor of 10++.
"a0000 FETCH 1:* (FLAGS RFC822.SIZE BODY.PEEK[HEADER.FIELDS(..)])\r\n"
there were less transcations and the speed was increase
by a factor of 100+.
The Imap code folder_imap.c and mbx_imap.c is now messy.
The rewrite in mailbox2 should clean this up though.
......
......@@ -61,6 +61,7 @@ record_t imap_record = &_imap_record;
#ifndef HAVE_STRTOK_R
char *strtok_r __P ((char *, const char *, char **));
#endif
/* Concrete IMAP implementation. */
static int folder_imap_open __P ((folder_t, int));
static int folder_imap_create __P ((folder_t));
......@@ -122,7 +123,7 @@ _folder_imap_init (folder_t folder)
return 0;
}
/* Destroy the resources. */
/* Destroy the folder resources. */
static void
folder_imap_destroy (folder_t folder)
{
......@@ -1374,9 +1375,12 @@ imap_body (f_imap_t f_imap, char **ptr)
}
}
status = imap_string (f_imap, ptr);
if (f_imap->callback.msg_imap->fheader == NULL
&& f_imap->state == IMAP_SCAN_ACK && f_imap->callback.total)
/* If the state scan. Catch it here. */
if (f_imap->state == IMAP_SCAN_ACK)
{
if (f_imap->callback.msg_imap->fheader)
header_destroy (&f_imap->callback.msg_imap->fheader, NULL);
status = header_create (&f_imap->callback.msg_imap->fheader,
f_imap->callback.buffer, f_imap->callback.total,
NULL);
......
......@@ -39,7 +39,7 @@ extern "C" {
#endif /*__P */
#define CLEAR_STATE(f_imap) \
f_imap->selected = NULL, f_imap->id = 0, f_imap->func = NULL, f_imap->state = IMAP_NO_STATE
f_imap->selected = NULL, f_imap->state = IMAP_NO_STATE
/* Clear the state and close the stream. */
#define CHECK_ERROR_CLOSE(folder, f_imap, status) \
......@@ -136,8 +136,6 @@ struct _f_imap
m_imap_t selected;
enum imap_state state;
void *func;
size_t id;
size_t seq; /* Sequence number to build a tag. */
char *capa; /* Cabilities of the server. */
......