From: Art Cancro Date: Sat, 28 Apr 2001 04:18:45 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: v7.86~6891 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=cb28eae49db178bd1b917015ada4e0d095b5aabd;p=citadel.git *** empty log message *** --- diff --git a/citadel/ChangeLog b/citadel/ChangeLog index a78654c52..985de7054 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -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 Fri Jul 10 1998 Art Cancro * Initial CVS import - diff --git a/citadel/database_sleepycat.c b/citadel/database_sleepycat.c index 16b988136..d067be9bf 100644 --- a/citadel/database_sleepycat.c +++ b/citadel/database_sleepycat.c @@ -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) { diff --git a/citadel/imap_fetch.c b/citadel/imap_fetch.c index a380732db..011119d3a 100644 --- a/citadel/imap_fetch.c +++ b/citadel/imap_fetch.c @@ -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); } } diff --git a/citadel/imap_tools.c b/citadel/imap_tools.c index 15b35627a..58aabd897 100644 --- a/citadel/imap_tools.c +++ b/citadel/imap_tools.c @@ -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); diff --git a/citadel/msgbase.c b/citadel/msgbase.c index fed836cbd..b4c8e0c08 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -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; } diff --git a/citadel/serv_imap.c b/citadel/serv_imap.c index ced8035b7..f78984deb 100644 --- a/citadel/serv_imap.c +++ b/citadel/serv_imap.c @@ -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; diff --git a/citadel/serv_imap.h b/citadel/serv_imap.h index 0769cbcc2..8f37c1b4e 100644 --- a/citadel/serv_imap.h +++ b/citadel/serv_imap.h @@ -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 diff --git a/citadel/serv_vandelay.c b/citadel/serv_vandelay.c index 4ca8a5d9e..9e6a0ea07 100644 --- a/citadel/serv_vandelay.c +++ b/citadel/serv_vandelay.c @@ -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);