$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.
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
-
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) {
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);
}
}
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);
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();
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;
}
* 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.
/*
* 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;
#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
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);