X-Git-Url: https://code.citadel.org/?p=citadel.git;a=blobdiff_plain;f=citadel%2Fmodules%2Fsmtp%2Fsmtp_util.c;fp=citadel%2Fmodules%2Fsmtp%2Fsmtp_util.c;h=dae60b6daf14a8d46f2c457d9fbcfd69ddca4302;hp=1c57d99595de161d134ac06a597fe3b5ac30c4a5;hb=154ecc9117291889ed20b392e65725f883a2d962;hpb=6e3e832f22b2a14bcb7f01839b70a2e4d0713025 diff --git a/citadel/modules/smtp/smtp_util.c b/citadel/modules/smtp/smtp_util.c index 1c57d9959..dae60b6da 100644 --- a/citadel/modules/smtp/smtp_util.c +++ b/citadel/modules/smtp/smtp_util.c @@ -161,10 +161,10 @@ void smtp_do_bounce(char *instr, StrBuf *OMsgTxt) bmsg->cm_magic = CTDLMESSAGE_MAGIC; bmsg->cm_anon_type = MES_NORMAL; bmsg->cm_format_type = FMT_RFC822; - bmsg->cm_fields['A'] = strdup("Citadel"); - bmsg->cm_fields['O'] = strdup(MAILROOM); - bmsg->cm_fields['N'] = strdup(config.c_nodename); - bmsg->cm_fields['U'] = strdup("Delivery Status Notification (Failure)"); + CM_SetField(bmsg, eAuthor, HKEY("Citadel")); + CM_SetField(bmsg, eOriginalRoom, HKEY(MAILROOM)); + CM_SetField(bmsg, eNodeName, config.c_nodename, strlen(config.c_nodename)); + CM_SetField(bmsg, eMsgSubject, HKEY("Delivery Status Notification (Failure)")); StrBufAppendBufPlain( BounceMB, HKEY("Content-type: multipart/mixed; boundary=\""), 0); @@ -286,9 +286,8 @@ void smtp_do_bounce(char *instr, StrBuf *OMsgTxt) StrBufAppendBufPlain(BounceMB, HKEY("--"), 0); StrBufAppendBuf(BounceMB, boundary, 0); StrBufAppendBufPlain(BounceMB, HKEY("--\r\n"), 0); - if (bmsg->cm_fields['M'] != NULL) - free(bmsg->cm_fields['M']); - bmsg->cm_fields['M'] = SmashStrBuf(&BounceMB); + CM_SetAsFieldSB(bmsg, eMesageText, &BounceMB); + /* Deliver the bounce if there's anything worth mentioning */ syslog(LOG_DEBUG, "num_bounces = %d\n", num_bounces); if (num_bounces > 0) { @@ -320,6 +319,6 @@ void smtp_do_bounce(char *instr, StrBuf *OMsgTxt) } } FreeStrBuf(&boundary); - CtdlFreeMessage(bmsg); + CM_Free(bmsg); syslog(LOG_DEBUG, "Done processing bounces\n"); }