]> SAFE projects GIT repository - jmp/mailleur/commitdiff
probleme with sorter (delay and Unable to scan <b0VIM 9.1>)
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Tue, 3 Jun 2025 18:18:18 +0000 (14:18 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Tue, 3 Jun 2025 18:18:18 +0000 (14:18 -0400)
app/sender.c
app/sorter.c
lib/geseml.c
lib/unieml.h

index 5f567e314d2ead2351f54b6e6debf020181e0dd4..367fca121ce1ed498552d947be0bf5d92d5e5f6c 100644 (file)
@@ -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) {
index 0a5dd482cf4cb1f06029984b3ddafea01d4ff184..d4039260a469f21204cdf5f4a4a7f874d05e9690 100644 (file)
@@ -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
 }
index b892c57ff6fe30a601e499fe87153730c35b0707..d4568d99c0459b5ca3ac25d97dcc418752f1ccb8 100644 (file)
@@ -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
 }
 /*
 \f
@@ -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;
index 07947735db0802bb3ff3198b4115169c1b973ab5..5a9d7020385cb6d0e4082c22ecad963830a63822 100644 (file)
@@ -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