On Tue, 2010-10-19 at 16:12 -0200, Pedro Padron wrote: > Yep, based on it I'm writing a PHP client [1] for the spamd protocol, > which is why I'm interested in this =)
I'm, not a PHP guy myself (let's just leave it at that ;), but that's quite nice -- a SA spamd client for PHP. :) Some feedback, after reading your blog post [1]. If the client can parse the default _SUMMARY_ template, it will be usable out-of-the-box without any SA code modification or the need for a custom plugin. Moreover, if you make your client smart enough to ignore the leading part prior to the _SUMMARY_, you'd also get rid of the requirement of a dedicated user and specific preferences. Since spamc was your inspiration, you might want to consider inheriting some of its behavior and options. In particular, the hostname and port as set in your $params should be default anyway. Another useful and likely easy to implement option would be the size limit. A message exceeding the threshold would not be passed to spamd. > [1] http://ppadron.blog.br/2010/05/04/php-api-to-spamassassin-spamd-protocol/ -- 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; }}}
