]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Able to remove session ID
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Tue, 27 May 2025 13:16:18 +0000 (09:16 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Tue, 27 May 2025 13:16:18 +0000 (09:16 -0400)
Makefile
lib/geseml.c
lib/unieml.c
lib/unieml.h

index fb93f83658b5bb221e2768e84786c6e863609962..014cb57a3f94dccf9de90cdbba0cd4805f3326f6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -53,6 +53,19 @@ sorter       :  clean debug
                ./data-queue/
                
 
+dbgsorter:  clean debug
+          @ mkdir -p $(TESTDIR)/var/spool/$(APPNAME)/queue
+          @ cp -a                                      \
+               data-queue/*                            \
+               $(TESTDIR)/var/spool/$(APPNAME)/queue
+          @ gdb                                        \
+               --args                                  \
+               bin/sorter                              \
+                  -f                                   \
+                  -d 2                                 \
+                  -c ./conf/mailleur.conf.dvl          \
+                  -r $(TESTDIR) 
+
 #--------------------------------------------------------------------
 #To test sender
 sender :  clean debug newtest
index 2937da398aa00d0bea9bdfcb51dfee6d1220f019..0f074bcadb0d280d8e67f9a50b176d93f03dd86f 100644 (file)
@@ -331,9 +331,39 @@ PUBLIC _Bool eml_doneqfile(TRATYP **list)
 #define OPEP    "geseml.c:eml_doneqfile,"
 
 _Bool check;
+SIDTYP **sids;
 
 check=true;
-(void) rou_alert(0,"%s JMPDBG check done",OPEP);
+sids=(SIDTYP **)0;
+(void) rou_alert(0,"%s JMPDBG trying check",OPEP);
+if (list!=(TRATYP **)0) {
+  while (*list!=(TRATYP *)0) {
+    SIDTYP *found;
+
+    found=eml_addsid(&sids,(*list)->sessid);
+    switch ((*list)->code) {
+      case 'C'  :       //completed
+        break;
+      default   :
+        found->count++;
+        break;
+      }
+    list++;
+    }
+  }
+if (sids!=(SIDTYP **)0) {
+  SIDTYP **ptr;
+
+  ptr=sids;
+  while (*ptr!=(SIDTYP *)0) {
+    if ((*ptr)->count==0) {
+      (void) rou_alert(0,"%s JMPDBG need to remove <%s>",OPEP,(*ptr)->sessid);
+      (void) eml_deleteqfile((*ptr)->sessid);
+      }
+    ptr++;
+    }
+  sids=eml_freesid(sids);
+  }
 return check;
 
 #undef  OPEP
index a3e1ba6ca19766fa996118ae772a72f7339b9fb1..31f6bc8341b007ef964010a0bb3811b393ea15a8 100644 (file)
@@ -44,6 +44,65 @@ static VOCTYP vocsmtp[]={
 /********************************************************/
 /*                                                      */
 /*     Procedure to free memory used by a list of      */
+/*      session id.                                     */
+/*                                                      */
+/********************************************************/
+PUBLIC SIDTYP **eml_freesid(SIDTYP **list)
+
+{
+if (list!=(SIDTYP **)0) {
+  SIDTYP **ptr;
+
+  ptr=list;
+  while (*ptr!=(SIDTYP *)0) {
+    (void) free(*ptr);
+    ptr++;
+    }
+  (void) free(list);
+  list=(SIDTYP **)0;
+  }
+return list;
+}
+/*
+^L
+*/
+/********************************************************/
+/*                                                      */
+/*     Procedure to add an session ID to a list of     */
+/*      session ID                                      */
+/*                                                      */
+/********************************************************/
+PUBLIC SIDTYP *eml_addsid(SIDTYP ***list,char *sessid)
+
+{
+SIDTYP *found;
+
+found=(SIDTYP *)0;
+if (*list!=(SIDTYP **)0) {
+  SIDTYP **ptr;
+
+  ptr=*list;
+  while (*ptr!=(SIDTYP *)0) {
+    if (strcmp(sessid,(*ptr)->sessid)==0) {
+      found=*ptr;
+      break;
+      }
+    ptr++;
+    }
+  }
+if (found==(SIDTYP *)0) {
+  found=(SIDTYP *)calloc(1,sizeof(SIDTYP));
+  found->sessid=sessid;
+  *list=(SIDTYP **)rou_addlist((void **)*list,(void *)found);
+  }
+return found;
+}
+/*
+^L
+*/
+/********************************************************/
+/*                                                      */
+/*     Procedure to free memory used by a list of      */
 /*      recipient.                                      */
 /*                                                      */
 /********************************************************/
index f38c0616cbaea70ce999b529e58c815a176eacfe..4be728e906744968cdcaf44b83250040319f9a3c 100644 (file)
@@ -48,6 +48,27 @@ typedef struct  {               //*definition of recipient
         char *userid;           //recipient email userid
         }RCPTYP;
 
+typedef struct  {               //definition of SID reference
+        int count;              //Number of SESSID reference
+        char *sessid;           //Session ID reference
+        }SIDTYP;
+
+//Freeing list of sessid
+extern SIDTYP **eml_freesid(SIDTYP **list);
+
+//adding an session ID to a list of session
+extern SIDTYP *eml_addsid(SIDTYP ***list,char *sessid);
+
+//procedure to Free one recipient info
+extern RCPTYP *eml_freerecipient(RCPTYP *info);
+
+//get a session unique id
+extern char *eml_getmainsesid();
+
+//procedure to add recipient to a recipient list
+//adding an session ID to a list of session
+extern SIDTYP *eml_addsid(SIDTYP ***list,char *sessid);
+
 //procedure to Free one recipient info
 extern RCPTYP *eml_freerecipient(RCPTYP *info);