From: Jean-Marc Pigeon (Delson) Date: Tue, 3 Jun 2025 18:18:18 +0000 (-0400) Subject: probleme with sorter (delay and Unable to scan ) X-Git-Tag: tag-0.8~72 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=f7907e3debb4d597321623972bfe14ba26b7e928;p=jmp%2Fmailleur probleme with sorter (delay and Unable to scan ) --- diff --git a/app/sender.c b/app/sender.c index 5f567e3..367fca1 100644 --- a/app/sender.c +++ b/app/sender.c @@ -38,29 +38,36 @@ _Bool status; status=false; if (tra!=(TRATYP **)0) { + time_t isnow; TRATYP **ptr; + isnow=time((time_t *)0); ptr=tra; status=true; while (*ptr!=(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='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 - //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); - status=false; - break; + (void) rou_alert(0,"%s JMPDBG date='%ld' isnow='%ld'",OPEP,(*ptr)->date,isnow); + if (((*ptr)->date+(*ptr)->delay)<=isnow) { + (void) rou_alert(0,"%s JMPDBG action delay='%d'",OPEP,(*ptr)->delay); + 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='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 + //JMPDBG set as the remote email was not succesful + (void) eml_add_delay(*ptr); + (void) rou_alert(0,"%s JMPDBG delay='%d'",OPEP,(*ptr)->delay); + break; + default : + (void) rou_alert(0,"%s unexpected code '%c'",OPEP,(*ptr)->code); + status=false; + break; + } } ptr++; } @@ -79,7 +86,7 @@ return status; static _Bool scantodo(char *fname) { -#define OPEP "sorter.c:scantodo," +#define OPEP "sender.c:scantodo," _Bool status; FILE *qfile; @@ -167,6 +174,7 @@ return status; int main(int argc,char *argv[]) { +#define OPEP "sender.c:main," int status; ARGTYP *params; int phase; @@ -178,7 +186,7 @@ foreground=true; phase=0; proceed=true; while (proceed==true) { - //(void) fprintf(stdout,"JMPDBG main phase='%d'\n",phase); + //(void) fprintf(stdout,"%s JMPDBG main phase='%d'\n",OPEP,phase); switch (phase) { case 0 : //checking parameters if ((params=par_getparams(argc,argv,"c:d:fh:r:v"))==(ARGTYP *)0) { diff --git a/app/sorter.c b/app/sorter.c index 0a5dd48..d403926 100644 --- a/app/sorter.c +++ b/app/sorter.c @@ -1,7 +1,7 @@ // vim: smarttab tabstop=8 shiftwidth=2 expandtab /********************************************************/ /* */ -/* SMTP protocol sender */ +/* SMTP protocol domain destination sorter */ /* Used to take the trans directive and generate */ /* a todo list a email to be send. */ /* */ @@ -18,8 +18,6 @@ #include "unisig.h" #include "geseml.h" -#define SORTER "sorter" //application name - /********************************************************/ /* */ /* procedure to scan all files */ @@ -99,6 +97,8 @@ while (proceed==true) { int main(int argc,char *argv[]) { +#define OPEP "sorter.c:main," + int status; ARGTYP *params; int phase; @@ -109,7 +109,7 @@ params=(ARGTYP *)0; phase=0; proceed=true; while (proceed==true) { - (void) fprintf(stdout,"JMPDBG main phase='%d' foreground='%d'\n",phase,foreground); + //(void) rou_alert(0,"%s JMPDBG phase='%d'",OPEP,phase); switch (phase) { case 0 : //checking parameters if ((params=par_getparams(argc,argv,"c:d:fhi:r:v"))==(ARGTYP *)0) { @@ -151,4 +151,5 @@ while (proceed==true) { phase++; } (void) exit(status); +#undef OPEP } diff --git a/lib/geseml.c b/lib/geseml.c index b892c57..d4568d9 100644 --- a/lib/geseml.c +++ b/lib/geseml.c @@ -126,6 +126,8 @@ return reflist; PUBLIC _Bool eml_dumptra(FILE *qfile,TRATYP **tra) { +#define OPEP "geseml.c:eml_dumptra," + _Bool action; action=false; @@ -154,8 +156,24 @@ if (tra!=(TRATYP **)0) { (*tra)->mailfrom, (*tra)->rcptto ); - if (((*tra)->date+(*tra)->delay)<=isnow) + if (((*tra)->date+(*tra)->delay)<=isnow) { + time_t bigre; + char timer[50]; + char strnow[50]; + + (void) strftime(strnow,sizeof(strnow),"#%Y-%m-%d %H:%M:%S", + localtime(&isnow)); + (void) strftime(timer,sizeof(timer),"#%Y-%m-%d %H:%M:%S", + localtime(&((*tra)->date))); + (void) rou_alert(0,"%s JMPDBG date=<%s> delay='%04d'", + OPEP,timer,(*tra)->delay); + bigre=(*tra)->date+(*tra)->delay; + (void) strftime(timer,sizeof(temps),"#%Y-%m-%d %H:%M:%S", + localtime(&bigre)); + (void) rou_alert(0,"%s JMPDBG timer=<%s> iwnow=<%s>",OPEP,timer,strnow); + (void) rou_alert(0,"%s JMPDBG action=true",OPEP); action=true; + } if (qfile==(FILE *)0) { (void) rou_alert(0,"TRA=<%s>",line); } @@ -167,6 +185,8 @@ if (tra!=(TRATYP **)0) { } } return action; + +#undef OPEP } /* @@ -552,6 +572,7 @@ PUBLIC _Bool eml_add_delay(TRATYP *tra) _Bool status; status=false; +(void) rou_alert(0,"eml_add_delay, JMPDBG"); if (tra!=(TRATYP *)0) { tra->delay=(tra->delay*2)+60; status=true; diff --git a/lib/unieml.h b/lib/unieml.h index 0794773..5a9d702 100644 --- a/lib/unieml.h +++ b/lib/unieml.h @@ -30,6 +30,7 @@ #define SBINDIR "/usr/sbin/" //appliaction installation directory #define SENDER "sender" //application email sender +#define SORTER "sorter" //application email sorter //list of keyword typedef enum { //list of SMTP protocol keyword