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.

4969 lines
220 KiB

  1. // --------------------------------------------------------------------------------
  2. // IMNXPORT.IDL
  3. // Copyright (c)1993-1998 Microsoft Corporation, All Rights Reserved
  4. //
  5. // Authors:
  6. // Steven J. Bailey (sbailey)
  7. // Steve Serdy (steveser)
  8. // Raymond Cheng (raych)
  9. // Greg Friedman (gregfrie)
  10. //
  11. // Date: 11/12/96
  12. // --------------------------------------------------------------------------------
  13. import "imnact.idl";
  14. interface IInternetTransport;
  15. interface ISMTPTransport;
  16. interface IPOP3Transport;
  17. interface INNTPTransport;
  18. interface IRASTransport;
  19. interface IIMAPTransport;
  20. interface IHTTPMailTransport;
  21. interface IPropFindResponse;
  22. cpp_quote("//--------------------------------------------------------------------------------")
  23. cpp_quote("// IMNXPORT.H")
  24. cpp_quote("//--------------------------------------------------------------------------------")
  25. cpp_quote("// (C) Copyright 1995-1998 Microsoft Corporation. All Rights Reserved.")
  26. cpp_quote("//")
  27. cpp_quote("// THIS CODE AND INFORMATION IS PROVIDED \"AS IS\" WITHOUT WARRANTY OF")
  28. cpp_quote("// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO")
  29. cpp_quote("// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A")
  30. cpp_quote("// PARTICULAR PURPOSE.")
  31. cpp_quote("//--------------------------------------------------------------------------------")
  32. cpp_quote("")
  33. cpp_quote("#pragma comment(lib,\"uuid.lib\")")
  34. cpp_quote("// --------------------------------------------------------------------------------")
  35. cpp_quote("// Dependencies")
  36. cpp_quote("// --------------------------------------------------------------------------------")
  37. cpp_quote("#include <ras.h>")
  38. cpp_quote("#include <raserror.h>")
  39. cpp_quote("")
  40. cpp_quote("// --------------------------------------------------------------------------------")
  41. cpp_quote("// GUIDS")
  42. cpp_quote("// --------------------------------------------------------------------------------")
  43. cpp_quote("// {CA30CC91-B1B3-11d0-85D0-00C04FD85AB4}")
  44. cpp_quote("DEFINE_GUID(CLSID_IInternetMessageUrl, 0xca30cc91, 0xb1b3, 0x11d0, 0x85, 0xd0, 0x0, 0xc0, 0x4f, 0xd8, 0x5a, 0xb4);")
  45. cpp_quote("")
  46. cpp_quote("// {0DF2C7E1-3435-11d0-81D0-00C04FD85AB4}")
  47. cpp_quote("DEFINE_GUID(IID_ITransportCallback, 0xdf2c7e1, 0x3435, 0x11d0, 0x81, 0xd0, 0x0, 0xc0, 0x4f, 0xd8, 0x5a, 0xb4);")
  48. cpp_quote("")
  49. cpp_quote("// {1F636C01-364E-11d0-81D3-00C04FD85AB4}")
  50. cpp_quote("DEFINE_GUID(IID_IInternetTransport, 0x1f636c01, 0x364e, 0x11d0, 0x81, 0xd3, 0x0, 0xc0, 0x4f, 0xd8, 0x5a, 0xb4);")
  51. cpp_quote("")
  52. cpp_quote("// {1F636C02-364E-11d0-81D3-00C04FD85AB4}")
  53. cpp_quote("DEFINE_GUID(IID_ISMTPCallback, 0x1f636c02, 0x364e, 0x11d0, 0x81, 0xd3, 0x0, 0xc0, 0x4f, 0xd8, 0x5a, 0xb4);")
  54. cpp_quote("")
  55. cpp_quote("// {FD853CE6-7F86-11d0-8252-00C04FD85AB4}")
  56. cpp_quote("DEFINE_GUID(CLSID_ISMTPTransport, 0xfd853ce6, 0x7f86, 0x11d0, 0x82, 0x52, 0x0, 0xc0, 0x4f, 0xd8, 0x5a, 0xb4);")
  57. cpp_quote("// {0DF2C7E2-3435-11d0-81D0-00C04FD85AB4}")
  58. cpp_quote("DEFINE_GUID(IID_ISMTPTransport, 0xdf2c7e2, 0x3435, 0x11d0, 0x81, 0xd0, 0x0, 0xc0, 0x4f, 0xd8, 0x5a, 0xb4);")
  59. cpp_quote("// {0DF2C7EC-3435-11d0-81D0-00C04FD85AB4}")
  60. cpp_quote("DEFINE_GUID(IID_ISMTPTransport2, 0xdf2c7eC, 0x3435, 0x11d0, 0x81, 0xd0, 0x0, 0xc0, 0x4f, 0xd8, 0x5a, 0xb4);")
  61. cpp_quote("")
  62. cpp_quote("// {0DF2C7E3-3435-11d0-81D0-00C04FD85AB4}")
  63. cpp_quote("DEFINE_GUID(IID_IPOP3Callback, 0xdf2c7e3, 0x3435, 0x11d0, 0x81, 0xd0, 0x0, 0xc0, 0x4f, 0xd8, 0x5a, 0xb4);")
  64. cpp_quote("")
  65. cpp_quote("// {FD853CE7-7F86-11d0-8252-00C04FD85AB4}")
  66. cpp_quote("DEFINE_GUID(CLSID_IPOP3Transport, 0xfd853ce7, 0x7f86, 0x11d0, 0x82, 0x52, 0x0, 0xc0, 0x4f, 0xd8, 0x5a, 0xb4);")
  67. cpp_quote("// {0DF2C7E4-3435-11d0-81D0-00C04FD85AB4}")
  68. cpp_quote("DEFINE_GUID(IID_IPOP3Transport, 0xdf2c7e4, 0x3435, 0x11d0, 0x81, 0xd0, 0x0, 0xc0, 0x4f, 0xd8, 0x5a, 0xb4);")
  69. cpp_quote("")
  70. cpp_quote("// {0DF2C7E5-3435-11d0-81D0-00C04FD85AB4}")
  71. cpp_quote("DEFINE_GUID(IID_INNTPCallback, 0xdf2c7e5, 0x3435, 0x11d0, 0x81, 0xd0, 0x0, 0xc0, 0x4f, 0xd8, 0x5a, 0xb4);")
  72. cpp_quote("")
  73. cpp_quote("// {FD853CE8-7F86-11d0-8252-00C04FD85AB4}")
  74. cpp_quote("DEFINE_GUID(CLSID_INNTPTransport, 0xfd853ce8, 0x7f86, 0x11d0, 0x82, 0x52, 0x0, 0xc0, 0x4f, 0xd8, 0x5a, 0xb4);")
  75. cpp_quote("// {0DF2C7E6-3435-11d0-81D0-00C04FD85AB4}")
  76. cpp_quote("DEFINE_GUID(IID_INNTPTransport, 0xdf2c7e6, 0x3435, 0x11d0, 0x81, 0xd0, 0x0, 0xc0, 0x4f, 0xd8, 0x5a, 0xb4);")
  77. cpp_quote("// {0DF2C7ED-3435-11d0-81D0-00C04FD85AB4}")
  78. cpp_quote("DEFINE_GUID(IID_INNTPTransport2, 0xdf2c7eD, 0x3435, 0x11d0, 0x81, 0xd0, 0x0, 0xc0, 0x4f, 0xd8, 0x5a, 0xb4);")
  79. cpp_quote("")
  80. cpp_quote("// {36D88911-3CD6-11d0-81DF-00C04FD85AB4}")
  81. cpp_quote("DEFINE_GUID(IID_IRASCallback, 0x36d88911, 0x3cd6, 0x11d0, 0x81, 0xdf, 0x0, 0xc0, 0x4f, 0xd8, 0x5a, 0xb4);")
  82. cpp_quote("")
  83. cpp_quote("// {FD853CE9-7F86-11d0-8252-00C04FD85AB4}")
  84. cpp_quote("DEFINE_GUID(CLSID_IRASTransport, 0xfd853ce9, 0x7f86, 0x11d0, 0x82, 0x52, 0x0, 0xc0, 0x4f, 0xd8, 0x5a, 0xb4);")
  85. cpp_quote("// {8A950001-3CCF-11d0-81DF-00C04FD85AB4}")
  86. cpp_quote("DEFINE_GUID(IID_IRASTransport, 0x8a950001, 0x3ccf, 0x11d0, 0x81, 0xdf, 0x0, 0xc0, 0x4f, 0xd8, 0x5a, 0xb4);")
  87. cpp_quote("")
  88. cpp_quote("// {FD853CEA-7F86-11d0-8252-00C04FD85AB4}")
  89. cpp_quote("DEFINE_GUID(CLSID_IRangeList, 0xfd853cea, 0x7f86, 0x11d0, 0x82, 0x52, 0x0, 0xc0, 0x4f, 0xd8, 0x5a, 0xb4);")
  90. cpp_quote("// {8C438160-4EF6-11d0-874F-00AA00530EE9}")
  91. cpp_quote("DEFINE_GUID(IID_IRangeList, 0x8c438160, 0x4ef6, 0x11d0, 0x87, 0x4f, 0x0, 0xaa, 0x0, 0x53, 0xe, 0xe9);")
  92. cpp_quote("")
  93. cpp_quote("// {E9E9D8A3-4EDD-11d0-874F-00AA00530EE9}")
  94. cpp_quote("DEFINE_GUID(IID_IIMAPCallback, 0xe9e9d8a3, 0x4edd, 0x11d0, 0x87, 0x4f, 0x0, 0xaa, 0x0, 0x53, 0xe, 0xe9);")
  95. cpp_quote("")
  96. cpp_quote("// {FD853CEB-7F86-11d0-8252-00C04FD85AB4}")
  97. cpp_quote("DEFINE_GUID(CLSID_IIMAPTransport, 0xfd853ceb, 0x7f86, 0x11d0, 0x82, 0x52, 0x0, 0xc0, 0x4f, 0xd8, 0x5a, 0xb4);")
  98. cpp_quote("// {E9E9D8A8-4EDD-11d0-874F-00AA00530EE9}")
  99. cpp_quote("DEFINE_GUID(IID_IIMAPTransport, 0xe9e9d8a8, 0x4edd, 0x11d0, 0x87, 0x4f, 0x0, 0xaa, 0x0, 0x53, 0xe, 0xe9);")
  100. cpp_quote("")
  101. cpp_quote("// {DA8283C0-37C5-11d2-ACD9-0080C7B6E3C5}")
  102. cpp_quote("DEFINE_GUID(IID_IIMAPTransport2, 0xda8283c0, 0x37c5, 0x11d2, 0xac, 0xd9, 0x0, 0x80, 0xc7, 0xb6, 0xe3, 0xc5);")
  103. cpp_quote("")
  104. cpp_quote("// {07849A11-B520-11d0-85D5-00C04FD85AB4}")
  105. cpp_quote("DEFINE_GUID(IID_IBindMessageStream, 0x7849a11, 0xb520, 0x11d0, 0x85, 0xd5, 0x0, 0xc0, 0x4f, 0xd8, 0x5a, 0xb4);")
  106. cpp_quote("")
  107. cpp_quote("// {CA30F3FF-C9AC-11d1-9A3A-00C04FA309D4}")
  108. cpp_quote("DEFINE_GUID(IID_ITransportCallbackService, 0xca30f3ff, 0xc9ac, 0x11d1, 0x9a, 0x3a, 0x0, 0xc0, 0x4f, 0xa3, 0x9, 0xd4);")
  109. cpp_quote("")
  110. cpp_quote("// {19F6481C-E5F0-11d1-A86E-0000F8084F96}")
  111. cpp_quote("DEFINE_GUID(IID_IHTTPMailCallback, 0x19f6481c, 0xe5f0, 0x11d1, 0xa8, 0x6e, 0x0, 0x0, 0xf8, 0x8, 0x4f, 0x96);")
  112. cpp_quote("")
  113. cpp_quote("// {5A580C11-E5EB-11d1-A86E-0000F8084F96}")
  114. cpp_quote("DEFINE_GUID(CLSID_IHTTPMailTransport,0x5a580c11, 0xe5eb, 0x11d1, 0xa8, 0x6e, 0x0, 0x0, 0xf8, 0x8, 0x4f, 0x96);")
  115. cpp_quote("// {B8BDE03C-E548-11d1-A86E-0000F8084F96}")
  116. cpp_quote("DEFINE_GUID(IID_IHTTPMailTransport, 0xb8bde03c, 0xe548, 0x11d1, 0xa8, 0x6e, 0x0, 0x0, 0xf8, 0x8, 0x4f, 0x96);")
  117. cpp_quote("")
  118. cpp_quote("// {BB847B8A-054A-11d2-A894-0000F8084F96}")
  119. cpp_quote("DEFINE_GUID(CLSID_IPropFindRequest, 0xbb847b8a, 0x54a, 0x11d2, 0xa8, 0x94, 0x0, 0x0, 0xf8, 0x8, 0x4f, 0x96);")
  120. cpp_quote("// {5CFC6308-0544-11d2-A894-0000F8084F96}")
  121. cpp_quote("DEFINE_GUID(IID_IPropFindRequest, 0x5cfc6308, 0x544, 0x11d2, 0xa8, 0x94, 0x0, 0x0, 0xf8, 0x8, 0x4f, 0x96);")
  122. cpp_quote("")
  123. cpp_quote("// {0DEE87DE-0547-11d2-A894-0000F8084F96}")
  124. cpp_quote("DEFINE_GUID(IID_IPropFindMultiResponse, 0xdee87de, 0x547, 0x11d2, 0xa8, 0x94, 0x0, 0x0, 0xf8, 0x8, 0x4f, 0x96);")
  125. cpp_quote("")
  126. cpp_quote("// {8A523716-0548-11d2-A894-0000F8084F96}")
  127. cpp_quote("DEFINE_GUID(IID_IPropFindResponse, 0x8a523716, 0x548, 0x11d2, 0xa8, 0x94, 0x0, 0x0, 0xf8, 0x8, 0x4f, 0x96);")
  128. cpp_quote("")
  129. cpp_quote("// {72A58FF8-227D-11d2-A8B5-0000F8084F96}")
  130. cpp_quote("DEFINE_GUID(IID_IDAVNamespaceArbiter, 0x72a58ff8, 0x227d, 0x11d2, 0xa8, 0xb5, 0x0, 0x0, 0xf8, 0x8, 0x4f, 0x96);")
  131. cpp_quote("")
  132. cpp_quote("// {EA678830-235D-11d2-A8B6-0000F8084F96}")
  133. cpp_quote("DEFINE_GUID(CLSID_IPropPatchRequest, 0xea678830, 0x235d, 0x11d2, 0xa8, 0xb6, 0x0, 0x0, 0xf8, 0x8, 0x4f, 0x96);")
  134. cpp_quote("// {AB8B8D2A-227F-11d2-A8B5-0000F8084F96}")
  135. cpp_quote("DEFINE_GUID(IID_IPropPatchRequest, 0xab8b8d2a, 0x227f, 0x11d2, 0xa8, 0xb5, 0x0, 0x0, 0xf8, 0x8, 0x4f, 0x96);")
  136. cpp_quote("")
  137. cpp_quote("// --------------------------------------------------------------------------------")
  138. cpp_quote("// Errors")
  139. cpp_quote("// --------------------------------------------------------------------------------")
  140. //;begin_internal
  141. //
  142. // NOTE: All inetcomm error codes must reside between CC00 and CFFF (a 1k block).
  143. // This has been approved by Johann Posch (johannp)
  144. // We further subdivide this range as follows:
  145. // CC00-CCFF IMNXPORT results
  146. // CD00-CDFF IMNACCT results
  147. // CE00-CEFF MIMEOLE results
  148. // CF00-CFFF undefined, do not use
  149. // (t-erikne 03/24/97)
  150. //
  151. //;end_internal
  152. cpp_quote("#ifndef FACILITY_INTERNET")
  153. cpp_quote("#define FACILITY_INTERNET 12")
  154. cpp_quote("#endif")
  155. cpp_quote("#ifndef HR_E")
  156. cpp_quote("#define HR_E(n) MAKE_SCODE(SEVERITY_ERROR, FACILITY_INTERNET, n)")
  157. cpp_quote("#endif")
  158. cpp_quote("#ifndef HR_S")
  159. cpp_quote("#define HR_S(n) MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_INTERNET, n)")
  160. cpp_quote("#endif")
  161. cpp_quote("#ifndef HR_CODE")
  162. cpp_quote("#define HR_CODE(hr) (INT)(hr & 0xffff)")
  163. cpp_quote("#endif")
  164. cpp_quote("")
  165. //;begin_internal
  166. // HRESULTS are even further subdivided in this file
  167. // NOTE: you should never progammatically rely on this ordering
  168. // it simply gives you a visual cue in the DOUTs
  169. // CC00-CC2F General
  170. // CC30-CC3F HTTPMail (first range)
  171. // CC40-CC5F WINSOCK
  172. // CC60-CC8F SMTP
  173. // CC90-CC9F POP3
  174. // CCA0-CCBF NNTP
  175. // CCC0-CCCF RAS
  176. // CCD0-CCEF IMAP
  177. // CCF0-CCFF HTTPMail (second range)
  178. //;end_internal
  179. cpp_quote("// --------------------------------------------------------------------------------")
  180. cpp_quote("// General Imnxport Return Values")
  181. cpp_quote("// --------------------------------------------------------------------------------")
  182. cpp_quote("#define IXP_E_LOAD_SICILY_FAILED HR_E(0xCC00)") // hrFailedToLoadSicily
  183. cpp_quote("#define IXP_E_INVALID_CERT_CN HR_E(0xCC01)") // hrInvalidCertCN
  184. cpp_quote("#define IXP_E_INVALID_CERT_DATE HR_E(0xCC02)") // hrInvalidCertDate
  185. cpp_quote("#define IXP_E_ALREADY_CONNECTED HR_E(0xCC03)") // hrAlreadyConnected
  186. cpp_quote("#define IXP_E_CONN HR_E(0xCC04)") // hrConn
  187. cpp_quote("#define IXP_E_NOT_CONNECTED HR_E(0xCC05)") // hrNotConnected
  188. cpp_quote("#define IXP_E_CONN_SEND HR_E(0xCC06)") // hrConnSend
  189. cpp_quote("#define IXP_E_WOULD_BLOCK HR_E(0xCC07)") // hrWouldBlock
  190. cpp_quote("#define IXP_E_INVALID_STATE HR_E(0xCC08)") // hrInvalidState
  191. cpp_quote("#define IXP_E_CONN_RECV HR_E(0xCC09)") // hrConnRecv
  192. cpp_quote("#define IXP_E_INCOMPLETE HR_E(0xCC0A)") // hrIncomplete
  193. cpp_quote("#define IXP_E_BUSY HR_E(0xCC0B)")
  194. cpp_quote("#define IXP_E_NOT_INIT HR_E(0xCC0C)")
  195. cpp_quote("#define IXP_E_CANT_FIND_HOST HR_E(0xCC0D)")
  196. cpp_quote("#define IXP_E_FAILED_TO_CONNECT HR_E(0xCC0E)")
  197. cpp_quote("#define IXP_E_CONNECTION_DROPPED HR_E(0xCC0F)")
  198. cpp_quote("#define IXP_E_INVALID_ADDRESS HR_E(0xCC10)")
  199. cpp_quote("#define IXP_E_INVALID_ADDRESS_LIST HR_E(0xCC11)")
  200. cpp_quote("#define IXP_E_SOCKET_READ_ERROR HR_E(0xCC12)")
  201. cpp_quote("#define IXP_E_SOCKET_WRITE_ERROR HR_E(0xCC13)")
  202. cpp_quote("#define IXP_E_SOCKET_INIT_ERROR HR_E(0xCC14)")
  203. cpp_quote("#define IXP_E_SOCKET_CONNECT_ERROR HR_E(0xCC15)")
  204. cpp_quote("#define IXP_E_INVALID_ACCOUNT HR_E(0xCC16)")
  205. cpp_quote("#define IXP_E_USER_CANCEL HR_E(0xCC17)")
  206. cpp_quote("#define IXP_E_SICILY_LOGON_FAILED HR_E(0xCC18)") // hrSicilyLogonFailed
  207. cpp_quote("#define IXP_E_TIMEOUT HR_E(0xCC19)")
  208. cpp_quote("#define IXP_E_SECURE_CONNECT_FAILED HR_E(0xCC1A)")
  209. cpp_quote("")
  210. cpp_quote("// --------------------------------------------------------------------------------")
  211. cpp_quote("// WINSOCK Errors")
  212. cpp_quote("// --------------------------------------------------------------------------------")
  213. cpp_quote("#define IXP_E_WINSOCK_WSASYSNOTREADY HR_E(0xCC40)")
  214. cpp_quote("#define IXP_E_WINSOCK_WSAVERNOTSUPPORTED HR_E(0xCC41)")
  215. cpp_quote("#define IXP_E_WINSOCK_WSAEPROCLIM HR_E(0xCC42)")
  216. cpp_quote("#define IXP_E_WINSOCK_WSAEFAULT HR_E(0xCC43)")
  217. cpp_quote("#define IXP_E_WINSOCK_FAILED_WSASTARTUP HR_E(0xCC44)")
  218. cpp_quote("#define IXP_E_WINSOCK_WSAEINPROGRESS HR_E(0xCC45)")
  219. cpp_quote("")
  220. cpp_quote("// --------------------------------------------------------------------------------")
  221. cpp_quote("// SMTP Command Response Values")
  222. cpp_quote("//--------------------------------------------------------------------------------")
  223. cpp_quote("#define IXP_E_SMTP_RESPONSE_ERROR HR_E(0xCC60)")
  224. cpp_quote("#define IXP_E_SMTP_UNKNOWN_RESPONSE_CODE HR_E(0xCC61)")
  225. cpp_quote("#define IXP_E_SMTP_500_SYNTAX_ERROR HR_E(0xCC62)")
  226. cpp_quote("#define IXP_E_SMTP_501_PARAM_SYNTAX HR_E(0xCC63)")
  227. cpp_quote("#define IXP_E_SMTP_502_COMMAND_NOTIMPL HR_E(0xCC64)")
  228. cpp_quote("#define IXP_E_SMTP_503_COMMAND_SEQ HR_E(0xCC65)")
  229. cpp_quote("#define IXP_E_SMTP_504_COMMAND_PARAM_NOTIMPL HR_E(0xCC66)")
  230. cpp_quote("#define IXP_E_SMTP_421_NOT_AVAILABLE HR_E(0xCC67)")
  231. cpp_quote("#define IXP_E_SMTP_450_MAILBOX_BUSY HR_E(0xCC68)")
  232. cpp_quote("#define IXP_E_SMTP_550_MAILBOX_NOT_FOUND HR_E(0xCC69)")
  233. cpp_quote("#define IXP_E_SMTP_451_ERROR_PROCESSING HR_E(0xCC6A)")
  234. cpp_quote("#define IXP_E_SMTP_551_USER_NOT_LOCAL HR_E(0xCC6B)")
  235. cpp_quote("#define IXP_E_SMTP_452_NO_SYSTEM_STORAGE HR_E(0xCC6C)")
  236. cpp_quote("#define IXP_E_SMTP_552_STORAGE_OVERFLOW HR_E(0xCC6D)")
  237. cpp_quote("#define IXP_E_SMTP_553_MAILBOX_NAME_SYNTAX HR_E(0xCC6E)")
  238. cpp_quote("#define IXP_E_SMTP_554_TRANSACT_FAILED HR_E(0xCC6F)")
  239. cpp_quote("")
  240. cpp_quote("#define IXP_S_SMTP_211_SYSTEM_STATUS HR_S(0xCC70)")
  241. cpp_quote("#define IXP_S_SMTP_214_HELP_MESSAGE HR_S(0xCC71)")
  242. cpp_quote("#define IXP_S_SMTP_220_READY HR_S(0xCC72)")
  243. cpp_quote("#define IXP_S_SMTP_221_CLOSING HR_S(0xCC73)")
  244. cpp_quote("#define IXP_S_SMTP_250_MAIL_ACTION_OKAY HR_S(0xCC74)")
  245. cpp_quote("#define IXP_S_SMTP_251_FORWARDING_MAIL HR_S(0xCC75)")
  246. cpp_quote("#define IXP_S_SMTP_354_START_MAIL_INPUT HR_S(0xCC76)")
  247. cpp_quote("#define IXP_S_SMTP_CONTINUE HR_S(0xCC77)")
  248. cpp_quote("#define IXP_S_SMTP_334_AUTH_READY_RESPONSE HR_S(0xCC78)")
  249. cpp_quote("#define IXP_S_SMTP_245_AUTH_SUCCESS HR_S(0xCC79)")
  250. cpp_quote("")
  251. cpp_quote("#define IXP_E_SMTP_REJECTED_SENDER HR_E(0xCC78)")
  252. cpp_quote("#define IXP_E_SMTP_REJECTED_RECIPIENTS HR_E(0xCC79)")
  253. cpp_quote("#define IXP_E_SMTP_NO_SENDER HR_E(0xCC7A)")
  254. cpp_quote("#define IXP_E_SMTP_NO_RECIPIENTS HR_E(0xCC7B)")
  255. cpp_quote("#define IXP_E_SMTP_530_STARTTLS_REQUIRED HR_E(0xCC7C)")
  256. cpp_quote("#define IXP_E_SMTP_NO_STARTTLS_SUPPORT HR_E(0xCC7D)")
  257. cpp_quote("#define IXP_S_SMTP_NO_DSN_SUPPORT HR_E(0xCC7E)")
  258. cpp_quote("#define IXP_E_SMTP_454_STARTTLS_FAILED HR_E(0xCC7F)")
  259. cpp_quote("")
  260. cpp_quote("// --------------------------------------------------------------------------------")
  261. cpp_quote("// POP3 Command Response Values")
  262. cpp_quote("// --------------------------------------------------------------------------------")
  263. cpp_quote("#define IXP_E_POP3_RESPONSE_ERROR HR_E(0xCC90)")
  264. cpp_quote("#define IXP_E_POP3_INVALID_USER_NAME HR_E(0xCC91)") // hrPOP3BadUserName
  265. cpp_quote("#define IXP_E_POP3_INVALID_PASSWORD HR_E(0xCC92)") // hrPOP3BadPassword
  266. cpp_quote("#define IXP_E_POP3_PARSE_FAILURE HR_E(0xCC93)")
  267. cpp_quote("#define IXP_E_POP3_NEED_STAT HR_E(0xCC94)")
  268. cpp_quote("#define IXP_E_POP3_NO_MESSAGES HR_E(0xCC95)")
  269. cpp_quote("#define IXP_E_POP3_NO_MARKED_MESSAGES HR_E(0xCC96)")
  270. cpp_quote("#define IXP_E_POP3_POPID_OUT_OF_RANGE HR_E(0xCC97)")
  271. cpp_quote("")
  272. cpp_quote("// --------------------------------------------------------------------------------")
  273. cpp_quote("// NNTP Command Response Values")
  274. cpp_quote("// --------------------------------------------------------------------------------")
  275. cpp_quote("#define IXP_E_NNTP_RESPONSE_ERROR HR_E(0xCCA0)") // hrInvalidResponse
  276. cpp_quote("#define IXP_E_NNTP_NEWGROUPS_FAILED HR_E(0xCCA1)")
  277. cpp_quote("#define IXP_E_NNTP_LIST_FAILED HR_E(0xCCA2)")
  278. cpp_quote("#define IXP_E_NNTP_LISTGROUP_FAILED HR_E(0xCCA3)")
  279. cpp_quote("#define IXP_E_NNTP_GROUP_FAILED HR_E(0xCCA4)")
  280. cpp_quote("#define IXP_E_NNTP_GROUP_NOTFOUND HR_E(0xCCA5)")
  281. cpp_quote("#define IXP_E_NNTP_ARTICLE_FAILED HR_E(0xCCA6)")
  282. cpp_quote("#define IXP_E_NNTP_HEAD_FAILED HR_E(0xCCA7)")
  283. cpp_quote("#define IXP_E_NNTP_BODY_FAILED HR_E(0xCCA8)")
  284. cpp_quote("#define IXP_E_NNTP_POST_FAILED HR_E(0xCCA9)")
  285. cpp_quote("#define IXP_E_NNTP_NEXT_FAILED HR_E(0xCCAA)")
  286. cpp_quote("#define IXP_E_NNTP_DATE_FAILED HR_E(0xCCAB)")
  287. cpp_quote("#define IXP_E_NNTP_HEADERS_FAILED HR_E(0xCCAC)")
  288. cpp_quote("#define IXP_E_NNTP_XHDR_FAILED HR_E(0xCCAD)")
  289. cpp_quote("#define IXP_E_NNTP_INVALID_USERPASS HR_E(0xCCAE)")
  290. cpp_quote("")
  291. cpp_quote("// --------------------------------------------------------------------------------")
  292. cpp_quote("// NNTP Server Response Values")
  293. cpp_quote("// --------------------------------------------------------------------------------")
  294. cpp_quote("#define IXP_NNTP_DATE_RESPONSE 111")
  295. cpp_quote("#define IXP_NNTP_POST_ALLOWED 200")
  296. cpp_quote("#define IXP_NNTP_POST_NOTALLOWED 201")
  297. cpp_quote("#define IXP_NNTP_GROUP_SELECTED 211")
  298. cpp_quote("#define IXP_NNTP_LIST_DATA_FOLLOWS 215")
  299. cpp_quote("#define IXP_NNTP_ARTICLE_FOLLOWS 220")
  300. cpp_quote("#define IXP_NNTP_HEAD_FOLLOWS 221")
  301. cpp_quote("#define IXP_NNTP_BODY_FOLLOWS 222")
  302. cpp_quote("#define IXP_NNTP_ARTICLE_RETRIEVED 223")
  303. cpp_quote("#define IXP_NNTP_OVERVIEW_FOLLOWS 224")
  304. cpp_quote("#define IXP_NNTP_NEWNEWSGROUPS_FOLLOWS 231")
  305. cpp_quote("#define IXP_NNTP_ARTICLE_POSTED_OK 240")
  306. cpp_quote("#define IXP_NNTP_AUTHORIZATION_ACCEPTED 250")
  307. cpp_quote("#define IXP_NNTP_AUTH_OK 281")
  308. cpp_quote("#define IXP_NNTP_SEND_ARTICLE_TO_POST 340")
  309. cpp_quote("#define IXP_NNTP_CONTINUE_AUTHORIZATION 350")
  310. cpp_quote("#define IXP_NNTP_PASSWORD_REQUIRED 381")
  311. cpp_quote("#define IXP_NNTP_NO_SUCH_NEWSGROUP 411")
  312. cpp_quote("#define IXP_NNTP_NO_NEXT_ARTICLE 421")
  313. cpp_quote("#define IXP_NNTP_NO_PREV_ARTICLE 422")
  314. cpp_quote("#define IXP_NNTP_NO_SUCH_ARTICLE_NUM 423")
  315. cpp_quote("#define IXP_NNTP_NO_SUCH_ARTICLE_FOUND 430")
  316. cpp_quote("#define IXP_NNTP_POSTING_NOT_ALLOWED 441")
  317. cpp_quote("#define IXP_NNTP_PROTOCOLS_SUPPORTED 485")
  318. cpp_quote("")
  319. cpp_quote("// --------------------------------------------------------------------------------")
  320. cpp_quote("// RAS Errors")
  321. cpp_quote("// --------------------------------------------------------------------------------")
  322. cpp_quote("#define IXP_S_RAS_NOT_NEEDED HR_S(0xCCC0)")
  323. cpp_quote("#define IXP_S_RAS_USING_CURRENT HR_S(0xCCC1)")
  324. cpp_quote("#define IXP_E_RAS_NOT_INSTALLED HR_E(0xCCC2)")
  325. cpp_quote("#define IXP_E_RAS_PROCS_NOT_FOUND HR_E(0xCCC3)")
  326. cpp_quote("#define IXP_E_RAS_ERROR HR_E(0xCCC4)")
  327. cpp_quote("#define IXP_E_RAS_INVALID_CONNECTOID HR_E(0xCCC5)")
  328. cpp_quote("#define IXP_E_RAS_GET_DIAL_PARAMS HR_E(0xCCC6)")
  329. cpp_quote("")
  330. cpp_quote("// --------------------------------------------------------------------------------")
  331. cpp_quote("// IMAP Return Codes")
  332. cpp_quote("// --------------------------------------------------------------------------------")
  333. cpp_quote("#define IXP_S_IMAP_UNRECOGNIZED_RESP HR_S(0xCCD0) // Did not recognize IMAP response CODE")
  334. cpp_quote("#define IXP_S_IMAP_VERBATIM_MBOX HR_S(0xCCE1) // Could not xlate mbox to target CP (or it's disabled): copying verbatim")
  335. cpp_quote("")
  336. cpp_quote("#define IXP_E_IMAP_LOGINFAILURE HR_E(0xCCD1) // LOGIN cmd failed")
  337. cpp_quote("#define IXP_E_IMAP_TAGGED_NO_RESPONSE HR_E(0xCCD2) // Received tagged NO response")
  338. cpp_quote("#define IXP_E_IMAP_BAD_RESPONSE HR_E(0xCCD3) // Received tagged BAD response")
  339. cpp_quote("#define IXP_E_IMAP_SVR_SYNTAXERR HR_E(0xCCD4) // Syntax error in svr response")
  340. cpp_quote("#define IXP_E_IMAP_NOTIMAPSERVER HR_E(0xCCD5) // This is not an IMAP server")
  341. cpp_quote("#define IXP_E_IMAP_BUFFER_OVERFLOW HR_E(0xCCD6) // Buffer overflow occurred")
  342. cpp_quote("#define IXP_E_IMAP_RECVR_ERROR HR_E(0xCCD7) // An error occurred in the recvr code")
  343. cpp_quote("#define IXP_E_IMAP_INCOMPLETE_LINE HR_E(0xCCD8) // Received incomplete line")
  344. cpp_quote("#define IXP_E_IMAP_CONNECTION_REFUSED HR_E(0xCCD9) // Received BYE on greeting")
  345. cpp_quote("#define IXP_E_IMAP_UNRECOGNIZED_RESP HR_E(0xCCDA) // Did not recognize IMAP response")
  346. cpp_quote("#define IXP_E_IMAP_CHANGEDUID HR_E(0xCCDB) // UID changed unexpectedly!")
  347. cpp_quote("#define IXP_E_IMAP_UIDORDER HR_E(0xCCDC) // UIDs not strictly ascending!")
  348. cpp_quote("#define IXP_E_IMAP_UNSOLICITED_BYE HR_E(0xCCDD) // Server issued UNSOLICITED BYE")
  349. cpp_quote("#define IXP_E_IMAP_IMPROPER_SVRSTATE HR_E(0xCCDE) // eg, Attempt to send FETCH before SELECT finishes")
  350. cpp_quote("#define IXP_E_IMAP_AUTH_NOT_POSSIBLE HR_E(0xCCDF) // No common authentication methods btwn client/svr")
  351. cpp_quote("#define IXP_E_IMAP_OUT_OF_AUTH_METHODS HR_E(0xCCE0) // We tried >= 1 auth method, no more left to try")
  352. cpp_quote("")
  353. cpp_quote("// --------------------------------------------------------------------------------")
  354. cpp_quote("// HTTPMail Return Codes")
  355. cpp_quote("// --------------------------------------------------------------------------------")
  356. cpp_quote("// http errors are discontiguous.")
  357. cpp_quote("#define IXP_E_HTTP_USE_PROXY HR_E(0xCC30) // http status 305")
  358. cpp_quote("#define IXP_E_HTTP_BAD_REQUEST HR_E(0xCC31) // http status 400")
  359. cpp_quote("#define IXP_E_HTTP_UNAUTHORIZED HR_E(0xCC32) // http status 401")
  360. cpp_quote("#define IXP_E_HTTP_FORBIDDEN HR_E(0xCC33) // http status 403")
  361. cpp_quote("#define IXP_E_HTTP_NOT_FOUND HR_E(0xCC34) // http status 404")
  362. cpp_quote("#define IXP_E_HTTP_METHOD_NOT_ALLOW HR_E(0xCC35) // http status 405")
  363. cpp_quote("#define IXP_E_HTTP_NOT_ACCEPTABLE HR_E(0xCC36) // http status 406")
  364. cpp_quote("#define IXP_E_HTTP_PROXY_AUTH_REQ HR_E(0xCC37) // http status 407")
  365. cpp_quote("#define IXP_E_HTTP_REQUEST_TIMEOUT HR_E(0xCC38) // http status 408")
  366. cpp_quote("#define IXP_E_HTTP_CONFLICT HR_E(0xCC39) // http status 409")
  367. cpp_quote("#define IXP_E_HTTP_GONE HR_E(0xCC3A) // http status 410")
  368. cpp_quote("#define IXP_E_HTTP_LENGTH_REQUIRED HR_E(0xCC3B) // http status 411")
  369. cpp_quote("#define IXP_E_HTTP_PRECOND_FAILED HR_E(0xCC3C) // http status 412")
  370. cpp_quote("#define IXP_E_HTTP_INTERNAL_ERROR HR_E(0xCC3D) // http status 500")
  371. cpp_quote("#define IXP_E_HTTP_NOT_IMPLEMENTED HR_E(0xCC3E) // http status 501")
  372. cpp_quote("#define IXP_E_HTTP_BAD_GATEWAY HR_E(0xCC3F) // http status 502")
  373. cpp_quote("// begin second range")
  374. cpp_quote("#define IXP_E_HTTP_SERVICE_UNAVAIL HR_E(0xCCF0) // http status 503")
  375. cpp_quote("#define IXP_E_HTTP_GATEWAY_TIMEOUT HR_E(0xCCF1) // http status 504")
  376. cpp_quote("#define IXP_E_HTTP_VERS_NOT_SUP HR_E(0xCCF2) // http status 505")
  377. cpp_quote("#define IXP_E_HTTP_INSUFFICIENT_STORAGE HR_E(0xCCF3) // http status 425 or 507")
  378. cpp_quote("#define IXP_E_HTTP_ROOT_PROP_NOT_FOUND HR_E(0xCCF4) // see IHTTPMailTransport::GetProperty")
  379. cpp_quote("")
  380. cpp_quote("// --------------------------------------------------------------------------------")
  381. cpp_quote("// String Length Constants")
  382. cpp_quote("// --------------------------------------------------------------------------------")
  383. cpp_quote("")
  384. // ---------------------------------------------------------------------------------------
  385. // All of the transports in this file work in an asyncronous mode. It is assumed that
  386. // the client application has a message pump on the thread in which a transport object
  387. // is created.
  388. // ---------------------------------------------------------------------------------------
  389. // ---------------------------------------------------------------------------------------
  390. // String Lengths
  391. // ---------------------------------------------------------------------------------------
  392. const SHORT CCHMAX_DOMAIN = 256;
  393. const SHORT CCHMAX_PHONE_NUMBER = 128; // RAS_MaxPhoneNumber
  394. // ---------------------------------------------------------------------------------------
  395. // Default Port Numbers
  396. // ---------------------------------------------------------------------------------------
  397. const DWORD DEFAULT_IMAP_PORT = 143;
  398. const DWORD DEFAULT_POP3_PORT = 110;
  399. const DWORD DEFAULT_SMTP_PORT = 25;
  400. const DWORD DEFAULT_NNTP_PORT = 119;
  401. // ---------------------------------------------------------------------------------------
  402. // Internet Address Type
  403. //
  404. // There are only two address types because the SMTP protocol only distinguishes
  405. // between a sender (ADDR_FROM) and recipients. ADDR_TO should include all Bcc, Cc and
  406. // To recipients.
  407. //
  408. // additional DSN flags may be anded in and will result in a DSN request only if the
  409. // SMTP server supports DSNs (rfc1891) and the transport connected with an EHLO command
  410. // ---------------------------------------------------------------------------------------
  411. typedef enum tagINETADDRTYPE {
  412. ADDR_TO, // Recipient of the message (To, CC, Bcc, etc)
  413. ADDR_FROM, // Sender of the message
  414. ADDR_DSN_NEVER = 16, // suppress all delivery status notification
  415. ADDR_DSN_SUCCESS = 32, // request DSN on successful delivery
  416. ADDR_DSN_FAILURE = 64, // request DSN on delivery failure
  417. ADDR_DSN_DELAY = 128 // request DSN if delivery is delayed
  418. } INETADDRTYPE;
  419. const DWORD ADDR_TOFROM_MASK = 0x1; // INETADDRTYPE & ADDR_TOFROM_MASK gives raw type
  420. const DWORD ADDR_DSN_MASK = 0xf0;
  421. // ---------------------------------------------------------------------------------------
  422. // DSNRET
  423. // controls what whether full message or headers only will be returned with DSNs
  424. // ---------------------------------------------------------------------------------------
  425. typedef enum tagDSNRET {
  426. DSNRET_DEFAULT, // use SMTP server default
  427. DSNRET_HDRS, // return 822 headers only
  428. DSNRET_FULL, // return full message - headers + body
  429. } DSNRET;
  430. // ---------------------------------------------------------------------------------------
  431. // Internet Address
  432. // ---------------------------------------------------------------------------------------
  433. typedef struct tagINETADDR {
  434. INETADDRTYPE addrtype;
  435. CHAR szEmail[CCHMAX_EMAIL_ADDRESS]; // A person's e-mail address
  436. } INETADDR, *LPINETADDR;
  437. // ---------------------------------------------------------------------------------------
  438. // Internet Address List
  439. // ---------------------------------------------------------------------------------------
  440. typedef struct tagINETADDRLIST {
  441. ULONG cAddress; // Number of elements in prgInetAddr
  442. LPINETADDR prgAddress; // Array of internet addresses
  443. } INETADDRLIST, *LPINETADDRLIST;
  444. // -----------------------------------------------------------------------------------
  445. // RAS Connection Type
  446. // -----------------------------------------------------------------------------------
  447. typedef enum tagRASCONNTYPE {
  448. RAS_CONNECT_LAN,
  449. RAS_CONNECT_MANUAL,
  450. RAS_CONNECT_RAS
  451. } RASCONNTYPE;
  452. // -----------------------------------------------------------------------------------
  453. // HTTPMAIL Root Property Types
  454. // -----------------------------------------------------------------------------------
  455. typedef enum tagHTTPMAILPROPTYPE {
  456. HTTPMAIL_PROP_INVALID,
  457. HTTPMAIL_PROP_ADBAR,
  458. HTTPMAIL_PROP_CONTACTS,
  459. HTTPMAIL_PROP_INBOX,
  460. HTTPMAIL_PROP_OUTBOX,
  461. HTTPMAIL_PROP_SENDMSG,
  462. HTTPMAIL_PROP_SENTITEMS,
  463. HTTPMAIL_PROP_DELETEDITEMS,
  464. HTTPMAIL_PROP_DRAFTS,
  465. HTTPMAIL_PROP_MSGFOLDERROOT,
  466. HTTPMAIL_PROP_SIG,
  467. HTTPMAIL_PROP_LAST
  468. } HTTPMAILPROPTYPE;
  469. // -----------------------------------------------------------------------------------
  470. // HTTPMAIL Special Folder Types
  471. // -----------------------------------------------------------------------------------
  472. typedef enum tagHTTPMAILSPECIALFOLDER {
  473. HTTPMAIL_SF_NONE = 0,
  474. HTTPMAIL_SF_UNRECOGNIZED,
  475. HTTPMAIL_SF_INBOX,
  476. HTTPMAIL_SF_DELETEDITEMS,
  477. HTTPMAIL_SF_DRAFTS,
  478. HTTPMAIL_SF_OUTBOX,
  479. HTTPMAIL_SF_SENTITEMS,
  480. HTTPMAIL_SF_CONTACTS,
  481. HTTPMAIL_SF_CALENDAR,
  482. HTTPMAIL_SF_MSNPROMO,
  483. HTTPMAIL_SF_LAST
  484. } HTTPMAILSPECIALFOLDER;
  485. // -----------------------------------------------------------------------------------
  486. // HTTPMAIL Contact Types
  487. // -----------------------------------------------------------------------------------
  488. typedef enum tagHTTPMAILCONTACTTYPE {
  489. HTTPMAIL_CT_CONTACT = 0, // default
  490. HTTPMAIL_CT_GROUP,
  491. HTTPMAIL_CT_LAST
  492. } HTTPMAILCONTACTTYPE;
  493. // -----------------------------------------------------------------------------------
  494. // DAV Namespaces
  495. // -----------------------------------------------------------------------------------
  496. const DWORD DAVNAMESPACE_UNKNOWN = 0xFFFFFFFF;
  497. const DWORD DAVNAMESPACE_DAV = 0;
  498. const DWORD DAVNAMESPACE_HOTMAIL = 1;
  499. const DWORD DAVNAMESPACE_HTTPMAIL = 2;
  500. const DWORD DAVNAMESPACE_MAIL = 3;
  501. const DWORD DAVNAMESPACE_CONTACTS = 4;
  502. // ---------------------------------------------------------------------------------------
  503. // Internet Server Flags...
  504. // ---------------------------------------------------------------------------------------
  505. cpp_quote("#define ISF_SMTP_USEIPFORHELO 0x00000001 // For HELO or EHLO Command")
  506. cpp_quote("#define ISF_ALWAYSPROMPTFORPASSWORD 0x00000002 // For HELO or EHLO Command") // Never save password (boolean)
  507. cpp_quote("#define ISF_SSLONSAMEPORT 0x00000004 // For SMTP Only - use STARTTLS") // For STARTTLS Support
  508. cpp_quote("#define ISF_QUERYDSNSUPPORT 0x00000008 // For SMTP Only - issue EHLO on connect and check for DSN")
  509. cpp_quote("#define ISF_QUERYAUTHSUPPORT 0x00000010 // For SMTP Only - issue EHLO on connect and check for AUTH")
  510. // ---------------------------------------------------------------------------------------
  511. // Internet Server Information...
  512. // ---------------------------------------------------------------------------------------
  513. typedef struct INETSERVER {
  514. CHAR szAccount[CCHMAX_ACCOUNT_NAME]; // IMN Account Name
  515. CHAR szUserName[CCHMAX_USERNAME]; // User's connection name
  516. CHAR szPassword[CCHMAX_PASSWORD]; // User's password
  517. CHAR szServerName[CCHMAX_SERVER_NAME]; // Server name (or IP address string)
  518. CHAR szConnectoid[CCHMAX_CONNECTOID]; // RAS Connection Name
  519. RASCONNTYPE rasconntype; // RAS connection type
  520. DWORD dwPort; // Port name
  521. BOOL fSSL; // Using SSL
  522. BOOL fTrySicily; // Try using sicily authentication
  523. DWORD dwTimeout; // Timeout in seconds
  524. DWORD dwFlags; // ISF_xxx Flags (above)
  525. } INETSERVER, *LPINETSERVER;
  526. // -----------------------------------------------------------------------------------
  527. // Internet Transport Types
  528. // -----------------------------------------------------------------------------------
  529. typedef enum tagIXPTYPE {
  530. IXP_NNTP, // NNTP (News)
  531. IXP_SMTP, // SMTP (Send)
  532. IXP_POP3, // POP3 (Recv)
  533. IXP_IMAP, // IMAP (Recv / remote store)
  534. IXP_RAS,
  535. IXP_HTTPMail // HTTPMail (Recv / remote store)
  536. } IXPTYPE;
  537. // -----------------------------------------------------------------------------------
  538. // IXPSTATUS - Transport Status Types
  539. //
  540. // These values are returned in the ITransportCallback::OnStatus callback method
  541. // and in the IInternetTransport::GetStatus member.
  542. // -----------------------------------------------------------------------------------
  543. typedef enum tagIXPSTATUS
  544. {
  545. IXP_FINDINGHOST, // Attempting to find host (IP/host name resolution)
  546. IXP_CONNECTING, // TCP/IP connection is in progress
  547. IXP_SECURING, // TCP/IP socket connection has been established, securing an SSL connection
  548. IXP_CONNECTED, // TCP/IP socket connection has been established, waiting for protcol response
  549. IXP_AUTHORIZING, // Performing authorization with the server
  550. IXP_AUTHRETRY, // Retrying authorization
  551. IXP_AUTHORIZED, // Authorization successful (transient state, heads directly to IXP_CONNECTED after)
  552. IXP_DISCONNECTING, // The connection is being closed
  553. IXP_DISCONNECTED, // The transport has been disconnected from the server
  554. IXP_LAST // Last status value (for boundschecking purposes)
  555. } IXPSTATUS;
  556. // DEPTH_INFINITY : this constant can be passed to any member of IHTTPMailTransport
  557. // that takes a DWORD parameter to specify depth in a propfind request.
  558. const DWORD DEPTH_INFINITY = 0xFFFFFFFE;
  559. // IHTTPMailTransport::MemberInfo Flags.
  560. typedef DWORD MEMBERINFOFLAGS;
  561. const MEMBERINFOFLAGS HTTP_MEMBERINFO_COMMONPROPS = 0x00000000;
  562. const MEMBERINFOFLAGS HTTP_MEMBERINFO_FOLDERPROPS = 0x00000001; // common props and folder props
  563. const MEMBERINFOFLAGS HTTP_MEMBERINFO_MESSAGEPROPS = 0x00000002; // common props and message props
  564. const MEMBERINFOFLAGS HTTP_MEMBERINFO_ALLPROPS = (HTTP_MEMBERINFO_FOLDERPROPS | HTTP_MEMBERINFO_MESSAGEPROPS);
  565. // ***NB: You have to be careful when changing IMAP_MSGFLAGS.
  566. // The function, IMAPMsgFlagsToARF in imapfldr.cpp will have to be updated.
  567. typedef DWORD IMAP_MSGFLAGS; // Message flags returned by FLAGS response,
  568. // PERMANENTFLAGS response code and FETCH
  569. const IMAP_MSGFLAGS IMAP_MSG_NOFLAGS = 0x00000000;
  570. const IMAP_MSGFLAGS IMAP_MSG_ANSWERED = 0x00000001;
  571. const IMAP_MSGFLAGS IMAP_MSG_FLAGGED = 0x00000002;
  572. const IMAP_MSGFLAGS IMAP_MSG_DELETED = 0x00000004;
  573. const IMAP_MSGFLAGS IMAP_MSG_SEEN = 0x00000008;
  574. const IMAP_MSGFLAGS IMAP_MSG_DRAFT = 0x00000010;
  575. const IMAP_MSGFLAGS IMAP_MSG_ALLFLAGS = 0x0000001F; // Keep this updated
  576. // ---------------------------------------------------------------------------------------
  577. // IID_ITransportCallbackService
  578. // ---------------------------------------------------------------------------------------
  579. [
  580. uuid(CA30F3FF-C9AC-11d1-9A3A-00C04FA309D4),
  581. local,
  582. ]
  583. interface ITransportCallbackService : IUnknown
  584. {
  585. HRESULT GetParentWindow(
  586. [in] DWORD dwReserved,
  587. [out] HWND *phwndParent);
  588. HRESULT GetAccount(
  589. [out] LPDWORD pdwServerType, // SRV_xxx Bit
  590. [out] IImnAccount **ppAccount);
  591. }
  592. // ---------------------------------------------------------------------------------------
  593. // IID_ITransportCallback
  594. // ---------------------------------------------------------------------------------------
  595. [
  596. uuid(0DF2C7E1-3435-11d0-81D0-00C04FD85AB4),
  597. helpstring("Base Transport Callback Interface"),
  598. local,
  599. ]
  600. interface ITransportCallback : IUnknown
  601. {
  602. // -----------------------------------------------------------------------------------
  603. // IXPRESULT
  604. //
  605. // This structure holds information about a server response or a transport result /
  606. // error.
  607. // -----------------------------------------------------------------------------------
  608. typedef struct tagIXPRESULT {
  609. HRESULT hrResult; // Error Code
  610. LPSTR pszResponse; // Last server response
  611. UINT uiServerError; // Server generated error number
  612. HRESULT hrServerError; // Associated HRESULT of server error
  613. DWORD dwSocketError; // Socket error as defined in winsock.h
  614. LPSTR pszProblem; // Additional information
  615. } IXPRESULT, *LPIXPRESULT;
  616. // -----------------------------------------------------------------------------------
  617. // OnTimeout
  618. //
  619. // Description:
  620. // This method is called by a transport when a timeout period has expired. A timeout
  621. // is defined as a period of time in which no activity has occurred. A client
  622. // can specify a timeout in the INETSERVER structure that is passed to the
  623. // IInternetTransport::Connect method.
  624. //
  625. // When this method is called, the client MUST return a value that indicates
  626. // whether the transport should wait another dwTimeout (seconds), or should
  627. // terminate the connection to the server.
  628. //
  629. // Parameters:
  630. // pdwTimeout Specifies the current timeout value in seconds. A
  631. // client can reset this value to a new timeout value,
  632. // and return S_OK in which case the client will
  633. // continue waiting for the new timeout period.
  634. // pTransport The transport that generated the timeout
  635. //
  636. // Returns:
  637. // S_OK Tells the transport to wait another timeout period
  638. // as specified by the value of *pdwTimeout (seconds).
  639. // S_FALSE Tells the transport to terminate it's connection and
  640. // return to the disconnected state.
  641. //
  642. // -----------------------------------------------------------------------------------
  643. HRESULT OnTimeout(
  644. [in,out]
  645. DWORD *pdwTimeout,
  646. [in]
  647. IInternetTransport *pTransport);
  648. // -----------------------------------------------------------------------------------
  649. // OnLogonPrompt
  650. //
  651. // Description:
  652. // This method is called when the transport requires logon information. The client
  653. // is expected to prompt the user and fill the szUserName, szPassword fields of
  654. // the INETSERVER structure passed in. The client should not attempt to change
  655. // any other fields in this structure, they should be used only for display.
  656. //
  657. // Parameters:
  658. // pInetServer Information about the current internet server.
  659. // pTransport The transport that generated the timeout
  660. //
  661. // Returns:
  662. // S_OK The user entered new logon information and the
  663. // transport should try to re-connect.
  664. // S_FALSE The user wants to cancel the current logon attempt.
  665. // If this value is returned, the transport returns
  666. // to the disconnected state.
  667. //
  668. // -----------------------------------------------------------------------------------
  669. HRESULT OnLogonPrompt(
  670. [in,out]
  671. LPINETSERVER pInetServer,
  672. [in]
  673. IInternetTransport *pTransport);
  674. // -----------------------------------------------------------------------------------
  675. // OnPrompt
  676. //
  677. // Description:
  678. // This method is called when the transport requires user input. This method is called
  679. // in the following cases:
  680. //
  681. // 1) hrError == IXP_E_INVALID_CERT_CN, Invalid certificate, SSL error
  682. // 2) hrError == IXP_E_INVALID_CERT_DATE, Invalid certificate date, SSL error
  683. //
  684. // Parameters:
  685. // hrError HRESULT of reason for user prompt, usually an error
  686. // pszText Suggested text of question to be displayed
  687. // pszCaption Suggested caption of messagebox
  688. // uType Same parameter as passed into MessageBox (Yes, no, etc)
  689. // pTransport The transport object that generated the OnPrompt
  690. //
  691. // Returns
  692. // INT This method should return the same value as the
  693. // standard windows MessageBox API function.
  694. //
  695. // -----------------------------------------------------------------------------------
  696. INT OnPrompt(
  697. [in]
  698. HRESULT hrError,
  699. [in]
  700. LPCTSTR pszText,
  701. [in]
  702. LPCTSTR pszCaption,
  703. [in]
  704. UINT uType,
  705. [in]
  706. IInternetTransport *pTransport);
  707. // -----------------------------------------------------------------------------------
  708. // OnStatus
  709. //
  710. // Description:
  711. // This method is called to allow the client to provide a user with a high level
  712. // progress indicator.
  713. //
  714. // Parameters:
  715. // ixpstatus Current status of the transport, described above
  716. // pTransport Transport object that generated the OnStatus call
  717. //
  718. // Returns:
  719. // HRESULT A client should always return S_OK
  720. //
  721. // -----------------------------------------------------------------------------------
  722. HRESULT OnStatus(
  723. [in]
  724. IXPSTATUS ixpstatus,
  725. [in]
  726. IInternetTransport *pTransport);
  727. // -----------------------------------------------------------------------------------
  728. // OnError
  729. //
  730. // Description:
  731. // This method is called when a transport encounters a fatal error that will most
  732. // likely result is a disconnection from the server. Normal protocol errors are
  733. // returned through each transports OnResponse metho. This method is used to handle
  734. // high-level errors such eas TCP/IP and connection failures.
  735. //
  736. // Parameters:
  737. // ixpstatus Current status of the transport (described above)
  738. // pResult Error information
  739. // pTransport Transport object that generated the OnError call
  740. //
  741. // Return Values:
  742. // HRESULT A client should always return S_OK
  743. //
  744. // -----------------------------------------------------------------------------------
  745. HRESULT OnError(
  746. [in]
  747. IXPSTATUS ixpstatus,
  748. [in]
  749. LPIXPRESULT pResult,
  750. [in]
  751. IInternetTransport *pTransport);
  752. // -----------------------------------------------------------------------------------
  753. // OnCommand
  754. //
  755. // Description:
  756. // This method is called for every command send to the server and for every respsonse
  757. // received from the server. This method is provided ONLY for logging and debugging
  758. // purposes. If you pass FALSE for fCommandLogging in the call to
  759. // IInternetTransport::Connect, this method will not be called. There is a small
  760. // amount of overhead when this function is called.
  761. //
  762. // Parameters:
  763. // cmdtype Is this a Send Line or a Response Line
  764. // pszLine Data send to or received from the server
  765. // hrResponse HRESULT of response code (see codes above). If this
  766. // is a failure code, then it indicates that the
  767. // transport just received an error from the server
  768. // and the current operation is going to fail, possible.
  769. // pTransport Transport that generated the call to OnCommand
  770. //
  771. // Returns:
  772. // S_OK The client should always return S_OK
  773. //
  774. // -----------------------------------------------------------------------------------
  775. typedef enum tagCMDTYPE {
  776. CMD_SEND,
  777. CMD_RESP
  778. } CMDTYPE;
  779. HRESULT OnCommand(
  780. [in]
  781. CMDTYPE cmdtype,
  782. [in]
  783. LPSTR pszLine,
  784. [in]
  785. HRESULT hrResponse,
  786. [in]
  787. IInternetTransport *pTransport);
  788. }
  789. // ---------------------------------------------------------------------------------------
  790. // IID_IInternetTransport
  791. // ---------------------------------------------------------------------------------------
  792. [
  793. uuid(1F636C01-364E-11d0-81D3-00C04FD85AB4),
  794. helpstring("Internet Transport Interface"),
  795. local,
  796. ]
  797. interface IInternetTransport : IUnknown
  798. {
  799. // Interface Constants
  800. const boolean iitAUTHENTICATE = TRUE;
  801. const boolean iitDONT_AUTHENTICATE = FALSE;
  802. const boolean iitENABLE_ONCOMMAND = TRUE;
  803. const boolean iitDISABLE_ONCOMMAND = FALSE;
  804. // -----------------------------------------------------------------------------------
  805. // GetServerInfo
  806. //
  807. // Description:
  808. // Allows the client to retreive server information for the transport. The data in
  809. // this structure is valid only after a call to IInternetTransport::Connect.
  810. //
  811. // Parameters:
  812. // pInetServer Current server information for the transport
  813. //
  814. // Returns:
  815. // E_INVALIDARG pInetServer is NULL
  816. //
  817. // -----------------------------------------------------------------------------------
  818. HRESULT GetServerInfo(
  819. [in,out]
  820. LPINETSERVER pInetServer);
  821. // -----------------------------------------------------------------------------------
  822. // GetIXPType
  823. //
  824. // Description:
  825. // This method returns the IXPTYPE of the transport.
  826. //
  827. // Parameters:
  828. // None
  829. //
  830. // Returns:
  831. // IXPTYPE Internet Transport Type
  832. //
  833. // -----------------------------------------------------------------------------------
  834. IXPTYPE GetIXPType(void);
  835. // -----------------------------------------------------------------------------------
  836. // IsState
  837. //
  838. // Description:
  839. // This method allows a client to query the transport for validity of different states.
  840. //
  841. // Parameters:
  842. // isstate The State in which to query
  843. //
  844. // Returns:
  845. // IXP_E_NOT_INIT The transport has not been initialized
  846. // IXP_E_NOT_CONNECTED The transport is not connected (return if isstate != IXP_IS_CONNECTED)
  847. // S_OK The IXP_IS_xxx state is true
  848. // S_FALSE The IXP_IS_xxx state is false
  849. //
  850. // -----------------------------------------------------------------------------------
  851. typedef enum tagIXPISSTATE {
  852. IXP_IS_CONNECTED, // Is the transport currently connected
  853. IXP_IS_BUSY, // Is the transport currently processing a command
  854. IXP_IS_READY, // Is the transport ready for input
  855. IXP_IS_AUTHENTICATED, // Has the transport performed authentication
  856. } IXPISSTATE;
  857. HRESULT IsState(
  858. [in]
  859. IXPISSTATE isstate);
  860. // -----------------------------------------------------------------------------------
  861. // InetServerFromAccount
  862. //
  863. // Description:
  864. // This method takes an Internet Mail and News Account object and returns a filled
  865. // INETSERVER structure.
  866. //
  867. // Parameters:
  868. // pAccount Internet Mail and News Account
  869. // pInetServer Upon successful return contains server information
  870. // required to call IInternetTransport::Connect.
  871. //
  872. // Return Values:
  873. // E_INVALIDARG pAccount is NULL or pInetServer is NULL
  874. //
  875. // -----------------------------------------------------------------------------------
  876. HRESULT InetServerFromAccount(
  877. [in]
  878. IImnAccount *pAccount,
  879. [in,out]
  880. LPINETSERVER pInetServer);
  881. // -----------------------------------------------------------------------------------
  882. // Connect
  883. //
  884. // Description:
  885. // Connects the transport to the server specified in pInetServer struct. This call
  886. // is asyncronous. Each transport defines that terminal connect state. For example,
  887. // for SMTP, the connect state (::Connect is done) is defined by the SMTP_CONNECTED,
  888. // state.
  889. //
  890. // Parameters:
  891. // pInetServer Internet Server connection information.
  892. // fAuthenticate Tells the transport whether of or not to perform
  893. // authentication with the server. If you client
  894. // passes FALSE, it is responsible for authentication.
  895. // fCommandLogging If you pass FALSE, the ITransportCallback::OnCommand
  896. // method will never be called.
  897. //
  898. // Returns:
  899. // E_INVALIDARG pInetServer is NULL, or a member of it is invalid
  900. // E_OUTOFMEMORY An memory allocation failed
  901. // E_FAIL Socket initialization or connection failed.
  902. // IXP_E_ALREADY_CONNECTED The transport is currently connected and busy
  903. // IXP_E_NOT_INIT The transport has not been Initialized
  904. // IXP_E_SOCKET_INIT_ERROR Unable to initilize the TCP/IP socket connection
  905. // IXP_E_SOCKET_CONNECT_ERROR Unable to connect the TCP/IP socket
  906. //
  907. // In general this function succeeds, even if the server does not exist. If the
  908. // server can not be found, the client will receive error information through
  909. // ITransportCallback::OnError, and the terminal connection state can be detected
  910. // when ITransportCallback::OnStatus(IXP_DISCONNECTED) is called.
  911. //
  912. // -----------------------------------------------------------------------------------
  913. HRESULT Connect(
  914. [in]
  915. LPINETSERVER pInetServer,
  916. [in]
  917. boolean fAuthenticate,
  918. [in]
  919. boolean fCommandLogging);
  920. // -----------------------------------------------------------------------------------
  921. // HandsOffCallback
  922. //
  923. // Description:
  924. // This method forces the Transport to release the callback interface that was
  925. // passed into the InitNew method of the transport. After this method is called,
  926. // no more calls will be made to the callback function. This method is provided
  927. // so that clients can resolve possible circurlar references.
  928. //
  929. // Parameters:
  930. // None
  931. //
  932. // Returns:
  933. // S_OK The callback was release
  934. // S_FALSE There is currently no callback registered
  935. //
  936. // -----------------------------------------------------------------------------------
  937. HRESULT HandsOffCallback(void);
  938. // -----------------------------------------------------------------------------------
  939. // Disconnect
  940. //
  941. // Description:
  942. // This method disconnects the transport. This method may cause the transport to
  943. // send a command, such as the QUIT command, to the server. This is the clean
  944. // method of terminating the connection to the server, as opposed to DropConnection.
  945. //
  946. // Parameters:
  947. // None
  948. //
  949. // Returns:
  950. // S_OK The connection has been dropped.
  951. // IXP_E_NOT_INIT The transport has not been Initialized
  952. // IXP_E_NOT_CONNECTED The transport is not connected.
  953. //
  954. // -----------------------------------------------------------------------------------
  955. HRESULT Disconnect(void);
  956. // -----------------------------------------------------------------------------------
  957. // DropConnection
  958. //
  959. // Description:
  960. // This method disconnects the transport. This is an un-clean way, but guaranteed
  961. // method of dropping the connection between the client and the server. To allow
  962. // the protocol to shutdown in a normal fashion, call Disconnect.
  963. //
  964. // Parameters:
  965. // None
  966. //
  967. // Returns:
  968. // S_OK The connection has been dropped.
  969. // IXP_E_NOT_INIT The transport has not been Initialized
  970. // IXP_E_NOT_CONNECTED The transport is not connected.
  971. //
  972. // -----------------------------------------------------------------------------------
  973. HRESULT DropConnection(void);
  974. // -----------------------------------------------------------------------------------
  975. // GetStatus
  976. //
  977. // Description:
  978. // This function returns the current status of the transport.
  979. //
  980. // Parameters:
  981. // IXPSTATUS *pCurrentStatus [out] - current status of the transport is returned here.
  982. //
  983. // Returns:
  984. // HRESULT indicating success or failure.
  985. // -----------------------------------------------------------------------------------
  986. HRESULT GetStatus([out]IXPSTATUS *pCurrentStatus);
  987. }
  988. // ---------------------------------------------------------------------------------------
  989. // IID_ISMTPCallback
  990. // ---------------------------------------------------------------------------------------
  991. [
  992. uuid(1F636C02-364E-11d0-81D3-00C04FD85AB4),
  993. helpstring("SMTP Callback Interface"),
  994. local,
  995. ]
  996. interface ISMTPCallback : ITransportCallback
  997. {
  998. // -----------------------------------------------------------------------------------
  999. // SMTPCOMMAND
  1000. // -----------------------------------------------------------------------------------
  1001. typedef enum tagSMTPCOMMAND {
  1002. SMTP_NONE,
  1003. SMTP_BANNER,
  1004. SMTP_CONNECTED,
  1005. SMTP_SEND_MESSAGE,
  1006. SMTP_AUTH,
  1007. SMTP_EHLO,
  1008. SMTP_HELO,
  1009. SMTP_MAIL,
  1010. SMTP_RCPT,
  1011. SMTP_RSET,
  1012. SMTP_QUIT,
  1013. SMTP_DATA,
  1014. SMTP_DOT,
  1015. SMTP_SEND_STREAM,
  1016. SMTP_CUSTOM
  1017. } SMTPCOMMAND;
  1018. // -----------------------------------------------------------------------------------
  1019. // SMTPSTREAM return OnResponse - command == SMTP_SEND_STREAM
  1020. // -----------------------------------------------------------------------------------
  1021. typedef struct tagSMTPSTREAM {
  1022. DWORD cbIncrement;
  1023. DWORD cbCurrent;
  1024. DWORD cbTotal;
  1025. } SMTPSTREAM, *LPSMTPSTREAM;
  1026. // -----------------------------------------------------------------------------------
  1027. // SMTPRESPONSE
  1028. //
  1029. // Description:
  1030. // command SMTPCOMMAND that generated the response
  1031. // fDone Is the command finished. If TRUE, the client
  1032. // can issue another command through ISMTPTransport,
  1033. // otherwise, the client should continue to pump
  1034. // messages until fDone = TRUE is received.
  1035. // rIxpResult Result Information for the response. If
  1036. // rIxpResult::hrResult specifies a FAILED result,
  1037. // the structure contains other information.
  1038. // pTransport Transport that generated the OnResponse call.
  1039. //
  1040. // -----------------------------------------------------------------------------------
  1041. typedef struct tagSMTPRESPONSE {
  1042. SMTPCOMMAND command; // Command in which the response was generated for
  1043. BOOL fDone; // Is this an SMTP continuation response?
  1044. IXPRESULT rIxpResult; // Result Information
  1045. ISMTPTransport *pTransport; // Pointer to the SMTP transport that generated the response
  1046. // This is a union of response information based on the command
  1047. [switch_type(SMTPCOMMAND), switch_is((SMTPCOMMAND)command)]
  1048. union {
  1049. [case(SMTP_SEND_STREAM)] SMTPSTREAM rStreamInfo;
  1050. [default];
  1051. };
  1052. } SMTPRESPONSE, *LPSMTPRESPONSE;
  1053. // -----------------------------------------------------------------------------------
  1054. // OnResponse
  1055. //
  1056. // Description:
  1057. // Called by ISMTPTransport when a command response is received from the SMTP server.
  1058. //
  1059. // Parameters:
  1060. // pResponse Response information
  1061. //
  1062. // Return Values:
  1063. // S_OK The client should always return S_OK
  1064. //
  1065. // -----------------------------------------------------------------------------------
  1066. HRESULT OnResponse(
  1067. [in]
  1068. LPSMTPRESPONSE pResponse);
  1069. }
  1070. // ---------------------------------------------------------------------------------------
  1071. // IID_ISMTPTransport
  1072. // ---------------------------------------------------------------------------------------
  1073. [
  1074. uuid(0DF2C7E2-3435-11d0-81D0-00C04FD85AB4),
  1075. helpstring("SMTP Transport Interface"),
  1076. local,
  1077. ]
  1078. interface ISMTPTransport : IInternetTransport
  1079. {
  1080. // -----------------------------------------------------------------------------------
  1081. // SMTPMESSAGE
  1082. // -----------------------------------------------------------------------------------
  1083. typedef struct tagSMTPMESSAGE {
  1084. ULONG cbSize; // Size of the message in bytes
  1085. LPSTREAM pstmMsg; // Stream containing ANSI MIME/rfc822 message stream
  1086. INETADDRLIST rAddressList; // Internet Address List containing sender and recipients
  1087. } SMTPMESSAGE, *LPSMTPMESSAGE;
  1088. // -----------------------------------------------------------------------------------
  1089. // InitNew
  1090. //
  1091. // Description:
  1092. // This method Initializes the internet transport. This method be called before
  1093. // the transport can doing anything.
  1094. //
  1095. // Parameters:
  1096. // pszLogFilePath Full file path in which to log the protocol commands.
  1097. // NULL is a valid value (no logging)
  1098. // pCallback(required) Specifies the Transport callback interface.
  1099. //
  1100. // Returns:
  1101. // E_INVALIDARG An invalid parameter was passed in
  1102. // E_OUTOFMEMORY An memory allocation failed
  1103. //
  1104. // -----------------------------------------------------------------------------------
  1105. HRESULT InitNew(
  1106. [in]
  1107. LPSTR pszLogFilePath,
  1108. [in]
  1109. ISMTPCallback *pCallback);
  1110. // -----------------------------------------------------------------------------------
  1111. // SendMessage
  1112. //
  1113. // Description:
  1114. // This method initiates the sending process. IInternetTransport::Connect must have
  1115. // been called before this method is called (i.e. the transport must be in the
  1116. // ready state). This method calls OnProgress throughout the transmission of
  1117. // pMessage->pstmMsg so that the client can display progress. When the message is
  1118. // fisnished, or if an error ocurrs, ITransportCallback::OnComplete is called.
  1119. //
  1120. // Parameters:
  1121. // pMessage(required) Contains the information for the message to send. This
  1122. // method duplicates the contents of pMessage and AddRefs,
  1123. // pMessage->pstmMsg so that the client can free pMessage
  1124. // immediately after calling this method.
  1125. //
  1126. // Returns:
  1127. // E_INVALIDARG pMessage is invalid or one of its members is invalid
  1128. // E_OUTOFMEMORY A memory allocation failed
  1129. // IXP_E_BUSY The transport is busy
  1130. // IXP_E_INVALID_ADDRESS_LIST SMTPMESSAGE::rInetAddrList contains invalid entries
  1131. // IXP_E_NOT_CONNECTED IInternetTransport::Connect has not been called, or
  1132. // the current connection has been lost. The transport
  1133. // will not automatically re-connect.
  1134. //
  1135. // -----------------------------------------------------------------------------------
  1136. HRESULT SendMessage(
  1137. [in]
  1138. LPSMTPMESSAGE pMessage);
  1139. // -----------------------------------------------------------------------------------
  1140. // CommandMAIL
  1141. // -----------------------------------------------------------------------------------
  1142. HRESULT CommandMAIL(
  1143. [in]
  1144. LPSTR pszEmailFrom);
  1145. // -----------------------------------------------------------------------------------
  1146. // CommandRCPT
  1147. // -----------------------------------------------------------------------------------
  1148. HRESULT CommandRCPT(
  1149. [in]
  1150. LPSTR pszEmailTo);
  1151. // -----------------------------------------------------------------------------------
  1152. // CommandEHLO
  1153. // -----------------------------------------------------------------------------------
  1154. HRESULT CommandEHLO(void);
  1155. // -----------------------------------------------------------------------------------
  1156. // CommandHELO
  1157. // -----------------------------------------------------------------------------------
  1158. HRESULT CommandHELO(void);
  1159. // -----------------------------------------------------------------------------------
  1160. // CommandHELO
  1161. // -----------------------------------------------------------------------------------
  1162. HRESULT CommandAUTH(
  1163. [in]
  1164. LPSTR pszAuthType);
  1165. // -----------------------------------------------------------------------------------
  1166. // CommandQUIT
  1167. // -----------------------------------------------------------------------------------
  1168. HRESULT CommandQUIT(void);
  1169. // -----------------------------------------------------------------------------------
  1170. // CommandRSET
  1171. // -----------------------------------------------------------------------------------
  1172. HRESULT CommandRSET(void);
  1173. // -----------------------------------------------------------------------------------
  1174. // CommandDATA
  1175. // -----------------------------------------------------------------------------------
  1176. HRESULT CommandDATA(void);
  1177. // -----------------------------------------------------------------------------------
  1178. // CommandDOT
  1179. // -----------------------------------------------------------------------------------
  1180. HRESULT CommandDOT(void);
  1181. // -----------------------------------------------------------------------------------
  1182. // SendDataStream - This method does a CommandDOT when it is finished.
  1183. // -----------------------------------------------------------------------------------
  1184. HRESULT SendDataStream(
  1185. [in]
  1186. IStream *pStream,
  1187. [in]
  1188. ULONG cbSize);
  1189. }
  1190. // ---------------------------------------------------------------------------------------
  1191. // IID_ISMTPTransport2
  1192. // ---------------------------------------------------------------------------------------
  1193. [
  1194. uuid(0DF2C7EC-3435-11d0-81D0-00C04FD85AB4),
  1195. helpstring("SMTP Transport Interface"),
  1196. local,
  1197. ]
  1198. interface ISMTPTransport2 : ISMTPTransport
  1199. {
  1200. // -----------------------------------------------------------------------------------
  1201. // SMTPMESSAGE2
  1202. //
  1203. // Adds DSN (rfc1891) support. To receive DSNs the SMTP server must implement rfc1891
  1204. // and the SMTP transport must be initialized with an EHLO command
  1205. // -----------------------------------------------------------------------------------
  1206. typedef struct tagSMTPMESSAGE2 {
  1207. SMTPMESSAGE smtpMsg; // SMTPMESSAGE structure
  1208. LPSTR pszDSNENVID; // value for MAIL ENVID paramter
  1209. DSNRET dsnRet; // value for MAIL RET parameter
  1210. DWORD dwReserved;
  1211. DWORD dwReserved2;
  1212. } SMTPMESSAGE2, *LPSMTPMESSAGE2;
  1213. //***************************************************************************
  1214. // Function: SetWindow
  1215. //
  1216. // Purpose:
  1217. // This function creates a new window for async winsock processing
  1218. //
  1219. // Returns:
  1220. // HRESULT indicating success or failure.
  1221. //***************************************************************************
  1222. HRESULT SetWindow(void);
  1223. //***************************************************************************
  1224. // Function: ResetWindow
  1225. //
  1226. // Purpose:
  1227. // This function closes a window for async winsock processing
  1228. //
  1229. // Returns:
  1230. // HRESULT indicating success or failure.
  1231. //***************************************************************************
  1232. HRESULT ResetWindow(void);
  1233. // -----------------------------------------------------------------------------------
  1234. // SendMessage2
  1235. //
  1236. // Description:
  1237. // This method initiates the sending process. IInternetTransport::Connect must have
  1238. // been called before this method is called (i.e. the transport must be in the
  1239. // ready state). This method calls OnProgress throughout the transmission of
  1240. // pMessage->pstmMsg so that the client can display progress. When the message is
  1241. // fisnished, or if an error ocurrs, ITransportCallback::OnComplete is called.
  1242. //
  1243. // Parameters:
  1244. // pMessage(required) Contains the information for the message to send. This
  1245. // method duplicates the contents of pMessage and AddRefs,
  1246. // pMessage->pstmMsg so that the client can free pMessage
  1247. // immediately after calling this method.
  1248. //
  1249. // Returns:
  1250. // E_INVALIDARG pMessage is invalid or one of its members is invalid
  1251. // E_OUTOFMEMORY A memory allocation failed
  1252. // IXP_E_BUSY The transport is busy
  1253. // IXP_E_INVALID_ADDRESS_LIST SMTPMESSAGE::rInetAddrList contains invalid entries
  1254. // IXP_E_NOT_CONNECTED IInternetTransport::Connect has not been called, or
  1255. // the current connection has been lost. The transport
  1256. // will not automatically re-connect.
  1257. //
  1258. // -----------------------------------------------------------------------------------
  1259. HRESULT SendMessage2(
  1260. [in]
  1261. LPSMTPMESSAGE2 pMessage);
  1262. // -----------------------------------------------------------------------------------
  1263. // CommandRCPT2
  1264. // -----------------------------------------------------------------------------------
  1265. HRESULT CommandRCPT2(
  1266. [in]
  1267. LPSTR pszEmailTo,
  1268. [in]
  1269. INETADDRTYPE atDSN);
  1270. }
  1271. // ---------------------------------------------------------------------------------------
  1272. // IID_IDAVNamespaceArbiter
  1273. // ---------------------------------------------------------------------------------------
  1274. [
  1275. uuid(72A58FF8-227D-11d2-A8B5-0000F8084F96),
  1276. helpstring("DAV Namespace Arbiter"),
  1277. local,
  1278. ]
  1279. interface IDAVNamespaceArbiter : IUnknown
  1280. {
  1281. HRESULT AddNamespace(
  1282. [in]
  1283. LPCSTR pszNamespace,
  1284. [out]
  1285. DWORD *pdwNamespaceID);
  1286. HRESULT GetNamespaceID(
  1287. [in]
  1288. LPCSTR pszNamespace,
  1289. [out]
  1290. DWORD *pdwNamespaceID);
  1291. HRESULT GetNamespacePrefix(
  1292. [in]
  1293. DWORD dwNamespaceID,
  1294. [out]
  1295. LPSTR *ppszNamespacePrefix);
  1296. }
  1297. // ---------------------------------------------------------------------------------------
  1298. // IID_IPropPatchRequest
  1299. // ---------------------------------------------------------------------------------------
  1300. [
  1301. uuid(AB8B8D2A-227F-11d2-A8B5-0000F8084F96),
  1302. helpstring("DAV PropPatch Request"),
  1303. local,
  1304. ]
  1305. interface IPropPatchRequest : IDAVNamespaceArbiter
  1306. {
  1307. HRESULT SetProperty(
  1308. [in]
  1309. DWORD dwNamespaceID,
  1310. [in]
  1311. LPCSTR pszPropertyName,
  1312. [in]
  1313. LPCSTR pszNewValue);
  1314. HRESULT RemoveProperty(
  1315. [in]
  1316. DWORD dwNamespaceID,
  1317. [in]
  1318. LPCSTR pszPropertyName);
  1319. HRESULT GenerateXML(
  1320. [out]
  1321. LPSTR *pszXML);
  1322. }
  1323. // ---------------------------------------------------------------------------------------
  1324. // IID_IPropFindRequest
  1325. // ---------------------------------------------------------------------------------------
  1326. [
  1327. uuid(5CFC6308-0544-11d2-A894-0000F8084F96),
  1328. helpstring("DAV PropFind Request"),
  1329. local,
  1330. ]
  1331. interface IPropFindRequest : IDAVNamespaceArbiter
  1332. {
  1333. HRESULT AddProperty(
  1334. [in]
  1335. DWORD dwNamespaceID,
  1336. [in]
  1337. LPCSTR pszPropertyName);
  1338. HRESULT GenerateXML(
  1339. [out]
  1340. LPSTR *pszXML);
  1341. }
  1342. // ---------------------------------------------------------------------------------------
  1343. // IID_IPropFindMultiResponse
  1344. // ---------------------------------------------------------------------------------------
  1345. [
  1346. uuid(0DEE87DE-0547-11d2-A894-0000F8084F96),
  1347. helpstring("DAV PropFind MultiResponse"),
  1348. local,
  1349. ]
  1350. interface IPropFindMultiResponse : IUnknown
  1351. {
  1352. BOOL IsComplete(void);
  1353. HRESULT GetLength(
  1354. [out]
  1355. ULONG *pulLength);
  1356. HRESULT GetResponse(
  1357. [in]
  1358. ULONG ulIndex,
  1359. [out]
  1360. IPropFindResponse **ppResponse);
  1361. }
  1362. // ---------------------------------------------------------------------------------------
  1363. // IID_IPropFindResponse
  1364. // ---------------------------------------------------------------------------------------
  1365. [
  1366. uuid(8A523716-0548-11d2-A894-0000F8084F96),
  1367. helpstring("DAV PropFind Response"),
  1368. local,
  1369. ]
  1370. interface IPropFindResponse : IUnknown
  1371. {
  1372. BOOL IsComplete(void);
  1373. HRESULT GetHref(
  1374. [out]
  1375. LPSTR *ppszHref);
  1376. HRESULT GetProperty(
  1377. [in]
  1378. DWORD dwNamespaceID,
  1379. [in]
  1380. LPCSTR pszPropertyName,
  1381. [out]
  1382. LPSTR *ppszPropertyValue);
  1383. }
  1384. // ---------------------------------------------------------------------------------------
  1385. // IID_IHTTPMailCallback
  1386. // ---------------------------------------------------------------------------------------
  1387. [
  1388. uuid(19F6481C-E5F0-11d1-A86E-0000F8084F96),
  1389. helpstring("HTTPMail Callback Interface"),
  1390. local,
  1391. ]
  1392. interface IHTTPMailCallback : ITransportCallback
  1393. {
  1394. // -----------------------------------------------------------------------------------
  1395. // HTTPMAILCOMMAND
  1396. // -----------------------------------------------------------------------------------
  1397. typedef enum tagHTTPMAILCOMMAND
  1398. {
  1399. HTTPMAIL_NONE,
  1400. HTTPMAIL_GETPROP,
  1401. HTTPMAIL_GET,
  1402. HTTPMAIL_PUT,
  1403. HTTPMAIL_POST,
  1404. HTTPMAIL_DELETE,
  1405. HTTPMAIL_BDELETE,
  1406. HTTPMAIL_PROPFIND,
  1407. HTTPMAIL_PROPPATCH,
  1408. HTTPMAIL_MKCOL,
  1409. HTTPMAIL_COPY,
  1410. HTTPMAIL_BCOPY,
  1411. HTTPMAIL_MOVE,
  1412. HTTPMAIL_BMOVE,
  1413. HTTPMAIL_MEMBERINFO,
  1414. HTTPMAIL_FINDFOLDERS,
  1415. HTTPMAIL_MARKREAD,
  1416. HTTPMAIL_SENDMESSAGE,
  1417. HTTPMAIL_LISTCONTACTS,
  1418. HTTPMAIL_CONTACTINFO,
  1419. HTTPMAIL_POSTCONTACT,
  1420. HTTPMAIL_PATCHCONTACT
  1421. } HTTPMAILCOMMAND;
  1422. // -----------------------------------------------------------------------------------
  1423. // HTTPMAILGETPROP
  1424. // -----------------------------------------------------------------------------------
  1425. typedef struct tagHTTPMAILGETPROP
  1426. {
  1427. HTTPMAILPROPTYPE type;
  1428. LPSTR pszProp;
  1429. } HTTPMAILGETPROP, *LPHTTPMAILGETPROP;
  1430. // -----------------------------------------------------------------------------------
  1431. // HTTPMAILGET
  1432. // -----------------------------------------------------------------------------------
  1433. typedef struct tagHTTPMAILGET
  1434. {
  1435. BOOL fTotalKnown; // server provided a content-length (cbTotal is valid)
  1436. DWORD cbIncrement; // bytes in this response
  1437. DWORD cbCurrent; // bytes downloaded so far
  1438. DWORD cbTotal; // total bytes in the response (if fTotalKnown == TRUE)
  1439. LPVOID pvBody; // content bytes
  1440. LPSTR pszContentType;
  1441. } HTTPMAILGET, *LPHTTPMAILGET;
  1442. // -----------------------------------------------------------------------------------
  1443. // HTTPMAILPOST
  1444. // -----------------------------------------------------------------------------------
  1445. typedef struct tagHTTPMAILPOST
  1446. {
  1447. LPSTR pszLocation;
  1448. BOOL fResend;
  1449. DWORD cbIncrement;
  1450. DWORD cbCurrent;
  1451. DWORD cbTotal;
  1452. } HTTPMAILPOST, *LPHTTPMAILPOST;
  1453. // -----------------------------------------------------------------------------------
  1454. // HTTPMAILPROPFIND
  1455. // -----------------------------------------------------------------------------------
  1456. typedef struct tagHTTPMAILPROPFIND
  1457. {
  1458. IPropFindMultiResponse *pMultiResponse; // parsed propfind response
  1459. } HTTPMAILPROPFIND, *LPHTTPMAILPROPFIND;
  1460. // -----------------------------------------------------------------------------------
  1461. // HTTPMAILLOCATION
  1462. // -----------------------------------------------------------------------------------
  1463. typedef struct tagHTTPMAILLOCATION
  1464. {
  1465. LPSTR pszLocation;
  1466. } HTTPMAILLOCATION, *LPHTTPMAILLOCATION;
  1467. // -----------------------------------------------------------------------------------
  1468. // HTTPMAILBCOPYMOVE
  1469. // -----------------------------------------------------------------------------------
  1470. typedef struct tagHTTPMAILBCOPYMOVE
  1471. {
  1472. LPSTR pszHref;
  1473. LPSTR pszLocation;
  1474. HRESULT hrResult;
  1475. } HTTPMAILBCOPYMOVE, *LPHTTPMAILBCOPYMOVE;
  1476. // -----------------------------------------------------------------------------------
  1477. // HTTPMAILBCOPYMOVELIST
  1478. // -----------------------------------------------------------------------------------
  1479. typedef struct tagHTTPMAILBCOPYMOVELIST
  1480. {
  1481. ULONG cBCopyMove;
  1482. LPHTTPMAILBCOPYMOVE prgBCopyMove;
  1483. } HTTPMAILBCOPYMOVELIST, *LPHTTPMAILBCOPYMOVELIST;
  1484. // -----------------------------------------------------------------------------------
  1485. // HTTPMAILMEMBERINFO
  1486. // -----------------------------------------------------------------------------------
  1487. typedef struct tagHTTPMEMBERINFO
  1488. {
  1489. // common properties
  1490. LPSTR pszHref;
  1491. BOOL fIsFolder;
  1492. // folder properties
  1493. LPSTR pszDisplayName;
  1494. BOOL fHasSubs;
  1495. BOOL fNoSubs;
  1496. DWORD dwUnreadCount;
  1497. DWORD dwVisibleCount;
  1498. HTTPMAILSPECIALFOLDER tySpecial;
  1499. // message properties
  1500. BOOL fRead;
  1501. BOOL fHasAttachment;
  1502. LPSTR pszTo;
  1503. LPSTR pszFrom;
  1504. LPSTR pszSubject;
  1505. LPSTR pszDate;
  1506. DWORD dwContentLength;
  1507. } HTTPMEMBERINFO, *LPHTTPMEMBERINFO;
  1508. // -----------------------------------------------------------------------------------
  1509. // HTTPMEMBERINFOLIST
  1510. // -----------------------------------------------------------------------------------
  1511. typedef struct tagHTTPMEMBERINFOLIST
  1512. {
  1513. ULONG cMemberInfo; // count of elements in prgMemberInfo
  1514. LPHTTPMEMBERINFO prgMemberInfo; // array of HTTPMEMBERINFO
  1515. } HTTPMEMBERINFOLIST, *LPHTTPMEMBERINFOLIST;
  1516. // -----------------------------------------------------------------------------------
  1517. // HTTPMEMBERERROR
  1518. // -----------------------------------------------------------------------------------
  1519. typedef struct tagHTTPMEMBERERROR
  1520. {
  1521. LPSTR pszHref;
  1522. HRESULT hrResult;
  1523. } HTTPMEMBERERROR, *LPHTTPMEMBERERROR;
  1524. // -----------------------------------------------------------------------------------
  1525. // HTTPMEMBERERRORLIST
  1526. // -----------------------------------------------------------------------------------
  1527. typedef struct tagHTTPMEMBERERRORLIST
  1528. {
  1529. ULONG cMemberError;
  1530. LPHTTPMEMBERERROR prgMemberError;
  1531. } HTTPMEMBERERRORLIST, *LPHTTPMEMBERERRORLIST;
  1532. // -----------------------------------------------------------------------------------
  1533. // HTTPCONTACTID
  1534. // -----------------------------------------------------------------------------------
  1535. typedef struct tagHTTPCONTACTID
  1536. {
  1537. LPSTR pszHref;
  1538. LPSTR pszId;
  1539. HTTPMAILCONTACTTYPE tyContact;
  1540. LPSTR pszModified;
  1541. } HTTPCONTACTID, *LPHTTPCONTACTID;
  1542. // -----------------------------------------------------------------------------------
  1543. // HTTPCONTACTIDLIST
  1544. // -----------------------------------------------------------------------------------
  1545. typedef struct tagHTTPCONTACTIDLIST
  1546. {
  1547. ULONG cContactId; // number of elements in prgContactId
  1548. LPHTTPCONTACTID prgContactId; // array cf contact ids
  1549. } HTTPCONTACTIDLIST, *LPHTTPCONTACTIDLIST;
  1550. // -----------------------------------------------------------------------------------
  1551. // HTTPCONTACTINFO
  1552. // -----------------------------------------------------------------------------------
  1553. typedef struct tagHTTPCONTACTINFO
  1554. {
  1555. LPSTR pszHref;
  1556. LPSTR pszId;
  1557. HTTPMAILCONTACTTYPE tyContact;
  1558. LPSTR pszModified;
  1559. LPSTR pszDisplayName;
  1560. LPSTR pszGivenName;
  1561. LPSTR pszSurname;
  1562. LPSTR pszNickname;
  1563. LPSTR pszEmail;
  1564. LPSTR pszHomeStreet;
  1565. LPSTR pszHomeCity;
  1566. LPSTR pszHomeState;
  1567. LPSTR pszHomePostalCode;
  1568. LPSTR pszHomeCountry;
  1569. LPSTR pszCompany;
  1570. LPSTR pszWorkStreet;
  1571. LPSTR pszWorkCity;
  1572. LPSTR pszWorkState;
  1573. LPSTR pszWorkPostalCode;
  1574. LPSTR pszWorkCountry;
  1575. LPSTR pszHomePhone;
  1576. LPSTR pszHomeFax;
  1577. LPSTR pszWorkPhone;
  1578. LPSTR pszWorkFax;
  1579. LPSTR pszMobilePhone;
  1580. LPSTR pszOtherPhone;
  1581. LPSTR pszBday;
  1582. LPSTR pszPager;
  1583. } HTTPCONTACTINFO, *LPHTTPCONTACTINFO;
  1584. // -----------------------------------------------------------------------------------
  1585. // HTTPCONTACTINFOLIST
  1586. // -----------------------------------------------------------------------------------
  1587. typedef struct tagHTTPCONTACTINFOLIST
  1588. {
  1589. ULONG cContactInfo;
  1590. LPHTTPCONTACTINFO prgContactInfo;
  1591. } HTTPCONTACTINFOLIST, *LPHTTPCONTACTINFOLIST;
  1592. // -----------------------------------------------------------------------------------
  1593. // HTTPMAILRESPONSE
  1594. // -----------------------------------------------------------------------------------
  1595. typedef struct tagHTTPMAILRESPONSE
  1596. {
  1597. HTTPMAILCOMMAND command; // Command for which the response was generated
  1598. DWORD dwContext; // Client context
  1599. BOOL fDone; // Is this the last response for the command
  1600. IXPRESULT rIxpResult; // Result information
  1601. IHTTPMailTransport *pTransport; // Pointer to the HTTPMail transport that generated the response
  1602. // This is a union of response information based on the command
  1603. [switch_type(HTTPMAILCOMMAND), switch_is((HTTPMAILCOMMAND)command)]
  1604. union
  1605. {
  1606. [case(HTTPMAIL_GETPROP)] HTTPMAILGETPROP rGetPropInfo;
  1607. [case(HTTPMAIL_GET)] HTTPMAILGET rGetInfo;
  1608. [case(HTTPMAIL_PUT)] HTTPMAILPOST rPutInfo;
  1609. [case(HTTPMAIL_POST)] HTTPMAILPOST rPostInfo;
  1610. [case(HTTPMAIL_PROPFIND)] HTTPMAILPROPFIND rPropFindInfo;
  1611. [case(HTTPMAIL_MKCOL)]HTTPMAILLOCATION rMkColInfo;
  1612. [case(HTTPMAIL_COPY)]HTTPMAILLOCATION rCopyMoveInfo;
  1613. [case(HTTPMAIL_BCOPY)]HTTPMAILBCOPYMOVELIST rBCopyMoveList;
  1614. [case(HTTPMAIL_MEMBERINFO)] HTTPMEMBERINFOLIST rMemberInfoList; // response for MemberInfo, FindFolders
  1615. [case(HTTPMAIL_MARKREAD)] HTTPMEMBERERRORLIST rMemberErrorList; // response for MarkRead, BDELETE
  1616. [case(HTTPMAIL_SENDMESSAGE)] HTTPMAILPOST rSendMessageInfo;
  1617. [case(HTTPMAIL_LISTCONTACTS)] HTTPCONTACTIDLIST rContactIdList;
  1618. [case(HTTPMAIL_CONTACTINFO)] HTTPCONTACTINFOLIST rContactInfoList;
  1619. [case(HTTPMAIL_POSTCONTACT)] HTTPCONTACTID rPostContactInfo;
  1620. [case(HTTPMAIL_PATCHCONTACT)] HTTPCONTACTID rPatchContactInfo;
  1621. [default];
  1622. };
  1623. } HTTPMAILRESPONSE, *LPHTTPMAILRESPONSE;
  1624. // -----------------------------------------------------------------------------------
  1625. // OnResponse
  1626. //
  1627. // Description
  1628. // Called by IHTTPMailTransport when a command response is received from the HTTP server
  1629. //
  1630. // Paramters
  1631. // pResponse Response information
  1632. //
  1633. // Return values:
  1634. // S_OK The client should always return S_OK
  1635. //
  1636. // -----------------------------------------------------------------------------------
  1637. HRESULT OnResponse(
  1638. [in]
  1639. LPHTTPMAILRESPONSE pResponse);
  1640. HRESULT GetParentWindow(
  1641. [out]
  1642. HWND *phwndParent);
  1643. }
  1644. // ---------------------------------------------------------------------------------------
  1645. // IID_IHTTPMailTransport
  1646. // ---------------------------------------------------------------------------------------
  1647. [
  1648. uuid(B8BDE03C-E548-11d1-A86E-0000F8084F96),
  1649. helpstring("HTTPMail Internet Transport Interface"),
  1650. local,
  1651. ]
  1652. interface IHTTPMailTransport : IInternetTransport
  1653. {
  1654. typedef struct tagHTTPTARGETLIST
  1655. {
  1656. ULONG cTarget;
  1657. LPCSTR *prgTarget;
  1658. } HTTPTARGETLIST, *LPHTTPTARGETLIST;
  1659. // -----------------------------------------------------------------------------------
  1660. // InitNew
  1661. //
  1662. // Description:
  1663. // This method Initializes the internet transport. This method be called before
  1664. // the transport can doing anything.
  1665. //
  1666. // Parameters:
  1667. // pszUserAgent User agent string sent in http queries
  1668. //
  1669. // pszLogFilePath Full file path in which to log the protocol commands.
  1670. // NULL is a valid value (no logging)
  1671. // pCallback(required) Specifies the Transport callback interface.
  1672. //
  1673. // Returns:
  1674. // E_INVALIDARG An invalid parameter was passed in
  1675. // E_OUTOFMEMORY An memory allocation failed
  1676. //
  1677. // -----------------------------------------------------------------------------------
  1678. HRESULT InitNew(
  1679. [in]
  1680. LPCSTR pszUserAgent,
  1681. [in]
  1682. LPCSTR pszLogFilePath,
  1683. [in]
  1684. IHTTPMailCallback *pCallback);
  1685. // -----------------------------------------------------------------------------------
  1686. // CommandGET
  1687. // rgszAcceptTypes is a null terminated list of accept types.
  1688. // -----------------------------------------------------------------------------------
  1689. HRESULT CommandGET(
  1690. [in]
  1691. LPCSTR pszPath,
  1692. [in]
  1693. LPCSTR *rgszAcceptTypes,
  1694. [in]
  1695. BOOL fTranslate,
  1696. [in]
  1697. DWORD dwContext);
  1698. // -----------------------------------------------------------------------------------
  1699. // CommandPUT
  1700. // -----------------------------------------------------------------------------------
  1701. HRESULT CommandPUT(
  1702. [in]
  1703. LPCSTR pszPath,
  1704. [in]
  1705. LPVOID lpvData,
  1706. [in]
  1707. ULONG cbSize,
  1708. [in]
  1709. DWORD dwContext);
  1710. // -----------------------------------------------------------------------------------
  1711. // CommandPOST
  1712. // -----------------------------------------------------------------------------------
  1713. HRESULT CommandPOST(
  1714. [in]
  1715. LPCSTR pszPath,
  1716. [in]
  1717. IStream *pStream,
  1718. [in]
  1719. LPCSTR pszContentType,
  1720. [in]
  1721. DWORD dwContext);
  1722. // -----------------------------------------------------------------------------------
  1723. // CommandDELETE
  1724. // -----------------------------------------------------------------------------------
  1725. HRESULT CommandDELETE(
  1726. [in]
  1727. LPCSTR pszPath,
  1728. [in]
  1729. DWORD dwContext);
  1730. // -----------------------------------------------------------------------------------
  1731. // CommandBDELETE
  1732. // -----------------------------------------------------------------------------------
  1733. HRESULT CommandBDELETE(
  1734. [in]
  1735. LPCSTR pszSourceCollection,
  1736. [in]
  1737. LPHTTPTARGETLIST pTargets,
  1738. [in]
  1739. DWORD dwContext);
  1740. // -----------------------------------------------------------------------------------
  1741. // CommandPROPFIND
  1742. // -----------------------------------------------------------------------------------
  1743. HRESULT CommandPROPFIND(
  1744. [in]
  1745. LPCSTR pszPath,
  1746. [in]
  1747. IPropFindRequest *pRequest,
  1748. [in]
  1749. DWORD dwDepth,
  1750. [in]
  1751. DWORD dwContext);
  1752. // -----------------------------------------------------------------------------------
  1753. // CommandPROPPATCH
  1754. // -----------------------------------------------------------------------------------
  1755. HRESULT CommandPROPPATCH(
  1756. [in]
  1757. LPCSTR pszPath,
  1758. [in]
  1759. IPropPatchRequest *pRequest,
  1760. [in]
  1761. DWORD dwContext);
  1762. // -----------------------------------------------------------------------------------
  1763. // CommandMKCOL
  1764. // -----------------------------------------------------------------------------------
  1765. HRESULT CommandMKCOL(
  1766. [in]
  1767. LPCSTR pszPath,
  1768. [in]
  1769. DWORD dwContext);
  1770. // -----------------------------------------------------------------------------------
  1771. // CommandCOPY
  1772. // -----------------------------------------------------------------------------------
  1773. HRESULT CommandCOPY(
  1774. [in]
  1775. LPCSTR pszPath,
  1776. [in]
  1777. LPCSTR pszDestination,
  1778. [in]
  1779. BOOL fAllowRename,
  1780. [in]
  1781. DWORD dwContext);
  1782. // -----------------------------------------------------------------------------------
  1783. // CommandBCOPY
  1784. // -----------------------------------------------------------------------------------
  1785. HRESULT CommandBCOPY(
  1786. [in]
  1787. LPCSTR pszSourceCollection,
  1788. [in]
  1789. LPHTTPTARGETLIST pTargets,
  1790. [in]
  1791. LPCSTR pszDestCollection,
  1792. [in]
  1793. LPHTTPTARGETLIST pDestinations,
  1794. [in]
  1795. BOOL fAllowRename,
  1796. [in]
  1797. DWORD dwContext);
  1798. // -----------------------------------------------------------------------------------
  1799. // CommandMOVE
  1800. // -----------------------------------------------------------------------------------
  1801. HRESULT CommandMOVE(
  1802. [in]
  1803. LPCSTR pszPath,
  1804. [in]
  1805. LPCSTR pszDestination,
  1806. [in]
  1807. BOOL fAllowRename,
  1808. [in]
  1809. DWORD dwContext);
  1810. // -----------------------------------------------------------------------------------
  1811. // CommandBMOVE
  1812. // -----------------------------------------------------------------------------------
  1813. HRESULT CommandBMOVE(
  1814. [in]
  1815. LPCSTR pszSourceCollection,
  1816. [in]
  1817. LPHTTPTARGETLIST pTargets,
  1818. [in]
  1819. LPCSTR pszDestCollection,
  1820. [in]
  1821. LPHTTPTARGETLIST pDestinations,
  1822. [in]
  1823. BOOL fAllowRename,
  1824. [in]
  1825. DWORD dwContext);
  1826. // -----------------------------------------------------------------------------------
  1827. // GetProperty
  1828. // Retrieves the requested account property synchronously or asynchronously.
  1829. // If the property is immediately available, it is returned synchronously,
  1830. // and the result of the function is S_OK. In the sync case, it is the caller's
  1831. // responsibility to free the property string by calling CoTaskMemFree.
  1832. // If the property is not available immediately, the function result is
  1833. // E_PENDING, and the result is returned via a call to the callback's
  1834. // OnResponse method.
  1835. //
  1836. // The caller can force the call to return async by passing a null ppszProp.
  1837. // The call CANNOT force the call to return sync.
  1838. //
  1839. // Returns: if requesting the root props succeeded, and the server returned
  1840. // xml that did not contain the specific root property requested by the client,
  1841. // the return value will be IXP_E_HTTP_ROOT_PROP_NOT_FOUND.
  1842. // -----------------------------------------------------------------------------------
  1843. HRESULT GetProperty(
  1844. [in]
  1845. HTTPMAILPROPTYPE proptype,
  1846. [out]
  1847. LPSTR *ppszProp);
  1848. // -----------------------------------------------------------------------------------
  1849. // MemberInfo
  1850. //
  1851. // Description:
  1852. // This method is called to discover folders, messages, and specific properties
  1853. // of folders and messages.
  1854. //
  1855. // Parameters:
  1856. //
  1857. // pszPath null terminated string that is the complete path
  1858. // to the resource (or collection)
  1859. // examples:
  1860. // a message: "http://www.hotmail.com/inbox/msg12345
  1861. // a folder: "http://www.hotmail.com/inbox/"
  1862. // MEMBERINFOFLAGS flags that define which properties should be requested
  1863. // dwDepth maps to the DAV depth header. Can be an integer or the
  1864. // constant DEPTH_INFINITY. A depth of 0 means request
  1865. // properties on the resource at pszPath. A depth of
  1866. // 1 means request properties on the resource at pszPath
  1867. // and at all of its first-level children, etc.
  1868. // fIncludeRoot boolean indicating whether or not to include the item
  1869. // at pszPath in the response. Maps to the "noroot" token
  1870. // optionally included in the DAV depth header. To request
  1871. // properties on all of the first-level members of a
  1872. // resource, and omit the resource itself from the response,
  1873. // set dwDepth = 1 and fIncludeRoot = FALSE.
  1874. // -----------------------------------------------------------------------------------
  1875. HRESULT MemberInfo(
  1876. [in]
  1877. LPCSTR pszPath,
  1878. [in]
  1879. MEMBERINFOFLAGS flags,
  1880. [in]
  1881. DWORD dwDepth,
  1882. [in]
  1883. BOOL fIncludeRoot,
  1884. [in]
  1885. DWORD dwContext);
  1886. // -----------------------------------------------------------------------------------
  1887. // FindFolders
  1888. //
  1889. // Description:
  1890. // This method is called to discover the collection hierarchy that exists underneath
  1891. // the pszPath URL. The response is identical to the MemberInfo response. This method
  1892. // causes a non-DAV 1.0 verb (SEARCH) to be sent to the server. Callers should be
  1893. // prepared to fallback to other forms of folder discovery if this method fails.
  1894. //
  1895. // Parameters:
  1896. //
  1897. // pszPath null terminated string that is the complete path
  1898. // to the root of the folder hiearchy. The collection at
  1899. // pszPath will not be included in the response.
  1900. //
  1901. // dwContext context provided by caller.
  1902. // -----------------------------------------------------------------------------------
  1903. HRESULT FindFolders(
  1904. [in]
  1905. LPCSTR pszPath,
  1906. [in]
  1907. DWORD dwContext);
  1908. // -----------------------------------------------------------------------------------
  1909. // MarkRead
  1910. // -----------------------------------------------------------------------------------
  1911. HRESULT MarkRead(
  1912. [in]
  1913. LPCSTR pszPath,
  1914. [in]
  1915. LPHTTPTARGETLIST pTargets,
  1916. [in]
  1917. BOOL fMarkRead,
  1918. [in]
  1919. DWORD dwContext);
  1920. // -----------------------------------------------------------------------------------
  1921. // SendMessage:
  1922. // Send a message using an http server that supports the http-based RFC821
  1923. // send protocol.
  1924. //
  1925. // Parameters:
  1926. //
  1927. // pszPath "sendmsg" url. server url that can receive
  1928. // "POST" commands with request bodies that
  1929. // conform to the http mail spec.
  1930. // pszFrom The "from" address associated with the outbound
  1931. // mail. This address must be of the form:
  1932. // [email protected]
  1933. // pTargets List of e-mail address that will receive
  1934. // copies of the message. This list should include
  1935. // all direct recipients as well as "cc" and "bcc"
  1936. // recipients. Addresses must be of the form:
  1937. // [email protected]
  1938. // fSaveInSent Indicates whether or not the server should save
  1939. // a copy of the outbound message in the users
  1940. // "Sent Items" folder. It is up to the server
  1941. // to determine the specific behavior associated
  1942. // with saving an outboundmessage.
  1943. // pMessageStream A stream that contains an rfc822 compliant
  1944. // message. The contents of this stream are not
  1945. // validated by this API. It is the responsibility
  1946. // of the caller to insure that the message is
  1947. // rfc822 compliant.
  1948. // dwContext A dword which indentifies the specific request.
  1949. // This dword will be included in all async responses,
  1950. // and enables the caller to uniquely identify the request.
  1951. // -----------------------------------------------------------------------------------
  1952. HRESULT SendMessage(
  1953. [in]
  1954. LPCSTR pszPath,
  1955. [in]
  1956. LPCSTR pszFrom,
  1957. [in]
  1958. LPHTTPTARGETLIST pTargets,
  1959. [in]
  1960. BOOL fSaveInSent,
  1961. [in]
  1962. IStream *pMessageStream,
  1963. [in]
  1964. DWORD dwContext);
  1965. // -----------------------------------------------------------------------------------
  1966. // ListContacts
  1967. // -----------------------------------------------------------------------------------
  1968. HRESULT ListContacts(
  1969. [in]
  1970. LPCSTR pszPath,
  1971. [in]
  1972. DWORD dwContext);
  1973. // -----------------------------------------------------------------------------------
  1974. // ListContactInfos : temporary method. pszPath is assumed to be a collection.
  1975. // returns all contacts in the specified collection. this method will go away
  1976. // when the hotmail server supports bpropfind. response is contained in the
  1977. // rContactInfoList and the command is the same as ContactInfo.
  1978. // -----------------------------------------------------------------------------------
  1979. HRESULT ListContactInfos(
  1980. [in]
  1981. LPCSTR pszCollectionPath,
  1982. [in]
  1983. DWORD dwContext);
  1984. // -----------------------------------------------------------------------------------
  1985. // ContactInfo
  1986. // -----------------------------------------------------------------------------------
  1987. HRESULT ContactInfo(
  1988. [in]
  1989. LPCSTR pszPath,
  1990. [in]
  1991. DWORD dwContext);
  1992. // -----------------------------------------------------------------------------------
  1993. // PostContact
  1994. // -----------------------------------------------------------------------------------
  1995. HRESULT PostContact(
  1996. [in]
  1997. LPCSTR pszPath,
  1998. [in]
  1999. LPHTTPCONTACTINFO pciInfo,
  2000. [in]
  2001. DWORD dwContext);
  2002. // -----------------------------------------------------------------------------------
  2003. // PatchContact
  2004. // -----------------------------------------------------------------------------------
  2005. HRESULT PatchContact(
  2006. [in]
  2007. LPCSTR pszPath,
  2008. [in]
  2009. LPHTTPCONTACTINFO pciInfo,
  2010. [in]
  2011. DWORD dwContext);
  2012. }
  2013. // ---------------------------------------------------------------------------------------
  2014. // IID_IPOP3Callback
  2015. // ---------------------------------------------------------------------------------------
  2016. [
  2017. uuid(0DF2C7E3-3435-11d0-81D0-00C04FD85AB4),
  2018. helpstring("POP3 Callback Interface"),
  2019. local,
  2020. ]
  2021. interface IPOP3Callback : ITransportCallback
  2022. {
  2023. // -----------------------------------------------------------------------------------
  2024. // POP3COMMAND
  2025. // -----------------------------------------------------------------------------------
  2026. typedef enum tagPOP3COMMAND {
  2027. POP3_NONE,
  2028. POP3_BANNER,
  2029. POP3_CONNECTED,
  2030. POP3_USER,
  2031. POP3_PASS,
  2032. POP3_AUTH,
  2033. POP3_UIDL,
  2034. POP3_STAT,
  2035. POP3_LIST,
  2036. POP3_DELE,
  2037. POP3_RETR,
  2038. POP3_TOP,
  2039. POP3_NOOP,
  2040. POP3_QUIT,
  2041. POP3_RSET,
  2042. POP3_CUSTOM
  2043. } POP3COMMAND;
  2044. // -----------------------------------------------------------------------------------
  2045. // POP3RETR
  2046. // -----------------------------------------------------------------------------------
  2047. typedef struct tagPOP3RETR {
  2048. BOOL fHeader; // The full rfc/mime header has been downloaded.
  2049. BOOL fBody; // The body has been downloaded.
  2050. DWORD dwPopId; // POP session message id
  2051. DWORD cbSoFar; // Number of bytes downloaded since start of download
  2052. LPSTR pszLines; // Lines of the message (do not free this).
  2053. ULONG cbLines; // Number of bytes in pszLines
  2054. } POP3RETR, *LPPOP3RETR;
  2055. // -----------------------------------------------------------------------------------
  2056. // POP3TOP
  2057. // -----------------------------------------------------------------------------------
  2058. typedef struct tagPOP3TOP {
  2059. BOOL fHeader; // The header has been downloaded.
  2060. BOOL fBody; // The body has been downloaded.
  2061. DWORD dwPopId; // POP session message id
  2062. DWORD cPreviewLines; // Number of lines being previewed
  2063. DWORD cbSoFar; // Number of bytes downloaded since start of download
  2064. LPSTR pszLines; // Header lines
  2065. ULONG cbLines; // Number of bytes in pszLines
  2066. } POP3TOP, *LPPOP3TOP;
  2067. // -----------------------------------------------------------------------------------
  2068. // POP3LIST
  2069. // -----------------------------------------------------------------------------------
  2070. typedef struct tagPOP3LIST {
  2071. DWORD dwPopId; // POP session message id
  2072. DWORD cbSize; // Message Size
  2073. } POP3LIST, *LPPOP3LIST;
  2074. // -----------------------------------------------------------------------------------
  2075. // POP3UIDL
  2076. // -----------------------------------------------------------------------------------
  2077. typedef struct tagPOP3UIDL {
  2078. DWORD dwPopId; // POP session message id
  2079. LPSTR pszUidl; // POP UIDL
  2080. } POP3UIDL, *LPPOP3UIDL;
  2081. // -----------------------------------------------------------------------------------
  2082. // POP3STAT
  2083. // -----------------------------------------------------------------------------------
  2084. typedef struct tagPOP3STAT {
  2085. DWORD cMessages; // Number of messages on the server
  2086. DWORD cbMessages; // Number of bytes of messages on the server
  2087. } POP3STAT, *LPPOP3STAT;
  2088. // -----------------------------------------------------------------------------------
  2089. // POP3RESPONSE
  2090. // -----------------------------------------------------------------------------------
  2091. typedef struct tagPOP3RESPONSE {
  2092. POP3COMMAND command; // Command in which the response was generated for
  2093. BOOL fDone; // Was this the last response for this command
  2094. IXPRESULT rIxpResult; // Result Information
  2095. IPOP3Transport *pTransport; // Pointer to the POP3 transport that generated the response
  2096. BOOL fValidInfo; // The data in the union below is valid. This can be FALSE due to the
  2097. // fact that the fDone == TRUE response can be received with
  2098. // no data.
  2099. // This is a union of response information based on the command
  2100. [switch_type(POP3COMMAND), switch_is((POP3COMMAND)command)]
  2101. union {
  2102. [case(POP3_UIDL)] POP3UIDL rUidlInfo;
  2103. [case(POP3_STAT)] POP3STAT rStatInfo;
  2104. [case(POP3_LIST)] POP3LIST rListInfo;
  2105. [case(POP3_DELE)] DWORD dwPopId;
  2106. [case(POP3_RETR)] POP3RETR rRetrInfo;
  2107. [case(POP3_TOP)] POP3TOP rTopInfo;
  2108. [default];
  2109. };
  2110. } POP3RESPONSE, *LPPOP3RESPONSE;
  2111. // -----------------------------------------------------------------------------------
  2112. // OnResponse
  2113. // -----------------------------------------------------------------------------------
  2114. HRESULT OnResponse(
  2115. [in]
  2116. LPPOP3RESPONSE pResponse);
  2117. }
  2118. // ---------------------------------------------------------------------------------------
  2119. // IID_IPOP3Transport
  2120. // ---------------------------------------------------------------------------------------
  2121. [
  2122. uuid(0DF2C7E4-3435-11d0-81D0-00C04FD85AB4),
  2123. helpstring("POP3 Internet Transport Interface"),
  2124. local,
  2125. ]
  2126. interface IPOP3Transport : IInternetTransport
  2127. {
  2128. // -----------------------------------------------------------------------------------
  2129. // POP3 Group/List/Single Item commands
  2130. // -----------------------------------------------------------------------------------
  2131. typedef enum tagPOP3CMDTYPE {
  2132. POP3CMD_GET_POPID,
  2133. POP3CMD_GET_MARKED,
  2134. POP3CMD_GET_ALL
  2135. } POP3CMDTYPE;
  2136. // -----------------------------------------------------------------------------------
  2137. // InitNew
  2138. //
  2139. // Description:
  2140. // This method Initializes the internet transport. This method be called before
  2141. // the transport can doing anything.
  2142. //
  2143. // Parameters:
  2144. // pszLogFilePath Full file path in which to log the protocol commands.
  2145. // NULL is a valid value (no logging)
  2146. // pCallback(required) Specifies the Transport callback interface.
  2147. //
  2148. // Returns:
  2149. // E_INVALIDARG An invalid parameter was passed in
  2150. // E_OUTOFMEMORY An memory allocation failed
  2151. //
  2152. // -----------------------------------------------------------------------------------
  2153. HRESULT InitNew(
  2154. [in]
  2155. LPSTR pszLogFilePath,
  2156. [in]
  2157. IPOP3Callback *pCallback);
  2158. // -----------------------------------------------------------------------------------
  2159. // MarkItem
  2160. // -----------------------------------------------------------------------------------
  2161. typedef enum tagPOP3MARKTYPE {
  2162. POP3_MARK_FOR_TOP = 0x00000001,
  2163. POP3_MARK_FOR_RETR = 0x00000002,
  2164. POP3_MARK_FOR_DELE = 0x00000004,
  2165. POP3_MARK_FOR_UIDL = 0x00000008,
  2166. POP3_MARK_FOR_LIST = 0x00000010
  2167. } POP3MARKTYPE;
  2168. HRESULT MarkItem(
  2169. [in]
  2170. POP3MARKTYPE marktype,
  2171. [in]
  2172. DWORD dwPopId,
  2173. [in]
  2174. boolean fMarked);
  2175. // -----------------------------------------------------------------------------------
  2176. // CommandAUTH
  2177. // -----------------------------------------------------------------------------------
  2178. HRESULT CommandAUTH(
  2179. [in]
  2180. LPSTR pszAuthType);
  2181. // -----------------------------------------------------------------------------------
  2182. // CommandUSER
  2183. // -----------------------------------------------------------------------------------
  2184. HRESULT CommandUSER(
  2185. [in]
  2186. LPSTR pszUserName);
  2187. // -----------------------------------------------------------------------------------
  2188. // CommandPass
  2189. // -----------------------------------------------------------------------------------
  2190. HRESULT CommandPASS(
  2191. [in]
  2192. LPSTR pszPassword);
  2193. // -----------------------------------------------------------------------------------
  2194. // CommandLIST
  2195. // -----------------------------------------------------------------------------------
  2196. HRESULT CommandLIST(
  2197. [in]
  2198. POP3CMDTYPE cmdtype,
  2199. [in]
  2200. DWORD dwPopId);
  2201. // -----------------------------------------------------------------------------------
  2202. // CommandTOP
  2203. // -----------------------------------------------------------------------------------
  2204. HRESULT CommandTOP(
  2205. [in]
  2206. POP3CMDTYPE cmdtype,
  2207. [in]
  2208. DWORD dwPopId,
  2209. [in]
  2210. DWORD cPreviewLines);
  2211. // -----------------------------------------------------------------------------------
  2212. // CommandQUIT
  2213. // -----------------------------------------------------------------------------------
  2214. HRESULT CommandQUIT(void);
  2215. // -----------------------------------------------------------------------------------
  2216. // CommandSTAT
  2217. // -----------------------------------------------------------------------------------
  2218. HRESULT CommandSTAT(void);
  2219. // -----------------------------------------------------------------------------------
  2220. // CommandNOOP
  2221. // -----------------------------------------------------------------------------------
  2222. HRESULT CommandNOOP(void);
  2223. // -----------------------------------------------------------------------------------
  2224. // CommandRSET
  2225. // -----------------------------------------------------------------------------------
  2226. HRESULT CommandRSET(void);
  2227. // -----------------------------------------------------------------------------------
  2228. // CommandUIDL
  2229. // -----------------------------------------------------------------------------------
  2230. HRESULT CommandUIDL(
  2231. [in]
  2232. POP3CMDTYPE cmdtype,
  2233. [in]
  2234. DWORD dwPopId);
  2235. // -----------------------------------------------------------------------------------
  2236. // CommandDELE
  2237. // -----------------------------------------------------------------------------------
  2238. HRESULT CommandDELE(
  2239. [in]
  2240. POP3CMDTYPE cmdtype,
  2241. [in]
  2242. DWORD dwPopId);
  2243. // -----------------------------------------------------------------------------------
  2244. // CommandRETR
  2245. // -----------------------------------------------------------------------------------
  2246. HRESULT CommandRETR(
  2247. [in]
  2248. POP3CMDTYPE cmdtype,
  2249. [in]
  2250. DWORD dwPopId);
  2251. }
  2252. // ---------------------------------------------------------------------------------------
  2253. // IID_INNTPCallback
  2254. // ---------------------------------------------------------------------------------------
  2255. [
  2256. uuid(0DF2C7E6-3435-11d0-81D0-00C04FD85AB4),
  2257. helpstring("NNTP Callback Interface"),
  2258. local,
  2259. ]
  2260. interface INNTPCallback : ITransportCallback
  2261. {
  2262. // -----------------------------------------------------------------------------------
  2263. // NNTPSTATE - These are the various states the NNTP Transport can be in. These
  2264. // states are also used to determine which type of data is being returned
  2265. // in the client's OnResponse() callback.
  2266. // -----------------------------------------------------------------------------------
  2267. typedef enum tagNNTPSTATE {
  2268. NS_DISCONNECTED, // not connected
  2269. NS_CONNECT, // awaiting connect response
  2270. NS_AUTHINFO, // awaiting authorization
  2271. NS_POST, // awaiting CommandPOST() to complete
  2272. NS_IDLE, // connected (& authorized if necessary)
  2273. NS_LIST, // awaiting LIST data
  2274. NS_LISTGROUP, // awaiting LISTGROUP data
  2275. NS_NEWGROUPS, // awaiting NEWGROUPS data
  2276. NS_GROUP, // awaiting GROUP response
  2277. NS_LAST, // awaiting LAST response
  2278. NS_NEXT, // awaiting NEXT response
  2279. NS_STAT, // awaiting STAT response
  2280. NS_ARTICLE, // awaiting ARTICLE data
  2281. NS_HEAD, // awaiting HEAD data
  2282. NS_BODY, // awaiting BODY data
  2283. NS_DATE, // awaiting DATE response
  2284. NS_MODE, // awaiting MODE response
  2285. NS_QUIT, // awaiting QUIT response
  2286. NS_HEADERS, // awaiting XOVER or XHDR data from GetHeaders()
  2287. NS_XHDR // awaiting XHDR data
  2288. } NNTPSTATE;
  2289. // -----------------------------------------------------------------------------------
  2290. // NNTPGROUP - This is the response from the CommandGROUP() function. The data is
  2291. // the current status of the group that was switched to.
  2292. // -----------------------------------------------------------------------------------
  2293. typedef struct tagNNTPGROUP {
  2294. DWORD dwCount; // Estimated number of articles in the group
  2295. DWORD dwFirst; // First article number in the group
  2296. DWORD dwLast; // Last article number in the group
  2297. LPSTR pszGroup; // Name of the group
  2298. } NNTPGROUP, *LPNNTPGROUP;
  2299. // -----------------------------------------------------------------------------------
  2300. // NNTPNEXT - This structure will be used for the response from CommandNEXT(),
  2301. // CommandLAST(), and CommandSTAT(). The data returned is the article
  2302. // number and message id for the article that is selected by the command
  2303. // that was issued.
  2304. // -----------------------------------------------------------------------------------
  2305. typedef struct tagNNTPNEXT {
  2306. DWORD dwArticleNum; // Article number
  2307. LPSTR pszMessageId; // Message ID
  2308. } NNTPNEXT, *LPNNTPNEXT;
  2309. // -----------------------------------------------------------------------------------
  2310. // NNTPARTICLE - This structure returns the data from a CommandARTICLE() function.
  2311. // Depending on the size of the article being retrieved, the callback
  2312. // may recieve multiple calls for a single article. When fDone is TRUE
  2313. // then all of the article data has been retrieved. pszLines is not
  2314. // accumulated over all of the callbacks, it is the client's
  2315. // responsibility to assemble all of the pszLines that are returned to
  2316. // build the message.
  2317. // -----------------------------------------------------------------------------------
  2318. typedef struct tagNNTPARTICLE {
  2319. DWORD dwArticleNum; // Article number
  2320. LPSTR pszMessageId; // Message ID
  2321. LPSTR pszLines; // Lines of the message
  2322. ULONG cbLines; // Number of bytes in pszLines
  2323. ULONG cLines; // Number of lines in pszLines
  2324. DWORD dwReserved; // Reserved for system use
  2325. } NNTPARTICLE, *LPNNTPARTICLE;
  2326. // -----------------------------------------------------------------------------------
  2327. // NNTPLIST - This structure is the data returned from the CommandLIST() function.
  2328. // Since the NNTP LIST command can have multiple extensions, the data
  2329. // returned is relatively unparsed to provide greater flexibility to the
  2330. // client. The data is returned in array of NULL terminated strings that
  2331. // contain the lines returned from the server. When fDone is TRUE, then
  2332. // all of the data has been retrieved. rgszLines is not accumulated by
  2333. // the transport between calls to OnResponse(). It is the client's
  2334. // responsibility to store this information as it comes in.
  2335. // -----------------------------------------------------------------------------------
  2336. typedef struct tagNNTPLIST {
  2337. DWORD cLines; // Number of lines returned
  2338. LPSTR *rgszLines; // Array of lines returned by the LIST command. The
  2339. // number of lines in rgszLines is cLines. The recipient
  2340. // must call INNTPCallback::FreeListResponse() to free
  2341. // this structure.
  2342. } NNTPLIST, *LPNNTPLIST;
  2343. // -----------------------------------------------------------------------------------
  2344. // NNTPLISTGROUP - This structure is sent in response to a CommandLISTGROUP() call.
  2345. // rgArticles is an array of article numbers that are contained in
  2346. // the newsgroup. Since there can be quite a few articles,
  2347. // OnResponse() may be called multiple times with the data as it
  2348. // arrives. rgArticles is not accumulated between calls to
  2349. // OnResponse() so it is up to the client to store this information
  2350. // as it arrives. fDone will be TRUE when all the information has
  2351. // been returned.
  2352. // -----------------------------------------------------------------------------------
  2353. typedef struct tagNNTPLISTGROUP {
  2354. DWORD cArticles; // Number of article numbers in rgArticles
  2355. DWORD *rgArticles; // Array of article numbers available in the group
  2356. } NNTPLISTGROUP, *LPNNTPLISTGROUP;
  2357. // -----------------------------------------------------------------------------------
  2358. // NNTPHEADER - This structure contains the parsed information for a single header
  2359. // returned from the GetHeaders() command. An array of these headers
  2360. // is contained in the NNTPHEADERRESP struct.
  2361. // -----------------------------------------------------------------------------------
  2362. typedef struct tagNNTPHEADER {
  2363. DWORD dwArticleNum; // Article number
  2364. LPSTR pszSubject; // Article subject
  2365. LPSTR pszFrom; // Who the article is from
  2366. LPSTR pszDate; // Date the article was posted
  2367. LPSTR pszMessageId; // Message id
  2368. LPSTR pszReferences; // References
  2369. DWORD dwBytes; // Size of the message in bytes (might not be filled in)
  2370. DWORD dwLines; // Size of the message in lines
  2371. LPSTR pszXref; // XREF: header for cross post managment
  2372. } NNTPHEADER, *LPNNTPHEADER;
  2373. // -----------------------------------------------------------------------------------
  2374. // NNTPHEADERRESP - This structure will be returned in response to the GetHeaders()
  2375. // command. Since the number of headers requested may be large,
  2376. // OnResponse() may be called multiple times in response to this
  2377. // command. rgHeaders is not accumulated by the transport between
  2378. // calls to OnResponse() therefore it is the responsibility of the
  2379. // caller to store this information as it is retrieved. When all
  2380. // the data is retrieved, then fDone will be set to TRUE. Since
  2381. // not all servers provide the XREF: header in their XOVER records,
  2382. // fSupportsXRef will be set to TRUE if the pszXref field in
  2383. // NNTPHEADER is valid. If this is FALSE, the client can retrieve
  2384. // this header with a call to CommandXHDR().
  2385. // -----------------------------------------------------------------------------------
  2386. typedef struct tagNNTPHEADERRESP {
  2387. DWORD cHeaders; // Number of headers in rgHeaders
  2388. LPNNTPHEADER rgHeaders; // Array of header structures
  2389. BOOL fSupportsXRef; // TRUE if the headers have a valid pszXref value.
  2390. // Otherwise, the client needs to issue an XHdr to
  2391. // retrieve that value if they're interested.
  2392. DWORD dwReserved; // Reserved for system use
  2393. } NNTPHEADERRESP, *LPNNTPHEADERRESP;
  2394. // -----------------------------------------------------------------------------------
  2395. // NNTPXHDR - An array of these structures will be returned in the NNTPXHDRRESP
  2396. // structure.
  2397. // -----------------------------------------------------------------------------------
  2398. typedef struct tagNNTPXHDR {
  2399. DWORD dwArticleNum; // Article number this header is for
  2400. LPSTR pszHeader; // Requested article header for this article
  2401. } NNTPXHDR, *LPNNTPXHDR;
  2402. // -----------------------------------------------------------------------------------
  2403. // NNTPXHDRRESP - This will be returned in response to a CommandXHDR() call. Since
  2404. // the number of headers returned is potentially large, OnResponse()
  2405. // may be called multiple times in response to this command. rgHeaders
  2406. // is not accumulated between calls to OnResponse(), therefore it is
  2407. // up to the client to store this data as it arrives. fDone will be
  2408. // set to TRUE when all of the headers have been returned.
  2409. // -----------------------------------------------------------------------------------
  2410. typedef struct tagNNTPXHDRRESP {
  2411. DWORD cHeaders; // Number of header values in rgHeaders
  2412. LPNNTPXHDR rgHeaders; // Array of NNTPXHDR structs containing the requested headers
  2413. DWORD dwReserved; // Reserved for system use
  2414. } NNTPXHDRRESP, *LPNNTPXHDRRESP;
  2415. // -----------------------------------------------------------------------------------
  2416. // NNTPRESPONSE - This structure is the general holder for all of the data returned
  2417. // from the INNTPTransport commands. The state member tells the
  2418. // receiver which command this data is in response to. If fMustRelease
  2419. // is TRUE, then when the client is done with this data, it should
  2420. // call INNTPTransport::ReleaseResponse() to free that memory. See
  2421. // the explanation of the various structures to see the details on
  2422. // each type of response.
  2423. // -----------------------------------------------------------------------------------
  2424. typedef struct tagNNTPRESPONSE {
  2425. NNTPSTATE state; // Command in which the response was generated for
  2426. BOOL fMustRelease; // TRUE if the data contained within this struct must be
  2427. // freed with a call to INNTPTransport::ReleaseResponse()
  2428. BOOL fDone; // TRUE when there is no more data that will arrive for this
  2429. // command
  2430. IXPRESULT rIxpResult; // Result Information
  2431. INNTPTransport *pTransport; // Pointer to the NNTP transport that generated the response
  2432. // This is a union of response information based on the command
  2433. [switch_type(NNTPSTATE), switch_is((NNTPSTATE) state)]
  2434. union {
  2435. [case(NS_GROUP)] NNTPGROUP rGroup;
  2436. [case(NS_LAST)] NNTPNEXT rLast;
  2437. [case(NS_NEXT)] NNTPNEXT rNext;
  2438. [case(NS_STAT)] NNTPNEXT rStat;
  2439. [case(NS_ARTICLE)] NNTPARTICLE rArticle;
  2440. [case(NS_HEAD)] NNTPARTICLE rHead;
  2441. [case(NS_BODY)] NNTPARTICLE rBody;
  2442. [case(NS_LIST)] NNTPLIST rList;
  2443. [case(NS_LISTGROUP)] NNTPLISTGROUP rListGroup;
  2444. [case(NS_NEWGROUPS)] NNTPLIST rNewgroups;
  2445. [case(NS_DATE)] SYSTEMTIME rDate;
  2446. [case(NS_HEADERS)] NNTPHEADERRESP rHeaders;
  2447. [case(NS_XHDR)] NNTPXHDRRESP rXhdr;
  2448. [default];
  2449. };
  2450. } NNTPRESPONSE, *LPNNTPRESPONSE;
  2451. // -----------------------------------------------------------------------------------
  2452. // OnResponse
  2453. // -----------------------------------------------------------------------------------
  2454. HRESULT OnResponse(
  2455. [in]
  2456. LPNNTPRESPONSE pResponse);
  2457. }
  2458. // ---------------------------------------------------------------------------------------
  2459. // IID_INNTPTransport
  2460. // ---------------------------------------------------------------------------------------
  2461. [
  2462. uuid(0DF2C7E5-3435-11d0-81D0-00C04FD85AB4),
  2463. helpstring("NNTP Internet Transport Interface"),
  2464. local,
  2465. ]
  2466. interface INNTPTransport : IInternetTransport
  2467. {
  2468. // -----------------------------------------------------------------------------------
  2469. // AUTHTYPE
  2470. // -----------------------------------------------------------------------------------
  2471. typedef enum tagAUTHTYPE {
  2472. AUTHTYPE_USERPASS,
  2473. AUTHTYPE_SIMPLE,
  2474. AUTHTYPE_SASL
  2475. } AUTHTYPE;
  2476. // -----------------------------------------------------------------------------------
  2477. // AUTHINFO - This structure is used to specify the type of authentication to use
  2478. // in the CommandAUTHINFO() command. For AUTHTYPE_USERPASS and
  2479. // AUTHTYPE_SIMPLE, pszUser and pszPass are the user name and password
  2480. // to send with the command.
  2481. // -----------------------------------------------------------------------------------
  2482. typedef struct tagNNTPAUTHINFO {
  2483. AUTHTYPE authtype;
  2484. LPSTR pszUser;
  2485. LPSTR pszPass;
  2486. } NNTPAUTHINFO, *LPNNTPAUTHINFO;
  2487. // -----------------------------------------------------------------------------------
  2488. // ARTICLEIDTYPE
  2489. // -----------------------------------------------------------------------------------
  2490. typedef enum tagARTICLEIDTYPE {
  2491. AID_MSGID,
  2492. AID_ARTICLENUM
  2493. } ARTICLEIDTYPE;
  2494. // -----------------------------------------------------------------------------------
  2495. // ARTICLEID
  2496. //
  2497. // This structure is used to specify an article id to the various NNTP commands that
  2498. // require one (i.e. ARTICLE, BODY, STAT). These commands accept either a message-id
  2499. // or if the user is current in a the context of a newsgroup the article number within
  2500. // that group. When filling in this structure the user should set idType to either
  2501. // AID_MSGID of pszMessageId is valid, or AID_ARTICLENUM if dwArticleNum.
  2502. // -----------------------------------------------------------------------------------
  2503. typedef struct ARTICLEID {
  2504. ARTICLEIDTYPE idType;
  2505. [switch_type(ARTICLEIDTYPE), switch_is((ARTICLEIDTYPE)idType)]
  2506. union {
  2507. [case(AID_MSGID)]
  2508. LPSTR pszMessageId;
  2509. [case(AID_ARTICLENUM)]
  2510. DWORD dwArticleNum;
  2511. [default];
  2512. };
  2513. } ARTICLEID, *LPARTICLEID;
  2514. // -----------------------------------------------------------------------------------
  2515. // NNTPMESSAGE
  2516. //
  2517. // This structure provides the information needed to post a message to the news server
  2518. // using the POST command.
  2519. // -----------------------------------------------------------------------------------
  2520. typedef struct tagNNTPMESSAGE {
  2521. ULONG cbSize; // Size of the message in bytes
  2522. LPSTREAM pstmMsg; // Stream containing a ANSI MIME/rfc822/rfc1036 message stream
  2523. } NNTPMESSAGE, *LPNNTPMESSAGE;
  2524. // -----------------------------------------------------------------------------------
  2525. // RANGE
  2526. //
  2527. // The range structure allows the caller to provide arguments for commands that allow
  2528. // a range of headers to be retrieved. The range structure can be used to specify a
  2529. // single number (ie XOVER 2010), or bounded range (ie XOVER 2000-2010) to request all
  2530. // of the headers within that range [inclusive]. Use the idType field to specify
  2531. // which range you are requesting.
  2532. // -----------------------------------------------------------------------------------
  2533. typedef enum tagRANGETYPE {
  2534. RT_SINGLE, // num
  2535. RT_RANGE, // num-num
  2536. } RANGETYPE;
  2537. typedef struct tagRANGE {
  2538. RANGETYPE idType;
  2539. DWORD dwFirst;
  2540. DWORD dwLast;
  2541. } RANGE, *LPRANGE;
  2542. // -----------------------------------------------------------------------------------
  2543. // InitNew
  2544. //
  2545. // Description:
  2546. // This method Initializes the internet transport. This method be called before
  2547. // the transport can doing anything.
  2548. //
  2549. // Parameters:
  2550. // pszLogFilePath Full file path in which to log the protocol commands.
  2551. // NULL is a valid value (no logging)
  2552. // pCallback(required) Specifies the Transport callback interface.
  2553. //
  2554. // Returns:
  2555. // E_INVALIDARG An invalid parameter was passed in
  2556. // E_OUTOFMEMORY An memory allocation failed
  2557. //
  2558. // -----------------------------------------------------------------------------------
  2559. HRESULT InitNew(
  2560. [in]
  2561. LPSTR pszLogFilePath,
  2562. [in]
  2563. INNTPCallback *pCallback);
  2564. // -----------------------------------------------------------------------------------
  2565. // CommandAUTHINFO
  2566. //
  2567. // Description:
  2568. // The function issues an NNTPAUTHINFO command to the server along with the information
  2569. // provided in the pszAuth parameter. RFC 977 provides the following formats as
  2570. // valid AUTHINFO commands:
  2571. //
  2572. // AUTHINFO USER name|PASS password
  2573. // AUTHINFO SIMPLE
  2574. // user password
  2575. //
  2576. //
  2577. // Parameters:
  2578. // pAuthInfo
  2579. //
  2580. // Returns:
  2581. // E_INVALIDARG An invalid parameter was passed in
  2582. // E_OUTOFMEMORY An memory allocation failed
  2583. //
  2584. // -----------------------------------------------------------------------------------
  2585. HRESULT CommandAUTHINFO(
  2586. [in]
  2587. LPNNTPAUTHINFO pAuthInfo);
  2588. // -----------------------------------------------------------------------------------
  2589. // CommandGROUP
  2590. //
  2591. // Description:
  2592. // The function issues an GROUP command to the server. The server's response string
  2593. // will be returned to the INNTPCallback::OnResponse().
  2594. //
  2595. // Parameters:
  2596. // pszGroup Name of the newsgroup to enter.
  2597. //
  2598. // Returns:
  2599. // E_INVALIDARG pszGroup is not a valid string pointer
  2600. // E_OUTOFMEMORY An memory allocation failed
  2601. //
  2602. // -----------------------------------------------------------------------------------
  2603. HRESULT CommandGROUP(
  2604. [in]
  2605. LPSTR pszGroup);
  2606. // -----------------------------------------------------------------------------------
  2607. // CommandLAST
  2608. //
  2609. // Description:
  2610. // This function issues the LAST command to the server. This has the effect of
  2611. // moving the current article pointer to the article immediately preceeding the
  2612. // current article pointer in the newsgroup. This command is only valid if a GROUP
  2613. // command has been issued previously. The article number and message-id pointed to
  2614. // by the new current article pointer are returned in INNTPCallback::OnResponse().
  2615. //
  2616. // Returns:
  2617. // S_OK
  2618. // E_OUTOFMEMORY
  2619. // IXP_E_NOT_INIT
  2620. // IXP_E_NOT_CONNECTED
  2621. // IXP_E_BUSY
  2622. //
  2623. // -----------------------------------------------------------------------------------
  2624. HRESULT CommandLAST(void);
  2625. // -----------------------------------------------------------------------------------
  2626. // CommandNEXT
  2627. //
  2628. // Description:
  2629. // This function issues the NEXT command to the server. This has the effect of
  2630. // moving the current article pointer to the article immediately after the current
  2631. // article pointer in the newsgroup. This command is only valid if a GROUP command
  2632. // has been issued previously. The article number and message-id pointed to by the
  2633. // new current article pointer are returned in INNTPCallback::OnResponse().
  2634. //
  2635. // Returns:
  2636. // S_OK
  2637. // E_OUTOFMEMORY
  2638. // IXP_E_NOT_INIT
  2639. // IXP_E_NOT_CONNECTED
  2640. // IXP_E_BUSY
  2641. //
  2642. // -----------------------------------------------------------------------------------
  2643. HRESULT CommandNEXT(void);
  2644. // -----------------------------------------------------------------------------------
  2645. // CommandSTAT
  2646. //
  2647. // Description:
  2648. // The function issues a STAT command to the server. If an article is specified
  2649. // then this command has the effect of moving the current article pointer to the
  2650. // specified message and returns the article number and message-id of the new current
  2651. // article. Otherwise, the function will return the article number and message-id
  2652. // of the current article.
  2653. //
  2654. // Parameters:
  2655. // pArticleId (optional) Article number or message-id of the article to
  2656. // retrieve status for. If a message-id is specified
  2657. // the current article pointer will NOT be updated.
  2658. //
  2659. // Returns:
  2660. // E_INVALIDARG pArticleId is not valid
  2661. // E_OUTOFMEMORY An memory allocation failed
  2662. // IXP_E_NOT_INIT
  2663. // IXP_E_NOT_CONNECTED
  2664. // IXP_E_BUSY
  2665. //
  2666. // -----------------------------------------------------------------------------------
  2667. HRESULT CommandSTAT(
  2668. [in]
  2669. LPARTICLEID pArticleId);
  2670. // -----------------------------------------------------------------------------------
  2671. // CommandARTICLE
  2672. //
  2673. // Description:
  2674. // This function is used to request an article from the server. If the caller has
  2675. // previously issued a GROUP command then the article can be specified by either
  2676. // article number or message-id. If the GROUP command has not been issued, then the
  2677. // article can only be requested by message-id.
  2678. //
  2679. // Parameters:
  2680. // pArticleId Either the article number or message-id of the article
  2681. // to retrieve.
  2682. //
  2683. // Returns:
  2684. // E_INVALIDARG An invalid parameter was passed in
  2685. // E_OUTOFMEMORY An memory allocation failed
  2686. //
  2687. // -----------------------------------------------------------------------------------
  2688. HRESULT CommandARTICLE(
  2689. [in]
  2690. LPARTICLEID pArticleId);
  2691. // -----------------------------------------------------------------------------------
  2692. // CommandHEAD
  2693. //
  2694. // Description:
  2695. // This function retrieves just the header for the requested article. If the caller
  2696. // has previously issued a GROUP command, then the article can be specified by either
  2697. // article number or message-id. Otherwise, the article must be requested by
  2698. // message-id. The provided stream will be filled and returned to the caller in
  2699. // INNTPCallback::OnResponse().
  2700. //
  2701. // Parameters:
  2702. // pArticleId Structure specifying the article to retreive the
  2703. // header for.
  2704. //
  2705. // Returns:
  2706. // E_INVALIDARG An invalid parameter was passed in
  2707. // E_OUTOFMEMORY An memory allocation failed
  2708. //
  2709. // -----------------------------------------------------------------------------------
  2710. HRESULT CommandHEAD(
  2711. [in]
  2712. LPARTICLEID pArticleId);
  2713. // -----------------------------------------------------------------------------------
  2714. // CommandBODY
  2715. //
  2716. // Description:
  2717. // This function retrieves just the body for the requested article. If the caller
  2718. // has previously issued a GROUP command, then the article can be specified by either
  2719. // article number or message-id. Otherwise, the article must be requested by
  2720. // message-id. The provided stream will be filled and returned to the caller in
  2721. // INNTPCallback::OnResponse().
  2722. //
  2723. // Parameters:
  2724. // pArticleId Structure specifying the article to retreive the
  2725. // body for.
  2726. //
  2727. // Returns:
  2728. // E_INVALIDARG An invalid parameter was passed in
  2729. // E_OUTOFMEMORY An memory allocation failed
  2730. //
  2731. // -----------------------------------------------------------------------------------
  2732. HRESULT CommandBODY(
  2733. [in]
  2734. LPARTICLEID pArticleId);
  2735. // -----------------------------------------------------------------------------------
  2736. // CommandPOST
  2737. //
  2738. // Description:
  2739. // Posts the specified message to the server.
  2740. //
  2741. // Parameters:
  2742. // pMessage Specifies a stream that contains a valid RFC1036
  2743. // message.
  2744. //
  2745. // Returns:
  2746. // E_INVALIDARG An invalid parameter was passed in
  2747. // E_OUTOFMEMORY An memory allocation failed
  2748. //
  2749. // -----------------------------------------------------------------------------------
  2750. HRESULT CommandPOST(
  2751. [in]
  2752. LPNNTPMESSAGE pMessage);
  2753. // -----------------------------------------------------------------------------------
  2754. // CommandLIST
  2755. //
  2756. // Description:
  2757. // Sends a LIST command to the news server. If pszArgs is NULL, then the command will
  2758. // retrieve a list of newsgroups available on the news server. The pszArgs parameter
  2759. // can be used to issue one of the various extensions to the LIST command, ie.
  2760. // LIST NEWSGROUPS, LIST ACTIVE, LIST OVERVIEW.FMT, or LIST SUBSCRIPTIONS. See
  2761. // RFC 977 at http://ds.internic.net/rfc/rfc977.txt for a full list of extensions.
  2762. //
  2763. // Parameters:
  2764. // pszArgs Any optional parameters that the user wants to
  2765. // send with the LIST command. See the "Description"
  2766. // above for more details.
  2767. //
  2768. // Returns:
  2769. // E_INVALIDARG An invalid parameter was passed in
  2770. // E_OUTOFMEMORY An memory allocation failed
  2771. //
  2772. // -----------------------------------------------------------------------------------
  2773. HRESULT CommandLIST(
  2774. [in]
  2775. LPSTR pszArgs);
  2776. // -----------------------------------------------------------------------------------
  2777. // CommandLISTGROUP
  2778. //
  2779. // Description:
  2780. // Retrieves a list of all the article numbers in a particular news group. If the
  2781. // caller specifies a newsgroup name, then the articles are listed for the specified
  2782. // newsgroup. Otherwise, the currently selected newsgroup is listed. NOTE - this
  2783. // command will reset the current article pointer is reset to the first article in
  2784. // the newsgroup that was specified.
  2785. //
  2786. // Parameters:
  2787. // pszGroup Optional newsgroup name to list articles for.
  2788. //
  2789. // Returns:
  2790. // E_INVALIDARG An invalid parameter was passed in
  2791. // E_OUTOFMEMORY An memory allocation failed
  2792. //
  2793. // -----------------------------------------------------------------------------------
  2794. HRESULT CommandLISTGROUP(
  2795. [in]
  2796. LPSTR pszGroup);
  2797. // -----------------------------------------------------------------------------------
  2798. // CommandNEWGROUPS
  2799. //
  2800. // Description:
  2801. // Retrieves the list of newsgroups which have been added to the server since the
  2802. // date specified in stLast. The caller can restrict the list by specifying a list
  2803. // of distributions in pszDist. For example:
  2804. //
  2805. // CommandNEWGROUPS(&stLast, "alt.tv")
  2806. //
  2807. // will return the list of newsgroups that begin with "alt.tv" that have been added
  2808. // to the server since the time in stLast.
  2809. //
  2810. // Parameters:
  2811. // pstLast The time to specify as the last time groups were checked.
  2812. // pszDist Distributions to check. This can be a single dist
  2813. // such as "alt" or a list of dists such as "alt.tv,comp".
  2814. // The list of distributions must be separated by commas.
  2815. //
  2816. // Returns:
  2817. // E_INVALIDARG An invalid parameter was passed in
  2818. // E_OUTOFMEMORY An memory allocation failed
  2819. //
  2820. // -----------------------------------------------------------------------------------
  2821. HRESULT CommandNEWGROUPS(
  2822. [in]
  2823. SYSTEMTIME *pstLast,
  2824. [in]
  2825. LPSTR pszDist);
  2826. // -----------------------------------------------------------------------------------
  2827. // CommandDATE
  2828. //
  2829. // Description:
  2830. // Retrieves the date and time from the news server.
  2831. //
  2832. // Returns:
  2833. // E_INVALIDARG An invalid parameter was passed in
  2834. // E_OUTOFMEMORY An memory allocation failed
  2835. //
  2836. // -----------------------------------------------------------------------------------
  2837. HRESULT CommandDATE(void);
  2838. // -----------------------------------------------------------------------------------
  2839. // CommandMODE
  2840. //
  2841. // Description:
  2842. // Issues a MODE command to the server. pszMode is a required argument, an example
  2843. // of which are "MODE READER" to tell the server that the connection is for a user
  2844. // instead of another server. Refer to RFC977 for more details.
  2845. //
  2846. // Parameters:
  2847. // pszMode Required argument to the MODE command.
  2848. //
  2849. // Returns:
  2850. // E_INVALIDARG An invalid parameter was passed in
  2851. // E_OUTOFMEMORY An memory allocation failed
  2852. //
  2853. // -----------------------------------------------------------------------------------
  2854. HRESULT CommandMODE(
  2855. [in]
  2856. LPSTR pszMode);
  2857. // -----------------------------------------------------------------------------------
  2858. // CommandXHDR
  2859. //
  2860. // Description:
  2861. // Issues an XHDR command to the server. This command can specify a range of
  2862. // messages or a single message to retrieve the header from. If pRange is NULL and
  2863. // pszMessageId is NULL the the header is retrieved from the message pointed to by
  2864. // the server's current message pointer (see STAT, NEXT, LAST).
  2865. //
  2866. // Parameters:
  2867. // pszHeader Which header to retrieve. IE "subject" or "xref"
  2868. // pRange (optional) Range of messages to retrieve the header from
  2869. // pszMessageId (optional) Message ID of the mesage to retrieve the header from
  2870. //
  2871. // Returns:
  2872. //
  2873. // -----------------------------------------------------------------------------------
  2874. HRESULT CommandXHDR(
  2875. [in]
  2876. LPSTR pszHeader,
  2877. [in]
  2878. LPRANGE pRange,
  2879. [in]
  2880. LPSTR pszMessageId);
  2881. // -----------------------------------------------------------------------------------
  2882. // CommandQUIT()
  2883. //
  2884. // Description:
  2885. // Issues a QUIT command to the server and terminates the connect.
  2886. //
  2887. // Returns:
  2888. // E_OUTOFMEMORY An memory allocation failed
  2889. //
  2890. // -----------------------------------------------------------------------------------
  2891. HRESULT CommandQUIT(void);
  2892. // -----------------------------------------------------------------------------------
  2893. // GetHeaders
  2894. //
  2895. // Description:
  2896. // Retrieves an array of headers from the server. If a GROUP command has not been
  2897. // previously sent this command is not valid.
  2898. //
  2899. // This function will first try to retrieve the specifed range of headers using
  2900. // the XOVER command. If the server doesn't support XOVER, then the function will
  2901. // try other methods such as a series of XHDR commands.
  2902. //
  2903. // Parameters:
  2904. // pRange The range of headers to request. See the
  2905. // documentation for the RANGE structure above to see
  2906. // how to specify a range.
  2907. //
  2908. // Returns:
  2909. // E_INVALIDARG An invalid parameter was passed in
  2910. // E_OUTOFMEMORY An memory allocation failed
  2911. //
  2912. // -----------------------------------------------------------------------------------
  2913. HRESULT GetHeaders(
  2914. [in]
  2915. LPRANGE pRange);
  2916. // -----------------------------------------------------------------------------------
  2917. // ReleaseResponse()
  2918. //
  2919. // Description:
  2920. // This function is used to free data returned to the client's OnResponse() callback.
  2921. //
  2922. // Parameters:
  2923. // pResponse A pointer to the NNTPRESPONSE structure passed to the
  2924. // OnResponse() callback.
  2925. //
  2926. // Returns:
  2927. // E_INVALIDARG An invalid parameter was passed in
  2928. //
  2929. // -----------------------------------------------------------------------------------
  2930. HRESULT ReleaseResponse(
  2931. [in]
  2932. LPNNTPRESPONSE pResponse);
  2933. }
  2934. // ---------------------------------------------------------------------------------------
  2935. // IID_INNTPTransport2
  2936. // ---------------------------------------------------------------------------------------
  2937. [
  2938. uuid(0DF2C7ED-3435-11d0-81D0-00C04FD85AB4),
  2939. helpstring("NNTP Transport 2 Interface"),
  2940. local,
  2941. ]
  2942. interface INNTPTransport2 : INNTPTransport
  2943. {
  2944. //***************************************************************************
  2945. // Function: SetWindow
  2946. //
  2947. // Purpose:
  2948. // This function creates a new window for async winsock processing
  2949. //
  2950. // Returns:
  2951. // HRESULT indicating success or failure.
  2952. //***************************************************************************
  2953. HRESULT SetWindow(void);
  2954. //***************************************************************************
  2955. // Function: ResetWindow
  2956. //
  2957. // Purpose:
  2958. // This function closes a window for async winsock processing
  2959. //
  2960. // Returns:
  2961. // HRESULT indicating success or failure.
  2962. //***************************************************************************
  2963. HRESULT ResetWindow(void);
  2964. }
  2965. // ---------------------------------------------------------------------------------------
  2966. // IID_IRASCallback
  2967. // ---------------------------------------------------------------------------------------
  2968. [
  2969. uuid(36D88911-3CD6-11d0-81DF-00C04FD85AB4),
  2970. helpstring("RAS Callback Interface"),
  2971. local,
  2972. ]
  2973. interface IRASCallback : IUnknown
  2974. {
  2975. // -----------------------------------------------------------------------------------
  2976. // OnReconnect
  2977. // -----------------------------------------------------------------------------------
  2978. HRESULT OnReconnect(
  2979. [in]
  2980. LPSTR pszCurrentConnectoid,
  2981. [in]
  2982. LPSTR pszNewConnectoid,
  2983. [in]
  2984. IRASTransport *pTransport);
  2985. // -----------------------------------------------------------------------------------
  2986. // OnLogonPrompt
  2987. // -----------------------------------------------------------------------------------
  2988. typedef struct tagIXPRASLOGON {
  2989. CHAR szConnectoid[CCHMAX_CONNECTOID];
  2990. CHAR szUserName[CCHMAX_USERNAME];
  2991. CHAR szPassword[CCHMAX_PASSWORD];
  2992. CHAR szDomain[CCHMAX_DOMAIN];
  2993. CHAR szPhoneNumber[CCHMAX_PHONE_NUMBER];
  2994. BOOL fSavePassword;
  2995. } IXPRASLOGON, *LPIXPRASLOGON;
  2996. HRESULT OnLogonPrompt(
  2997. [in,out]
  2998. LPIXPRASLOGON pRasLogon,
  2999. [in]
  3000. IRASTransport *pTransport);
  3001. // -----------------------------------------------------------------------------------
  3002. // OnRasDialStatus
  3003. // -----------------------------------------------------------------------------------
  3004. cpp_quote("#ifndef RASCONNSTATE")
  3005. typedef DWORD RASCONNSTATE;
  3006. cpp_quote("#endif")
  3007. HRESULT OnRasDialStatus(
  3008. [in]
  3009. RASCONNSTATE rasconnstate,
  3010. [in]
  3011. DWORD dwError,
  3012. [in]
  3013. IRASTransport *pTransport);
  3014. // -----------------------------------------------------------------------------------
  3015. // OnDisconnect
  3016. //
  3017. // Description:
  3018. // This method allows the client to decide if the current RAS connection should
  3019. // be hungup. This is useful, especially on application shutdown, in which case
  3020. // the user may want to leave their RAS connection established even after the
  3021. // application using the connection goes away. This client could show UI on this
  3022. // callback to prompt the user.
  3023. //
  3024. // Parameters:
  3025. // pTransport The RAS transport that generated the OnDisconnect call
  3026. //
  3027. // Returns:
  3028. // S_OK The client can return S_OK to "hangup" the current
  3029. // RAS connnection.
  3030. // S_FALSE The client can return S_FALSE to leave the connection
  3031. // established.
  3032. // -----------------------------------------------------------------------------------
  3033. HRESULT OnDisconnect(
  3034. [in]
  3035. LPSTR pszCurrentConnectoid,
  3036. [in]
  3037. boolean fConnectionOwner,
  3038. [in]
  3039. IRASTransport *pTransport);
  3040. }
  3041. // ---------------------------------------------------------------------------------------
  3042. // IID_IRASTransport
  3043. // ---------------------------------------------------------------------------------------
  3044. [
  3045. uuid(8A950001-3CCF-11d0-81DF-00C04FD85AB4),
  3046. helpstring("RAS Transport Interface"),
  3047. local,
  3048. ]
  3049. interface IRASTransport : IInternetTransport
  3050. {
  3051. // -----------------------------------------------------------------------------------
  3052. // InitNew
  3053. // -----------------------------------------------------------------------------------
  3054. HRESULT InitNew(
  3055. [in]
  3056. IRASCallback *pCallback);
  3057. // -----------------------------------------------------------------------------------
  3058. // GetCurrentConnectoid - Returns Connectoid name of the current RAS Connection.
  3059. // If not connected, IXP_E_NOT_CONNECTED is returned. cchMax must be greater than or
  3060. // equal to CCHMAX_CONNECTOID, or E_INVALIDARG will be returned.
  3061. // -----------------------------------------------------------------------------------
  3062. HRESULT GetCurrentConnectoid(
  3063. [in,ref]
  3064. LPSTR pszConnectoid,
  3065. [in]
  3066. ULONG cchMax);
  3067. // ----------------------------------------------------------
  3068. // GetRasErrorString
  3069. // ----------------------------------------------------------
  3070. HRESULT GetRasErrorString (
  3071. [in]
  3072. UINT uRasErrorValue,
  3073. [in,ref]
  3074. LPSTR pszErrorString,
  3075. [in]
  3076. ULONG cchMax,
  3077. [out]
  3078. DWORD *pdwRASResult);
  3079. // ----------------------------------------------------------
  3080. // FillConnectoidCombo
  3081. // ----------------------------------------------------------
  3082. HRESULT FillConnectoidCombo(
  3083. [in]
  3084. HWND hwndComboBox,
  3085. [in]
  3086. boolean fUpdateOnly,
  3087. [out]
  3088. DWORD *pdwRASResult);
  3089. // ----------------------------------------------------------
  3090. // EditConnectoid
  3091. // ----------------------------------------------------------
  3092. HRESULT EditConnectoid(
  3093. [in]
  3094. HWND hwndParent,
  3095. [in]
  3096. LPSTR pszConnectoid,
  3097. [out]
  3098. DWORD *pdwRASResult);
  3099. // ----------------------------------------------------------
  3100. // CreateConnectoid
  3101. // ----------------------------------------------------------
  3102. HRESULT CreateConnectoid(
  3103. [in]
  3104. HWND hwndParent,
  3105. [out]
  3106. DWORD *pdwRASResult);
  3107. }
  3108. // ***************************************************************************************
  3109. // ---------------------------------------------------------------------------------------
  3110. // IID_IRangeList
  3111. // ---------------------------------------------------------------------------------------
  3112. [
  3113. uuid(8C438160-4EF6-11d0-874F-00AA00530EE9),
  3114. helpstring("Rangelist Interface: used to represent a range of messages."),
  3115. local,
  3116. ]
  3117. interface IRangeList : IUnknown
  3118. {
  3119. // ----------------------------------
  3120. // IID_IRangeList Interface Constants
  3121. // ----------------------------------
  3122. const ULONG RL_RANGE_ERROR = ((ULONG)-1); // [out] Indicates that no match could be found
  3123. const ULONG RL_LAST_MESSAGE = ((ULONG)-1); // [in] Equivalent to "*" in an IMAP range list
  3124. // ----------------------------------
  3125. // IID_IRangeList Interface Functions
  3126. // ----------------------------------
  3127. //***********************************************************************
  3128. // Function: Clear
  3129. // Purpose: Clears all entries in the rangelist. Note that no memory
  3130. // is freed by this operation.
  3131. // Returns: S_OK. This function cannot fail.
  3132. //***********************************************************************
  3133. HRESULT Clear(void);
  3134. //***********************************************************************
  3135. // Function: IsInRange
  3136. // Purpose: Determines whether the given value is in the rangelist.
  3137. // Arguments:
  3138. // [in] const ULONG value - the value to test against the rangelist.
  3139. //
  3140. // Returns: S_OK if given value is in the rangelist, else S_FALSE.
  3141. //***********************************************************************
  3142. HRESULT IsInRange([in] const ULONG value);
  3143. //***********************************************************************
  3144. // Function: Min
  3145. // Arguments:
  3146. // [out] ULONG *pulMin - the minimum value in the rangelist is returned
  3147. // here. For example, for the rangelist "10-20,31,44,50-65", this
  3148. // function returns 10. If the rangelist is empty, a value of
  3149. // RL_RANGE_ERROR is returned.
  3150. // Returns: S_OK. This function cannot fail.
  3151. //***********************************************************************
  3152. HRESULT Min([out] ULONG *pulMin);
  3153. //***********************************************************************
  3154. // Function: Max
  3155. // Arguments:
  3156. // [out] ULONG *pulMax - the maximum value in the rangelist is returned
  3157. // here. For example, for the rangelist "10-20,31,44,50-65", this
  3158. // function returns 65. If the rangelist is empty, a value of
  3159. // RL_RANGE_ERROR is returned.
  3160. // Returns: S_OK. This function cannot fail.
  3161. //***********************************************************************
  3162. HRESULT Max([out] ULONG *pulMax); // return the maximum in-range value
  3163. //***********************************************************************
  3164. // Function: Save
  3165. // Purpose: This function returns a copy of the internal rangelist
  3166. // representation which may be loaded later via the Load() function.
  3167. // NOTE THAT THE INTERNAL RANGELIST REPRESENTATION IS NOT SUITABLE FOR
  3168. // NETWORK TRANSMITTAL.
  3169. // Arguments:
  3170. // [out] byte **ppbDestination - if successful, this function returns
  3171. // a pointer to a copy of the internal rangelist representation
  3172. // suitable for use with the Load() command (but not for
  3173. // network transmittal).
  3174. // [out] ULONG *pulSizeOfDestination - if successful, this function
  3175. // returns the size of the data pointed to by *ppbDestination.
  3176. //
  3177. // Returns: HRESULT indicating success or failure. Failure to allocate
  3178. // memory is typically the reason for failure.
  3179. //***********************************************************************
  3180. HRESULT Save([out] byte **ppbDestination,
  3181. [out] ULONG *pulSizeOfDestination);
  3182. //***********************************************************************
  3183. // Function: Load
  3184. // Purpose: This function loads the given internal rangelist
  3185. // representation, obtained via the Save() function, thus restoring
  3186. // the rangelist which was saved.
  3187. // Arguments:
  3188. // [in] byte *pbSource - a pointer to the internal rangelist
  3189. // representation obtained using the Save() function.
  3190. // [in] ULONG ulSizeOfSource - the size of the data pointed to by
  3191. // pbSource.
  3192. //
  3193. // Returns: HRESULT indicating success or failure.
  3194. //***********************************************************************
  3195. HRESULT Load([in, size_is(ulSizeOfSource)] byte *pbSource,
  3196. [in] const ULONG ulSizeOfSource);
  3197. //***********************************************************************
  3198. // Function: AddRange
  3199. // Purpose: This function adds a range of values to the rangelist.
  3200. // For example, to add 19-99 to the rangelist, call AddRange(19,99).
  3201. // Arguments:
  3202. // [in] ULONG low - low number of the range to add to the rangelist.
  3203. // [in] ULONG high - high number of the range to add to the rangelist.
  3204. //
  3205. // Returns: HRESULT indicating success or failure.
  3206. //***********************************************************************
  3207. HRESULT AddRange([in] const ULONG low,
  3208. [in] const ULONG high);
  3209. //***********************************************************************
  3210. // Function: AddSingleValue
  3211. // Purpose: This function adds a single value to the rangelist.
  3212. // For example, to add 69 to the rangelist, call AddRange(69).
  3213. // Arguments:
  3214. // [in] ULONG value - the single value to add to the rangelist.
  3215. //
  3216. // Returns: HRESULT indicating success or failure.
  3217. //***********************************************************************
  3218. HRESULT AddSingleValue([in] const ULONG value);
  3219. //***********************************************************************
  3220. // Function: AddRangeList
  3221. // Purpose: This function adds a rangelist to the rangelist.
  3222. // Arguments:
  3223. // [in] IRangeList *prl - the rangelist to add to the rangelist.
  3224. //
  3225. // Returns: HRESULT indicating success or failure.
  3226. //***********************************************************************
  3227. HRESULT AddRangeList([in] const IRangeList *prl);
  3228. //***********************************************************************
  3229. // Function: DeleteRange
  3230. // Purpose: This function deletes a range of values from the rangelist.
  3231. // For example, to remove 7-11 from the rangelist, call DeleteRange(7,11).
  3232. // Arguments:
  3233. // [in] ULONG low - low number of the range to remove from the rangelist.
  3234. // [in] ULONG high - high number of the range to remove from the rangelist.
  3235. //
  3236. // Returns: HRESULT indicating success or failure.
  3237. //***********************************************************************
  3238. HRESULT DeleteRange([in] const ULONG low,
  3239. [in] const ULONG high);
  3240. //***********************************************************************
  3241. // Function: DeleteSingleValue
  3242. // Purpose: This function removes a single value from the rangelist.
  3243. // For example, to remove 42 to the rangelist, call DeleteRange(42).
  3244. // Arguments:
  3245. // [in] ULONG value - the single value to remove from the rangelist.
  3246. //
  3247. // Returns: HRESULT indicating success or failure.
  3248. //***********************************************************************
  3249. HRESULT DeleteSingleValue([in] const ULONG value);
  3250. //***********************************************************************
  3251. // Function: DeleteRangeList
  3252. // Purpose: This function removes a rangelist from the rangelist.
  3253. // Arguments:
  3254. // [in] IRangeList *prl - the rangelist to remove from the rangelist.
  3255. //
  3256. // Returns: HRESULT indicating success or failure.
  3257. //***********************************************************************
  3258. HRESULT DeleteRangeList([in] const IRangeList *prl);
  3259. //***********************************************************************
  3260. // Function: MinOfRange
  3261. // Purpose: This function finds the range that the given value belongs
  3262. // to, and returns the minimum of that range. For example, for the
  3263. // rangelist "10-20,30,40-50", MinOfRange(45) returns 40.
  3264. // Arguments:
  3265. // [in] ULONG value - a value in the range for which you would like to
  3266. // find the minimum.
  3267. // [out] ULONG *pulMinOfRange - the minimum value in the range of which
  3268. // "value" is a member is returned here. If "value" is not in
  3269. // the rangelist, a value of RL_RANGE_ERROR is returned.
  3270. // Returns: S_OK. This function cannot fail.
  3271. //***********************************************************************
  3272. HRESULT MinOfRange([in] const ULONG value,
  3273. [out] ULONG *pulMinOfRange);
  3274. //***********************************************************************
  3275. // Function: MaxOfRange
  3276. // Purpose: This function finds the range that the given value belongs
  3277. // to, and returns the maximum of that range. For example, for the
  3278. // rangelist "10-20,30,40-50", MaxOfRange(15) returns 20.
  3279. // Arguments:
  3280. // [in] ULONG value - a value in the range for which you would like to
  3281. // find the maximum.
  3282. // [out] ULONG *pulMaxOfRange - the maximum value in the range of which
  3283. // "value" is a member is returned here. If "value" is not in the
  3284. // rangelist, a value of RL_RANGE_ERROR is returned.
  3285. // Returns: S_OK. This function cannot fail.
  3286. //***********************************************************************
  3287. HRESULT MaxOfRange([in] const ULONG value,
  3288. [out] ULONG *pulMaxOfRange);
  3289. //***********************************************************************
  3290. // Function: RangeToIMAPString
  3291. // Purpose: This function outputs the rangelist as an IMAP message set,
  3292. // as specified by the "set" terminal in RFC 1730/2060 (IMAP).
  3293. // Arguments:
  3294. // [out] LPSTR *ppszDestination - an IMAP message set string is
  3295. // returned here. It is the responsibility of the caller to CoTaskMemFree
  3296. // this buffer when he is done with it. Pass in NULL if not interested.
  3297. // [out] LPDWORD pdwLengthOfDestination - the length of the IMAP
  3298. // message set string returned by this function (does not include
  3299. // null-terminator). Pass in NULL if not interested.
  3300. // Returns: HRESULT indicating success or failure.
  3301. //***********************************************************************
  3302. HRESULT RangeToIMAPString([out] LPSTR *ppszDestination,
  3303. [out] LPDWORD pdwLengthOfDestination);
  3304. //***********************************************************************
  3305. // Function: Next
  3306. // Purpose: This function returns the smallest value in the rangelist
  3307. // which is greater than the given value. For instance, for a rangelist
  3308. // 5-10, the call Next(7) would return 8.
  3309. // Arguments:
  3310. // [in] ULONG current - the value for which you'd like to find the next
  3311. // number in the rangelist.
  3312. // [out] ULONG *pulNext - the smallest number in the rangelist greater
  3313. // than "value" is returned here, or RL_RANGE_ERROR if no such
  3314. // number could be found.
  3315. // Returns: S_OK. This function cannot fail.
  3316. //***********************************************************************
  3317. HRESULT Next([in] const ULONG current, [out] ULONG *pulNext);
  3318. //***********************************************************************
  3319. // Function: Prev
  3320. // Purpose: This function returns the largest value in the rangelist
  3321. // which is smaller than the given value. For instance, for a rangelist
  3322. // 5-10, the call Prev(7) would return 6.
  3323. // Arguments:
  3324. // [in] ULONG current - the value for which you'd like to find the
  3325. // previous number in the rangelist.
  3326. // [out] ULONG *pulPrev - the largest number in the rangelist smaller
  3327. // than "value" is returned here, or RL_RANGE_ERROR if no such
  3328. // number could be found.
  3329. // Returns: S_OK. This function cannot fail.
  3330. //***********************************************************************
  3331. HRESULT Prev([in] const ULONG current, [out] ULONG *pulPrev);
  3332. //***********************************************************************
  3333. // Function: Cardinality
  3334. // Purpose: This function counts the members in the rangelist set. For
  3335. // example, for the rangelist 1-11, Cardinality() returns 11.
  3336. // Arguments:
  3337. // [out] ULONG *pulCardinality - The number of members in the
  3338. // rangelist set is returned here.
  3339. // Returns: S_OK. This function cannot fail.
  3340. //***********************************************************************
  3341. HRESULT Cardinality(ULONG *pulCardinality);
  3342. //***********************************************************************
  3343. // Function: CardinalityFrom
  3344. // Purpose: This function counts the members in the rangelist set which
  3345. // are larger than the given starting point. For example, for the
  3346. // rangelist 1-11, Cardinality(10) returns 2.
  3347. // Arguments:
  3348. // [in] ULONG ulStartPoint - represents 1 less than the lowest number
  3349. // which should be considered in the cardinality count.
  3350. // [out] ULONG *pulCardinalityFrom - The number of members in the
  3351. // rangelist set which are larger than the given starting point
  3352. // is returned here.
  3353. // Returns: S_OK. This function cannot fail.
  3354. //***********************************************************************
  3355. HRESULT CardinalityFrom([in] const ULONG ulStartPoint,
  3356. [out] ULONG *pulCardinalityFrom);
  3357. } // interface IRangeList
  3358. // ***************************************************************************************
  3359. // ---------------------------------------------------------------------------------------
  3360. // IID_IIMAPCallback
  3361. // ---------------------------------------------------------------------------------------
  3362. [
  3363. uuid(E9E9D8A3-4EDD-11d0-874F-00AA00530EE9),
  3364. helpstring("IMAP Callback Interface: used to notify an IID_IIMAPTransport client of IMAP server events."),
  3365. local,
  3366. ]
  3367. interface IIMAPCallback : ITransportCallback
  3368. {
  3369. // -------------------------------------
  3370. // IID_IIMAPCallback Interface Constants
  3371. // -------------------------------------
  3372. typedef DWORD IMAP_MBOXFLAGS; // Mailbox flags returned by the LIST/LSUB command
  3373. const IMAP_MBOXFLAGS IMAP_MBOX_NOFLAGS = 0x00000000;
  3374. const IMAP_MBOXFLAGS IMAP_MBOX_MARKED = 0x00000001;
  3375. const IMAP_MBOXFLAGS IMAP_MBOX_NOINFERIORS = 0x00000002;
  3376. const IMAP_MBOXFLAGS IMAP_MBOX_NOSELECT = 0x00000004;
  3377. const IMAP_MBOXFLAGS IMAP_MBOX_UNMARKED = 0x00000008;
  3378. const IMAP_MBOXFLAGS IMAP_MBOX_ALLFLAGS = 0x0000000F; // Keep this updated
  3379. // --------------------------------------
  3380. // IID_IIMAPCallback Interface Data Types
  3381. // --------------------------------------
  3382. // The following enumeration identifies the types of IMAP_RESPONSE structures
  3383. typedef enum tagIMAP_RESPONSE_TYPE {
  3384. irtERROR_NOTIFICATION, // Indicates an error has been encountered during response parsing
  3385. irtCOMMAND_COMPLETION, // Indicates this IMAP command is completed
  3386. irtSERVER_ALERT, // ALERT response (see IMAP spec)
  3387. irtPARSE_ERROR, // PARSE response (see IMAP spec)
  3388. irtMAILBOX_UPDATE, // EXISTS, RECENT, or UNSEEN responses (see IMAP spec)
  3389. irtDELETED_MSG, // EXPUNGE response (see IMAP spec)
  3390. irtFETCH_BODY, // Partial body from a message, returned via FETCH
  3391. irtUPDATE_MSG, // FETCH response (see IMAP spec)
  3392. irtAPPLICABLE_FLAGS, // FLAGS response (see IMAP spec)
  3393. irtPERMANENT_FLAGS, // PERMANENTFLAGS response code (see IMAP spec)
  3394. irtUIDVALIDITY, // UIDVALIDITY response code (see IMAP spec)
  3395. irtREADWRITE_STATUS, // READ-WRITE or READ-ONLY response code (see IMAP spec)
  3396. irtTRYCREATE, // TRYCREATE response code (see IMAP spec)
  3397. irtSEARCH, // SEARCH response (see IMAP spec)
  3398. irtMAILBOX_LISTING, // LIST or LSUB response (see IMAP spec)
  3399. irtMAILBOX_STATUS, // STATUS response (see IMAP spec)
  3400. irtAPPEND_PROGRESS, // Progress of APPEND stream upload
  3401. irtUPDATE_MSG_EX // Extended FETCH response (see IMAP spec)
  3402. } IMAP_RESPONSE_TYPE;
  3403. // Fetch body part - body parts requested by the client are returned piece-by-piece
  3404. // as they are received from the server, using this structure. After the entire FETCH
  3405. // response is received, the client will also receive a FETCH_CMD_RESULTS structure
  3406. // (see below) with the remaining requested information.
  3407. typedef struct tagFETCH_BODY_PART {
  3408. DWORD dwMsgSeqNum; // Message sequence number to which this FETCH resp applies
  3409. LPSTR pszBodyTag; // Pointer to the IMAP tag identifying this body part (eg,
  3410. // "RFC822.PEEK", or "BODY[2.2]<0.2048>"). NOTE that we terminate
  3411. // the tag at the FIRST SPACE. This means that even though you sent
  3412. // "BODY[HEADER.FIELDS (foo bar)]", the tag returned will only be
  3413. // "BODY[HEADER.FIELDS".
  3414. DWORD dwTotalBytes; // Total number of bytes expected for this body part
  3415. DWORD dwSizeOfData; // The number of bytes pointed to by pszData
  3416. DWORD dwOffset; // Offset of the start of this data buffer
  3417. BOOL fDone; // TRUE when this is the last data buffer
  3418. LPSTR pszData; // A pointer to the body part data
  3419. LPARAM lpFetchCookie1; // User-settable values, initially set to 0. These will persist
  3420. LPARAM lpFetchCookie2; // throughout the FETCH response, ie, for all FETCH_BODY_PART
  3421. // responses (even if multiple body parts are fetched), and for
  3422. // the final FETCH_CMD_RESULTS structure.
  3423. } FETCH_BODY_PART;
  3424. // Fetch results structure - holds data from a FETCH response. Since FETCH
  3425. // responses can be unsolicited, the recipient must check that a data item is
  3426. // valid before attempting to use it.
  3427. typedef struct tagFETCH_CMD_RESULTS {
  3428. DWORD dwMsgSeqNum; // Message sequence number to which this FETCH resp applies
  3429. BOOL bMsgFlags; // TRUE if MsgFlags (below) contains valid data
  3430. IMAP_MSGFLAGS mfMsgFlags; // Used to return the FLAGS tag of a FETCH response
  3431. BOOL bRFC822Size; // TRUE if dwRFC822Size (below) contains valid data
  3432. DWORD dwRFC822Size; // Used to return the RFC822.SIZE tag of a FETCH response
  3433. BOOL bUID; // TRUE if dwUID (below) contains valid data
  3434. DWORD dwUID; // Used to return the UID tag of a FETCH response
  3435. BOOL bInternalDate; // TRUE if ftInternalDate (below) contains valid data
  3436. FILETIME ftInternalDate; // Used to return the INTERNALDATE tag of a FETCH response
  3437. LPARAM lpFetchCookie1; // User-settable values. These will persist throughout
  3438. LPARAM lpFetchCookie2; // the FETCH, ie, for all FETCH_BODY_PART responses (even
  3439. // if multiple body parts are fetched), and for the final
  3440. // FETCH_CMD_RESULTS structure.
  3441. } FETCH_CMD_RESULTS;
  3442. typedef struct tagIMAPADDR {
  3443. LPSTR pszName; // See formal syntax for "addr_name", RFC2060
  3444. LPSTR pszADL; // See formal syntax for "addr_adl", RFC2060
  3445. LPSTR pszMailbox; // See formal syntax for "addr_mailbox", RFC2060
  3446. LPSTR pszHost; // See formal syntax for "addr_host", RFC2060
  3447. struct tagIMAPADDR *pNext; // Pointer to next address
  3448. } IMAPADDR;
  3449. typedef struct tagFETCH_CMD_RESULTS_EX {
  3450. // *** First part of this structure is exactly like FETCH_CMD_RESULTS ***
  3451. DWORD dwMsgSeqNum; // Message sequence number to which this FETCH resp applies
  3452. BOOL bMsgFlags; // TRUE if MsgFlags (below) contains valid data
  3453. IMAP_MSGFLAGS mfMsgFlags; // Used to return the FLAGS tag of a FETCH response
  3454. BOOL bRFC822Size; // TRUE if dwRFC822Size (below) contains valid data
  3455. DWORD dwRFC822Size; // Used to return the RFC822.SIZE tag of a FETCH response
  3456. BOOL bUID; // TRUE if dwUID (below) contains valid data
  3457. DWORD dwUID; // Used to return the UID tag of a FETCH response
  3458. BOOL bInternalDate; // TRUE if ftInternalDate (below) contains valid data
  3459. FILETIME ftInternalDate; // Used to return the INTERNALDATE tag of a FETCH response
  3460. LPARAM lpFetchCookie1; // User-settable values. These will persist throughout
  3461. LPARAM lpFetchCookie2; // the FETCH, ie, for all FETCH_BODY_PART responses (even
  3462. // if multiple body parts are fetched), and for the final
  3463. // FETCH_CMD_RESULTS structure.
  3464. // *** Second part of this structure contains the extensions ***
  3465. BOOL bEnvelope; // TRUE if we received an ENVELOPE response
  3466. FILETIME ftENVDate; // Date returned via ENVELOPE
  3467. LPSTR pszENVSubject; // "Subject" returned via ENVELOPE
  3468. IMAPADDR *piaENVFrom; // "From" addresses returned via ENVELOPE
  3469. IMAPADDR *piaENVSender; // "Sender" addresses returned via ENVELOPE
  3470. IMAPADDR *piaENVReplyTo; // "ReplyTo" addresses returned via ENVELOPE
  3471. IMAPADDR *piaENVTo; // "To" addresses returned via ENVELOPE
  3472. IMAPADDR *piaENVCc; // "Cc" addresses returned via ENVELOPE
  3473. IMAPADDR *piaENVBcc; // "Bcc" addresses returned via ENVELOPE
  3474. LPSTR pszENVInReplyTo; // "InReplyTo" returned via ENVELOPE
  3475. LPSTR pszENVMessageID; // "MessageID" returned via ENVELOPE
  3476. DWORD dwReserved1;
  3477. DWORD dwReserved2;
  3478. DWORD dwReserved3;
  3479. } FETCH_CMD_RESULTS_EX;
  3480. // The following structure is used to track and communicate EXISTS,
  3481. // RECENT and UNSEEN responses from the IMAP server
  3482. typedef struct tagMBOX_MSGCOUNT {
  3483. BOOL bGotExistsResponse;
  3484. DWORD dwExists;
  3485. BOOL bGotRecentResponse;
  3486. DWORD dwRecent;
  3487. BOOL bGotUnseenResponse;
  3488. DWORD dwUnseen;
  3489. } MBOX_MSGCOUNT;
  3490. // The following structure returns the results of a LIST or LSUB response
  3491. typedef struct tagIMAP_LISTLSUB_RESPONSE {
  3492. LPSTR pszMailboxName;
  3493. IMAP_MBOXFLAGS imfMboxFlags;
  3494. char cHierarchyChar;
  3495. } IMAP_LISTLSUB_RESPONSE;
  3496. // The following structure returns the results of a STATUS response
  3497. typedef struct tagIMAP_STATUS_RESPONSE {
  3498. LPSTR pszMailboxName;
  3499. BOOL fMessages;
  3500. DWORD dwMessages;
  3501. BOOL fRecent;
  3502. DWORD dwRecent;
  3503. BOOL fUIDNext;
  3504. DWORD dwUIDNext;
  3505. BOOL fUIDValidity;
  3506. DWORD dwUIDValidity;
  3507. BOOL fUnseen;
  3508. DWORD dwUnseen;
  3509. } IMAP_STATUS_RESPONSE;
  3510. // The following structure returns the progress of the current APPEND command
  3511. typedef struct tagAPPEND_PROGRESS {
  3512. DWORD dwUploaded;
  3513. DWORD dwTotal;
  3514. } APPEND_PROGRESS;
  3515. // The following union can hold the results of many types of IMAP responses
  3516. typedef [switch_type(IMAP_RESPONSE_TYPE)] union tagIMAP_RESPONSE_DATA {
  3517. [case (irtMAILBOX_UPDATE)] MBOX_MSGCOUNT *pmcMsgCount; // For mailbox update (EXISTS, RECENT, UNSEEN) data
  3518. [case (irtDELETED_MSG)] DWORD dwDeletedMsgSeqNum; // For EXPUNGE response data
  3519. [case (irtFETCH_BODY)] FETCH_BODY_PART *pFetchBodyPart; // For body parts (eg, RFC822) retrieved via FETCH
  3520. [case (irtUPDATE_MSG)] FETCH_CMD_RESULTS *pFetchResults; // For message update (FETCH) data
  3521. [case (irtAPPLICABLE_FLAGS, irtPERMANENT_FLAGS)]
  3522. IMAP_MSGFLAGS imfImapMessageFlags; // For FLAGS response or PERMANENTFLAGS response code data
  3523. [case (irtUIDVALIDITY)] DWORD dwUIDValidity; // For UIDVALIDITY response code data
  3524. [case (irtREADWRITE_STATUS)] BOOL bReadWrite; // For READ-WRITE or READ-ONLY response code data
  3525. [case (irtSEARCH)] IRangeList *prlSearchResults; // For SEARCH response data
  3526. [case (irtMAILBOX_LISTING)]
  3527. IMAP_LISTLSUB_RESPONSE illrdMailboxListing; // For LIST or LSUB response data
  3528. [case (irtMAILBOX_STATUS)]
  3529. IMAP_STATUS_RESPONSE *pisrStatusResponse; // For STATUS response data
  3530. [case (irtAPPEND_PROGRESS)]
  3531. APPEND_PROGRESS *papAppendProgress;
  3532. [case (irtUPDATE_MSG_EX)] FETCH_CMD_RESULTS_EX
  3533. *pFetchResultsEx; // For message update (FETCH) data
  3534. } IMAP_RESPONSE_DATA;
  3535. // The following structure is used to represent all IMAP responses
  3536. typedef struct tagIMAP_RESPONSE {
  3537. WPARAM wParam; // This is 0 if unsolicited response or unresolvable
  3538. LPARAM lParam; // This is 0 if unsolicited response or unresolvable
  3539. HRESULT hrResult;
  3540. LPSTR lpszResponseText;
  3541. IMAP_RESPONSE_TYPE irtResponseType;
  3542. [switch_is(irtResponseType)] IMAP_RESPONSE_DATA irdResponseData;
  3543. } IMAP_RESPONSE;
  3544. //-----------------------------------------------------------------------
  3545. // IID_IIMAPCallback Interface Functions
  3546. //-----------------------------------------------------------------------
  3547. //***********************************************************************
  3548. // Function: OnResponse
  3549. // Purpose: This function is used to report IMAP server responses to
  3550. // IMAP commands (or unsolicited responses).
  3551. // Arguments:
  3552. // [in] IMAP_RESPONSE *pirIMAPResponse - a pointer to an IMAP response
  3553. // structure is returned to the IID_IIMAPTransport user via
  3554. // this callback.
  3555. // Returns: This function should always return S_OK.
  3556. //***********************************************************************
  3557. HRESULT OnResponse([in] const IMAP_RESPONSE *pirIMAPResponse);
  3558. } // interface IIMAPCallback
  3559. // ***************************************************************************************
  3560. // ---------------------------------------------------------------------------------------
  3561. // IID_IIMAPTransport
  3562. // ---------------------------------------------------------------------------------------
  3563. [
  3564. uuid(E9E9D8A8-4EDD-11d0-874F-00AA00530EE9),
  3565. helpstring("IMAP Transport Interface: used to send IMAP commands to an IMAP server."),
  3566. local,
  3567. ]
  3568. interface IIMAPTransport : IInternetTransport
  3569. {
  3570. // -------------------------------------
  3571. // IID_IIMAPTransport Interface Constants
  3572. // -------------------------------------
  3573. // The following DWORDs are returned by IIMAPTransport::Capability
  3574. const DWORD IMAP_CAPABILITY_IMAP4 = 0x00000001;
  3575. const DWORD IMAP_CAPABILITY_IMAP4rev1 = 0x00000002;
  3576. const DWORD IMAP_CAPABILITY_IDLE = 0x00000004;
  3577. const DWORD IMAP_CAPABILITY_ALLFLAGS = 0x00000007; // Keep this updated
  3578. //-----------------------------------------------------------------------
  3579. // IID_IIMAPTransport Interface Functions
  3580. //-----------------------------------------------------------------------
  3581. //***************************************************************************
  3582. // Function: InitNew
  3583. //
  3584. // Purpose:
  3585. // This function initializes the CImap4Agent class. This function
  3586. // must be the next function called after instantiating the CImap4Agent class.
  3587. //
  3588. // Arguments:
  3589. // LPSTR pszLogFilePath [in] - path to a log file (where all input and
  3590. // output is logged), if the caller wishes to log IMAP transactions.
  3591. // IIMAPCallback *pCBHandler [in] - pointer to a IIMAPCallback object.
  3592. // This object allows the CImap4Agent class to report all IMAP response
  3593. // results to its user.
  3594. //
  3595. // Returns:
  3596. // HRESULT indicating success or failure.
  3597. //***************************************************************************
  3598. HRESULT InitNew([in] LPSTR pszLogFilePath,
  3599. [in] IIMAPCallback *pCBHandler);
  3600. //***************************************************************************
  3601. // Function: NewIRangeList
  3602. //
  3603. // Purpose:
  3604. // This function returns a pointer to an IRangeList. Its purpose is to
  3605. // allow full functionality from an IIMAPTransport pointer without needing
  3606. // to resort to CoCreateInstance to get an IRangeList.
  3607. //
  3608. // Arguments:
  3609. // IRangeList **pprlNewRangeList [out] - if successful, the function
  3610. // returns a pointer to the new IRangeList.
  3611. //
  3612. // Returns:
  3613. // HRESULT indicating success or failure.
  3614. //***************************************************************************
  3615. HRESULT NewIRangeList([out] IRangeList **pprlNewRangeList);
  3616. //***************************************************************************
  3617. // Function: Capability
  3618. //
  3619. // Purpose:
  3620. // The CImap4Agent class always asks for the server's CAPABILITIES after
  3621. // a connection is established. The result is saved in a register and
  3622. // is available by calling this function.
  3623. //
  3624. // Arguments:
  3625. // [out] DWORD *pdwCapabilityFlags - this function returns a DWORD with
  3626. // bit-flags specifying which capabilities this IMAP server
  3627. // supports.
  3628. //
  3629. // Returns:
  3630. // HRESULT indicating success or failure.
  3631. //***************************************************************************
  3632. HRESULT Capability([out] DWORD *pdwCapabilityFlags);
  3633. //***************************************************************************
  3634. // Function: Select
  3635. //
  3636. // Purpose:
  3637. // This function issues a SELECT command to the IMAP server.
  3638. //
  3639. // Arguments:
  3640. // WPARAM wParam [in] - (see below)
  3641. // LPARAM lParam [in] - the wParam and lParam form a unique ID assigned by
  3642. // the caller to this IMAP command and its responses. Can be anything,
  3643. // but note that the value of 0, 0 is reserved for unsolicited responses.
  3644. // IIMAPCallback *pCBHandler [in] - the CB handler to use to process the
  3645. // responses for this command. If this is NULL, the default CB handler
  3646. // is used.
  3647. // LPSTR lpszMailboxName - pointer to IMAP-compliant mailbox name
  3648. //
  3649. // Returns:
  3650. // HRESULT indicating success or failure of send operation.
  3651. //***************************************************************************
  3652. HRESULT Select([in] WPARAM wParam,
  3653. [in] LPARAM lParam,
  3654. [in] IIMAPCallback *pCBHandler,
  3655. [in] LPSTR lpszMailboxName);
  3656. //***************************************************************************
  3657. // Function: Examine
  3658. //
  3659. // Purpose:
  3660. // This function issues an EXAMINE command to the IMAP server.
  3661. //
  3662. // Arguments:
  3663. // Same as for the Select() function.
  3664. //
  3665. // Returns:
  3666. // Same as for the Select() function.
  3667. //***************************************************************************
  3668. HRESULT Examine([in] WPARAM wParam,
  3669. [in] LPARAM lParam,
  3670. [in] IIMAPCallback *pCBHandler,
  3671. [in] LPSTR lpszMailboxName);
  3672. //***************************************************************************
  3673. // Function: Create
  3674. //
  3675. // Purpose:
  3676. // This function issues a CREATE command to the IMAP server.
  3677. //
  3678. // Arguments:
  3679. // WPARAM wParam [in] - (see below)
  3680. // LPARAM lParam [in] - the wParam and lParam form a unique ID assigned by
  3681. // the caller to this IMAP command and its responses. Can be anything,
  3682. // but note that the value of 0, 0 is reserved for unsolicited responses.
  3683. // IIMAPCallback *pCBHandler [in] - the CB handler to use to process the
  3684. // responses for this command. If this is NULL, the default CB handler
  3685. // is used.
  3686. // LPSTR lpszMailboxName - IMAP-compliant name of the mailbox.
  3687. //
  3688. // Returns:
  3689. // HRESULT indicating success or failure of send operation.
  3690. //***************************************************************************
  3691. HRESULT Create([in] WPARAM wParam,
  3692. [in] LPARAM lParam,
  3693. [in] IIMAPCallback *pCBHandler,
  3694. [in] LPSTR lpszMailboxName);
  3695. //***************************************************************************
  3696. // Function: Delete
  3697. //
  3698. // Purpose:
  3699. // This function issues a DELETE command to the IMAP server.
  3700. //
  3701. // Arguments:
  3702. // WPARAM wParam [in] - (see below)
  3703. // LPARAM lParam [in] - the wParam and lParam form a unique ID assigned by
  3704. // the caller to this IMAP command and its responses. Can be anything,
  3705. // but note that the value of 0, 0 is reserved for unsolicited responses.
  3706. // IIMAPCallback *pCBHandler [in] - the CB handler to use to process the
  3707. // responses for this command. If this is NULL, the default CB handler
  3708. // is used.
  3709. // LPSTR lpszMailboxName - IMAP-compliant name of the mailbox.
  3710. //
  3711. // Returns:
  3712. // HRESULT indicating success or failure of send operation.
  3713. //***************************************************************************
  3714. HRESULT Delete([in] WPARAM wParam,
  3715. [in] LPARAM lParam,
  3716. [in] IIMAPCallback *pCBHandler,
  3717. [in] LPSTR lpszMailboxName);
  3718. //***************************************************************************
  3719. // Function: Rename
  3720. //
  3721. // Purpose:
  3722. // This function issues a RENAME command to the IMAP server.
  3723. //
  3724. // Arguments:
  3725. // WPARAM wParam [in] - (see below)
  3726. // LPARAM lParam [in] - the wParam and lParam form a unique ID assigned by
  3727. // the caller to this IMAP command and its responses. Can be anything,
  3728. // but note that the value of 0, 0 is reserved for unsolicited responses.
  3729. // IIMAPCallback *pCBHandler [in] - the CB handler to use to process the
  3730. // responses for this command. If this is NULL, the default CB handler
  3731. // is used.
  3732. // LPSTR lpszMailboxName - CURRENT IMAP-compliant name of the mailbox.
  3733. // LPSTR lpszNewMailboxName - NEW IMAP-compliant name of the mailbox.
  3734. //
  3735. // Returns:
  3736. // HRESULT indicating success or failure of send operation.
  3737. //***************************************************************************
  3738. HRESULT Rename([in] WPARAM wParam,
  3739. [in] LPARAM lParam,
  3740. [in] IIMAPCallback *pCBHandler,
  3741. [in] LPSTR lpszMailboxName,
  3742. [in] LPSTR lpszNewMailboxName);
  3743. //***************************************************************************
  3744. // Function: Subscribe
  3745. //
  3746. // Purpose:
  3747. // This function issues a SUBSCRIBE command to the IMAP server.
  3748. //
  3749. // Arguments:
  3750. // WPARAM wParam [in] - (see below)
  3751. // LPARAM lParam [in] - the wParam and lParam form a unique ID assigned by
  3752. // the caller to this IMAP command and its responses. Can be anything,
  3753. // but note that the value of 0, 0 is reserved for unsolicited responses.
  3754. // IIMAPCallback *pCBHandler [in] - the CB handler to use to process the
  3755. // responses for this command. If this is NULL, the default CB handler
  3756. // is used.
  3757. // LPSTR lpszMailboxName - IMAP-compliant name of the mailbox.
  3758. //
  3759. // Returns:
  3760. // HRESULT indicating success or failure of send operation.
  3761. //***************************************************************************
  3762. HRESULT Subscribe([in] WPARAM wParam,
  3763. [in] LPARAM lParam,
  3764. [in] IIMAPCallback *pCBHandler,
  3765. [in] LPSTR lpszMailboxName);
  3766. //***************************************************************************
  3767. // Function: Unsubscribe
  3768. //
  3769. // Purpose:
  3770. // This function issues an UNSUBSCRIBE command to the IMAP server.
  3771. //
  3772. // Arguments:
  3773. // WPARAM wParam [in] - (see below)
  3774. // LPARAM lParam [in] - the wParam and lParam form a unique ID assigned by
  3775. // the caller to this IMAP command and its responses. Can be anything,
  3776. // but note that the value of 0, 0 is reserved for unsolicited responses.
  3777. // IIMAPCallback *pCBHandler [in] - the CB handler to use to process the
  3778. // responses for this command. If this is NULL, the default CB handler
  3779. // is used.
  3780. // LPSTR lpszMailboxName - IMAP-compliant name of the mailbox.
  3781. //
  3782. // Returns:
  3783. // HRESULT indicating success or failure of send operation.
  3784. //***************************************************************************
  3785. HRESULT Unsubscribe([in] WPARAM wParam,
  3786. [in] LPARAM lParam,
  3787. [in] IIMAPCallback *pCBHandler,
  3788. [in] LPSTR lpszMailboxName);
  3789. //***************************************************************************
  3790. // Function: List
  3791. //
  3792. // Purpose:
  3793. // This function issues a LIST command to the IMAP server.
  3794. //
  3795. // Arguments:
  3796. // WPARAM wParam [in] - (see below)
  3797. // LPARAM lParam [in] - the wParam and lParam form a unique ID assigned by
  3798. // the caller to this IMAP command and its responses. Can be anything,
  3799. // but note that the value of 0, 0 is reserved for unsolicited responses.
  3800. // IIMAPCallback *pCBHandler [in] - the CB handler to use to process the
  3801. // responses for this command. If this is NULL, the default CB handler
  3802. // is used.
  3803. // LPSTR lpszMailboxNameReference - IMAP-compliant reference for mbox name
  3804. // LPSTR lpszMailboxNamePattern - IMAP-compliant pattern for mailbox name
  3805. //
  3806. // Returns:
  3807. // HRESULT indicating success or failure of send operation.
  3808. //***************************************************************************
  3809. HRESULT List([in] WPARAM wParam,
  3810. [in] LPARAM lParam,
  3811. [in] IIMAPCallback *pCBHandler,
  3812. [in] LPSTR lpszMailboxNameReference,
  3813. [in] LPSTR lpszMailboxNamePattern);
  3814. //***************************************************************************
  3815. // Function: Lsub
  3816. //
  3817. // Purpose:
  3818. // This function issues a LSUB command to the IMAP server.
  3819. //
  3820. // Arguments:
  3821. // WPARAM wParam [in] - (see below)
  3822. // LPARAM lParam [in] - the wParam and lParam form a unique ID assigned by
  3823. // the caller to this IMAP command and its responses. Can be anything,
  3824. // but note that the value of 0, 0 is reserved for unsolicited responses.
  3825. // IIMAPCallback *pCBHandler [in] - the CB handler to use to process the
  3826. // responses for this command. If this is NULL, the default CB handler
  3827. // is used.
  3828. // LPSTR lpszMailboxNameReference - IMAP-compliant reference for mbox name
  3829. // LPSTR lpszMailboxNamePattern - IMAP-compliant pattern for mailbox name.
  3830. //
  3831. // Returns:
  3832. // HRESULT indicating success or failure of send operation.
  3833. //***************************************************************************
  3834. HRESULT Lsub([in] WPARAM wParam,
  3835. [in] LPARAM lParam,
  3836. [in] IIMAPCallback *pCBHandler,
  3837. [in] LPSTR lpszMailboxNameReference,
  3838. [in] LPSTR lpszMailboxNamePattern);
  3839. //***************************************************************************
  3840. // Function: Append
  3841. //
  3842. // Purpose:
  3843. // This function issues an APPEND command to the IMAP server.
  3844. //
  3845. // Arguments:
  3846. // WPARAM wParam [in] - (see below)
  3847. // LPARAM lParam [in] - the wParam and lParam form a unique ID assigned by
  3848. // the caller to this IMAP command and its responses. Can be anything,
  3849. // but note that the value of 0, 0 is reserved for unsolicited responses.
  3850. // IIMAPCallback *pCBHandler [in] - the CB handler to use to process the
  3851. // responses for this command. If this is NULL, the default CB handler
  3852. // is used.
  3853. // LPSTR lpszMailboxName - IMAP-compliant mailbox name to append message to.
  3854. // LPSTR lpszMessageFlags - IMAP-compliant list of msg flags to set for msg.
  3855. // Set to NULL to set no message flags. (Avoid passing "()" due to old Cyrus
  3856. // server bug). $REVIEW: This should be changed to IMAP_MSGFLAGS!!!
  3857. // FILETIME ftMessageDateTime - date/time to associate with msg (GMT/UTC)
  3858. // LPSTREAM lpstmMessageToSave - the message to save, in RFC822 format.
  3859. // No need to rewind the stream, this is done by CConnection::SendStream.
  3860. //
  3861. // Returns:
  3862. // HRESULT indicating success or failure of send operation.
  3863. //***************************************************************************
  3864. HRESULT Append([in] WPARAM wParam,
  3865. [in] LPARAM lParam,
  3866. [in] IIMAPCallback *pCBHandler,
  3867. [in] LPSTR lpszMailboxName,
  3868. [in] LPSTR lpszMessageFlags,
  3869. [in] FILETIME ftMessageDateTime,
  3870. [in] LPSTREAM lpstmMessageToSave);
  3871. //***************************************************************************
  3872. // Function: Close
  3873. //
  3874. // Purpose:
  3875. // This function issues a CLOSE command to the IMAP server.
  3876. //
  3877. // Arguments:
  3878. // WPARAM wParam [in] - (see below)
  3879. // LPARAM lParam [in] - the wParam and lParam form a unique ID assigned by
  3880. // the caller to this IMAP command and its responses. Can be anything,
  3881. // but note that the value of 0, 0 is reserved for unsolicited responses.
  3882. // IIMAPCallback *pCBHandler [in] - the CB handler to use to process the
  3883. // responses for this command. If this is NULL, the default CB handler
  3884. // is used.
  3885. //
  3886. // Returns:
  3887. // HRESULT indicating success or failure of send operation.
  3888. //***************************************************************************
  3889. HRESULT Close([in] WPARAM wParam,
  3890. [in] LPARAM lParam,
  3891. [in] IIMAPCallback *pCBHandler);
  3892. //***************************************************************************
  3893. // Function: Expunge
  3894. //
  3895. // Purpose:
  3896. // This function issues an EXPUNGE command to the IMAP server.
  3897. //
  3898. // Arguments:
  3899. // WPARAM wParam [in] - (see below)
  3900. // LPARAM lParam [in] - the wParam and lParam form a unique ID assigned by
  3901. // the caller to this IMAP command and its responses. Can be anything,
  3902. // but note that the value of 0, 0 is reserved for unsolicited responses.
  3903. // IIMAPCallback *pCBHandler [in] - the CB handler to use to process the
  3904. // responses for this command. If this is NULL, the default CB handler
  3905. // is used.
  3906. //
  3907. // Returns:
  3908. // HRESULT indicating success or failure on send operation.
  3909. //***************************************************************************
  3910. HRESULT Expunge([in] WPARAM wParam,
  3911. [in] LPARAM lParam,
  3912. [in] IIMAPCallback *pCBHandler);
  3913. //***************************************************************************
  3914. // Function: Search
  3915. //
  3916. // Purpose:
  3917. // This function issues a SEARCH command to the IMAP server.
  3918. //
  3919. // Arguments:
  3920. // WPARAM wParam [in] - (see below)
  3921. // LPARAM lParam [in] - the wParam and lParam form a unique ID assigned by
  3922. // the caller to this IMAP command and its responses. Can be anything,
  3923. // but note that the value of 0, 0 is reserved for unsolicited responses.
  3924. // IIMAPCallback *pCBHandler [in] - the CB handler to use to process the
  3925. // responses for this command. If this is NULL, the default CB handler
  3926. // is used.
  3927. // LPSTR lpszSearchCriteria - IMAP-compliant list of search criteria
  3928. // boolean bReturnUIDs - if TRUE, we prepend "UID" to command.
  3929. // IRangeList *pMsgRange [in] - range of messages over which to operate
  3930. // the search. This argument should be NULL to exclude the message
  3931. // set from the search criteria.
  3932. // boolean bUIDRangeList [in] - TRUE if pMsgRange refers to a UID range,
  3933. // FALSE if pMsgRange refers to a message sequence number range. If
  3934. // pMsgRange is NULL, this argument is ignored.
  3935. //
  3936. // Returns:
  3937. // HRESULT indicating success or failure on send operation.
  3938. //***************************************************************************
  3939. HRESULT Search([in] WPARAM wParam,
  3940. [in] LPARAM lParam,
  3941. [in] IIMAPCallback *pCBHandler,
  3942. [in] LPSTR lpszSearchCriteria,
  3943. [in] boolean bReturnUIDs,
  3944. [in] IRangeList *pMsgRange,
  3945. [in] boolean bUIDRangeList);
  3946. //***************************************************************************
  3947. // Function: Fetch
  3948. //
  3949. // Purpose:
  3950. // This function issues a FETCH command to the IMAP server.
  3951. //
  3952. // Arguments:
  3953. // WPARAM wParam [in] - (see below)
  3954. // LPARAM lParam [in] - the wParam and lParam form a unique ID assigned by
  3955. // the caller to this IMAP command and its responses. Can be anything,
  3956. // but note that the value of 0, 0 is reserved for unsolicited responses.
  3957. // IIMAPCallback *pCBHandler [in] - the CB handler to use to process the
  3958. // responses for this command. If this is NULL, the default CB handler
  3959. // is used.
  3960. // IRangeList *pMsgRange [in] - range of messages to fetch. The caller
  3961. // should pass NULL if he is using UIDs and he wants to generate his
  3962. // own message set (in lpszFetchArgs). If the caller is using msg
  3963. // seq nums, this argument MUST be specified to allow this class to
  3964. // resequence the msg nums as required.
  3965. // boolean bUIDMsgRange [in] - if TRUE, prepends "UID" to FETCH command and
  3966. // treats pMsgRange as a UID range.
  3967. // LPSTR lpszFetchArgs - arguments to the FETCH command
  3968. //
  3969. //
  3970. // Returns:
  3971. // HRESULT indicating success or failure of the send operation.
  3972. //***************************************************************************
  3973. HRESULT Fetch([in] WPARAM wParam,
  3974. [in] LPARAM lParam,
  3975. [in] IIMAPCallback *pCBHandler,
  3976. [in] IRangeList *pMsgRange,
  3977. [in] boolean bUIDMsgRange,
  3978. [in] LPSTR lpszFetchArgs);
  3979. //***************************************************************************
  3980. // Function: Store
  3981. //
  3982. // Purpose:
  3983. // This function issues a STORE command to the IMAP server.
  3984. //
  3985. // Arguments:
  3986. // WPARAM wParam [in] - (see below)
  3987. // LPARAM lParam [in] - the wParam and lParam form a unique ID assigned by
  3988. // the caller to this IMAP command and its responses. Can be anything,
  3989. // but note that the value of 0, 0 is reserved for unsolicited responses.
  3990. // IIMAPCallback *pCBHandler [in] - the CB handler to use to process the
  3991. // responses for this command. If this is NULL, the default CB handler
  3992. // is used.
  3993. // IRangeList *pMsgRange [in] - range of messages to store. The caller
  3994. // should pass NULL if he is using UIDs and he wants to generate his
  3995. // own message set (in lpszStoreArgs). If the caller is using msg
  3996. // seq nums, this argument MUST be specified to allow this class to
  3997. // resequence the msg nums as required.
  3998. // boolean bUIDRangeList [in] - if TRUE, we prepend "UID" to the STORE command
  3999. // LPSTR lpszStoreArgs - arguments for the STORE command.
  4000. //
  4001. // Returns:
  4002. // HRESULT indicating success or failure of the send operation.
  4003. //***************************************************************************
  4004. HRESULT Store([in] WPARAM wParam,
  4005. [in] LPARAM lParam,
  4006. [in] IIMAPCallback *pCBHandler,
  4007. [in] IRangeList *pMsgRange,
  4008. [in] boolean bUIDRangeList,
  4009. [in] LPSTR lpszStoreArgs);
  4010. //***************************************************************************
  4011. // Function: Copy
  4012. //
  4013. // Purpose:
  4014. // This function issues a COPY command to the IMAP server.
  4015. //
  4016. // Arguments:
  4017. // WPARAM wParam [in] - (see below)
  4018. // LPARAM lParam [in] - the wParam and lParam form a unique ID assigned by
  4019. // the caller to this IMAP command and its responses. Can be anything,
  4020. // but note that the value of 0, 0 is reserved for unsolicited responses.
  4021. // IIMAPCallback *pCBHandler [in] - the CB handler to use to process the
  4022. // responses for this command. If this is NULL, the default CB handler
  4023. // is used.
  4024. // IRangeList *pMsgRange [in] - the range of messages to copy. This
  4025. // argument must be supplied.
  4026. // boolean bUIDRangeList [in] - if TRUE, prepends "UID" to COPY command
  4027. // LPSTR lpszMailboxName [in] - C String of mailbox name
  4028. //
  4029. // Returns:
  4030. // HRESULT indicating success or failure of send operation.
  4031. //***************************************************************************
  4032. HRESULT Copy([in] WPARAM wParam,
  4033. [in] LPARAM lParam,
  4034. [in] IIMAPCallback *pCBHandler,
  4035. [in] IRangeList *pMsgRange,
  4036. [in] boolean bUIDRangeList,
  4037. [in] LPSTR lpszMailboxName);
  4038. //***************************************************************************
  4039. // Function: Noop
  4040. //
  4041. // Purpose:
  4042. // This function issues a NOOP command to the IMAP server.
  4043. //
  4044. // Arguments:
  4045. // WPARAM wParam [in] - (see below)
  4046. // LPARAM lParam [in] - the wParam and lParam form a unique ID assigned by
  4047. // the caller to this IMAP command and its responses. Can be anything,
  4048. // but note that the value of 0, 0 is reserved for unsolicited responses.
  4049. // IIMAPCallback *pCBHandler [in] - the CB handler to use to process the
  4050. // responses for this command. If this is NULL, the default CB handler
  4051. // is used.
  4052. //
  4053. // Returns:
  4054. // HRESULT indicating success or failure of send operation.
  4055. //***************************************************************************
  4056. HRESULT Noop([in] WPARAM wParam,
  4057. [in] LPARAM lParam,
  4058. [in] IIMAPCallback *pCBHandler);
  4059. //---------------------------------------------------------------------------
  4060. // Message Sequence Number to UID member functions - the caller may use
  4061. // these functions to map from MSN's to UID's, if the caller uses UIDs
  4062. // to refer to messages. If the caller uses MSN's, there is no need to
  4063. // invoke the following functions.
  4064. //---------------------------------------------------------------------------
  4065. //***************************************************************************
  4066. // Function: ResizeMsgSeqNumTable
  4067. //
  4068. // Purpose:
  4069. // This function is called whenever we receive an EXISTS response. It
  4070. // resizes the MsgSeqNumToUID table to match the current size of the mailbox.
  4071. //
  4072. // Arguments:
  4073. // DWORD dwSizeOfMbox [in] - the number returned via the EXISTS response.
  4074. //
  4075. // Returns:
  4076. // HRESULT indicating success or failure.
  4077. //***************************************************************************
  4078. HRESULT ResizeMsgSeqNumTable([in] DWORD dwSizeOfMbox);
  4079. //***************************************************************************
  4080. // Function: UpdateSeqNumToUID
  4081. //
  4082. // Purpose:
  4083. // This function is called whenever we receive a FETCH response which has
  4084. // both a message sequence number and a UID number. It updates the
  4085. // MsgSeqNumToUID table so that given msg seq number maps to the given UID.
  4086. //
  4087. // Arguments:
  4088. // DWORD dwMsgSeqNum [in] - the message sequence number of the FETCH
  4089. // response.
  4090. // DWORD dwUID [in] - the UID of the given message sequence number.
  4091. //
  4092. // Returns:
  4093. // HRESULT indicating success or failure.
  4094. //***************************************************************************
  4095. HRESULT UpdateSeqNumToUID([in] DWORD dwMsgSeqNum,
  4096. [in] DWORD dwUID);
  4097. //***************************************************************************
  4098. // Function: RemoveSequenceNum
  4099. //
  4100. // Purpose:
  4101. // This function is called whenever we receive an EXPUNGE response. It
  4102. // removes the given message sequence number from the MsgSeqNumToUID table,
  4103. // and compacts the table so that all message sequence numbers following
  4104. // the deleted one are re-sequenced.
  4105. //
  4106. // Arguments:
  4107. // DWORD dwDeletedMsgSeqNum [in] - message sequence number of deleted msg.
  4108. //
  4109. // Returns:
  4110. // HRESULT indicating success or failure.
  4111. //***************************************************************************
  4112. HRESULT RemoveSequenceNum([in] DWORD dwDeletedMsgSeqNum);
  4113. //***************************************************************************
  4114. // Function: MsgSeqNumToUID
  4115. //
  4116. // Purpose:
  4117. // This function takes a message sequence number and converts it to a UID
  4118. // based on the MsgSeqNumToUID table.
  4119. //
  4120. // Arguments:
  4121. // DWORD dwMsgSeqNum [in] - the sequence number for which the caller wants
  4122. // to know the UID.
  4123. // DWORD *pdwUID [out] - the UID associated with the given sequence number
  4124. // is returned here. If none could be found, this function returns 0.
  4125. //
  4126. // Returns:
  4127. // HRESULT indicating success or failure.
  4128. //***************************************************************************
  4129. HRESULT MsgSeqNumToUID([in] DWORD dwMsgSeqNum, [out] DWORD *pdwUID);
  4130. //***************************************************************************
  4131. // Function: GetMsgSeqNumToUIDArray
  4132. //
  4133. // Purpose:
  4134. // This function returns a copy of the MsgSeqNumToUID array. The caller
  4135. // will want to do this to delete messages from the cache which no longer
  4136. // exist on the server, for example.
  4137. //
  4138. // Arguments:
  4139. // DWORD **ppdwMsgSeqNumToUIDArray [out] - the function returns a pointer
  4140. // to the copy of the MsgSeqNumToUID array in this argument. Note that
  4141. // it is the caller's responsibility to MemFree the array. If no array
  4142. // is available, or it is empty, the returned pointer value is NULL.
  4143. // DWORD *pdwNumberOfElements [out] - the function returns the size of
  4144. // the MsgSeqNumToUID array.
  4145. //
  4146. // Returns:
  4147. // HRESULT indicating success or failure.
  4148. //***************************************************************************
  4149. HRESULT GetMsgSeqNumToUIDArray([out] DWORD **ppdwMsgSeqNumToUIDArray,
  4150. [out] DWORD *pdwNumberOfElements);
  4151. //***************************************************************************
  4152. // Function: GetHighestMsgSeqNum
  4153. //
  4154. // Purpose:
  4155. // This function returns the highest message sequence number reported in
  4156. // the MsgSeqNumToUID array.
  4157. //
  4158. // Arguments:
  4159. // DWORD *pdwHighestMSN [out] - the highest message sequence number in the
  4160. // table is returned here.
  4161. //
  4162. // Returns:
  4163. // HRESULT indicating success or failure.
  4164. //***************************************************************************
  4165. HRESULT GetHighestMsgSeqNum([out] DWORD *pdwHighestMSN);
  4166. //***************************************************************************
  4167. // Function: ResetMsgSeqNumToUID
  4168. //
  4169. // Purpose:
  4170. // This function resets the variables used to maintain the MsgSeqNumToUID
  4171. // table. This function is AUTOMATICALLY called whenever the MsgSeqNumToUID
  4172. // table becomes invalid (say, when a new mailbox is selected, or we are
  4173. // disconnected). This function shouldn't normally need to be called, but
  4174. // I've placed it here just in case someone needs it.
  4175. //
  4176. // Returns:
  4177. // S_OK. This function cannot fail.
  4178. //***************************************************************************
  4179. HRESULT ResetMsgSeqNumToUID(void);
  4180. //---------------------------------------------------------------------------
  4181. // Leaving Message Sequence Number to UID member functions zone
  4182. //---------------------------------------------------------------------------
  4183. //***************************************************************************
  4184. // Function: SetDefaultCBHandler
  4185. //
  4186. // Purpose: This function changes the current default IIMAPCallback handler
  4187. // to the given one.
  4188. //
  4189. // Arguments:
  4190. // IIMAPCallback *pCBHandler [in] - a pointer to the new callback handler.
  4191. //
  4192. // Returns:
  4193. // HRESULT indicating success or failure.
  4194. //***************************************************************************
  4195. HRESULT SetDefaultCBHandler([in] IIMAPCallback *pCBHandler);
  4196. //***************************************************************************
  4197. // Function: Status
  4198. //
  4199. // Purpose:
  4200. // This function issues a STATUS command to the IMAP server.
  4201. //
  4202. // Arguments:
  4203. // WPARAM wParam [in] - (see below)
  4204. // LPARAM lParam [in] - the wParam and lParam form a unique ID assigned by
  4205. // the caller to this IMAP command and its responses. Can be anything,
  4206. // but note that the value of 0, 0 is reserved for unsolicited responses.
  4207. // IIMAPCallback *pCBHandler [in] - the CB handler to use to process the
  4208. // responses for this command. If this is NULL, the default CB handler
  4209. // is used.
  4210. // LPSTR pszMailboxName [in] - the mailbox which you want to get the
  4211. // STATUS of.
  4212. // LPSTR pszStatusCmdArgs [in] - the arguments for the STATUS command,
  4213. // eg, "(MESSAGES UNSEEN)".
  4214. //
  4215. // Returns:
  4216. // HRESULT indicating success or failure of the send operation.
  4217. //***************************************************************************
  4218. HRESULT Status([in] WPARAM wParam,
  4219. [in] LPARAM lParam,
  4220. [in] IIMAPCallback *pCBHandler,
  4221. [in] LPSTR pszMailboxName,
  4222. [in] LPSTR pszStatusCmdArgs);
  4223. } // interface IIMAPTransport
  4224. // ***************************************************************************************
  4225. // ---------------------------------------------------------------------------------------
  4226. // IID_IIMAPTransport2
  4227. // ---------------------------------------------------------------------------------------
  4228. [
  4229. uuid(DA8283C0-37C5-11d2-ACD9-0080C7B6E3C5),
  4230. helpstring("IMAP Transport Interface 2: Extension to IIMAPTransport."),
  4231. local,
  4232. ]
  4233. interface IIMAPTransport2 : IIMAPTransport
  4234. {
  4235. //-----------------------------------------------------------------------
  4236. // IID_IIMAPTransport Interface Functions
  4237. //-----------------------------------------------------------------------
  4238. //***************************************************************************
  4239. // Function: SetDefaultCP
  4240. //
  4241. // Purpose:
  4242. // This function allows the caller to tell IIMAPTransport what codepage to
  4243. // use for IMAP mailbox names. After calling this function, all mailbox names
  4244. // submitted to IIMAPTransport will be translated from the default codepage,
  4245. // and all mailbox names returned from the server will be translated to
  4246. // the default codepage before being returned via IIMAPCallback.
  4247. //
  4248. // Arguments:
  4249. // DWORD dwTranslateFlags [in] - enables/disables automatic translation to
  4250. // and from default codepage and IMAP-modified UTF-7. If disabled, caller
  4251. // wishes all mailbox names to be passed verbatim to/from IMAP server.
  4252. // Note that by default we translate for IMAP4 servers, even with its
  4253. // round-trippability problems, because this is how we used to do it
  4254. // in the past.
  4255. // UINT uiCodePage [in] - the default codepage to use for translations.
  4256. // By default this value is the CP returned by GetACP().
  4257. //
  4258. // Returns:
  4259. // HRESULT indicating success or failure.
  4260. //***************************************************************************
  4261. HRESULT SetDefaultCP([in] DWORD dwTranslateFlags,
  4262. [in] UINT uiCodePage);
  4263. // TranslateFlags
  4264. const DWORD IMAP_MBOXXLATE_DEFAULT = 0x00000000; // Always translate, even for IMAP4
  4265. const DWORD IMAP_MBOXXLATE_DISABLE = 0x00000001; // Always disable
  4266. const DWORD IMAP_MBOXXLATE_DISABLEIMAP4 = 0x00000002; // Disable for IMAP4, translate for IMAP4rev1
  4267. const DWORD IMAP_MBOXXLATE_VERBATIMOK = 0x00000004; // Non-translatable mbox names can be returned verbatim
  4268. // Note if translation disabled, all mboxes will be
  4269. // returned with IXP_S_IMAP_VERBATIM_MBOX
  4270. const DWORD IMAP_MBOXXLATE_RETAINCP = 0x00000008; // Don't change codepage with this call
  4271. //***************************************************************************
  4272. // Function: MultiByteToModifiedUTF7
  4273. //
  4274. // Purpose:
  4275. // This function takes a MultiByte string and converts it to modified IMAP
  4276. // UTF7, which is described in RFC2060. This function is only needed if the
  4277. // user has disabled transparent mailbox translation using SetDefaultCP(FALSE,0).
  4278. //
  4279. // Arguments:
  4280. // LPCSTR pszSource [in] - pointer to the MultiByte string to convert to UTF7.
  4281. // LPSTR *ppszDestination [out] - a pointer to a string buffer containing
  4282. // the UTF7 equivalent of pszSource is returned here. It is the caller's
  4283. // responsibility to MemFree this string.
  4284. // UINT uiSourceCP [in] - indicates the codepage for pszSource
  4285. // Note that no translation is performed if SetDefaultCP(FALSE,.) was called.
  4286. // DWORD dwFlags [in] - Reserved. Leave as 0.
  4287. //
  4288. // Returns:
  4289. // HRESULT indicating success or failure.
  4290. //***************************************************************************
  4291. HRESULT MultiByteToModifiedUTF7([in] LPCSTR pszSource,
  4292. [out] LPSTR *ppszDestination,
  4293. [in] UINT uiSourceCP,
  4294. [in] DWORD dwFlags);
  4295. //***************************************************************************
  4296. // Function: ModifiedUTF7ToMultiByte
  4297. //
  4298. // Purpose:
  4299. // This function takes a modified IMAP UTF-7 string (as defined in RFC2060)
  4300. // and converts it to a multi-byte string. This function is only needed if the
  4301. // user has disabled transparent mailbox translation using SetDefaultCP(FALSE,0).
  4302. //
  4303. // Arguments:
  4304. // LPCSTR pszSource [in] - a null-terminated string containing the modified
  4305. // IMAP UTF-7 string to convert to multibyte.
  4306. // LPSTR *ppszDestination [out] - this function returns a pointer to the
  4307. // null-terminated multibyte string (in the system codepage) obtained
  4308. // from pszSource. It is the caller's responsiblity to MemFree this
  4309. // string when it is done with it.
  4310. // UINT uiDestintationCP [in] - indicates the desired codepage for the
  4311. // destination string. Note that no translation is performed if
  4312. // SetDefaultCP(FALSE,.) was called.
  4313. // DWORD dwFlags [in] - Reserved. Leave as 0.
  4314. //
  4315. // Returns:
  4316. // HRESULT indicating success or failure. Success result codes include:
  4317. // S_OK - pszSource successfully converted to modified UTF-7
  4318. // IXP_S_IMAP_VERBATIM_MBOX - pszSource could not be converted to multibyte,
  4319. // so ppszDestination contains a duplicate of pszSource. If target CP
  4320. // is Unicode, pszSource is converted to Unicode with the assumption
  4321. // that it is USASCII. IMAP_MBOXXLATE_VERBATIMOK must have been set via
  4322. // SetDefaultCP in order to get this behaviour.
  4323. //***************************************************************************
  4324. HRESULT ModifiedUTF7ToMultiByte([in] LPCSTR pszSource,
  4325. [out] LPSTR *ppszDestination,
  4326. [in] UINT uiDestinationCP,
  4327. [in] DWORD dwFlags);
  4328. //***************************************************************************
  4329. // Function: SetIdleMode
  4330. //
  4331. // Purpose:
  4332. // The IMAP IDLE extension allows the server to unilaterally report changes
  4333. // to the currently selected mailbox: new email, flag updates, and message
  4334. // expunges. IIMAPTransport always enters IDLE mode when no IMAP commands
  4335. // are pending, but it turns out that this can result in unnecessary
  4336. // entry and exit of IDLE mode when the caller tries to sequence IMAP commands.
  4337. // This function allows the caller to disable the use of the IDLE extension.
  4338. //
  4339. // Arguments:
  4340. // DWORD dwIdleFlags [in] - enables or disables the use of the IDLE extension.
  4341. //
  4342. // Returns:
  4343. // HRESULT indicating success or failure.
  4344. //***************************************************************************
  4345. HRESULT SetIdleMode([in] DWORD dwIdleFlags);
  4346. // Idle Flags
  4347. const DWORD IMAP_IDLE_DISABLE = 0x00000000;
  4348. const DWORD IMAP_IDLE_ENABLE = 0x00000001;
  4349. //***************************************************************************
  4350. // Function: EnableFetchEx
  4351. //
  4352. // Purpose:
  4353. // IIMAPTransport only understood a subset of FETCH response tags. Notable
  4354. // omissions included ENVELOPE and BODYSTRUCTURE. Calling this function
  4355. // changes the behaviour of IIMAPTransport::Fetch. Instead of returning
  4356. // FETCH responses via IIMAPCallback::OnResponse(irtUPDATE_MSG),
  4357. // the FETCH response is returned via OnResponse(irtUPDATE_MSG_EX).
  4358. // Other FETCH-related responses remain unaffected (eg, irtFETCH_BODY).
  4359. //
  4360. // Arguments:
  4361. // DWORD dwFetchExFlags [in] - enables or disables FETCH extensions.
  4362. //
  4363. // Returns:
  4364. // HRESULT indicating success or failure.
  4365. //***************************************************************************
  4366. HRESULT EnableFetchEx([in] DWORD dwFetchExFlags);
  4367. // FetchEx flags
  4368. const DWORD IMAP_FETCHEX_DISABLE = 0x00000000;
  4369. const DWORD IMAP_FETCHEX_ENABLE = 0x00000001;
  4370. //***************************************************************************
  4371. // Function: SetWindow
  4372. //
  4373. // Purpose:
  4374. // This function creates a new window for async winsock processing
  4375. //
  4376. // Returns:
  4377. // HRESULT indicating success or failure.
  4378. //***************************************************************************
  4379. HRESULT SetWindow(void);
  4380. //***************************************************************************
  4381. // Function: ResetWindow
  4382. //
  4383. // Purpose:
  4384. // This function closes a window for async winsock processing
  4385. //
  4386. // Returns:
  4387. // HRESULT indicating success or failure.
  4388. //***************************************************************************
  4389. HRESULT ResetWindow(void);
  4390. } // interface IIMAPTransport2
  4391. cpp_quote("// --------------------------------------------------------------------------------")
  4392. cpp_quote("// Exported C Functions")
  4393. cpp_quote("// --------------------------------------------------------------------------------")
  4394. cpp_quote("#if !defined(_IMNXPORT_)")
  4395. cpp_quote("#define IMNXPORTAPI DECLSPEC_IMPORT HRESULT WINAPI")
  4396. cpp_quote("#else")
  4397. cpp_quote("#define IMNXPORTAPI HRESULT WINAPI")
  4398. cpp_quote("#endif")
  4399. cpp_quote("#ifdef __cplusplus")
  4400. cpp_quote("extern \"C\" {")
  4401. cpp_quote("#endif")
  4402. cpp_quote("")
  4403. cpp_quote("// --------------------------------------------------------------------------------")
  4404. cpp_quote("// CreateRASTransport")
  4405. cpp_quote("// ")
  4406. cpp_quote("// Description:")
  4407. cpp_quote("// This method creates a IRASTransport object. The client must initialize the")
  4408. cpp_quote("// object by calling IRASTransport::InitNew")
  4409. cpp_quote("// ")
  4410. cpp_quote("// Parameters:")
  4411. cpp_quote("// ppTransport Upon successful return, contains the a pointer to")
  4412. cpp_quote("// an IRASTransport interface")
  4413. cpp_quote("// ")
  4414. cpp_quote("// Return Values:")
  4415. cpp_quote("// S_OK Successful.")
  4416. cpp_quote("// E_INVALIDARG ppTransport is NULL")
  4417. cpp_quote("// E_OUTOFMEMORY Memory allocation failure...")
  4418. cpp_quote("// ")
  4419. cpp_quote("// --------------------------------------------------------------------------------")
  4420. cpp_quote("IMNXPORTAPI CreateRASTransport(")
  4421. cpp_quote(" /* out */ IRASTransport **ppTransport);")
  4422. cpp_quote("")
  4423. cpp_quote("// --------------------------------------------------------------------------------")
  4424. cpp_quote("// CreateNNTPTransport")
  4425. cpp_quote("// ")
  4426. cpp_quote("// Description:")
  4427. cpp_quote("// This method creates a INNTPTransport object. The client must initialize the")
  4428. cpp_quote("// object by calling INNTPTransport::InitNew")
  4429. cpp_quote("// ")
  4430. cpp_quote("// Parameters:")
  4431. cpp_quote("// ppTransport Upon successful return, contains the a pointer to")
  4432. cpp_quote("// an INNTPTransport interface")
  4433. cpp_quote("// ")
  4434. cpp_quote("// Return Values:")
  4435. cpp_quote("// S_OK Successful.")
  4436. cpp_quote("// E_INVALIDARG ppTransport is NULL")
  4437. cpp_quote("// E_OUTOFMEMORY Memory allocation failure...")
  4438. cpp_quote("// ")
  4439. cpp_quote("// --------------------------------------------------------------------------------")
  4440. cpp_quote("IMNXPORTAPI CreateNNTPTransport(")
  4441. cpp_quote(" /* out */ INNTPTransport **ppTransport);")
  4442. cpp_quote("")
  4443. cpp_quote("// --------------------------------------------------------------------------------")
  4444. cpp_quote("// CreateSMTPTransport")
  4445. cpp_quote("// ")
  4446. cpp_quote("// Description:")
  4447. cpp_quote("// This method creates a ISMTPTransport object. The client must initialize the")
  4448. cpp_quote("// object by calling ISMTPTransport::InitNew")
  4449. cpp_quote("// ")
  4450. cpp_quote("// Parameters:")
  4451. cpp_quote("// ppTransport Upon successful return, contains the a pointer to")
  4452. cpp_quote("// an ISMTPTransport interface")
  4453. cpp_quote("// ")
  4454. cpp_quote("// Return Values:")
  4455. cpp_quote("// S_OK Successful.")
  4456. cpp_quote("// E_INVALIDARG ppTransport is NULL")
  4457. cpp_quote("// E_OUTOFMEMORY Memory allocation failure...")
  4458. cpp_quote("// ")
  4459. cpp_quote("// --------------------------------------------------------------------------------")
  4460. cpp_quote("IMNXPORTAPI CreateSMTPTransport(")
  4461. cpp_quote(" /* out */ ISMTPTransport **ppTransport);")
  4462. cpp_quote("")
  4463. cpp_quote("// --------------------------------------------------------------------------------")
  4464. cpp_quote("// CreatePOP3Transport")
  4465. cpp_quote("// ")
  4466. cpp_quote("// Description:")
  4467. cpp_quote("// This method creates a IPOP3Transport object. The client must initialize the")
  4468. cpp_quote("// object by calling IPOP3Transport::InitNew")
  4469. cpp_quote("// ")
  4470. cpp_quote("// Parameters:")
  4471. cpp_quote("// ppTransport Upon successful return, contains the a pointer to")
  4472. cpp_quote("// an IPOP3Transport interface")
  4473. cpp_quote("// ")
  4474. cpp_quote("// Return Values:")
  4475. cpp_quote("// S_OK Successful.")
  4476. cpp_quote("// E_INVALIDARG ppTransport is NULL")
  4477. cpp_quote("// E_OUTOFMEMORY Memory allocation failure...")
  4478. cpp_quote("// ")
  4479. cpp_quote("// --------------------------------------------------------------------------------")
  4480. cpp_quote("IMNXPORTAPI CreatePOP3Transport(")
  4481. cpp_quote(" /* out */ IPOP3Transport **ppTransport);")
  4482. cpp_quote("")
  4483. cpp_quote("// --------------------------------------------------------------------------------")
  4484. cpp_quote("// CreateIMAPTransport")
  4485. cpp_quote("// ")
  4486. cpp_quote("// Description:")
  4487. cpp_quote("// This method creates a IIMAPTransport object. The client must initialize the")
  4488. cpp_quote("// object by calling IIMAPTransport::InitNew")
  4489. cpp_quote("// ")
  4490. cpp_quote("// Parameters:")
  4491. cpp_quote("// ppTransport Upon successful return, contains the a pointer to")
  4492. cpp_quote("// an IIMAPTransport interface")
  4493. cpp_quote("// ")
  4494. cpp_quote("// Return Values:")
  4495. cpp_quote("// S_OK Successful.")
  4496. cpp_quote("// E_INVALIDARG ppTransport is NULL")
  4497. cpp_quote("// E_OUTOFMEMORY Memory allocation failure...")
  4498. cpp_quote("// ")
  4499. cpp_quote("// --------------------------------------------------------------------------------")
  4500. cpp_quote("IMNXPORTAPI CreateIMAPTransport(")
  4501. cpp_quote(" /* out */ IIMAPTransport **ppTransport);")
  4502. cpp_quote("")
  4503. cpp_quote("// --------------------------------------------------------------------------------")
  4504. cpp_quote("// CreateIMAPTransport2")
  4505. cpp_quote("// ")
  4506. cpp_quote("// Description:")
  4507. cpp_quote("// This method creates an IIMAPTransport2 object. The client must initialize the")
  4508. cpp_quote("// object by calling IIMAPTransport2::InitNew")
  4509. cpp_quote("// ")
  4510. cpp_quote("// Parameters:")
  4511. cpp_quote("// ppTransport Upon successful return, contains the a pointer to")
  4512. cpp_quote("// an IIMAPTransport2 interface")
  4513. cpp_quote("// ")
  4514. cpp_quote("// Return Values:")
  4515. cpp_quote("// S_OK Successful.")
  4516. cpp_quote("// E_INVALIDARG ppTransport is NULL")
  4517. cpp_quote("// E_OUTOFMEMORY Memory allocation failure...")
  4518. cpp_quote("// ")
  4519. cpp_quote("// --------------------------------------------------------------------------------")
  4520. cpp_quote("IMNXPORTAPI CreateIMAPTransport2(")
  4521. cpp_quote(" /* out */ IIMAPTransport2 **ppTransport);")
  4522. cpp_quote("")
  4523. cpp_quote("// --------------------------------------------------------------------------------")
  4524. cpp_quote("// CreateRangeList")
  4525. cpp_quote("// ")
  4526. cpp_quote("// Description:")
  4527. cpp_quote("// This method creates a IRangeList object.")
  4528. cpp_quote("// ")
  4529. cpp_quote("// Parameters:")
  4530. cpp_quote("// ppRangeList Upon successful return, contains the a pointer to")
  4531. cpp_quote("// an IRangeList interface")
  4532. cpp_quote("// ")
  4533. cpp_quote("// Return Values:")
  4534. cpp_quote("// S_OK Successful.")
  4535. cpp_quote("// E_INVALIDARG ppRangeList is NULL")
  4536. cpp_quote("// E_OUTOFMEMORY Memory allocation failure...")
  4537. cpp_quote("// ")
  4538. cpp_quote("// --------------------------------------------------------------------------------")
  4539. cpp_quote("IMNXPORTAPI CreateRangeList(")
  4540. cpp_quote(" /* out */ IRangeList **ppRangeList);")
  4541. cpp_quote("")
  4542. cpp_quote("#ifdef __cplusplus")
  4543. cpp_quote("}")
  4544. cpp_quote("#endif")
  4545. cpp_quote("")