On Tue, 2010-10-19 at 16:12 -0200, Pedro Padron wrote:
> 2010/10/19 Karsten Bräckelmann
> Yep, based on it I'm writing a PHP client [1] for the spamd protocol,
> which is why I'm interested in this =)
>
> > Oh, and if you really want a CSV separated output, it should be possibly
> > to write a plugin that provides a custom Template Tag to be used instead
> > of the default _SUMMARY_, without hacking the spamd source itself.
>
> I have already tried to use only _SUMMARY_, but I was thinking that I
> should not mess with the report template because it should provide a
> human readable explanation, since it is used in PROCESS to return a
> modified version of the message.
Unless report_safe is set to 0. Frankly, IMHO both the rewrite_header
and report_safe 1 (default) really are only useful with broken clients
who cannot filter based on arbitrary headers. I suggest to not use
either of them if using IMAP and server side filtering, or an MUA with
half a brain.
Encapsulating the original message makes user review of identified but
possibly FP a real pain in the ass.
> However... I just realized that I can set different report templates
> per user... This should do the trick, along with a custom template
> tag.
Yep, the report option is a user preference.
However, rather than diving into SA plugin internals and writing Perl
code, it might be easier for you to just have your PHP client parse the
default _SUMMARY_ template output.
--
char *t="\10pse\0r\0dtu...@ghno\x4e\xc8\x79\xf4\xab\x51\x8a\x10\xf4\xf4\xc4";
main(){ char h,m=h=*t++,*x=t+2*h,c,i,l=*x,s=0; for (i=0;i<l;i++){ i%8? c<<=1:
(c=*++x); c&128 && (s+=h); if (!(h>>=1)||!t[s+h]){ putchar(t[s]);h=m;s=0; }}}