From 2cda40735908d1d7bb9fa6cd147f9a4be0ebe391 Mon Sep 17 00:00:00 2001 From: Jean-Marc Pigeon Date: Sun, 21 Sep 2025 10:08:33 -0400 Subject: [PATCH] Able to store status within actions tables --- lib/gessql.c | 14 ++++++++++---- sql/mailleur.sql | 1 + www/lvlmai.php | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/gessql.c b/lib/gessql.c index 41d0722..31b973a 100644 --- a/lib/gessql.c +++ b/lib/gessql.c @@ -46,7 +46,7 @@ PUBLIC _Bool sql_mngact(SQLPTR *sqlptr,ACTTYP *act) #define OPEP "gessql.c:sql_mngact," static const char *del="DELETE FROM "ACTTBL" WHERE sessid=%s AND rcptto=%s"; -static const char *ins="INSERT INTO "ACTTBL" (%s) VALUES(%s,%s,%s,%s,%s,%s,%s,%d,%s)"; +static const char *ins="INSERT INTO "ACTTBL" (%s) VALUES(%s,%s,%s,%s,%s,%s,%s,%d,%d,%s)"; _Bool isok; @@ -73,7 +73,7 @@ if (act!=(ACTTYP *)0) { if (act->resp!=(char **)0) { char *field; - field="code,sessid,reverse,smtpfrom,emailfrom,subject,rcptto,numline,info"; + field="code,sessid,reverse,smtpfrom,emailfrom,subject,rcptto,numline,status,info"; (void) sql_request(sqlptr,del,gid,grcpt); if (act->resp!=(char **)0) { char **resp; @@ -83,13 +83,19 @@ if (act!=(ACTTYP *)0) { num=1; while (*resp!=(char *)0) { if ((*resp)[3]==' ') { + char strint[5]; + int status; char *ginfo; - ginfo=sql_gooddata(sqlptr,*resp); + + (void) memset(strint,'\000',sizeof(strint)); + (void) strncpy(strint,*resp,3); + status=atoi(strint); + ginfo=sql_gooddata(sqlptr,(*resp)+3); (void) sql_request(sqlptr,ins,field, gcode,gid, greverse,gsfrom,ghfrom,ghsubject, - grcpt,num,ginfo); + grcpt,num,status,ginfo); ginfo=rou_freestr(ginfo); } resp++; diff --git a/sql/mailleur.sql b/sql/mailleur.sql index 878ffbb..d02bc75 100644 --- a/sql/mailleur.sql +++ b/sql/mailleur.sql @@ -100,6 +100,7 @@ CREATE TABLE actions ( rcptto TEXT, //SMTP Connection "RCPT TO:" emailfrom TEXT, //email contents "From:" subject TEXT, //email contents "Subject:" + status INTEGER, //info status numline INTEGER, //status line info TEXT //line info ); diff --git a/www/lvlmai.php b/www/lvlmai.php index 86e63a5..fdce6a0 100644 --- a/www/lvlmai.php +++ b/www/lvlmai.php @@ -43,7 +43,7 @@ foreach($actions as $action) { if ($count & 1 ) { $bgcolor="green"; } - $status=substr($action['info'],0,4); + $status=$action['status']; $date=$action['creation']; $reverse=$action['reverse']; $smtpfrom=$action['smtpfrom']; -- 2.47.3