* $Id$
*
* IMAP server for the Citadel system
- * Copyright (C) 2000-2005 by Art Cancro and others.
+ * Copyright (C) 2000-2006 by Art Cancro and others.
* This code is released under the terms of the GNU General Public License.
*
* WARNING: the IMAP protocol is badly designed. No implementation of it
/*
- * does the real work for expunge
+ * Does the real work for expunge.
*/
int imap_do_expunge(void)
{
int i;
int num_expunged = 0;
+ long *delmsgs = NULL;
+ int num_delmsgs = 0;
lprintf(CTDL_DEBUG, "imap_do_expunge() called\n");
if (IMAP->selected == 0) {
return (0);
}
- if (IMAP->num_msgs > 0)
+ if (IMAP->num_msgs > 0) {
+ delmsgs = malloc(IMAP->num_msgs * sizeof(long));
for (i = 0; i < IMAP->num_msgs; ++i) {
if (IMAP->flags[i] & IMAP_DELETED) {
- CtdlDeleteMessages(CC->room.QRname,
- IMAP->msgids[i], "", 1);
- ++num_expunged;
+ delmsgs[num_delmsgs++] = IMAP->msgids[i];
}
}
+ if (num_delmsgs > 0) {
+ CtdlDeleteMessages(CC->room.QRname, delmsgs, num_delmsgs, "");
+ }
+ num_expunged += num_delmsgs;
+ free(delmsgs);
+ }
if (num_expunged > 0) {
imap_rescan_msgids();
irl->irl_newfloor);
if (r != crr_ok) {
/* FIXME handle error returns better */
- lprintf(CTDL_ERR, "CtdlRenameRoom() error %d\n",
- r);
+ lprintf(CTDL_ERR, "CtdlRenameRoom() error %d\n", r);
}
irlp = irl;
irl = irl->next;
char cmdbuf[SIZ];
char *parms[SIZ];
int num_parms;
+ struct timeval tv1, tv2;
+ gettimeofday(&tv1, NULL);
CC->lastcmd = time(NULL);
memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
flush_output();
/* If the client transmitted a message we can free it now */
imap_free_transmitted_message();
+
+ gettimeofday(&tv2, NULL);
+ lprintf(CTDL_DEBUG, "IMAP %s took %ld microseconds\n",
+ parms[1],
+ (tv2.tv_usec + (tv2.tv_sec * 1000000)) - (tv1.tv_usec + (tv1.tv_sec * 1000000))
+ );
}