On Wed, Oct 06, 2004 at 02:11:19PM -0700, [EMAIL PROTECTED] wrote: > > Is there any documentation for the spamd client interface? > MIMEDefang can talk to clamd.sock directly, using the commands in man > clamd, rather than spawning `clamdscan` processes. I checked man > spamd and man spamc but couldn't find anything. I tried browsing the > spamc source code but it's pretty hard going. > > Can anyone illustrate the spamc<->spamd conversation, so I can have > MIMEDefang emulate spamc (talking to the socket directly using > IO::Socket perl commands?)
I've actually started a project to write a pureperl based client, to hopefully be included in the SA source. I haven't been able to put as much time as I would like into it, but you're welcome to take a stab. The protocol is documented in spamd/PROTOCOL in the 3.0 tarball, you'll probably have to follow along in the spamd source as well. I'm attaching my VERY ROUGH module that I've started, feel free to fill in all the gaps, all I ask is that you send back any improvements. The ultimate goal will be inclusion in the SA tree. With this module installed you can test it via a simple script such as this: #!/usr/bin/perl -w use strict; use Mail::SpamAssassin::Client; my $testmsg = 'cut and paste some msg here, but obviously you would want to get this from somewhere else, it's just an example after all'; my $client = new Mail::SpamAssassin::Client({port=>783,host=>'localhost',username=>'parker'}); #my $client = new Mail::SpamAssassin::Client({socketpath=>'/tmp/myspamd.sock',username=>'root'}); if ($client->ping()) { print "Ping is ok\n"; } # yeah, I know this part isn't quite right, but its rough $client->process($testmsg); Michael PS ignore the learn method for now, that's from something else I'm working on.
Client.pm
Description: Perl program