- MSG_syslog(LOG_DEBUG, "Returning to original room %s\n", hold_rm);
- if (strcasecmp(hold_rm, CCC->room.QRname))
- CtdlUserGoto(hold_rm, 0, 1, NULL, NULL);
-
- /* For internet mail, generate delivery instructions.
- * Yes, this is recursive. Deal with it. Infinite recursion does
- * not happen because the delivery instructions message does not
- * contain a recipient.
- */
- if ((recps != NULL) && (recps->num_internet > 0)) {
- StrBuf *SpoolMsg = NewStrBuf();
- long nTokens;
-
- MSGM_syslog(LOG_DEBUG, "Generating delivery instructions\n");
-
- StrBufPrintf(SpoolMsg,
- "Content-type: "SPOOLMIME"\n"
- "\n"
- "msgid|%ld\n"
- "submitted|%ld\n"
- "bounceto|%s\n",
- newmsgid,
- (long)time(NULL),
- bounce_to);
-
- if (recps->envelope_from != NULL) {
- StrBufAppendBufPlain(SpoolMsg, HKEY("envelope_from|"), 0);
- StrBufAppendBufPlain(SpoolMsg, recps->envelope_from, -1, 0);
- StrBufAppendBufPlain(SpoolMsg, HKEY("\n"), 0);
- }
- if (recps->sending_room != NULL) {
- StrBufAppendBufPlain(SpoolMsg, HKEY("source_room|"), 0);
- StrBufAppendBufPlain(SpoolMsg, recps->sending_room, -1, 0);
- StrBufAppendBufPlain(SpoolMsg, HKEY("\n"), 0);
- }
-
- nTokens = num_tokens(recps->recp_internet, '|');
- for (i = 0; i < nTokens; i++) {
- long len;
- len = extract_token(recipient, recps->recp_internet, i, '|', sizeof recipient);
- if (len > 0) {
- StrBufAppendBufPlain(SpoolMsg, HKEY("remote|"), 0);
- StrBufAppendBufPlain(SpoolMsg, recipient, len, 0);
- StrBufAppendBufPlain(SpoolMsg, HKEY("|0||\n"), 0);
- }
- }
-
- imsg = malloc(sizeof(struct CtdlMessage));
- memset(imsg, 0, sizeof(struct CtdlMessage));
- imsg->cm_magic = CTDLMESSAGE_MAGIC;
- imsg->cm_anon_type = MES_NORMAL;
- imsg->cm_format_type = FMT_RFC822;
- imsg->cm_fields[eMsgSubject] = strdup("QMSG");
- imsg->cm_fields[eAuthor] = strdup("Citadel");
- imsg->cm_fields[eJournal] = strdup("do not journal");
- imsg->cm_fields[eMesageText] = SmashStrBuf(&SpoolMsg); /* imsg owns this memory now */
- CtdlSubmitMsg(imsg, NULL, SMTP_SPOOLOUT_ROOM, QP_EADDR);
- CM_Free(imsg);