mailnews/mapi/mapihook/build/msgMapi.idl
author Mike Kaganski <mikekaganski@gmail.com>
Thu, 17 Jan 2019 15:38:00 +0100
changeset 34237 aaf39a9bd368a7fec19e61ccfadb5179d7fb90e8
parent 34228 335361a67f2d354655b2beb5c670b74a57f96725
child 33955 c6a688894f61e63f9556cad0870372d469611d60
permissions -rw-r--r--
Bug 1048658 - Implement MAPISendMailW(). r=jorgk

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

// This idl will be compiled by MIDL.  MS-COM is used
// as bridge between MAPI clients and the Mozilla.

import "unknwn.idl";

typedef wchar_t LOGIN_PW_TYPE[256];

typedef struct
{
    unsigned long   ulReserved;
    unsigned long   flFlags;           /* Flags */
    unsigned long   nPosition_NotUsed; /* character in text to be replaced by attachment */
    LPSTR           lpszPathName;      /* Full path name including file name */
    LPSTR           lpszFileName;      /* Real (original) file name */
    unsigned char * lpFileType_NotUsed ;
} nsMapiFileDesc, * lpnsMapiFileDesc;


typedef struct
{
    unsigned long    ulReserved;
    unsigned long    ulRecipClass; /* MAPI_TO, MAPI_CC, MAPI_BCC, MAPI_ORIG    */
    LPSTR            lpszName;     /* Recipient name to display */
    LPSTR            lpszAddress;  /* Recipient email address */
    unsigned long    ulEIDSize_NotUsed;
    unsigned char  * lpEntryID_NotUsed ;
} nsMapiRecipDesc, * lpnsMapiRecipDesc;

typedef struct
{
    unsigned long ulReserved;
    LPSTR             lpszSubject;                      /* Message Subject */
    LPSTR             lpszNoteText;                     /* Message Text */
    LPSTR             lpszMessageType;
    LPSTR             lpszDateReceived;                 /* in YYYY/MM/DD HH:MM format */
    LPSTR             lpszConversationID_NotUsed;       /* conversation thread ID */
    unsigned long     flFlags;                          /* unread,return receipt */
    lpnsMapiRecipDesc lpOriginator;                     /* Originator descriptor  */
    unsigned long     nRecipCount;                      /* Number of recipients   */
    [size_is (nRecipCount)] lpnsMapiRecipDesc lpRecips; /* Recipient descriptors  */
    unsigned long     nFileCount;                       /* # of file attachments  */
    [size_is (nFileCount)] lpnsMapiFileDesc lpFiles;    /* Attachment descriptors */
} nsMapiMessage, * lpnsMapiMessage;

typedef struct
{
    unsigned long     ulReserved;
    unsigned long     flFlags;               /* Flags */
    unsigned long     nPosition_NotUsed;     /* character in text to be replaced by attachment */
    LPWSTR            lpszPathName;          /* Full path name including file name */
    LPWSTR            lpszFileName;          /* Real (original) file name */
    unsigned char*    lpFileType_NotUsed;
} nsMapiFileDescW, *lpnsMapiFileDescW;

typedef struct
{
    unsigned long      ulReserved;
    unsigned long      ulRecipClass;  /* MAPI_TO, MAPI_CC, MAPI_BCC, MAPI_ORIG    */
    LPWSTR             lpszName;      /* Recipient name to display */
    LPWSTR             lpszAddress;   /* Recipient email address */
    unsigned long      ulEIDSize_NotUsed;
    unsigned char*     lpEntryID_NotUsed;
} nsMapiRecipDescW, *lpnsMapiRecipDescW;

typedef struct
{
    unsigned long           ulReserved;
    LPWSTR                  lpszSubject;                 /* Message Subject */
    LPWSTR                  lpszNoteText;                /* Message Text */
    LPWSTR                  lpszMessageType;
    LPWSTR                  lpszDateReceived;            /* in YYYY/MM/DD HH:MM format */
    LPWSTR                  lpszConversationID_NotUsed;  /* conversation thread ID */
    unsigned long           flFlags;                     /* unread,return receipt */
    lpnsMapiRecipDescW      lpOriginator;                /* Originator descriptor  */
    unsigned long           nRecipCount;                 /* Number of recipients   */
    [size_is (nRecipCount)] lpnsMapiRecipDescW lpRecips; /* Recipient descriptors  */
    unsigned long           nFileCount;                  /* # of file attachments  */
    [size_is (nFileCount)]  lpnsMapiFileDescW lpFiles;   /* Attachment descriptors */
} nsMapiMessageW, *lpnsMapiMessageW;

[
    object,
    uuid(6EDCD38E-8861-11d5-A3DD-00B0D0F3BAA7),
    helpstring("nsIMapi Interface"),
    pointer_default(unique)
]

interface nsIMapi : IUnknown
{
    HRESULT Login([in] unsigned long aUIArg, [in, unique] LOGIN_PW_TYPE aLogin,
                  [in, unique] LOGIN_PW_TYPE aPassWord, [in] unsigned long aFlags,
                  [out] unsigned long *aSessionId);

    HRESULT Initialize();
    HRESULT IsValid();
    HRESULT IsValidSession([in] unsigned long aSession);

    HRESULT SendMail([in] unsigned long aSession, [in, unique] lpnsMapiMessage aMessage,
                     [in] unsigned long aFlags, [in] unsigned long aReserved) ;

    HRESULT SendDocuments([in] unsigned long aSession,
                          [in, unique] LPTSTR aDelimChar, [in, unique] LPTSTR aFilePaths,
                          [in, unique] LPTSTR aFileNames, [in] ULONG aFlags ) ;

    HRESULT FindNext([in] unsigned long aSession, [in] ULONG ulUIParam, [in, unique] const LPTSTR lpszMessageType,
                     [in, unique] const LPTSTR lpszSeedMessageID, [in] ULONG flFlags, [in] ULONG ulReserved,
                     [in] [out] char lpszMessageID[64] ) ;

    HRESULT ReadMail([in] unsigned long lhSession, [in] ULONG ulUIParam, [in, unique] LPTSTR lpszMessageID,
                     [in] ULONG flFlags, [in] ULONG ulReserved, [out] lpnsMapiMessage *lppMessage);

    HRESULT DeleteMail([in] unsigned long lhSession, [in] ULONG ulUIParam, [in, unique] LPTSTR lpszMessageID,
                       [in] ULONG flFlags, [in] ULONG ulReserved);

    HRESULT SaveMail([in] unsigned long lhSession, [in] ULONG ulUIParam, [in, unique] lpnsMapiMessage lppMessage,
                     [in] ULONG flFlags, [in] ULONG ulReserved, [in, unique] LPTSTR lpszMessageID);

    HRESULT SendMailW([in] unsigned long aSession, [in, unique] lpnsMapiMessageW aMessage,
                      [in] unsigned long aFlags, [in] unsigned long aReserved);

    HRESULT Logoff(unsigned long aSession);
    HRESULT CleanUp();
};