From: Jean-Marc Pigeon (Delson) Date: Sun, 1 Jun 2025 13:59:00 +0000 (-0400) Subject: Adding delay timing to sender transaction file X-Git-Tag: tag-0.8~77 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=525346d33c934e0cdf23aa8e3b28d5d9936ca81a;p=jmp%2Fmailleur Adding delay timing to sender transaction file --- diff --git a/app/sender.c b/app/sender.c index 5d93ec1..df72896 100644 --- a/app/sender.c +++ b/app/sender.c @@ -48,14 +48,16 @@ if (tra!=(TRATYP **)0) { switch ((*ptr)->code) { case 'L' : //local delivery (*ptr)->code='C'; //delivery done 'C'ompleted + (void) eml_add_delay(*ptr); if (eml_store_email(*ptr)==false) { - (*ptr)->code='D'; //delivery done 'D'elayed + (*ptr)->code='L'; //delivery done 'D'elayed (void) rou_alert(0,"%s Unable to deliver email <%s> to <%s>", OPEP,(*ptr)->sessid,(*ptr)->rcptto); } break; case 'R' : //remote delivery - (*ptr)->code='C'; //delivery completed Temporary JMPDBG + //JMPDBG set as the remote email was not succesful + (void) eml_add_delay(*ptr); break; default : (void) rou_alert(0,"%s unexpected code '%c'",OPEP,(*ptr)->code); @@ -64,7 +66,6 @@ if (tra!=(TRATYP **)0) { } ptr++; } - (void) eml_dumptra((FILE *)0,tra); } return status; #undef OPEP diff --git a/lib/geseml.c b/lib/geseml.c index e12d4d7..0fb2069 100644 --- a/lib/geseml.c +++ b/lib/geseml.c @@ -134,7 +134,7 @@ if (tra!=(TRATYP **)0) { while (*tra!=(TRATYP *)0) { char line[300]; - (void) snprintf(line,sizeof(line),"%c %lu %u %s %s %s", + (void) snprintf(line,sizeof(line),"%c %lu %04u %s %s %s", (*tra)->code, (*tra)->date, (*tra)->delay, @@ -508,3 +508,25 @@ return done; #undef OPEP } +/* + +*/ +/********************************************************/ +/* */ +/* Procedure to add an execution delay to an email */ +/* sending request. */ +/* Return true if succesfull, false otherwise */ +/* */ +/********************************************************/ +PUBLIC _Bool eml_add_delay(TRATYP *tra) + +{ +_Bool status; + +status=false; +if (tra!=(TRATYP *)0) { + tra->delay=(tra->delay*2)+60; + status=true; + } +return status; +} diff --git a/lib/geseml.h b/lib/geseml.h index 99e0cb4..bb59902 100644 --- a/lib/geseml.h +++ b/lib/geseml.h @@ -44,4 +44,7 @@ extern void eml_doneqfile(TRATYP **list); //procedure to store an email to the local email storage area extern _Bool eml_store_email(TRATYP *tra); +//procedure to add execution delay to an email sending +extern _Bool eml_add_delay(TRATYP *tra); + #endif