Update of /cvsroot/mahogany/M/src/modules/spam
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30734/src/modules/spam
Modified Files:
DspamFilter.cpp
Log Message:
don't keep DSPAM_CTX alive for a long time, this doesn't seem to work correctly
Index: DspamFilter.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/modules/spam/DspamFilter.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -b -u -2 -r1.9 -r1.10
--- DspamFilter.cpp 13 Jul 2004 23:29:46 -0000 1.9
+++ DspamFilter.cpp 14 Jul 2004 16:15:57 -0000 1.10
@@ -88,4 +88,5 @@
public:
DspamFilter();
+ virtual ~DspamFilter();
// these public methods are used by GUI class (DspamOptionsPage below)
@@ -108,4 +109,7 @@
String *params) const;
+ // get the context creating it on demand
+ DSPAM_CTX *GetCtx() const;
+
private:
// helper: used as DoProcess() argument to initialize the context or to get
@@ -152,4 +156,6 @@
+ DspamCtx *m_ctx;
+
DECLARE_SPAM_FILTER("dspam", 100);
};
@@ -210,9 +216,19 @@
dspam_init_driver();
+
+ m_ctx = NULL;
}
-bool DspamFilter::DoProcess(const Message& msg, ContextHandler& handler)
+DspamFilter::~DspamFilter()
{
- DspamCtx ctx(dspam_init
+ delete m_ctx;
+}
+
+DSPAM_CTX *DspamFilter::GetCtx() const
+{
+ if ( !m_ctx )
+ {
+ const_cast<DspamFilter *>(this)->
+ m_ctx = new DspamCtx(dspam_init
(
M_DSPAM_USER,
@@ -221,11 +237,32 @@
DSF_CHAINED | DSF_NOISE
));
- if ( !ctx )
+ }
+
+ if ( !*m_ctx )
{
ERRORMESSAGE((_("DSPAM: library initialization failed.")));
- return false;
+ return NULL;
}
+ return *m_ctx;
+}
+
+bool DspamFilter::DoProcess(const Message& msg, ContextHandler& handler)
+{
+#if 0
+ DSPAM_CTX *ctx = GetCtx();
+#else
+ DspamCtx ctx(dspam_init
+ (
+ M_DSPAM_USER,
+ NULL,
+ DSM_PROCESS,
+ DSF_CHAINED | DSF_NOISE
+ ));
+#endif
+ if ( !ctx )
+ return false;
+
String str;
if ( !msg.WriteToString(str) )
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates