X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fmodules%2Fsmtp%2Fsmtp_util.c;h=a77f73dd6d5e095c136c2361968f66f6594df4c4;hb=5165e905c8c869b92876738b0436c9e784abce3a;hp=4a4ac365bc639a63f2bf0f8abfc95a53d9886051;hpb=da0b049809b9ad1459a4ac0467e79bfb5c5d2719;p=citadel.git diff --git a/citadel/modules/smtp/smtp_util.c b/citadel/modules/smtp/smtp_util.c index 4a4ac365b..a77f73dd6 100644 --- a/citadel/modules/smtp/smtp_util.c +++ b/citadel/modules/smtp/smtp_util.c @@ -1,7 +1,7 @@ /* * Utility functions for the Citadel SMTP implementation * - * Copyright (c) 1998-2017 by the citadel.org team + * Copyright (c) 1998-2021 by the citadel.org team * * This program is open source software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3. @@ -23,18 +23,7 @@ #include #include #include - -#if TIME_WITH_SYS_TIME -# include -# include -#else -# if HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif - +#include #include #include #include @@ -61,9 +50,8 @@ #include "ctdl_module.h" #include "smtp_util.h" -const char *smtp_get_Recipients(void) -{ - citsmtp *sSMTP = SMTP; +const char *smtp_get_Recipients(void) { + struct citsmtp *sSMTP = SMTP; if (sSMTP == NULL) return NULL; @@ -81,8 +69,7 @@ const char *smtp_get_Recipients(void) * SDB_BOUNCE_ALL Advise the sender that all deliveries have failed and will not be retried * SDB_WARN Warn the sender about all 4XX transient delays */ -void smtp_do_bounce(const char *instr, int is_final) -{ +void smtp_do_bounce(const char *instr, int is_final) { int i; int lines; int status; @@ -95,7 +82,7 @@ void smtp_do_bounce(const char *instr, int is_final) int num_bounces = 0; int bounce_this = 0; struct CtdlMessage *bmsg = NULL; - recptypes *valid; + struct recptypes *valid; int successful_bounce = 0; static int seq = 0; StrBuf *BounceMB; @@ -107,7 +94,6 @@ void smtp_do_bounce(const char *instr, int is_final) StrBufAppendPrintf(boundary, "%s_%04x%04x", CtdlGetConfigStr("c_fqdn"), getpid(), ++seq); - /* Start building our bounce message */ bmsg = (struct CtdlMessage *) malloc(sizeof(struct CtdlMessage)); @@ -120,7 +106,6 @@ void smtp_do_bounce(const char *instr, int is_final) bmsg->cm_format_type = FMT_RFC822; CM_SetField(bmsg, eAuthor, HKEY("Citadel")); CM_SetField(bmsg, eOriginalRoom, HKEY(MAILROOM)); - CM_SetField(bmsg, eNodeName, CtdlGetConfigStr("c_nodename"), strlen(CtdlGetConfigStr("c_nodename"))); CM_SetField(bmsg, eMsgSubject, HKEY("Delivery Status Notification (Failure)")); StrBufAppendBufPlain(BounceMB, HKEY("Content-type: multipart/mixed; boundary=\""), 0); StrBufAppendBuf(BounceMB, boundary, 0); @@ -133,8 +118,7 @@ void smtp_do_bounce(const char *instr, int is_final) StrBufAppendBufPlain(BounceMB, HKEY("\r\n"), 0); StrBufAppendBufPlain(BounceMB, HKEY("Content-type: text/plain\r\n\r\n"), 0); - if (is_final == SDB_BOUNCE_ALL) - { + if (is_final == SDB_BOUNCE_ALL) { StrBufAppendBufPlain( BounceMB, HKEY( "A message you sent could not be delivered " @@ -143,8 +127,7 @@ void smtp_do_bounce(const char *instr, int is_final) "Giving up on the following addresses:\n\n"), 0); } - else if (is_final == SDB_BOUNCE_FATALS) - { + else if (is_final == SDB_BOUNCE_FATALS) { StrBufAppendBufPlain( BounceMB, HKEY( "A message you sent could not be delivered " @@ -152,8 +135,7 @@ void smtp_do_bounce(const char *instr, int is_final) "The following addresses were undeliverable:\n\n"), 0); } - else if (is_final == SDB_WARN) - { + else if (is_final == SDB_WARN) { StrBufAppendBufPlain( BounceMB, HKEY("A message you sent has not been delivered " @@ -162,8 +144,7 @@ void smtp_do_bounce(const char *instr, int is_final) "The following addresses were undeliverable:\n\n"), 0); } - else // should never get here - { + else { // should never get here StrBufAppendBufPlain(BounceMB, HKEY("This message should never occur.\n\n"), 0); } @@ -248,14 +229,14 @@ void smtp_do_bounce(const char *instr, int is_final) valid = validate_recipients(bounceto, smtp_get_Recipients (), 0); if (valid != NULL) { if (valid->num_error == 0) { - CtdlSubmitMsg(bmsg, valid, "", QP_EADDR); + CtdlSubmitMsg(bmsg, valid, ""); successful_bounce = 1; } } /* If not, post it in the Aide> room */ if (successful_bounce == 0) { - CtdlSubmitMsg(bmsg, NULL, CtdlGetConfigStr("c_aideroom"), QP_EADDR); + CtdlSubmitMsg(bmsg, NULL, CtdlGetConfigStr("c_aideroom")); } /* Free up the memory we used */ @@ -269,9 +250,6 @@ void smtp_do_bounce(const char *instr, int is_final) } - - - char *smtpcodes[][2] = { { "211 - System status / system help reply" }, { "214", "Help message" }, @@ -324,7 +302,6 @@ char *smtpcodes[][2] = { }; - char *smtpstatus(int code) { int i; @@ -336,4 +313,3 @@ char *smtpstatus(int code) { return("Unknown or other SMTP status"); } -