diff src/spamass.cpp.in @ 167:9b129ed78d7d stable-6-0-6

actually use spamassassin result, allow build without spam assassin, only call it if some recipient needs it.
author carl
date Mon, 27 Aug 2007 20:49:19 -0700
parents 5809bcdc325b
children 6bac960af6b4
line wrap: on
line diff
--- a/src/spamass.cpp.in	Sun Aug 26 20:54:59 2007 -0700
+++ b/src/spamass.cpp.in	Mon Aug 27 20:49:19 2007 -0700
@@ -22,15 +22,27 @@
 
 static const char Id[] = "$Id$";
 
+char *spamc = "@SPAMC@";
+char *spamc_empty = "";
 bool warnedmacro = false;   /* have we logged that we couldn't fetch a macro? */
 const int maxlen = 1000;    // used for snprintf buffers
 
 
-SpamAssassin::SpamAssassin()
+SpamAssassin::SpamAssassin(mlfiPriv *priv_, int ip, char *helo_, char *from, char *qid)
 {
     error           = false;
     running         = false;
     first_recipient = true;
+    priv            = priv_;
+    ip4             = ip;
+    helo            = helo_;
+    envfrom         = from;
+    queueid         = qid;
+    pid             = 0;
+    pipe_io[0][0] = -1;
+    pipe_io[0][1] = -1;
+    pipe_io[1][0] = -1;
+    pipe_io[1][1] = -1;
 }
 
 
@@ -55,26 +67,6 @@
 }
 
 
-void SpamAssassin::mlfi_connect(mlfiPriv *priv_, int ip)
-{
-    priv = priv_;
-    ip4 = ip;
-}
-
-
-void SpamAssassin::mlfi_helo(char *helohost)
-{
-    helo = helohost;
-}
-
-
-void SpamAssassin::mlfi_envfrom(char *from, char *qid)
-{
-    envfrom = from;
-    queueid = qid;
-}
-
-
 void SpamAssassin::mlfi_envrcpt(SMFICTX *ctx, char *envrcpt)
 {
     if (first_recipient) {
@@ -227,7 +219,7 @@
 
             // execute spamc
             char* argv[3];
-            argv[0] = "@SPAMC@";
+            argv[0] = spamc;
             argv[1] = "-c";
             argv[2] = NULL;
             execvp(argv[0] , argv); // does not return!