#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "serv_extensions.h"
#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
CC->redirect_alloc = SIZ;
CtdlOutputMsg(msgnum, MT_RFC822,
(need_body ? HEADERS_ALL : HEADERS_ONLY),
- 0, 1);
+ 0, 1, NULL);
if (!need_body) cprintf("\r\n"); /* extra trailing newline */
IMAP->cached_rfc822_data = CC->redirect_buffer;
IMAP->cached_rfc822_len = CC->redirect_len;
/*
* Load a specific part of a message into the temp file to be output to a
* client. FIXME we can handle parts like "2" and "2.1" and even "2.MIME"
- * but we still can't handle "2.HEADER" (which might not be a problem, because
- * we currently don't have the ability to break out nested RFC822's anyway).
+ * but we still can't handle "2.HEADER" (which might not be a problem).
*
* Note: mime_parser() was called with dont_decode set to 1, so we have the
* luxury of simply spewing without having to re-encode.
char buf[SIZ];
int lines = 0;
+ /* Handle NULL message gracefully */
+ if (msg == NULL) {
+ cprintf("BODYSTRUCTURE (\"TEXT\" \"PLAIN\" "
+ "(\"CHARSET\" \"US-ASCII\") NIL NIL "
+ "\"7BIT\" 0 0)");
+ return;
+ }
+
/* For non-RFC822 (ordinary Citadel) messages, this is short and
* sweet...
*/
if (IMAP->num_msgs > 0) {
for (i = 0; i < IMAP->num_msgs; ++i) {
+
+ /* Abort the fetch loop if the session breaks.
+ * This is important for users who keep mailboxes
+ * that are too big *and* are too impatient to
+ * let them finish loading. :)
+ */
+ if (CC->kill_me) return;
+
+ /* Get any message marked for fetch. */
if (IMAP->flags[i] & IMAP_SELECTED) {
imap_do_fetch_msg(i+1, num_items, itemlist);
}