]> code.citadel.org Git - citadel.git/commitdiff
* serv_imap.c: improve SELECT time by fetching the msglist directly out of
authorArt Cancro <ajc@citadel.org>
Mon, 23 May 2005 14:07:40 +0000 (14:07 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 23 May 2005 14:07:40 +0000 (14:07 +0000)
  the database instead of doing a CtdlForEachMessage() loop.

citadel/ChangeLog
citadel/serv_imap.c

index 862c44e9d4ba38d9e1d158362a1ae5c512a5f336..146c38e00f339723ca8b66519ae41bd56834fcdc 100644 (file)
@@ -1,4 +1,8 @@
  $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
 
@@ -6756,4 +6760,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
-
index 465c81ea91c1053448927bc7d60e2a62ee5c466c..b89b4f08b1f71285a64c3458e6b4cc5ebc181d76 100644 (file)
@@ -223,6 +223,7 @@ void imap_add_single_msgid(long msgnum, void *userdata)
  */
 void imap_load_msgids(void)
 {
+       struct cdbdata *cdbfr;
 
        if (IMAP->selected == 0) {
                lprintf(CTDL_ERR,
@@ -234,8 +235,20 @@ void imap_load_msgids(void)
        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);