From 6056e0278cc5a6d17d082a01151c8ef3065992db Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Sat, 26 Apr 2008 14:11:49 +0000 Subject: [PATCH] * some more work on the DSPAM module; unfinished; disabled. --- citadel/citadel_dirs.c | 12 +++++++++++- citadel/citadel_dirs.h | 2 ++ citadel/modules/dspam/serv_dspam.c | 19 ++++++++++++------- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/citadel/citadel_dirs.c b/citadel/citadel_dirs.c index bade7734a..c889640ef 100644 --- a/citadel/citadel_dirs.c +++ b/citadel/citadel_dirs.c @@ -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. diff --git a/citadel/citadel_dirs.h b/citadel/citadel_dirs.h index 490884efb..3d568a593 100644 --- a/citadel/citadel_dirs.h +++ b/citadel/citadel_dirs.h @@ -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]; diff --git a/citadel/modules/dspam/serv_dspam.c b/citadel/modules/dspam/serv_dspam.c index 0c3cefee5..e0f478f6c 100644 --- a/citadel/modules/dspam/serv_dspam.c +++ b/citadel/modules/dspam/serv_dspam.c @@ -48,10 +48,13 @@ #ifdef HAVE_LIBDSPAM +#define CONFIG_DEFAULT file_dpsam_conf +#define LOGDIR file_dspam_log -#undef HAVE_CONFIG_H + +//#define HAVE_CONFIG_H #include -#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) { -- 2.39.2