Hello, Achim. 
You wrote in <mid:[EMAIL PROTECTED]>

AW> i tried to use the function TBP_GetSpamScore from the plugin interface
AW> with no result. if i return 100 for every mail nothing happens.

May be you set the option to delete all the messages with "score more than...".
So, it is really seems that nothing happens - i.e. letters just deleted :).
Anyway, you can check the filter's work throw internal The Bat! log - it will be
records like:

!27.08.2003, 19:24:08: FILTER - Message from marichu alviola
<[EMAIL PROTECTED]> to [EMAIL PROTECTED] with subject Free to join!!! Time
tested online business..... scored 100, qualified as JUNK MAIL

(this is the cite from really working filter).

Also it may be the thing which is a bit trick: when I begin to test filter's API
I also tried at first just return some constant number for every function's
call. And it also didn't work. I suggest that such function works only when it
request some data from The Bat! (as MSID and so on). If this is no secret, cite
your function here - and I think it will be possible to find a solution.

Below is the real procedure from BayesIt! antispam filter (and it really works).
Note the usage of CriticalSections! It is necessary, because multiple instances
of TBP_GetSpamScore can be called simultaneously.

int WINAPI TBP_GetSpamScore(int MSID, TBPGetDataProc flt)
{
    if (R==0) return 0;         // no regarding base!
    DWORD s=0;
    baesyan::maildict* dictionary = NULL;
    email::email* mail = NULL;

    // retrieve the message's body
    char* bdy = GetStr(mpidRawMessage,MSID,flt,s);
    if (s==0) return 0;
    dictionary = new baesyan::maildict(true);
    mail = new email::email(dictionary);
    mail->assign(bdy,s);

    // make a frequency dictionary from the retrieved letter
    if (!mail->parseletter(ign,_kl)) mail->parseletter(ign,_kl);
    delete mail; mail=0;
    delete[] bdy; bdy=0;

    // first check if the base is already ready (it must be prepared
    // by background process). If no, return zero (=non-spam) and report
    // about training mode into log.
    if (!status) {
       if (data.FLG&&data.currep) {
          EnterCriticalSection(&loglock);
          logln_(dictionary->msid().c_str());
          logln (IDS_log_trainmode);
          agl();
          LeaveCriticalSection(&loglock);
       }
       delete dictionary; dictionary=0;
       return 0;
    }

    // Base is existing. So, create the filter using the base and method
    regard::filter f(data.SIGNIFY_TOKENS);
    f.set_base(R);
    f.set_method(mtd);
    double result=0;

    // this is core part: calculate a score from the dictionary
    EnterCriticalSection(&filterlock);
    result = f.filt(dictionary);
    LeaveCriticalSection(&filterlock);
    int rint = 100*result;

    // write the report to the log (if necessary)
    if (data.FLG) {
        EnterCriticalSection(&loglock);
        if (data.currep) {
            logln_(dictionary->msid().c_str());
            logfloat (IDS_Graham, result);
            logfloat (IDS_log_spamgrade,result);
            logres (IDS_log_valuebat,rint);
        };
        if (data.gradrep) {
            if (!data.currep)logln_(dictionary->msid().c_str());
            logln (IDS_line);
            if (log) for (DWORD i=0; i!=f.word(); ++i)
               logfloat (f.rul()[i].token.c_str(), f.rul()[i].weight);
            logln (IDS_line);
        };
        agl();
        LeaveCriticalSection(&loglock);
    }

    // trlimit is value of "Junkscore" parameter from TBPlugin.ini file
    // make automatic "mark as junk/non-junk" basing of the counted score
    if (rint>trlimit) {
       spamd->add(*dictionary);
    } else {
       nspamd->add(*dictionary);
    }

    // clear memory and return result...
    delete dictionary; dictionary=0;
    return rint;
}

-- 
Sincerely,
 Alexey.
Using TB 2.0b5 on WinXP Pro SP1 (2600), spelling by ORFO2002 (CSAPI) 
..with Kaspersky Antivirus Plugin (ver 3.5 Gold) & antispam filter BayesIt! 0.4b

   mailto:[EMAIL PROTECTED]


________________________________________________
http://www.silverstones.com/thebat/TBUDLInfo.html

Reply via email to