* some more work on the DSPAM module; unfinished; disabled.
authorWilfried Göesgens <willi@citadel.org>
Sat, 26 Apr 2008 14:11:49 +0000 (14:11 +0000)
committerWilfried Göesgens <willi@citadel.org>
Sat, 26 Apr 2008 14:11:49 +0000 (14:11 +0000)
citadel/citadel_dirs.c
citadel/citadel_dirs.h
citadel/modules/dspam/serv_dspam.c

index bade7734acf9f0060f1c62a2d59458f678a82226..c889640efeac0a5e77f3e662c7833f1f165ee07b 100644 (file)
@@ -67,6 +67,8 @@ char file_crpt_file_cer[PATH_MAX]="";
 char file_chkpwd[PATH_MAX]="";
 char file_base64[PATH_MAX]="";
 char file_funambol_msg[PATH_MAX] = "";
+char file_dpsam_conf[PATH_MAX] = "";
+char file_dspam_log[PATH_MAX] = "";
 
 int home_specified = 0;
 
@@ -232,7 +234,15 @@ void calc_dirs_n_files(int relh, int home, const char *relhome, const char  *ctd
                 "%sbase64",
                 ctdl_utilbin_dir);
 
-
+       snprintf(file_dpsam_conf,
+                sizeof file_dpsam_conf,
+                "%sdspam.conf",
+                ctdl_etc_dir);
+       snprintf(file_dspam_log, 
+                sizeof file_dspam_log, 
+                "%sdspam.log",
+                ctdl_home_directory);
+       
        /* 
         * DIRTY HACK FOLLOWS! due to configs in the network dir in the 
         * legacy installations, we need to calculate ifdeffed here.
index 490884efb8f03c6e30cad5646ac3b80d771bdb9c..3d568a593c8f401aa170bb3a6de2f11f1e72b531 100644 (file)
@@ -49,6 +49,8 @@ extern char file_crpt_file_csr[PATH_MAX];
 extern char file_crpt_file_cer[PATH_MAX];
 extern char file_chkpwd[PATH_MAX];
 extern char file_base64[PATH_MAX];
+extern char file_dpsam_conf[PATH_MAX];
+extern char file_dspam_log[PATH_MAX];
 
 extern char file_funambol_msg[PATH_MAX];
 
index 0c3cefee5400ead4153f5b7084b5c04b67fc9716..e0f478f6c79042cdf80541004ec6b1943d073482 100644 (file)
 
 
 #ifdef HAVE_LIBDSPAM
+#define CONFIG_DEFAULT file_dpsam_conf
+#define LOGDIR file_dspam_log
 
-#undef HAVE_CONFIG_H
+
+//#define HAVE_CONFIG_H
 #include <dspam/libdspam.h>
-#define HAVE_CONFIG_H
+//#define HAVE_CONFIG_H
 
 typedef struct stringlist stringlist;
 
@@ -155,9 +158,8 @@ void dspam_do_msg(long msgnum, void *userdata)
        {
 /* Copy to a safe place */
 
-               SIG.data = malloc (CTX->signature->length);
-               if (SIG.data != NULL)
-                       memcpy (SIG.data, CTX->signature->data, CTX->signature->length);
+               msg->cm_fields['G'] = malloc (CTX->signature->length * 2);
+               CtdlEncodeBase64(msg->cm_fields['G'], CTX->signature->data, CTX->signature->length, 0);
        }
        free(msgtext);
 
@@ -184,18 +186,21 @@ int serv_dspam_room(struct ctdlroom *room)
 // dspam_init (cc->username, NULL, ctdl_dspam_home, DSM_PROCESS,
        //                  DSF_SIGNATURE | DSF_NOISE);
        /// todo: if roomname = spam / ham -> learn!
-       if (room->QRflags & QR_PRIVATE) /* Are we sending to a private mailbox? */
+       if ((room->QRflags & QR_PRIVATE) &&/* Are we sending to a private mailbox? */
+           (strstr(room->QRname, ".Mail")!=NULL))
+
        {
                char User[64];
                // maybe we should better get our realname here?
                snprintf(User, 64, "%ld", room->QRroomaide);
-
+               extract_token(User, room->QRname, 0, '.', sizeof(User));
                CTX = dspam_init(User, 
                                 NULL,
                                 ctdl_dspam_dir, 
                                 DSM_PROCESS, 
                                 DSF_SIGNATURE | DSF_NOISE);
        }
+       else return 0;//// 
        /// else -> todo: global user for public rooms etc.
        if (CTX == NULL)
        {