$Log$
+ Revision 647.19 2005/05/23 14:07:39 ajc
+ * serv_imap.c: improve SELECT time by fetching the msglist directly out of
+ the database instead of doing a CtdlForEachMessage() loop.
+
Revision 647.18 2005/05/22 16:12:25 ajc
* Full text indexer is now switchable on/off
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
-
*/
void imap_load_msgids(void)
{
+ struct cdbdata *cdbfr;
if (IMAP->selected == 0) {
lprintf(CTDL_ERR,
imap_free_msgids(); /* If there was already a map, free it */
TRACE;
- CtdlForEachMessage(MSGS_ALL, 0L, NULL, NULL,
- imap_add_single_msgid, NULL);
+ /* Load the message list */
+ cdbfr = cdb_fetch(CDB_MSGLISTS, &CC->room.QRnumber, sizeof(long));
+ if (cdbfr != NULL) {
+ IMAP->msgids = malloc(cdbfr->len);
+ memcpy(IMAP->msgids, cdbfr->ptr, cdbfr->len);
+ IMAP->num_msgs = cdbfr->len / sizeof(long);
+ IMAP->num_alloc = cdbfr->len / sizeof(long);
+ cdb_free(cdbfr);
+ }
+
+ if (IMAP->num_msgs) {
+ IMAP->flags = malloc(IMAP->num_alloc * sizeof(long));
+ memset(IMAP->flags, 0, (IMAP->num_alloc * sizeof(long)) );
+ }
TRACE;
imap_set_seen_flags(0);