mapi.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. /*
  2. * Copyright 2005 - 2016 Zarafa and its licensors
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU Affero General Public License, version 3,
  6. * as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU Affero General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU Affero General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. *
  16. */
  17. #ifndef __M4L_MAPI_H_
  18. #define __M4L_MAPI_H_
  19. #define MAPI_H
  20. #include <kopano/platform.h>
  21. /* seems unused? */
  22. #define lhSessionNull ((LHANDLE)0)
  23. /* seems unused? */
  24. /* used by attachments? */
  25. struct MapiFileDesc {
  26. ULONG ulReserved;
  27. ULONG flFlags;
  28. ULONG nPosition;
  29. LPSTR lpszPathName;
  30. LPSTR lpszFileName;
  31. LPVOID lpFileType;
  32. };
  33. typedef struct MapiFileDesc *lpMapiFileDesc;
  34. struct MapiFileTagExt {
  35. ULONG ulReserved;
  36. ULONG cbTag;
  37. LPBYTE lpTag;
  38. ULONG cbEncoding;
  39. LPBYTE lpEncoding;
  40. };
  41. typedef struct MapiFileTagExt *lpMapiFileTagExt;
  42. #define MAPI_ORIG 0x00000000
  43. #define MAPI_TO 0x00000001
  44. #define MAPI_CC 0x00000002
  45. #define MAPI_BCC 0x00000003
  46. /* from mapidefs.h */
  47. #define MAPI_P1 0x10000000
  48. #define MAPI_SUBMITTED 0x80000000
  49. /* #define MAPI_AUTHORIZE 0x00000004 */
  50. /* #define MAPI_DISCRETE 0x10000000 */
  51. struct MapiRecepDesc {
  52. ULONG ulReserved;
  53. ULONG ulRecipClass; /* MAPI_TO, MAPI_CC, MAPI_BCC, MAPI_ORIG */
  54. LPSTR lpszName;
  55. LPSTR lpszAddress;
  56. ULONG ulEIDSize;
  57. LPVOID lpEntryID;
  58. };
  59. typedef struct MapiRecipDesc *lpMapiRecipDesc;
  60. #define MAPI_UNREAD 0x00000001
  61. #define MAPI_RECEIPT_REQUESTED 0x00000002
  62. #define MAPI_SENT 0x00000004
  63. struct MapiMessage {
  64. ULONG ulReserved;
  65. LPSTR lpszSubject;
  66. LPSTR lpszNoteText;
  67. LPSTR lpszMessageType; /* MAPI_UNREAD, MAPI_RECEIPT_REQUESTED, MAPI_SENT */
  68. LPSTR lpszDateReceived;
  69. LPSTR lpszConversationID;
  70. FLAGS flFlags;
  71. lpMapiRecipDesc lpOriginator;
  72. ULONG nRecipCount;
  73. lpMapiRecipDesc lpRecips;
  74. ULONG nFileCount;
  75. lpMapiFileDesc lpFiles;
  76. };
  77. typedef struct MapiMessage *lpMapiMessage;
  78. /* flFlags for MAPI* Function calls */
  79. #define MAPI_LOGON_UI 0x00000001
  80. #define MAPI_PASSWORD_UI 0x00020000
  81. #define MAPI_NEW_SESSION 0x00000002
  82. #define MAPI_FORCE_DOWNLOAD 0x00001000
  83. #define MAPI_EXTENDED 0x00000020
  84. #define MAPI_DIALOG 0x00000008
  85. #define MAPI_USE_DEFAULT 0x00000040
  86. #define MAPI_UNREAD_ONLY 0x00000020
  87. #define MAPI_GUARANTEE_FIFO 0x00000100
  88. #define MAPI_LONG_MSGID 0x00004000
  89. #define MAPI_PEEK 0x00000080
  90. #define MAPI_SUPPRESS_ATTACH 0x00000800
  91. #define MAPI_ENVELOPE_ONLY 0x00000040
  92. #define MAPI_BODY_AS_FILE 0x00000200
  93. #define MAPI_AB_NOMODIFY 0x00000400
  94. extern "C" {
  95. /* Function definitions */
  96. ULONG MAPILogon(
  97. ULONG ulUIParam,
  98. LPSTR lpszProfileName,
  99. LPSTR lpszPassword,
  100. FLAGS flFlags,
  101. ULONG ulReserved,
  102. LPLHANDLE lplhSession
  103. );
  104. ULONG MAPILogoff(
  105. LHANDLE lhSession,
  106. ULONG ulUIParam,
  107. FLAGS flFlags,
  108. ULONG ulReserved
  109. );
  110. /* Simple MAPI functions */
  111. ULONG MAPISendMail(
  112. LHANDLE lhSession,
  113. ULONG ulUIParam,
  114. lpMapiMessage lpMessage,
  115. FLAGS flFlags,
  116. ULONG ulReserved
  117. );
  118. ULONG MAPISendDocuments(
  119. ULONG ulUIParam,
  120. LPSTR lpszDelimChar,
  121. LPSTR lpszFilePaths,
  122. LPSTR lpszFileNames,
  123. ULONG ulReserved
  124. );
  125. ULONG MAPIFindNext(
  126. LHANDLE lhSession,
  127. ULONG ulUIParam,
  128. LPSTR lpszMessageType,
  129. LPSTR lpszSeedMessageID,
  130. FLAGS flFlags,
  131. ULONG ulReserved,
  132. LPSTR lpszMessageID
  133. );
  134. ULONG MAPIReadMail(
  135. LHANDLE lhSession,
  136. ULONG ulUIParam,
  137. LPSTR lpszMessageID,
  138. FLAGS flFlags,
  139. ULONG ulReserved,
  140. lpMapiMessage *lppMessage
  141. );
  142. ULONG MAPISaveMail(
  143. LHANDLE lhSession,
  144. ULONG ulUIParam,
  145. lpMapiMessage lpMessage,
  146. FLAGS flFlags,
  147. ULONG ulReserved,
  148. LPSTR lpszMessageID
  149. );
  150. ULONG MAPIDeleteMail(
  151. LHANDLE lhSession,
  152. ULONG ulUIParam,
  153. LPSTR lpszMessageID,
  154. FLAGS flFlags,
  155. ULONG ulReserved
  156. );
  157. ULONG MAPIFreeBuffer(
  158. LPVOID pv
  159. );
  160. ULONG MAPIAddress(
  161. LHANDLE lhSession,
  162. ULONG ulUIParam,
  163. LPSTR lpszCaption,
  164. ULONG nEditFields,
  165. LPSTR lpszLabels,
  166. ULONG nRecips,
  167. lpMapiRecipDesc lpRecips,
  168. FLAGS flFlags,
  169. ULONG ulReserved,
  170. LPULONG lpnNewRecips,
  171. lpMapiRecipDesc *lppNewRecips
  172. );
  173. ULONG MAPIDetails(
  174. LHANDLE lhSession,
  175. ULONG ulUIParam,
  176. lpMapiRecipDesc lpRecip,
  177. FLAGS flFlags,
  178. ULONG ulReserved
  179. );
  180. ULONG MAPIResolveName(
  181. LHANDLE lhSession,
  182. ULONG ulUIParam,
  183. LPSTR lpszName,
  184. FLAGS flFlags,
  185. ULONG ulReserved,
  186. lpMapiRecipDesc *lppRecip
  187. );
  188. /* Return codes */
  189. #define SUCCESS_SUCCESS 0
  190. #define MAPI_USER_ABORT 1
  191. #define MAPI_E_USER_ABORT MAPI_USER_ABORT
  192. #define MAPI_E_FAILURE 2
  193. #define MAPI_E_LOGON_FAILURE 3
  194. //#define MAPI_E_LOGIN_FAILURE MAPI_E_LOGON_FAILURE
  195. #define MAPI_E_DISK_FULL 4
  196. #define MAPI_E_INSUFFICIENT_MEMORY 5
  197. #define MAPI_E_ACCESS_DENIED 6
  198. #define MAPI_E_TOO_MANY_SESSIONS 8
  199. #define MAPI_E_TOO_MANY_FILES 9
  200. #define MAPI_E_TOO_MANY_RECIPIENTS 10
  201. #define MAPI_E_ATTACHMENT_NOT_FOUND 11
  202. #define MAPI_E_ATTACHMENT_OPEN_FAILURE 12
  203. #define MAPI_E_ATTACHMENT_WRITE_FAILURE 13
  204. #define MAPI_E_UNKNOWN_RECIPIENT 14
  205. #define MAPI_E_BAD_RECIPTYPE 15
  206. #define MAPI_E_NO_MESSAGES 16
  207. #define MAPI_E_INVALID_MESSAGE 17
  208. #define MAPI_E_TEXT_TOO_LARGE 18
  209. #define MAPI_E_INVALID_SESSION 19
  210. #define MAPI_E_TYPE_NOT_SUPPORTED 20
  211. #define MAPI_E_AMBIGUOUS_RECIPIENT 21
  212. //#define MAPI_E_AMBIG_RECIP MAPI_E_AMBIGUOUS_RECIPIENT
  213. #define MAPI_E_MESSAGE_IN_USE 22
  214. #define MAPI_E_NETWORK_FAILURE 23
  215. #define MAPI_E_INVALID_EDITFIELDS 24
  216. #define MAPI_E_INVALID_RECIPS 25
  217. #define MAPI_E_NOT_SUPPORTED 26
  218. } // EXTERN "C"
  219. #endif /* __M4L_MAPI_H_ */