SF.net SVN: mahogany: [7213] trunk/M/src/modules/spam/DspamFilter.cpp

[email protected]
Newsgroups gmane.mail.mahogany.cvs
Message-ID <[email protected]>
Revision: 7213
          http://svn.sourceforge.net/mahogany/?rev=7213&view=rev
Author:   vadz
Date:     2007-02-24 14:07:50 -0800 (Sat, 24 Feb 2007)

Log Message:
-----------
set HashAutoExpand parameter so that hash driver database isn't limited in size (without it, the database becomes useless after some time as the information in it is not accurate any longer because not everything can be saved in it)

Modified Paths:
--------------
    trunk/M/src/modules/spam/DspamFilter.cpp

Modified: trunk/M/src/modules/spam/DspamFilter.cpp
===================================================================
--- trunk/M/src/modules/spam/DspamFilter.cpp	2007-01-18 14:24:13 UTC (rev 7212)
+++ trunk/M/src/modules/spam/DspamFilter.cpp	2007-02-24 22:07:50 UTC (rev 7213)
@@ -55,7 +55,7 @@
    // create the context
    DspamCtx(int mode, unsigned flags)
    {
-      m_ctx = dspam_init
+      m_ctx = dspam_create
               (
                   "mahogany", // user
                   NULL,       // no group
@@ -63,16 +63,30 @@
                   mode,
                   flags
               );
+      if ( !m_ctx )
+         return;
 
       // use default algorithm/tokenizer
       m_ctx->algorithms = DSA_GRAHAM | DSA_BURTON | DSP_GRAHAM;
       m_ctx->tokenizer = DSZ_CHAIN;
+
+      // unlimit the hash table size for now to avoid "hash table full" errors
+      dspam_addattribute(m_ctx, "HashAutoExtend", "on");
+
+      // and now that the attributes are set we can attach the context to the
+      // storage
+      if ( dspam_attach(m_ctx, NULL) != 0 )
+      {
+         dspam_destroy(m_ctx);
+         m_ctx = NULL;
+      }
    }
 
    // destroy the context
    ~DspamCtx()
    {
-      dspam_destroy(m_ctx);
+      if ( m_ctx )
+         dspam_destroy(m_ctx);
    }
 
    operator DSPAM_CTX *() const { return m_ctx; }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.