/* ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is Mozilla
 *
 * The Initial Developer of the Original Code is
 * Netscape Communications Corp.
 * Portions created by the Initial Developer are Copyright (C) 2001
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *          Krishna Mohan Khandrika (kkhandrika@netscape.com)
 *          Rajiv Dayal (rdayal@netscape.com)
 *          David Bienvenu (bienvenu@nventure.com)
 *
 * Alternatively, the contents of this file may be used under the terms of
 * either the GNU General Public License Version 2 or later (the "GPL"), or
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 * in which case the provisions of the GPL or the LGPL are applicable instead
 * of those above. If you wish to allow use of your version of this file only
 * under the terms of either the GPL or the LGPL, and not to allow others to
 * use your version of this file under the terms of the MPL, indicate your
 * decision by deleting the provisions above and replace them with the notice
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * the terms of any one of the MPL, the GPL or the LGPL.
 *
 * ***** END LICENSE BLOCK ***** */

// 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 */
    LPTSTR            lpszPathName;          /* Full path name including file name */
    LPTSTR            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;

[
    object,
    uuid(6EDCD38E-8861-11d5-A3DD-00B0D0F3BAA7),
    helpstring("nsIMapi Inteface"),
    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] short aRecipCount, [in, size_is(aRecipCount)] lpnsMapiRecipDesc aRecips, 
                  [in] short aFileCount, [in, size_is(aFileCount)] lpnsMapiFileDesc aFiles, 
                  [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] LPTSTR lpszMessageType,
                              [in, unique] 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 Logoff (unsigned long aSession);
    HRESULT CleanUp();
};



