Documentation Problems → xml-rpc 'classify' & 'handle_message' are wrong

xml-rpc 'classify' & 'handle_message' are wrong

http://getpopfile.org/docs/popfilemodules:xmlrpc#popfile_xml-rpc_api

says that the classify and handle_message functions return the bucket name. It doesn't It returns some kind of probability. the handle function returns a probability as well.

This is the pertitent line from my qpsmtpd plugin: {{{

my $pop_result = XMLRPC::Lite ->proxy('http://localhost:8081/RPC2')

-> call('POPFile/API.classify',$sk,$message)
-> result;

##A little later on, I log results.

$self->log(LOGINFO, "$pop_subject popfile_xmlrpc Result is $pop_result");

}}}

It seems to ignore magnets in calculating a score. The two mails at 13:06 were both redirected to ham with magnets.

Logs show $pop_result as numbers.

grep 'classified as' /var/log/qpsmtpd/qpsmtpd.log
Mon Oct 12 09:18:47 2009 localhost[11726]: popfile_xmlrpc classified as 25.7034657496158
Mon Oct 12 09:35:45 2009 localhost[11739]: popfile_xmlrpc classified as 40.8573079627447
Mon Oct 12 09:37:46 2009 localhost[11746]: popfile_xmlrpc classified as 41.4802772215009
Mon Oct 12 13:06:06 2009 localhost[11905]: popfile_xmlrpc classified as 40.7739002537209
Mon Oct 12 13:06:26 2009 localhost[11912]: popfile_xmlrpc classified as 22.4956047725948
Mon Oct 12 14:27:00 2009 mothership[11984]: popfile_xmlrpc classified as 57.9133342276165
Mon Oct 12 15:12:28 2009 mothership[12030]: popfile_xmlrpc classified as 45.5103673244632
Mon Oct 12 17:56:49 2009 mothership[12182]: popfile_xmlrpc classified as 26.7320252598093
Mon Oct 12

  • Message #1028

    handle_message works for me. I re-ran some of my XML-RPC tests using the current 1.1.1 release and they still work.

    ---------------------------------
    Message: personal-01.msg
    
    API.get_session_key: _fXA3bx7hWYEA8L5KoF3z_
    API.handle_message: 1
    paramsall...
      bucket:  personal
      slot-id: 683
      magnet:  1
    API.release_session_key: XMLRPC::Lite=HASH(0x2b3e07c)
    
    ---------------------------------
    Message: regular-01.msg
    
    API.get_session_key: _xEn02Vujz6NXE1re4_
    API.handle_message: 1
    paramsall...
      bucket:  regular
      slot-id: 684
      magnet:  0
    API.release_session_key: XMLRPC::Lite=HASH(0x2a6e2e4)
    
    ---------------------------------
    

    As you can see, the script returns the bucket name and shows whether or not a magnet was used.

    Here is the script I used:

    use strict;
    use XMLRPC::Lite;
    
    # c:\programme\popfile\perl.exe C:\smtp-proxy\check_popfile.pl MAIL OUTPUT
    # %1 mail-file that shall be processed
    # %2 output-file
    
    my $xml = XMLRPC::Lite ->proxy('http://localhost:8081/RPC2') ;
    print "API.get_session_key: ";
    my $sk = $xml -> call('POPFile/API.get_session_key','admin','')
        -> result;
    print "_".$sk."_\n";
    
    print "API.handle_message: ";
    my $ret = $xml->call('POPFile/API.handle_message',$sk, $ARGV[0], $ARGV[0].".pf");
    print $ret."\n";
    
    print "paramsall...\n";
    my @res = $ret->paramsall;
    
    print "  bucket:  ".@res[0]."\n";
    print "  slot-id: ".@res[1]."\n";
    print "  magnet:  ".@res[2]."\n";
    
    unlink($ARGV[0].".pf");
    open(FH, ">", $ARGV[1]);
    print FH @res[0]."\nhttp://localhost:8000/jump_to_message?view=".@res[1];
    close FH;
    
    print "API.release_session_key: ";
    $xml -> call('POPFile/API.release_session_key',$sk);
    print $xml."\n";
    

    I did not write this script - a user supplied it to demonstrate a problem with the XMLRPC support for the Windows version

    Brian

    • Message #1029

      The wiki's simple 'classify' example also works for me with the current 1.1.1 release:

      perl.exe wiki-testxml.pl
      spam
      

      Brian

      (edited to fix the quotes around the 'classify' link)