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.

139 lines
6.5 KiB

  1. // --------------------------------------------------------------------------------
  2. // Mimeutil.h
  3. // Copyright (c)1993-1995 Microsoft Corporation, All Rights Reserved
  4. // --------------------------------------------------------------------------------
  5. #ifndef __MIMEUTIL_H
  6. #define __MIMEUTIL_H
  7. // --------------------------------------------------------------------------------
  8. // Dependencies
  9. // --------------------------------------------------------------------------------
  10. #include "mimeole.h"
  11. #include "imnact.h"
  12. class CWabal;
  13. typedef CWabal *LPWABAL;
  14. typedef struct SECURITY_PARAMtag SECURITY_PARAM;
  15. typedef struct tagHTMLOPT HTMLOPT;
  16. typedef struct tagPLAINOPT PLAINOPT;
  17. // --------------------------------------------------------------------------------
  18. // Mail Message Index Cache Header
  19. // --------------------------------------------------------------------------------
  20. #define SafeMimeOleFree(_pv) \
  21. if (_pv) { \
  22. Assert(g_pMoleAlloc); \
  23. g_pMoleAlloc->Free(_pv); \
  24. _pv = NULL; \
  25. } else
  26. #define MimeOleAlloc(_cb) g_pMoleAlloc->Alloc(_cb)
  27. // --------------------------------------------------------------------------------
  28. // Cached Current Default Character Set From Fonts Options Dialog
  29. // --------------------------------------------------------------------------------
  30. extern HCHARSET g_hDefaultCharsetForNews;
  31. extern HCHARSET g_hDefaultCharsetForMail;
  32. extern int g_iLastCharsetSelection;
  33. extern int g_iCurrentCharsetSelection;
  34. // --------------------------------------------------------------------------------
  35. // Message constructors
  36. // Note: Everyone should use HrCreateMessage as it wraps the MimeOle call passing
  37. // an Athena-Specific implementation of the MimeInline Object to correctly
  38. // in-line HTML and PLAIN text
  39. // --------------------------------------------------------------------------------
  40. HRESULT HrCreateMessage(IMimeMessage **ppMsg);
  41. // --------------------------------------------------------------------------------
  42. // Message Utility Functions
  43. // --------------------------------------------------------------------------------
  44. HRESULT HrSaveMsgToFile(LPMIMEMESSAGE pMsg, LPSTR lpszFile);
  45. HRESULT HrLoadMsgFromFile(LPMIMEMESSAGE pMsg, LPSTR lpszFile);
  46. HRESULT HrLoadMsgFromFileW(LPMIMEMESSAGE pMsg, LPWSTR lpwszFile);
  47. HRESULT HrDupeMsg(LPMIMEMESSAGE pMsg, LPMIMEMESSAGE *ppMsg);
  48. HRESULT HrSetServer(LPMIMEMESSAGE pMsg, LPSTR lpszServer);
  49. HRESULT HrSetAccount(LPMIMEMESSAGE pMsg, LPSTR pszAcctName);
  50. HRESULT HrSetAccountByAccount(LPMIMEMESSAGE pMsg, IImnAccount *pAcct);
  51. // --------------------------------------------------------------------------------
  52. // Wabal Conversion Functions
  53. // --------------------------------------------------------------------------------
  54. HRESULT HrGetWabalFromMsg(LPMIMEMESSAGE pMsg, LPWABAL *ppWabal);
  55. HRESULT HrSetWabalOnMsg(LPMIMEMESSAGE pMsg, LPWABAL pWabal);
  56. HRESULT HrCheckDisplayNames(LPWABAL lpWabal, CODEPAGEID cpID);
  57. #if 0
  58. HRESULT HrSetReplyTo(LPMIMEMESSAGE pMsg, LPSTR lpszEmail);
  59. #endif
  60. LONG MimeOleRecipToMapi(IADDRESSTYPE addrtype);
  61. IADDRESSTYPE MapiRecipToMimeOle(LONG lRecip);
  62. // --------------------------------------------------------------------------------
  63. // Attachment helper functions
  64. // --------------------------------------------------------------------------------
  65. HRESULT HrRemoveAttachments(LPMIMEMESSAGE pMsg, BOOL fKeepRelatedSection);
  66. // Note: the caller of GetAttachIcon must call DestroyIcon on the hIcon returned!
  67. HRESULT GetAttachmentCount(LPMIMEMESSAGE pMsg, ULONG *cCount);
  68. // --------------------------------------------------------------------------------
  69. // Random Utility Functions
  70. // --------------------------------------------------------------------------------
  71. HRESULT HrComputeLineCount(LPMIMEMESSAGE pMsg, LPDWORD pdw);
  72. HRESULT HrHasEncodedBodyParts(LPMIMEMESSAGE pMsg, ULONG cBody, LPHBODY rghBody);
  73. HRESULT HrHasBodyParts(LPMIMEMESSAGE pMsg);
  74. HRESULT HrIsBodyEncoded(LPMIMEMESSAGE pMsg, HBODY hBody);
  75. HRESULT HrCopyHeader(LPMIMEMESSAGE pMsg, HBODY hBodyDest, HBODY hBodySrc, LPCSTR pszName);
  76. HRESULT HrSetMessageText(LPMIMEMESSAGE pMsg, LPTSTR pszText);
  77. // --------------------------------------------------------------------------------
  78. // MHTML Utility Functions
  79. // --------------------------------------------------------------------------------
  80. HRESULT HrIsInRelatedSection(LPMIMEMESSAGE pMsg, HBODY hBody);
  81. #if 0
  82. HRESULT HrFindUrlInMsg(LPMIMEMESSAGE pMsg, LPSTR lpszUrl, LPSTREAM *ppstm);
  83. HRESULT HrSniffStreamFileExt(LPSTREAM pstm, LPSTR *lplpszExt);
  84. #endif
  85. // --------------------------------------------------------------------------------
  86. // Random functions that probably shouldn't even be in this file
  87. // --------------------------------------------------------------------------------
  88. #if 0
  89. HRESULT HrEscapeQuotedString (LPTSTR pszIn, LPTSTR *ppszOut);
  90. #endif
  91. // sizeof(lspzBuffer) needs to be == or > CCHMAX_CSET_NAME
  92. HRESULT HrGetMetaTagName(HCHARSET hCharset, LPSTR pszBuffer, DWORD cchSize);
  93. #if 0
  94. // --------------------------------------------------------------------------------
  95. // functions for ghosting props
  96. // --------------------------------------------------------------------------------
  97. HRESULT HrMarkGhosted(LPMIMEMESSAGE pMsg, HBODY hBody);
  98. HRESULT HrIsGhosted(LPMIMEMESSAGE pMsg, HBODY hBody);
  99. HRESULT HrGhostKids(LPMIMEMESSAGE pMsg, HBODY hBody);
  100. HRESULT HrDeleteGhostedKids(LPMIMEMESSAGE pMsg, HBODY hBody);
  101. #endif
  102. // --------------------------------------------------------------------------------
  103. // Internat Stuff
  104. // --------------------------------------------------------------------------------
  105. HRESULT HGetDefaultCharset(HCHARSET *hCharset);
  106. void SetDefaultCharset(HCHARSET hCharset);
  107. UINT uCodePageFromCharset(HCHARSET hCharset);
  108. UINT uCodePageFromMsg(LPMIMEMESSAGE pMsg);
  109. HRESULT HrSetMsgCodePage(LPMIMEMESSAGE pMsg, UINT uCodePage);
  110. #if 0
  111. HRESULT HrIStreamWToInetCset(LPSTREAM pstmW, HCHARSET hCharset, LPSTREAM *ppstmOut);
  112. #endif
  113. // --------------------------------------------------------------------------------
  114. // Property Utilities
  115. // --------------------------------------------------------------------------------
  116. HRESULT HrSetSentTimeProp(IMimeMessage *pMessage, LPSYSTEMTIME pst /* optional */ );
  117. HRESULT HrSetMailOptionsOnMessage(IMimeMessage *pMessage, HTMLOPT *pHtmlOpt, PLAINOPT *pPlainOpt,
  118. HCHARSET hCharset, BOOL fHTML);
  119. HRESULT HrSafeToEncodeToCP(LPWSTR pwsz, CODEPAGEID cpID);
  120. HRESULT HrSafeToEncodeToCPA(LPCSTR psz, CODEPAGEID cpSrc, CODEPAGEID cpDest);
  121. #endif // __MIMEUTIL_H