shell32/shellview: Implemented IFolderView::GetFocusedItem.
[wine] / include / imnxport.idl
1 /*
2  * Copyright 2006 Robert Shearman for CodeWeavers
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18
19 import "imnact.idl";
20
21 interface IInternetTransport;
22 interface ISMTPTransport;
23 interface IPOP3Transport;
24 interface IIMAPTransport;
25
26 /* CLSIDs */
27
28 cpp_quote("DEFINE_GUID(CLSID_IInternetMessageUrl, 0xca30cc91, 0xb1b3, 0x11d0, 0x85, 0xd0, 0x00, 0xc0, 0x4f, 0xd8, 0x5a, 0xb4);")
29 cpp_quote("DEFINE_GUID(CLSID_ISMTPTransport, 0xfd853ce6, 0x7f86, 0x11d0, 0x82, 0x52, 0x00, 0xc0, 0x4f, 0xd8, 0x5a, 0xb4);")
30 cpp_quote("DEFINE_GUID(CLSID_ISMTPTransport2, 0xdf2c7eC, 0x3435, 0x11d0, 0x81, 0xd0, 0x0, 0xc0, 0x4f, 0xd8, 0x5a, 0xb4);")
31 cpp_quote("DEFINE_GUID(CLSID_IPOP3Transport, 0xfd853ce7, 0x7f86, 0x11d0, 0x82, 0x52, 0x00, 0xc0, 0x4f, 0xd8, 0x5a, 0xb4);")
32 cpp_quote("DEFINE_GUID(CLSID_INNTPTransport, 0xfd853ce8, 0x7f86, 0x11d0, 0x82, 0x52, 0x00, 0xc0, 0x4f, 0xd8, 0x5a, 0xb4);")
33 cpp_quote("DEFINE_GUID(CLSID_IRASTransport, 0xfd853ce9, 0x7f86, 0x11d0, 0x82, 0x52, 0x00, 0xc0, 0x4f, 0xd8, 0x5a, 0xb4);")
34 cpp_quote("DEFINE_GUID(CLSID_IRangeList, 0xfd853cea, 0x7f86, 0x11d0, 0x82, 0x52, 0x00, 0xc0, 0x4f, 0xd8, 0x5a, 0xb4);")
35 cpp_quote("DEFINE_GUID(CLSID_IIMAPTransport, 0xfd853ceb, 0x7f86, 0x11d0, 0x82, 0x52, 0x00, 0xc0, 0x4f, 0xd8, 0x5a, 0xb4);")
36 cpp_quote("DEFINE_GUID(CLSID_IHTTPMailTransport, 0x5a580c11, 0xe5eb, 0x11d1, 0xa8, 0x6e, 0x00, 0x00, 0xf8, 0x08, 0x4f, 0x96);")
37 cpp_quote("DEFINE_GUID(CLSID_IPropFindRequest, 0xbb847b8a, 0x054a, 0x11d2, 0xa8, 0x94, 0x00, 0x00, 0xf8, 0x08, 0x4f, 0x96);")
38 cpp_quote("DEFINE_GUID(CLSID_IPropPatchRequest, 0xea678830, 0x235d, 0x11d2, 0xa8, 0xb6, 0x00, 0x00, 0xf8, 0x08, 0x4f, 0x96);")
39
40 /* Error Codes */
41
42 cpp_quote("#ifndef HR_E")
43 cpp_quote("#define HR_E(n) MAKE_SCODE(SEVERITY_ERROR, FACILITY_INTERNET, n)")
44 cpp_quote("#endif")
45 cpp_quote("#ifndef HR_S")
46 cpp_quote("#define HR_S(n) MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_INTERNET, n)")
47 cpp_quote("#endif")
48
49 /* General Error Codes */
50 cpp_quote("#define IXP_E_LOAD_SICILY_FAILED     HR_E(0xCC00)")
51 cpp_quote("#define IXP_E_INVALID_CERT_CN        HR_E(0xCC01)")
52 cpp_quote("#define IXP_E_INVALID_CERT_DATE      HR_E(0xCC02)")
53 cpp_quote("#define IXP_E_ALREADY_CONNECTED      HR_E(0xCC03)")
54 cpp_quote("#define IXP_E_CONN                   HR_E(0xCC04)")
55 cpp_quote("#define IXP_E_NOT_CONNECTED          HR_E(0xCC05)")
56 cpp_quote("#define IXP_E_CONN_SEND              HR_E(0xCC06)")
57 cpp_quote("#define IXP_E_WOULD_BLOCK            HR_E(0xCC07)")
58 cpp_quote("#define IXP_E_INVALID_STATE          HR_E(0xCC08)")
59 cpp_quote("#define IXP_E_CONN_RECV              HR_E(0xCC09)")
60 cpp_quote("#define IXP_E_INCOMPLETE             HR_E(0xCC0A)")
61 cpp_quote("#define IXP_E_BUSY                   HR_E(0xCC0B)")
62 cpp_quote("#define IXP_E_NOT_INIT               HR_E(0xCC0C)")
63 cpp_quote("#define IXP_E_CANT_FIND_HOST         HR_E(0xCC0D)")
64 cpp_quote("#define IXP_E_FAILED_TO_CONNECT      HR_E(0xCC0E)")
65 cpp_quote("#define IXP_E_CONNECTION_DROPPED     HR_E(0xCC0F)")
66 cpp_quote("#define IXP_E_INVALID_ADDRESS        HR_E(0xCC10)")
67 cpp_quote("#define IXP_E_INVALID_ADDRESS_LIST   HR_E(0xCC11)")
68 cpp_quote("#define IXP_E_SOCKET_READ_ERROR      HR_E(0xCC12)")
69 cpp_quote("#define IXP_E_SOCKET_WRITE_ERROR     HR_E(0xCC13)")
70 cpp_quote("#define IXP_E_SCOKET_INIT_ERROR      HR_E(0xCC14)")
71 cpp_quote("#define IXP_E_SOCKET_CONNECT_ERROR   HR_E(0xCC15)")
72 cpp_quote("#define IXP_E_INVALID_ACCOUNT        HR_E(0xCC16)")
73 cpp_quote("#define IXP_E_USER_CANCEL            HR_E(0xCC17)")
74 cpp_quote("#define IXP_E_SICILY_LOGON_FAILED    HR_E(0xCC18)")
75 cpp_quote("#define IXP_E_TIMEOUT                HR_E(0xCC19)")
76 cpp_quote("#define IXP_E_SECURE_CONNECT_FAILED  HR_E(0xCC1A)")
77
78 /* SMTP Failure Statuses */
79 cpp_quote("#define IXP_E_SMTP_RESPONSE_ERROR            HR_E(0xCC60)")
80 cpp_quote("#define IXP_E_SMTP_UNKNOWN_RESPONSE_CODE     HR_E(0xCC61)")
81 cpp_quote("#define IXP_E_SMTP_500_SYNTAX_ERROR          HR_E(0xCC62)")
82 cpp_quote("#define IXP_E_SMTP_501_PARAM_SYNTAX          HR_E(0xCC63)")
83 cpp_quote("#define IXP_E_SMTP_502_COMMAND_NOTIMPL       HR_E(0xCC64)")
84 cpp_quote("#define IXP_E_SMTP_503_COMMAND_SEQ           HR_E(0xCC65)")
85 cpp_quote("#define IXP_E_SMTP_504_COMMAND_PARAM_NOTIMPL HR_E(0xCC66)")
86 cpp_quote("#define IXP_E_SMTP_421_NOT_AVAILABLE         HR_E(0xCC67)")
87 cpp_quote("#define IXP_E_SMTP_450_MAILBOX_BUSY          HR_E(0xCC68)")
88 cpp_quote("#define IXP_E_SMTP_550_MAILBOX_NOT_FOUND     HR_E(0xCC69)")
89 cpp_quote("#define IXP_E_SMTP_451_ERROR_PROCESSING      HR_E(0xCC6A)")
90 cpp_quote("#define IXP_E_SMTP_551_USER_NOT_LOCAL        HR_E(0xCC6B)")
91 cpp_quote("#define IXP_E_SMTP_452_NO_SYSTEM_STORAGE     HR_E(0xCC6C)")
92 cpp_quote("#define IXP_E_SMTP_552_STORAGE_OVERFLOW      HR_E(0xCC6D)")
93 cpp_quote("#define IXP_E_SMTP_553_MAILBOX_NAME_SYNTAX   HR_E(0xCC6E)")
94 cpp_quote("#define IXP_E_SMTP_554_TRANSACT_FAILED       HR_E(0xCC6F)")
95
96 /* SMTP Success Statuses */
97 cpp_quote("#define IXP_E_SMTP_211_SYSTEM_STATUS         HR_S(0xCC70)")
98 cpp_quote("#define IXP_E_SMTP_214_HELP_MESSAGE          HR_S(0xCC71)")
99 cpp_quote("#define IXP_E_SMTP_220_READY                 HR_S(0xCC72)")
100 cpp_quote("#define IXP_E_SMTP_221_CLOSING               HR_S(0xCC73)")
101 cpp_quote("#define IXP_E_SMTP_250_MAIL_ACTION_OKAY      HR_S(0xCC74)")
102 cpp_quote("#define IXP_E_SMTP_251_FORWARDING_MAIL       HR_S(0xCC75)")
103 cpp_quote("#define IXP_E_SMTP_354_START_MAIL_INPUT      HR_S(0xCC76)")
104 cpp_quote("#define IXP_E_SMTP_CONTINUE                  HR_S(0xCC77)")
105 cpp_quote("#define IXP_E_SMTP_334_AUTH_READY_RESPONSE   HR_S(0xCC78)")
106 cpp_quote("#define IXP_E_SMTP_245_AUTH_SUCCESS          HR_S(0xCC79)")
107
108 /* More SMTP Failure Statuses */
109 cpp_quote("#define IXP_E_SMTP_REJECTED_SENDER           HR_E(0xCC78)")
110 cpp_quote("#define IXP_E_SMTP_REJECTED_RECIPIENTS       HR_E(0xCC79)")
111 cpp_quote("#define IXP_E_SMTP_NO_SENDER                 HR_E(0xCC7A)")
112 cpp_quote("#define IXP_E_SMTP_NO_RECIPIENTS             HR_E(0xCC7B)")
113 cpp_quote("#define IXP_E_SMTP_530_STARTTLS_REQUIRED     HR_E(0xCC7C)")
114 cpp_quote("#define IXP_E_SMTP_NO_STARTTLS_SUPPORT       HR_E(0xCC7D)")
115 cpp_quote("#define IXP_E_SMTP_NO_DSN_SUPPORT            HR_E(0xCC7E)")
116 cpp_quote("#define IXP_E_SMTP_454_STARTTLS_FAILED       HR_E(0xCC7F)")
117
118 const SHORT CCHMAX_DOMAIN = 256;
119 const SHORT CCHMAX_PHONE_NUMBER = 128;
120
121 const DWORD DEFAULT_IMAP_PORT = 143;
122 const DWORD DEFAULT_POP3_PORT = 110;
123 const DWORD DEFAULT_SMTP_PORT = 25;
124 const DWORD DEFAULT_NNTP_PORT = 119;
125
126 typedef enum tagINETADDRTYPE
127 {
128     ADDR_TO,
129     ADDR_FROM,
130     ADDR_DSN_NEVER = 16,
131     ADDR_DSN_SUCCESS = 32,
132     ADDR_DSN_FAILURE = 64,
133     ADDR_DSN_DELAY = 128
134 } INETADDRTYPE;
135
136 const DWORD ADDR_TOFROM_MASK = 0x1;
137 const DWORD ADDR_DSN_MASK = 0xf0;
138
139 typedef enum tagDSNRET
140 {
141     DSNRET_DEFAULT,
142     DSNRET_HDRS,
143     DSNRET_FULL,
144 } DSNRET;
145
146 typedef struct tagINETADDR
147 {
148     INETADDRTYPE addrtype;
149     CHAR szEmail[CCHMAX_EMAIL_ADDRESS];
150 } INETADDR, *LPINETADDR;
151
152 typedef struct tagINETADDRLIST
153 {
154     ULONG cAddress;
155     LPINETADDR prgAddress;
156 } INETADDRLIST, *LPINETADDRLIST;
157
158 typedef enum tagRASCONNTYPE
159 {
160     RAS_CONNECT_LAN,
161     RAS_CONNECT_MANUAL,
162     RAS_CONNECT_RAS
163 } RASCONNTYPE;
164
165 typedef enum tagHTTPMAILPROPTYPE
166 {
167     HTTPMAIL_PROP_INVALID,
168     HTTPMAIL_PROP_ADBAR,
169     HTTPMAIL_PROP_CONTACTS,
170     HTTPMAIL_PROP_INBOX,
171     HTTPMAIL_PROP_OUTBOX,
172     HTTPMAIL_PROP_SENDMSG,
173     HTTPMAIL_PROP_SENTITEMS,
174     HTTPMAIL_PROP_DELETEDITEMS,
175     HTTPMAIL_PROP_DRAFTS,
176     HTTPMAIL_PROP_MSGFOLDERROOT,
177     HTTPMAIL_PROP_SIG,
178     HTTPMAIL_PROP_LAST
179 } HTTPMAILPROPTYPE;
180
181 typedef enum tagHTTPMAILSPECIALFOLDER
182 {
183     HTTPMAIL_SF_NONE,
184     HTTPMAIL_SF_UNRECOGNIZED,
185     HTTPMAIL_SF_INBOX,
186     HTTPMAIL_SF_DELETEDITEMS,
187     HTTPMAIL_SF_DRAFTS,
188     HTTPMAIL_SF_OUTBOX,
189     HTTPMAIL_SF_SENTITEMS,
190     HTTPMAIL_SF_CONTACTS,
191     HTTPMAIL_SF_CALENDAR,
192     HTTPMAIL_SF_MSNPROMO,
193     HTTPMAIL_SF_LAST
194 } HTTPMAILSPECIALFOLDER;
195
196 typedef enum tagHTTPMAILCONTACTTYPE
197 {
198     HTTPMAIL_CT_CONTACT,
199     HTTPMAIL_CT_GROUP,
200     HTTPMAIL_CT_LAST
201 } HTTPMAILCONTACTTYPE;
202
203 const DWORD DAVNAMESPACE_UNKNOWN = 0xFFFFFFFF;
204 const DWORD DAVNAMESPACE_DAV = 0;
205 const DWORD DAVNAMESPACE_HOTMAIL = 1;
206 const DWORD DAVNAMESPACE_HTTPMAIL = 2;
207 const DWORD DAVNAMESPACE_MAIL = 3;
208 const DWORD DAVNAMESPACE_CONTACTS = 4;
209
210 cpp_quote("#define ISF_SMTP_USEIPFORHELO        0x01")
211 cpp_quote("#define ISF_ALWAYSPROMPTFORPASSWORD  0x02")
212 /* for SMTP - send EHLO and use STARTTLS if available: */
213 cpp_quote("#define ISF_SSLONSAMEPORT            0x04")
214 cpp_quote("#define ISF_QUERYDSNSUPPORT          0x08")
215 /* for SMTP - send EHLO and use AUTH if available: */
216 cpp_quote("#define ISF_QUERYAUTHSUPPORT         0x10")
217
218 typedef struct INETSERVER
219 {
220     CHAR szAccount[CCHMAX_ACCOUNT_NAME];
221     CHAR szUserName[CCHMAX_USERNAME];
222     CHAR szPassword[CCHMAX_PASSWORD];
223     CHAR szServerName[CCHMAX_SERVER_NAME];
224     CHAR szConnectoid[CCHMAX_CONNECTOID];
225     RASCONNTYPE rasconntype;
226     DWORD dwPort;
227     BOOL fSSL;
228     BOOL fTrySicily;
229     DWORD dwTimeout;
230     DWORD dwFlags;
231 } INETSERVER, *LPINETSERVER;
232
233 typedef enum tagIXPTYPE
234 {
235     IXP_NNTP,
236     IXP_SMTP,
237     IXP_POP3,
238     IXP_IMAP,
239     IXP_RAS,
240     IXP_HTTPMail
241 } IXPTYPE;
242
243 typedef enum tagIXPSTATUS
244 {
245     IXP_FINDINGHOST,
246     IXP_CONNECTING,
247     IXP_SECURING,
248     IXP_CONNECTED,
249     IXP_AUTHORIZING,
250     IXP_AUTHRETRY,
251     IXP_AUTHORIZED,
252     IXP_DISCONNECTING,
253     IXP_DISCONNECTED,
254     IXP_LAST
255 } IXPSTATUS;
256
257 const DWORD DEPTH_INFINITY = 0xFFFFFFFE;
258
259 typedef DWORD MEMBERINFOFLAGS;
260
261 const MEMBERINFOFLAGS HTTP_MEMBERINFO_COMMONPROPS = 0x0;
262 const MEMBERINFOFLAGS HTTP_MEMBERINFO_FOLDERPROPS = 0x1;
263 const MEMBERINFOFLAGS HTTP_MEMBERINFO_MESSAGEPROPS = 0x2;
264 const MEMBERINFOFLAGS HTTP_MEMBERINFO_ALLPROPS = HTTP_MEMBERINFO_FOLDERPROPS | HTTP_MEMBERINFO_MESSAGEPROPS;
265
266 typedef DWORD IMAP_MSGFLAGS;
267
268 const IMAP_MSGFLAGS IMAP_MSG_NOFLAGS = 0x00;
269 const IMAP_MSGFLAGS IMAP_MSG_ANSWERED = 0x01;
270 const IMAP_MSGFLAGS IMAP_MSG_FLAGGED = 0x02;
271 const IMAP_MSGFLAGS IMAP_MSG_DELETED = 0x04;
272 const IMAP_MSGFLAGS IMAP_MSG_SEEN = 0x08;
273 const IMAP_MSGFLAGS IMAP_MSG_DRAFT = 0x10;
274 const IMAP_MSGFLAGS IMAP_MSG_ALLFLAGS = 0x1f;
275
276 [
277     object,
278     uuid(CA30F3FF-C9AC-11D1-9A3A-00C04FA309D4),
279     local
280 ]
281 interface ITransportCallbackService : IUnknown
282 {
283     HRESULT GetParentWindow(
284         [in]    DWORD dwReserved,
285         [out]   HWND *phwndParent);
286
287     HRESULT GetAccount(
288         [out]   LPDWORD pdwServerType,
289         [out]   IImnAccount **ppAccount);
290 }
291
292 [
293     object,
294     uuid(0DF2C7E1-3435-11D0-81D0-00C04FD85AB4),
295     local
296 ]
297 interface ITransportCallback : IUnknown
298 {
299     typedef struct tagIXPRESULT
300     {
301         HRESULT hrResult;
302         LPSTR pszResponse;
303         UINT uiServerError;
304         HRESULT hrServerError;
305         DWORD dwSocketError;
306         LPSTR pszProblem;
307     } IXPRESULT, *LPIXPRESULT;
308
309     typedef enum tagCMDTYPE
310     {
311         CMD_SEND,
312         CMD_RESP
313     } CMDTYPE;
314
315     HRESULT OnTimeout(
316         [in,out]    DWORD *pdwTimeout,
317         [in]        IInternetTransport *pTransport);
318
319     HRESULT OnLogonPrompt(
320         [in,out]    LPINETSERVER pInetServer,
321         [in]        IInternetTransport *pTransport);
322
323     INT OnPrompt(
324         [in]    HRESULT hrError,
325         [in]    LPCSTR pszText,
326         [in]    LPCSTR pszCaption,
327         [in]    UINT uType,
328         [in]    IInternetTransport *pTransport);
329
330     HRESULT OnStatus(
331         [in]    IXPSTATUS ixpstatus,
332         [in]    IInternetTransport *pTransport);
333
334     HRESULT OnError(
335         [in]    IXPSTATUS ixpstatus,
336         [in]    LPIXPRESULT pResult,
337         [in]    IInternetTransport *pTransport);
338
339     HRESULT OnCommand(
340         [in]    CMDTYPE cmdtype,
341         [in]    LPSTR pszLine,
342         [in]    HRESULT hrResponse,
343         [in]    IInternetTransport *pTransport);
344 }
345
346 [
347     object,
348     uuid(1F636C01-364E-11D0-81D3-00C04FD85AB4),
349     local
350 ]
351 interface IInternetTransport : IUnknown
352 {
353     const boolean iitAUTHENTICATE = TRUE;
354     const boolean iitDONT_AUTHENTICATe = FALSE;
355     const boolean iitENABLE_ONCOMMAND = TRUE;
356     const boolean iitDISABLE_ONCOMMAND = FALSE;
357
358     typedef enum tagIXPISSTATE
359     {
360         IXP_IS_CONNECTED,
361         IXP_IS_BUSY,
362         IXP_IS_READY,
363         IXP_IS_AUTHENTICATED
364     } IXPISSTATE;
365
366     HRESULT GetServerInfo(
367         [in,out]    LPINETSERVER pInetServer);
368
369     IXPTYPE GetIXPType();
370
371     HRESULT IsState(
372         [in]    IXPISSTATE isstate);
373
374     HRESULT InetServerFromAccount(
375         [in]        IImnAccount *pAccount,
376         [in,out]    LPINETSERVER pInetServer);
377
378     HRESULT Connect(
379         [in]    LPINETSERVER pInetServer,
380         [in]    boolean fAuthenticate,
381         [in]    boolean fCommandLogging);
382
383     HRESULT HandsOffCallback();
384
385     HRESULT Disconnect();
386
387     HRESULT DropConnection();
388
389     HRESULT GetStatus(
390         [out]   IXPSTATUS *pCurrentStatus);
391 }
392
393 [
394     object,
395     uuid(1F636C02-364E-11D0-81D3-00C04FD85AB4),
396     local
397 ]
398 interface ISMTPCallback : ITransportCallback
399 {
400     typedef enum tagSMTPCOMMAND
401     {
402         SMTP_NONE,
403         SMTP_BANNER,
404         SMTP_CONNECTED,
405         SMTP_SEND_MESSAGE,
406         SMTP_AUTH,
407         SMTP_EHLO,
408         SMTP_HELO,
409         SMTP_MAIL,
410         SMTP_RCPT,
411         SMTP_RSET,
412         SMTP_QUIT,
413         SMTP_DATA,
414         SMTP_DOT,
415         SMTP_SEND_STREAM,
416         SMTP_CUSTOM
417     } SMTPCOMMAND;
418
419     typedef struct tagSMTPSTREAM
420     {
421         DWORD cbIncrement;
422         DWORD cbCurrent;
423         DWORD cbTotal;
424     } SMTPSTREAM, *LPSMTPSTREAM;
425
426     typedef struct tagSMTPRESPONSE
427     {
428         SMTPCOMMAND command;
429         BOOL fDone;
430         IXPRESULT rIxpResult;
431         ISMTPTransport *pTransport;
432
433         [switch_type(SMTPCOMMAND), switch_is(command)]
434         union
435         {
436         [case(SMTP_SEND_STREAM)]    SMTPSTREAM rStreamInfo;
437         [default];
438         } DUMMYUNIONNAME;
439     } SMTPRESPONSE, *LPSMTPRESPONSE;
440
441     HRESULT OnResponse(
442         [in] LPSMTPRESPONSE pResponse);
443 }
444
445 [
446     object,
447     uuid(0DF2C7E2-3435-11D0-81D0-00C04FD85AB4),
448     local
449 ]
450 interface ISMTPTransport : IInternetTransport
451 {
452     typedef struct tagSMTPMESSAGE
453     {
454         ULONG cbSize;
455         LPSTREAM pstmMsg;
456         INETADDRLIST rAddressList;
457     } SMTPMESSAGE, *LPSMTPMESSAGE;
458
459     HRESULT InitNew(
460         [in]    LPSTR pszLogFilePath,
461         [in]    ISMTPCallback *pCallback);
462
463 cpp_quote("#ifdef WINE_NO_UNICODE_MACROS")
464 cpp_quote("#undef SendMessage")
465 cpp_quote("#endif")
466
467     HRESULT SendMessage(
468         [in]    LPSMTPMESSAGE pMessage);
469
470     HRESULT CommandMAIL(
471         [in]    LPSTR pszEmailFrom);
472
473     HRESULT CommandRCPT(
474         [in]    LPSTR pszEmailTo);
475
476     HRESULT CommandEHLO();
477
478     HRESULT CommandHELO();
479
480     HRESULT CommandAUTH(
481         [in]    LPSTR pszAuthType);
482
483     HRESULT CommandQUIT();
484
485     HRESULT CommandRSET();
486
487     HRESULT CommandDATA();
488
489     HRESULT CommandDOT();
490
491     HRESULT SendDataStream(
492         [in]    IStream *pStream,
493         [in]    ULONG cbSize);
494 }
495
496 [
497     object,
498     uuid(0DF2C7EC-3435-11D0-81D0-00C04FD85AB4),
499     local
500 ]
501 interface ISMTPTransport2 : ISMTPTransport
502 {
503     typedef struct tagSMTPMESSAGE2
504     {
505         SMTPMESSAGE smtpMsg;
506         LPSTR pszDSNENVID;
507         DSNRET dsnRet;
508         DWORD dwReserved;
509         DWORD dwReserved2;
510     } SMTPMESSAGE2, *LPSMTPMESSAGE2;
511
512     HRESULT SetWindow();
513
514     HRESULT ResetWindow();
515
516     HRESULT SendMessage2(
517         [in]    LPSMTPMESSAGE2 pMessage);
518
519     HRESULT CommandRCPT2(
520         [in]    LPSTR pszEmailTo,
521         [in]    INETADDRTYPE atDSN);
522 }
523
524 /* FIXME: IDAVNamespaceArbiter, IPropPatchRequest, IPropFindRequest, IPropFindMultiResponse, IPropFindResponse, IHTTPMailCallback, IHTTPMailTransport */
525
526 [
527     object,
528     uuid(0DF2C7E3-3435-11D0-81D0-00C04FD85AB4),
529     local
530 ]
531 interface IPOP3Callback : ITransportCallback
532 {
533     typedef enum tagPOP3COMMAND
534     {
535         POP3_NONE,
536         POP3_BANNER,
537         POP3_CONNECTED,
538         POP3_USER,
539         POP3_PASS,
540         POP3_AUTH,
541         POP3_UIDL,
542         POP3_STAT,
543         POP3_LIST,
544         POP3_DELE,
545         POP3_RETR,
546         POP3_TOP,
547         POP3_NOOP,
548         POP3_QUIT,
549         POP3_RSET,
550         POP3_CUSTOM
551     } POP3COMMAND;
552
553     typedef struct tagPOP3RETR
554     {
555         BOOL fHeader;
556         BOOL fBody;
557         DWORD dwPopId;
558         DWORD cbSoFar;
559         LPSTR pszLines;
560         ULONG cbLines;
561     } POP3RETR, *LPPOP3RETR;
562
563     typedef struct tagPOP3TOP
564     {
565         BOOL fHeader;
566         BOOL fBody;
567         DWORD dwPopId;
568         DWORD cPreviewLines;
569         DWORD cbSoFar;
570         LPSTR pszLines;
571         ULONG cbLines;
572     } POP3TOP, *LPPOP3TOP;
573
574     typedef struct tagPOP3LIST
575     {
576         DWORD dwPopId;
577         DWORD cbSize;
578     } POP3LIST, *LPPOP3LIST;
579
580     typedef struct tagPOP3UIDL
581     {
582         DWORD dwPopId;
583         LPSTR pszUidl;
584     } POP3UIDL, *LPPOP3UIDL;
585
586     typedef struct tagPOP3STAT
587     {
588         DWORD cMessages;
589         DWORD cbMessages;
590     } POP3STAT, *LPPOP3STAT;
591
592     typedef struct tagPOP3RESPONSE
593     {
594         POP3COMMAND command;
595         BOOL fDone;
596         IXPRESULT rIxpResult;
597         IPOP3Transport *pTransport;
598         BOOL fValidInfo;
599         [switch_type(POP3COMMAND), switch_is(command)]
600         union
601         {
602         [case(POP3_UIDL)] POP3UIDL rUidlInfo;
603         [case(POP3_STAT)] POP3STAT rStatInfo;
604         [case(POP3_LIST)] POP3LIST rListInfo;
605         [case(POP3_DELE)] DWORD dwPopId;
606         [case(POP3_RETR)] POP3RETR rRetrInfo;
607         [case(POP3_TOP)]  POP3TOP rTopInfo;
608         [default];
609         } DUMMYUNIONNAME;
610     } POP3RESPONSE, *LPPOP3RESPONSE;
611
612     HRESULT OnResponse(
613         [in]    LPPOP3RESPONSE pResponse);
614 }
615
616 [
617     object,
618     uuid(0DF2C7E4-3435-11D0-81D0-00C04FD85AB4),
619     local
620 ]
621 interface IPOP3Transport : IInternetTransport
622 {
623     typedef enum tagPOP3CMDTYPE
624     {
625         POP3CMD_GET_POPID,
626         POP3CMD_GET_MARKED,
627         POP3CMD_GET_ALL
628     } POP3CMDTYPE;
629
630     typedef enum tagPOP3MARKTYPE
631     {
632         POP3_MARK_FOR_TOP = 0x01,
633         POP3_MARK_FOR_RETR = 0x02,
634         POP3_MARK_FOR_DELE = 0x04,
635         POP3_MARK_FOR_UIDL = 0x08,
636         POP3_MARK_FOR_LIST = 0x10
637     } POP3MARKTYPE;
638
639     HRESULT InitNew(
640         [in]    LPSTR pszLogFilePath,
641         [in]    IPOP3Callback *pCallback);
642
643     HRESULT MarkItem(
644         [in]    POP3MARKTYPE marktype,
645         [in]    DWORD dwPopId,
646         [in]    boolean fMarked);
647
648     HRESULT CommandAUTH(
649         [in]    LPSTR pszAuthType);
650
651     HRESULT CommandUSER(
652         [in]    LPSTR pszUserName);
653
654     HRESULT CommandPASS(
655         [in]    LPSTR pszPassword);
656
657     HRESULT CommandLIST(
658         [in]    POP3CMDTYPE cmdtype,
659         [in]    DWORD dwPopId);
660
661     HRESULT CommandTOP(
662         [in]    POP3CMDTYPE cmdtype,
663         [in]    DWORD dwPopId,
664         [in]    DWORD cPreviewLines);
665
666     HRESULT CommandQUIT();
667
668     HRESULT CommandSTAT();
669
670     HRESULT CommandNOOP();
671
672     HRESULT CommandRSET();
673
674     HRESULT CommandUIDL(
675         [in]    POP3CMDTYPE cmdtype,
676         [in]    DWORD dwPopId);
677
678     HRESULT CommandDELE(
679         [in]    POP3CMDTYPE cmdtype,
680         [in]    DWORD dwPopId);
681
682     HRESULT CommandRETR(
683         [in]    POP3CMDTYPE cmdtype,
684         [in]    DWORD dwPopId);
685 }
686
687 /* FIXME: INNTPCallback, INNTPTransport */
688
689 [
690     object,
691     uuid(8C438160-4EF6-11d0-874F-00AA00530EE9),
692     local,
693 ]
694 interface IRangeList : IUnknown
695 {
696     const ULONG RL_RANGE_ERROR = ((ULONG)-1);
697     const ULONG RL_LAST_MESSAGE = ((ULONG)-1);
698
699     HRESULT Clear();
700
701     HRESULT IsInRange(
702         [in]    const ULONG value);
703
704     HRESULT Min(
705         [out]   ULONG *pulMin);
706
707     HRESULT Max(
708         [out]   ULONG *pulMax);
709
710     HRESULT Save(
711         [out]   byte **ppbDestination,
712         [out]   ULONG *pulSizeOfDestination);
713
714     HRESULT Load(
715         [in, size_is(ulSizeOfSource)]   byte *pbSource,
716         [in]    const ULONG ulSizeOfSource);
717
718     HRESULT AddRange(
719         [in]    const ULONG low,
720         [in]    const ULONG high);
721
722     HRESULT AddSingleValue(
723         [in]    const ULONG value);
724
725     HRESULT AddRangeList(
726         [in]    const IRangeList *prl);
727
728     HRESULT DeleteRange(
729         [in]    const ULONG low,
730         [in]    const ULONG high);
731
732     HRESULT DeleteSingleValue(
733         [in]    const ULONG value);
734
735     HRESULT DeleteRangeList(
736         [in]    const IRangeList *prl);
737
738     HRESULT MinOfRange(
739         [in]    const ULONG value,
740         [out]   ULONG *pulMinOfRange);
741
742     HRESULT MaxOfRange(
743         [in]    const ULONG value,
744         [out]   ULONG *pulMaxOfRange);
745
746     HRESULT RangeToIMAPString(
747         [out]   LPSTR *ppszDestination,
748         [out]   LPDWORD pdwLengthOfDestination);
749
750     HRESULT Next(
751         [in]    const ULONG current,
752         [out]   ULONG *pulNext);
753
754     HRESULT Prev(
755         [in]    const ULONG current,
756         [out]   ULONG *pulPrev);
757
758     HRESULT Cardinality(
759         [out]   ULONG *pulCardinality);
760
761     HRESULT CardinalityFrom(
762         [in]    const ULONG ulStartPoint,
763         [out]   ULONG *pulCardinalityFrom);
764 }
765
766 [
767     object,
768     uuid(E9E9D8A3-4EDD-11d0-874F-00AA00530EE9),
769     local
770 ]
771 interface IIMAPCallback : ITransportCallback
772 {
773     typedef DWORD IMAP_MBOXFLAGS;
774     const IMAP_MBOXFLAGS IMAP_MBOX_NOFLAGS = 0x0;
775     const IMAP_MBOXFLAGS IMAP_MBOX_MARKED = 0x1;
776     const IMAP_MBOXFLAGS IMAP_MBOX_NOINFERIORS = 0x2;
777     const IMAP_MBOXFLAGS IMAP_MBOX_NOSELECT = 0x4;
778     const IMAP_MBOXFLAGS IMAP_MBOX_UNMARKED = 0x8;
779     const IMAP_MBOXFLAGS IMAP_MBOX_ALLFLAGS = 0xf;
780
781     typedef enum tagIMAP_RESPONSE_TYPE
782     {
783         irtERROR_NOTIFICATION,
784         irtCOMMAND_COMPLETION,
785         irtSERVER_ALERT,
786         irtPARSE_ERROR,
787         irtMAILBOX_UPDATE,
788         irtDELETED_MSG,
789         irtFETCH_BODY,
790         irtUPDATE_MSG,
791         irtAPPLICABLE_FLAGS,
792         irtPERMANENT_FLAGS,
793         irtUIDVALIDITY,
794         irtREADWRITE_STATUS,
795         irtTRYCREATE,
796         irtSEARCH,
797         irtMAILBOX_LISTING,
798         irtMAILBOX_STATUS,
799         irtAPPEND_PROGRESS,
800         irtUPDATE_MSG_EX
801     } IMAP_RESPONSE_TYPE;
802
803     typedef struct tagFETCH_BODY_PART
804     {
805         DWORD dwMsgSeqNum;
806         LPSTR pszBodyTag;
807         DWORD dwTotalBytes;
808         DWORD dwSizeOfData;
809         DWORD dwOffset;
810         BOOL fDone;
811         LPSTR pszData;
812         LPARAM lpFetchCookie1;
813         LPARAM lpFetchCookie2;
814     } FETCH_BODY_PART;
815
816     typedef struct tagFETCH_CMD_RESULTS
817     {
818         DWORD dwMsgSeqNum;
819         BOOL bMsgFlags;
820         IMAP_MSGFLAGS mfMsgFlags;
821         BOOL bRFC822Size;
822         DWORD dwRFC822Size;
823         BOOL bUID;
824         DWORD dwUID;
825         BOOL bInternalDate;
826         FILETIME ftInternalDate;
827         LPARAM lpFetchCookie1;
828         LPARAM lpFetchCookie2;
829     } FETCH_CMD_RESULTS;
830
831     typedef struct tagIMAPADDR
832     {
833         LPSTR pszName;
834         LPSTR pszADL;
835         LPSTR pszMailbox;
836         LPSTR pszHost;
837         struct tagIMAPADDR *pNext;
838     } IMAPADDR;
839
840     typedef struct tagFETCH_CMD_RESULTS_EX
841     {
842         DWORD dwMsgSeqNum;
843         BOOL bMsgFlags;
844         IMAP_MSGFLAGS mfMsgFlags;
845         BOOL bRFC822Size;
846         DWORD dwRFC822Size;
847         BOOL bUID;
848         DWORD dwUID;
849         BOOL bInternalDate;
850         FILETIME ftInternalDate;
851         LPARAM lpFetchCookie1;
852         LPARAM lpFetchCookie2;
853         BOOL bEnvelope;
854         FILETIME ftENVDate;
855         LPSTR pszENVSubject;
856         IMAPADDR *piaENVFrom;
857         IMAPADDR *piaENVSender;
858         IMAPADDR *piaENVReplyTo;
859         IMAPADDR *piaENVTo;
860         IMAPADDR *piaENVCc;
861         IMAPADDR *piaENVBcc;
862         LPSTR pszENVInReplyTo;
863         LPSTR pszENVMessageID;
864         DWORD dwReserved1;
865         DWORD dwReserved2;
866         DWORD dwReserved3;
867     } FETCH_CMD_RESULTS_EX;
868
869     typedef struct tagMBOX_MSGCOUNT
870     {
871         BOOL bGotExistsResponse;
872         DWORD dwExists;
873         BOOL bGotRecentResponse;
874         DWORD dwRecent;
875         BOOL bGotUnseenResponse;
876         DWORD dwUnseen;
877     } MBOX_MSGCOUNT;
878
879     typedef struct tagIMAP_LISTLSUB_RESPONSE
880     {
881         LPSTR pszMailboxName;
882         IMAP_MBOXFLAGS imfMboxFlags;
883         char cHierarchyChar;
884     } IMAP_LISTLSUB_RESPONSE;
885
886     typedef struct tagIMAP_STATUS_RESPONSE
887     {
888         LPSTR pszMailboxName;
889         BOOL fMessages;
890         DWORD dwMessages;
891         BOOL fRecent;
892         DWORD dwRecent;
893         BOOL fUIDNext;
894         DWORD dwUIDNext;
895         BOOL fUIDValidity;
896         DWORD dwUIDValidity;
897         BOOL fUnseen;
898         DWORD dwUnseen;
899     } IMAP_STATUS_RESPONSE;
900
901     typedef struct tagAPPEND_PROGRESS
902     {
903         DWORD dwUploaded;
904         DWORD dwTotal;
905     } APPEND_PROGRESS;
906
907     typedef [switch_type(IMAP_RESPONSE_TYPE)] union tagIMAP_RESPONSE_DATA
908     {
909         [case (irtMAILBOX_UPDATE)] MBOX_MSGCOUNT *pmcMsgCount;
910         [case (irtDELETED_MSG)] DWORD dwDeletedMsgSeqNum;
911         [case (irtFETCH_BODY)] FETCH_BODY_PART *pFetchBodyPart;
912         [case (irtUPDATE_MSG)] FETCH_CMD_RESULTS *pFetchResults;
913         [case (irtAPPLICABLE_FLAGS, irtPERMANENT_FLAGS)] IMAP_MSGFLAGS imfImapMessageFlags;
914         [case (irtUIDVALIDITY)] DWORD dwUIDValidity;
915         [case (irtREADWRITE_STATUS)] BOOL bReadWrite;
916         [case (irtSEARCH)] IRangeList *prlSearchResults;
917         [case (irtMAILBOX_LISTING)] IMAP_LISTLSUB_RESPONSE illrdMailboxListing;
918         [case (irtMAILBOX_STATUS)] IMAP_STATUS_RESPONSE *pisrStatusResponse;
919         [case (irtAPPEND_PROGRESS)] APPEND_PROGRESS *papAppendProgress;
920         [case (irtUPDATE_MSG_EX)] FETCH_CMD_RESULTS_EX *pFetchResultsEx;
921     } IMAP_RESPONSE_DATA;
922
923     typedef struct tagIMAP_RESPONSE
924     {
925         WPARAM wParam;
926         LPARAM lParam;
927         HRESULT hrResult;
928         LPSTR lpszResponseText;
929         IMAP_RESPONSE_TYPE irtResponseType;
930         [switch_is(irtResponseType)] IMAP_RESPONSE_DATA irdResponseData;
931     } IMAP_RESPONSE;
932
933     HRESULT OnResponse([in] const IMAP_RESPONSE *pirIMAPResponse);
934 }
935
936 [
937 object,
938 uuid(E9E9D8A8-4EDD-11d0-874F-00AA00530EE9),
939 local,
940 ]
941 interface IIMAPTransport : IInternetTransport
942 {
943     const DWORD IMAP_CAPABILITY_IMAP4 = 0x1;
944     const DWORD IMAP_CAPABILITY_IMAP4rev1 = 0x2;
945     const DWORD IMAP_CAPABILITY_IDLE = 0x4;
946     const DWORD IMAP_CAPABILITY_ALLFLAGS = 0x7;
947
948     HRESULT InitNew(
949         [in]    LPSTR pszLogFilePath,
950         [in]    IIMAPCallback *pCBHandler);
951
952     HRESULT NewIRangeList(
953         [out]   IRangeList **pprlNewRangeList);
954
955     HRESULT Capability(
956         [out]   DWORD *pdwCapabilityFlags);
957
958     HRESULT Select(
959         [in]    WPARAM wParam,
960         [in]    LPARAM lParam,
961         [in]    IIMAPCallback *pCBHandler,
962         [in]    LPSTR lpszMailboxName);
963
964     HRESULT Examine(
965         [in]    WPARAM wParam,
966         [in]    LPARAM lParam,
967         [in]    IIMAPCallback *pCBHandler,
968         [in]    LPSTR lpszMailboxName);
969
970     HRESULT Create(
971         [in]    WPARAM wParam,
972         [in]    LPARAM lParam,
973         [in]    IIMAPCallback *pCBHandler,
974         [in]    LPSTR lpszMailboxName);
975
976     HRESULT Delete(
977         [in]    WPARAM wParam,
978         [in]    LPARAM lParam,
979         [in]    IIMAPCallback *pCBHandler,
980         [in]    LPSTR lpszMailboxName);
981
982     HRESULT Rename(
983         [in]    WPARAM wParam,
984         [in]    LPARAM lParam,
985         [in]    IIMAPCallback *pCBHandler,
986         [in]    LPSTR lpszMailboxName,
987         [in]    LPSTR lpszNewMailboxName);
988
989     HRESULT Subscribe(
990         [in]    WPARAM wParam,
991         [in]    LPARAM lParam,
992         [in]    IIMAPCallback *pCBHandler,
993         [in]    LPSTR lpszMailboxName);
994
995     HRESULT Unsubscribe(
996         [in]    WPARAM wParam,
997         [in]    LPARAM lParam,
998         [in]    IIMAPCallback *pCBHandler,
999         [in]    LPSTR lpszMailboxName);
1000
1001     HRESULT List(
1002         [in]    WPARAM wParam,
1003         [in]    LPARAM lParam,
1004         [in]    IIMAPCallback *pCBHandler,
1005         [in]    LPSTR lpszMailboxNameReference,
1006         [in]    LPSTR lpszMailboxNamePattern);
1007
1008     HRESULT Lsub(
1009         [in]    WPARAM wParam,
1010         [in]    LPARAM lParam,
1011         [in]    IIMAPCallback *pCBHandler,
1012         [in]    LPSTR lpszMailboxNameReference,
1013         [in]    LPSTR lpszMailboxNamePattern);
1014
1015     HRESULT Append(
1016         [in]    WPARAM wParam,
1017         [in]    LPARAM lParam,
1018         [in]    IIMAPCallback *pCBHandler,
1019         [in]    LPSTR lpszMailboxName,
1020         [in]    LPSTR lpszMessageFlags,
1021         [in]    FILETIME ftMessageDateTime,
1022         [in]    LPSTREAM lpstmMessageToSave);
1023
1024     HRESULT Close(
1025         [in]    WPARAM wParam,
1026         [in]    LPARAM lParam,
1027         [in]    IIMAPCallback *pCBHandler);
1028
1029     HRESULT Expunge(
1030         [in]    WPARAM wParam,
1031         [in]    LPARAM lParam,
1032         [in]    IIMAPCallback *pCBHandler);
1033
1034     HRESULT Search(
1035         [in]    WPARAM wParam,
1036         [in]    LPARAM lParam,
1037         [in]    IIMAPCallback *pCBHandler,
1038         [in]    LPSTR lpszSearchCriteria,
1039         [in]    boolean bReturnUIDs,
1040         [in]    IRangeList *pMsgRange,
1041         [in]    boolean bUIDRangeList);
1042
1043     HRESULT Fetch(
1044         [in]    WPARAM wParam,
1045         [in]    LPARAM lParam,
1046         [in]    IIMAPCallback *pCBHandler,
1047         [in]    IRangeList *pMsgRange,
1048         [in]    boolean bUIDMsgRange,
1049         [in]    LPSTR lpszFetchArgs);
1050
1051     HRESULT Store(
1052         [in]    WPARAM wParam,
1053         [in]    LPARAM lParam,
1054         [in]    IIMAPCallback *pCBHandler,
1055         [in]    IRangeList *pMsgRange,
1056         [in]    boolean bUIDRangeList,
1057         [in]    LPSTR lpszStoreArgs);
1058
1059     HRESULT Copy(
1060         [in]    WPARAM wParam,
1061         [in]    LPARAM lParam,
1062         [in]    IIMAPCallback *pCBHandler,
1063         [in]    IRangeList *pMsgRange,
1064         [in]    boolean bUIDRangeList,
1065         [in]    LPSTR lpszMailboxName);
1066
1067     HRESULT Noop(
1068         [in]    WPARAM wParam,
1069         [in]    LPARAM lParam,
1070         [in]    IIMAPCallback *pCBHandler);
1071
1072     HRESULT ResizeMsgSeqNumTable(
1073         [in]    DWORD dwSizeOfMbox);
1074
1075     HRESULT UpdateSeqNumToUID(
1076         [in]    DWORD dwMsgSeqNum,
1077         [in]    DWORD dwUID);
1078
1079     HRESULT RemoveSequenceNum(
1080         [in]    DWORD dwDeletedMsgSeqNum);
1081
1082     HRESULT MsgSeqNumToUID(
1083         [in]    DWORD dwMsgSeqNum,
1084         [out]   DWORD *pdwUID);
1085
1086     HRESULT GetMsgSeqNumToUIDArray(
1087         [out]   DWORD **ppdwMsgSeqNumToUIDArray,
1088         [out]   DWORD *pdwNumberOfElements);
1089
1090     HRESULT GetHighestMsgSeqNum(
1091         [out]   DWORD *pdwHighestMSN);
1092
1093     HRESULT ResetMsgSeqNumToUID();
1094
1095     HRESULT SetDefaultCBHandler(
1096         [in]    IIMAPCallback *pCBHandler);
1097
1098     HRESULT Status(
1099         [in]    WPARAM wParam,
1100         [in]    LPARAM lParam,
1101         [in]    IIMAPCallback *pCBHandler,
1102         [in]    LPSTR pszMailboxName,
1103         [in]    LPSTR pszStatusCmdArgs);
1104 }
1105
1106 #if 0
1107 cpp_quote("HRESULT WINAPI CreateRASTransport(IRASTransport **ppTransport);")
1108 cpp_quote("HRESULT WINAPI CreateNNTPTransport(INNTPTransport **ppTransport);")
1109 cpp_quote("HRESULT WINAPI CreateIMAPTransport2(IIMAPTransport2 **ppTransport);")
1110 #endif
1111 cpp_quote("HRESULT WINAPI CreateRangeList(IRangeList **ppRangeList);")
1112 cpp_quote("HRESULT WINAPI CreateSMTPTransport(ISMTPTransport **ppTransport);")
1113 cpp_quote("HRESULT WINAPI CreatePOP3Transport(IPOP3Transport **ppTransport);")
1114 cpp_quote("HRESULT WINAPI CreateIMAPTransport(IIMAPTransport **ppTransport);")