]> SAFE projects GIT repository - jmp/mailleur/commitdiff
tables "actions" datbase management seems to be working
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Sun, 29 Jun 2025 23:04:11 +0000 (19:04 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Sun, 29 Jun 2025 23:04:11 +0000 (19:04 -0400)
lib/devsql.c
sql/mailleur.sql

index 8e2e4855ab611d635dff3c16691762572ba163ac..6b7bf7542d25a6eb8f35dd6fff4aea59dd88e414 100644 (file)
@@ -823,7 +823,8 @@ PUBLIC _Bool sql_mngact(SQLPTR *sqlptr,SQLENUM action,ACTTYP *act)
 
 {
 #define OPEP    "devsql.c:sql_mngact,"
-#define DELACT  "DELETE * FROM "ACTIONS" WHERE sessid=%s AND rcptto=%s"
+#define DELACT  "DELETE FROM "ACTIONS" WHERE sessid=%s AND rcptto=%s"
+#define INACT   "INSERT INTO "ACTIONS" (%s) VALUES(%s,%s,%d,%s)"
 
 _Bool isok;
 
@@ -837,12 +838,24 @@ if (act!=(ACTTYP *)0) {
   if (act->resp==(char **)0)
     (void) sqlrequest(sqlptr,DELACT,goodid,goodrcpt);
   else {
+    char *field;
+
+    field="sessid,rcptto,numline,info";
     if (act->resp!=(char **)0) {
       char **resp;
+      int num;
   
       resp=act->resp;
+      num=1;
       while (*resp!=(char *)0) {
+        char *goodinfo;
+
+        goodinfo=sql_gooddata(sqlptr,*resp);
+        (void) sqlrequest(sqlptr,INACT,field,goodid,goodrcpt,num,goodinfo);
+        (void) rou_alert(0,INACT,field,goodid,goodrcpt,num,goodinfo);
+        goodinfo=rou_freestr(goodinfo);
         resp++;
+        num++;
         }
       }
     }
@@ -852,6 +865,7 @@ if (act!=(ACTTYP *)0) {
   }
 return isok;
 
+#undef  INACT
 #undef  DELACT
 #undef  OPEP
 }
index ed22b2f01b6c64aafa60517f65b43249b60ac2c2..5e9791ca207e9d833f466b1d75dc008df5059b2f 100644 (file)
@@ -82,8 +82,8 @@ CREATE TABLE sessions (
 GRANT SELECT                           ON sessions TO mailapache;
 
 //table about recipient email information
-//summerize all emails recived status according sessions and recipient
-CREATE TABLE infos     (
+//summerize all emails received actions status according sessions and recipient
+CREATE TABLE actions   (
        creation        DBTIMESTAMP     //record creation
                        DFLT NOW(),
        sessid          TEXT,           //Session id