From 51d565d26ccd8cbca6aadc7339390255dfb1b200 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Thu, 24 Feb 2000 03:44:00 +0000 Subject: [PATCH] * Implemented holdoff time (15 minutes) for SMTP send retry. * Implemented "try for 3 days and then give up" on SMTP send. --- citadel/ChangeLog | 5 +++- citadel/serv_smtp.c | 65 ++++++++++++++++++++++++++++++++++++++++++--- citadel/sysconfig.h | 24 ++++++++++++----- 3 files changed, 82 insertions(+), 12 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index 7466ee8e8..b66ee38d1 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,8 @@ $Log$ +Revision 1.468 2000/02/24 03:44:00 ajc +* Implemented holdoff time (15 minutes) for SMTP send retry. +* Implemented "try for 3 days and then give up" on SMTP send. + Revision 1.467 2000/02/24 00:51:48 ajc * Client protocol synchronization check during exit from chat. This closes Bug #15. @@ -1654,4 +1658,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import - diff --git a/citadel/serv_smtp.c b/citadel/serv_smtp.c index 4ff49901a..b08f2d23a 100644 --- a/citadel/serv_smtp.c +++ b/citadel/serv_smtp.c @@ -976,11 +976,32 @@ void smtp_do_bounce(char *instr) { int num_bounces = 0; int bounce_this = 0; long bounce_msgid = (-1); + time_t submitted = 0L; struct CtdlMessage *bmsg = NULL; + int give_up = 0; lprintf(9, "smtp_do_bounce() called\n"); strcpy(bounceto, ""); + lines = num_tokens(instr, '\n'); + + + /* See if it's time to give up on delivery of this message */ + for (i=0; i SMTP_GIVE_UP ) { + give_up = 1; + } + + + bmsg = (struct CtdlMessage *) mallok(sizeof(struct CtdlMessage)); if (bmsg == NULL) return; memset(bmsg, 0, sizeof(struct CtdlMessage)); @@ -990,14 +1011,28 @@ void smtp_do_bounce(char *instr) { bmsg->cm_format_type = 1; bmsg->cm_fields['A'] = strdoop("Citadel"); bmsg->cm_fields['N'] = strdoop(config.c_nodename); - bmsg->cm_fields['M'] = strdoop( + if (give_up) bmsg->cm_fields['M'] = strdoop( +"BOUNCE! BOUNCE!! BOUNCE!!!\n\n" +"FIXME ... this message should be made to look nice and stuff.\n" +"In the meantime, you should be aware that we're giving up on the\n" +"following deliveries because their mail servers are fux0red and\n" +"would not accept the message for a very, very long time:\n\n" +); + + else bmsg->cm_fields['M'] = strdoop( "BOUNCE! BOUNCE!! BOUNCE!!!\n\n" "FIXME ... this message should be made to look nice and stuff.\n" "In the meantime, you should be aware that the following\n" -"recipient addresses had permanent fatal errors:\n\n"); +"recipient addresses had permanent fatal errors:\n\n" +); + + + + /* + * Now go through the instructions checking for stuff. + */ - lines = num_tokens(instr, '\n'); for (i=0; i last_attempted) + last_attempted = attempted; + } } + + /* + * Postpone delivery if we've already tried recently. + */ + if ( (time(NULL) - last_attempted) < SMTP_RETRY_INTERVAL) { + lprintf(7, "Retry time not yet reached.\n"); + phree(instr); + return; + } + + + /* + * Bail out if there's no actual message associated with this + */ if (text_msgid < 0L) { lprintf(3, "SMTP: no 'msgid' directive found!\n"); phree(instr); diff --git a/citadel/sysconfig.h b/citadel/sysconfig.h index 7efd4eaed..7b749753a 100644 --- a/citadel/sysconfig.h +++ b/citadel/sysconfig.h @@ -68,15 +68,18 @@ #define HOUSEKEEPING_WAKEUP 60 +/* + * NLI is the string that shows up in a ho's online listing for sessions + * that are active, but for which no user has yet authenticated. + */ #define NLI "(not logged in)" - -/*** STRUCTURE SIZE VARIABLES ***/ - -/* You may NOT change this value once you set up your system. */ -#define MAXFLOORS 16 /* Do not set higher than 127 */ - -/*** END OF STRUCTURE SIZE VARIABLES ***/ +/* + * Maximum number of floors on the system. + * WARNING! *Never* change this value once your system is up; THINGS WILL DIE! + * Also, do not set it higher than 127. + */ +#define MAXFLOORS 16 /* @@ -86,6 +89,13 @@ #define POP3_PORT 110 #define SMTP_PORT 25 +/* + * SMTP delivery retry and give-up times + * FIXME ... put this in a programmable config somewhere + */ +#define SMTP_RETRY_INTERVAL 900 /* retry sends every 15 minutes */ +#define SMTP_GIVE_UP 259200 /* give up after 3 days */ + /* * The names of rooms which are automatically created by the system -- 2.30.2