Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
3.0 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // JunkRule.h
  4. //
  5. ///////////////////////////////////////////////////////////////////////////////
  6. // Bring in only once
  7. #pragma once
  8. #include "oerules.h"
  9. #include "msoejunk.h"
  10. #include "addrrule.h"
  11. class COEJunkRule : public IOERule
  12. {
  13. private:
  14. enum
  15. {
  16. RULE_STATE_UNINIT = 0x00000000,
  17. RULE_STATE_INIT = 0x00000001,
  18. RULE_STATE_LOADED = 0x00000002,
  19. RULE_STATE_DIRTY = 0x00000004,
  20. RULE_STATE_DISABLED = 0x00000008,
  21. RULE_STATE_INVALID = 0x00000010,
  22. RULE_STATE_EXCPT_WAB = 0x00000020,
  23. RULE_STATE_DATA_LOADED = 0x00000040
  24. };
  25. enum {RULE_VERSION = 0x00050000};
  26. private:
  27. LONG m_cRef;
  28. DWORD m_dwState;
  29. HINSTANCE m_hinst;
  30. IOEJunkFilter * m_pIJunkFilter;
  31. DWORD m_dwJunkPct;
  32. IOERuleAddrList * m_pIAddrList;
  33. IUnknown * m_pIUnkInner;
  34. LPSTR m_pszJunkDll;
  35. LPSTR m_pszDataFile;
  36. public:
  37. // Constructor/destructor
  38. COEJunkRule() : m_cRef(0), m_dwState(RULE_STATE_NULL), m_hinst(NULL),
  39. m_pIJunkFilter(NULL), m_dwJunkPct(2), m_pIAddrList(NULL),
  40. m_pIUnkInner(NULL), m_pszJunkDll(NULL), m_pszDataFile(NULL) {}
  41. ~COEJunkRule();
  42. // IUnknown members
  43. STDMETHODIMP QueryInterface(REFIID riid, void ** ppvObject);
  44. STDMETHODIMP_(ULONG) AddRef(void);
  45. STDMETHODIMP_(ULONG) Release(void);
  46. // IRule members
  47. STDMETHODIMP Reset(void);
  48. STDMETHODIMP GetState(DWORD * pdwState);
  49. STDMETHODIMP Validate(DWORD dwFlags) {return S_OK;}
  50. STDMETHODIMP GetProp(RULE_PROP prop, DWORD dwFlags, PROPVARIANT * pvarResult);
  51. STDMETHODIMP SetProp(RULE_PROP prop, DWORD dwFlags, PROPVARIANT * pvarValue);
  52. STDMETHODIMP Evaluate(LPCSTR pszAcct, MESSAGEINFO * pMsgInfo, IMessageFolder * pFolder,
  53. IMimePropertySet * pIMPropSet, IMimeMessage * pIMMsg, ULONG cbMsgSize,
  54. ACT_ITEM ** ppActions, ULONG * pcActions);
  55. STDMETHODIMP LoadReg(LPCSTR szRegPath);
  56. STDMETHODIMP SaveReg(LPCSTR szRegPath, BOOL fClearDirty);
  57. STDMETHODIMP Clone(IOERule ** ppIRule);
  58. HRESULT HrInit(LPCSTR pszJunkDll, LPCSTR pszDataFile);
  59. private:
  60. HRESULT _HrGetDefaultActions(ACT_ITEM * pAct, ULONG cAct);
  61. HRESULT _HrSetSpamThresh(VOID);
  62. HRESULT _HrGetSpamFlags(LPCSTR pszAcct, IMimeMessage * pIMMsg, DWORD * pdwFlags);
  63. HRESULT _HrIsSenderInWAB(IMimeMessage * pIMMsg);
  64. HRESULT _HrLoadJunkFilter(VOID);
  65. };
  66. HRESULT HrCreateJunkRule(IOERule ** ppIRule);