Main Page | Compound List | File List | Compound Members | File Members

SpamUtil.h

00001 
00002 #ifndef SPAMUTIL_H
00003 #define SPAMUTIL_H
00004 
00005 /*
00006   This email filter was written by Ian Kaplan, Bear Products
00007   International.  It is copyrighted by Ian Kaplan, 2004,
00008   www.bearcave.com.
00009 
00010   You have permission to use this software without restriction on two
00011   conditions:
00012 
00013     1. You must preserve this copyright notice in this software and
00014        any software derived from it.
00015 
00016     2. You accept any risk entailed in using this software.  By
00017        using this software, you acknowledge that you have a
00018        sophisticated background in software engineering and 
00019        understand the way this software functions.  You further
00020        acknowledge that using this software may result in the
00021        irretrievable loss of important e-email and you alone
00022        are responsible for this loss.
00023 
00024   If either of these conditions are unacceptable, you may not use any
00025   part of this software.
00026 
00027  */
00028 
00029 #include "MailFilter.h"
00030 #include "SpamParameters.h"
00031 
00041 class SpamUtil
00042 {
00043  private:
00045   SpamUtil( const SpamUtil &rhs );
00046 
00047  public:
00048   // email type synthesized from the Content-Type and Content-Transfer-Encoding
00049   typedef enum { BAD_CONT, 
00050                  UNKNOWN,
00051                  BLANK,
00052                  HTML, 
00053                  TEXT, 
00054                  MULTIPART, 
00055                  AUDIO, 
00056                  IMAGE, 
00057                  APPLICATION,
00058                  WINDOZ, 
00059                  BASE64 } contentType;
00060 
00061  public:
00062   SpamUtil() {}
00063   ~SpamUtil() {}
00064   static const int getFileSize( FILE *fp, const char *fileName, char *msgbuf );
00065   static const char *trimEnd(char *str );
00066   static void trim(const char * str );
00067   static const char *findColon( const char *buf );
00068   static const char *skipWhiteSpace( const char *pBuf );
00069   static bool isBlankLine(const char *buf);
00070   static void strncpy(char *pDest, const char *pSrc, size_t destSize );
00071   static void toLower(char *dest, const char *src);
00072   static void toLower(char *dest, const char *src, size_t size);
00073   static bool match(const char *bufStart,
00074                     const size_t len,
00075                     const char *word );
00076   static bool match(const char *bufStart,
00077                     const char *bufEnd,
00078                     const char *word );
00079   static contentType classifySection( const char *buf );
00080   const char *classificationToStr( MailFilter::classification klass );
00081   static const char *typeToStr( contentType type );
00082   static MailFilter::classification checkLine(const char *buf, 
00083                                               SpamParameters &params,
00084                                               char *foundStr,
00085                                               const size_t foundStrSize );
00086 };
00087 
00088 #endif

Generated on Sat Mar 27 13:07:38 2004 for Mail Filter by doxygen 1.3.3