]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Adding delay timing to sender transaction file
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Sun, 1 Jun 2025 13:59:00 +0000 (09:59 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Sun, 1 Jun 2025 13:59:00 +0000 (09:59 -0400)
app/sender.c
lib/geseml.c
lib/geseml.h

index 5d93ec1d50b2bb0ec24d87bf1bf413dce36e3792..df72896a0b74e5eb87cd6214797f53552b5ee85b 100644 (file)
@@ -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
index e12d4d72c191575c70f7ab762d3055777ce95979..0fb2069148dcff2b2c56d02dbbf25b7f374ccc86 100644 (file)
@@ -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
 }
+/*
+\f
+*/
+/********************************************************/
+/*                                                      */
+/*      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;
+}
index 99e0cb44dfe1b5756ba12c949f47a0d255ee6ebb..bb599028630aaaf6b6f78f74a65bb0c54a168951 100644 (file)
@@ -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