*** empty log message ***
authorArt Cancro <ajc@citadel.org>
Sat, 28 Apr 2001 04:18:45 +0000 (04:18 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 28 Apr 2001 04:18:45 +0000 (04:18 +0000)
citadel/ChangeLog
citadel/database_sleepycat.c
citadel/imap_fetch.c
citadel/imap_tools.c
citadel/msgbase.c
citadel/serv_imap.c
citadel/serv_imap.h
citadel/serv_vandelay.c

index a78654c52b1abd9294e0eb917aee43f53ebe1a11..985de7054337200ee1214dc9b52c270fd31649e5 100644 (file)
@@ -1,4 +1,7 @@
  $Log$
+ Revision 573.131  2001/04/28 04:18:44  ajc
+ *** empty log message ***
+
  Revision 573.130  2001/04/26 03:31:00  ajc
  * Finished the implementation of per-message seen/unseen logic, both in the
    server proper and in IMAP.  Citadel protocol uses new "seen" command.
@@ -2513,4 +2516,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 16b98813633c169176901c5063989d03feeef462..d067be9bfb1b5c69d3e650b76f4930ebe08150cc 100644 (file)
@@ -540,13 +540,14 @@ struct cdbdata *cdb_next_item(int cdb)
 
 void cdb_begin_transaction(void) {
 
-       if (MYTID != NULL) {    /* FIXME this slows it down, take it out */
+       /******** this check slows it down and is not needed except to debug
+       if (MYTID != NULL) {
                lprintf(1, "cdb_begin_transaction: ERROR: opening a new transaction with one already open!\n");
                abort();
        }
-       else {
-               txbegin(&MYTID);
-       }
+       ***************************/
+
+       txbegin(&MYTID);
 }
 
 void cdb_end_transaction(void) {
index a380732dba2e4ca4c683c5e24e0764916afed54a..011119d3aca25d5e0b6b4e0cf7cc27ee2a306178 100644 (file)
@@ -513,8 +513,9 @@ void imap_fetch_body(long msgnum, char *item, int is_peek,
 
        fclose(tmp);
 
-       if (is_peek) {
-               /* FIXME set the last read pointer or something */
+       /* Mark this message as "seen" *unless* this is a "peek" operation */
+       if (is_peek == 0) {
+               CtdlSetSeen(msgnum, 1);
        }
 }
 
index 15b35627aaf4a4a3750c07596f8ed7e6d266da96..58aabd897da843ac79c3b2e8fa8c070419c79e8e 100644 (file)
@@ -149,7 +149,6 @@ int imap_roomname(char *rbuf, int bufsize, char *foldername)
                extract(buf, foldername, 0);
                for (i = 0; i < MAXFLOORS; ++i) {
                        fl = cgetfloor(i);
-                       lprintf(9, "floor %d: %s\n", i, fl->f_name);    /* FIXME take out */
                        if (fl->f_flags & F_INUSE) {
                                if (!strcasecmp(buf, fl->f_name)) {
                                        extract(rbuf, foldername, 1);
index fed836cbd1b2e65f082601daed5f87a4aba523bd..b4c8e0c088b52304007f6cac6f43fce07f0e7f6c 100644 (file)
@@ -365,6 +365,8 @@ int CtdlForEachMessage(int mode, long ref,
        struct SuppMsgInfo smi;
        struct CtdlMessage *msg;
        int is_seen;
+       long lastold = 0L;
+       int printed_lastold = 0;
 
        /* Learn about the user and room in question */
        get_mm();
@@ -434,19 +436,25 @@ int CtdlForEachMessage(int mode, long ref,
                for (a = 0; a < num_msgs; ++a) {
                        thismsg = msglist[a];
                        is_seen = is_msg_in_mset(vbuf.v_seen, thismsg);
-                       if ((thismsg > 0)
+                       if (is_seen) lastold = thismsg;
+                       if ((thismsg > 0L)
                            && (
 
                                       (mode == MSGS_ALL)
                                       || ((mode == MSGS_OLD) && (is_seen))
                                       || ((mode == MSGS_NEW) && (!is_seen))
-                                           /* FIXME handle lastold mode */
                                       || ((mode == MSGS_LAST) && (a >= (num_msgs - ref)))
                                   || ((mode == MSGS_FIRST) && (a < ref))
                                || ((mode == MSGS_GT) && (thismsg > ref))
                                || ((mode == MSGS_EQ) && (thismsg == ref))
                            )
                            ) {
+                               if ((mode == MSGS_NEW) && (CC->usersupp.flags & US_LASTOLD) && (lastold > 0L) && (printed_lastold == 0) && (!is_seen)) {
+                                       if (CallBack)
+                                               CallBack(lastold, userdata);
+                                       printed_lastold = 1;
+                                       ++num_processed;
+                               }
                                if (CallBack) CallBack(thismsg, userdata);
                                ++num_processed;
                        }
index ced8035b79a21103af5740fea14ed5f066416304..f78984deb3bb477d99b62c1ad6cca651dd446c64 100644 (file)
@@ -5,8 +5,10 @@
  * Copyright (C) 2000-2001 by Art Cancro and others.
  * This code is released under the terms of the GNU General Public License.
  *
- * WARNING: this is an incomplete implementation, still in progress.  Parts of
- * it work, but it's not really usable yet from a user perspective.
+ * WARNING: this is an incomplete implementation.  It is now good enough to
+ * be usable with much of the popular IMAP client software available, but it
+ * is by no means perfect.  Some commands (particularly SEARCH and RENAME)
+ * are implemented either incompletely or not at all.
  *
  * WARNING: Mark Crispin is an idiot.  IMAP is the most brain-damaged protocol
  * you will ever have the profound lack of pleasure to encounter.
@@ -104,25 +106,28 @@ void imap_set_seen_flags(void) {
 /*
  * Back end for imap_load_msgids()
  *
- * FIXME: this should be optimized by figuring out a way to allocate memory
- * once rather than doing a reallok() for each message.
+ * Optimization: instead of calling realloc() to add each message, we
+ * allocate space in the list for REALLOC_INCREMENT messages at a time.  This
+ * allows the mapping to proceed much faster.
  */
 void imap_add_single_msgid(long msgnum, void *userdata) {
        
        IMAP->num_msgs = IMAP->num_msgs + 1;
        if (IMAP->msgids == NULL) {
-               IMAP->msgids = mallok(IMAP->num_msgs * sizeof(long));
+               IMAP->msgids = mallok(IMAP->num_msgs * sizeof(long)
+                                       * REALLOC_INCREMENT);
        }
-       else {
+       else if (IMAP->num_msgs % REALLOC_INCREMENT == 0) {
                IMAP->msgids = reallok(IMAP->msgids,
-                       IMAP->num_msgs * sizeof(long));
+                       (IMAP->num_msgs + REALLOC_INCREMENT) * sizeof(long));
        }
        if (IMAP->flags == NULL) {
-               IMAP->flags = mallok(IMAP->num_msgs * sizeof(long));
+               IMAP->flags = mallok(IMAP->num_msgs * sizeof(long)
+                                       * REALLOC_INCREMENT);
        }
-       else {
+       else if (IMAP->num_msgs % REALLOC_INCREMENT == 0) {
                IMAP->flags = reallok(IMAP->flags,
-                       IMAP->num_msgs * sizeof(long));
+                       (IMAP->num_msgs + REALLOC_INCREMENT) * sizeof(long));
        }
        IMAP->msgids[IMAP->num_msgs - 1] = msgnum;
        IMAP->flags[IMAP->num_msgs - 1] = 0;
index 0769cbcc2f894b5841317f2ad8aaa4b66b6cf6d0..8f37c1b4ead8e84d2250cca7ecd1c865fd6cd36d 100644 (file)
@@ -49,3 +49,9 @@ enum {
 
 
 #define IMAP ((struct citimap *)CtdlGetUserData(SYM_IMAP))
+
+/*
+ * When loading arrays of message ID's into memory, increase the buffer to
+ * hold this many additional messages instead of calling realloc() each time.
+ */
+#define REALLOC_INCREMENT 100
index 4ca8a5d9ef75cab81dcd7d02df1356244ac449fa..9e6a0ea077ba9a5c1a7374deffa43fbfe5a5317c 100644 (file)
@@ -526,7 +526,7 @@ void cmd_artv(char *cmdbuf) {
        char cmd[SIZ];
        static int is_running = 0;
 
-       if (CtdlAccessCheck(ac_aide)) return;   /* FIXME should be intpgm */
+       if (CtdlAccessCheck(ac_internal)) return;
        if (is_running) {
                cprintf("%d The importer/exporter is already running.\n",
                        ERROR);