/*
* $Id$
*
- * IMAP server for the Citadel/UX system
+ * IMAP server for the Citadel system
* Copyright (C) 2000-2002 by Art Cancro and others.
* This code is released under the terms of the GNU General Public License.
*
if (CC->h_command_function != imap_command_loop)
return;
+ /* If there is a mailbox selected, auto-expunge it. */
+ if (IMAP->selected) {
+ imap_do_expunge();
+ }
+
lprintf(CTDL_DEBUG, "Performing IMAP cleanup hook\n");
imap_free_msgids();
imap_free_transmitted_message();
IMAP->cached_fetch = NULL;
IMAP->cached_msgnum = (-1);
- cprintf("* OK %s Citadel/UX IMAP4rev1 server ready\r\n",
+ cprintf("* OK %s Citadel IMAP4rev1 server ready\r\n",
config.c_fqdn);
}
if (!ok) {
cprintf("%s NO ... no such room, or access denied\r\n",
parms[0]);
- /* IMAP->selected = 0; */
return;
}
int num_expunged = 0;
lprintf(CTDL_DEBUG, "imap_do_expunge() called\n");
- if (IMAP->selected == 0)
+ if (IMAP->selected == 0) {
return (0);
+ }
if (IMAP->num_msgs > 0)
for (i = 0; i < IMAP->num_msgs; ++i) {
CtdlDeleteMessages(CC->room.QRname,
IMAP->msgids[i], "");
++num_expunged;
- lprintf(CTDL_DEBUG, "%ld ... deleted\n",
- IMAP->msgids[i]);
- } else {
- lprintf(CTDL_DEBUG, "%ld ... not deleted\n",
- IMAP->msgids[i]);
}
}
imap_rescan_msgids();
}
+ lprintf(9, "Expunged %d messages.\n", num_expunged);
return (num_expunged);
}
{
/* Yes, we always expunge on close. */
- imap_do_expunge();
+ if (IMAP->selected) {
+ imap_do_expunge();
+ }
IMAP->selected = 0;
IMAP->readonly = 0;
/* Ok, at this point we're in normal command mode. The first thing
* we do is print any incoming pages (yeah! we really do!)
*/
- imap_print_express_messages();
+ imap_print_instant_messages();
/*
* Before processing the command that was just entered... if we happen
}
else if (!strcasecmp(parms[1], "LOGOUT")) {
- imap_do_expunge(); /* yes, we auto-expunge */
+ if (IMAP->selected) {
+ imap_do_expunge(); /* yes, we auto-expunge */
+ }
cprintf("* BYE %s logging out\r\n", config.c_fqdn);
cprintf("%s OK thank you for using Citadel IMAP\r\n",
parms[0]);
char *serv_imap_init(void)
{
CtdlRegisterServiceHook(config.c_imap_port,
- NULL, imap_greeting, imap_command_loop);
+ NULL, imap_greeting, imap_command_loop, NULL);
CtdlRegisterSessionHook(imap_cleanup_function, EVT_STOP);
return "$Id$";
}