diff src/context.h @ 310:802e2b779ed1

enable smtp verify logging
author Carl Byington <carl@five-ten-sg.com>
date Sun, 18 Sep 2016 18:32:37 -0700
parents 368572c57013
children f5547e7b3a09
line wrap: on
line diff
--- a/src/context.h	Wed Aug 03 08:28:31 2016 -0700
+++ b/src/context.h	Sun Sep 18 18:32:37 2016 -0700
@@ -56,15 +56,17 @@
     char    efrom[maxlen];  // last envelope from sent on this socket
     int     pending;        // unread bytes in buffer, not including the null terminator
     char    buffer[maxlen];
+    const char  *queueid;   // last queueid for logging
 public:
     SMTP(int f)             {fd = f; error = false; now(); efrom[0] = '\0'; init();};
     ~SMTP()                 {if (!error) quit(); closefd();};
-    void    init()          {pending = 0; buffer[0] = '\0';};
+    void    init()          {pending = 0; buffer[0] = '\0'; queueid = NULL;};
     void    append(const char *c)   {strncat(buffer, c, max(0, maxlen-1-(int)strlen(c)));};
     bool    err()           {return error;};
     void    now()           {stamp = time(NULL);};
     time_t  get_stamp()     {return stamp;};
     int     get_fd()        {return fd;};
+    void    set_id(const char *id)  {queueid = id;};
     int     writer();
     int     reader();
     int     read_line();
@@ -78,8 +80,8 @@
     int     quit();
     void    closefd();
 #ifdef VERIFY_DEBUG
-    static void log(const char *m, int v);
-    static void log(const char *m, const char *v);
+    void log(const char *m, int v);
+    void log(const char *m, const char *v);
 #endif
 };
 
@@ -93,7 +95,7 @@
     void    closer();           // if the oldest socket is ancient, close it
     SMTP    *get_connection();
     void    put_connection(SMTP *conn);
-    bool    ok(const char *from, const char *to);
+    bool    ok(const char *queueid, const char *from, const char *to);
 };
 
 class WHITELISTER {