//+---------------------------------------------------------------------------
//
//	Copyright 2001 Microsoft Corporation. All Rights Reserved.
//
//	Contents: MSN Messenger UI Automation interfaces
// 
//----------------------------------------------------------------------------

#ifdef __MKTYPLIB__
#define VARIANT_BOOL boolean
#else  // __MKTYPLIB__
cpp_quote("//+-------------------------------------------------------------------------")
cpp_quote("//")
cpp_quote("//  Microsoft Windows")
cpp_quote("//  Copyright 1997 Microsoft Corporation. All Rights Reserved.")
cpp_quote("//")
cpp_quote("//  File: msgrua.h")
cpp_quote("//")
cpp_quote("//--------------------------------------------------------------------------")


import "ocidl.idl";
import "objidl.idl";
import "oleidl.idl";
import "oaidl.idl";


#endif // __MKTYPLIB__
#include "msgruaid.h"

//////////////////////////////////////////////////////////////////////////////////
// GUID usage:
// {218CB450-20B6-11d2-8E17-0000F803A446}-{218CB45F-20B6-11d2-8E17-0000F803A446}

//--------------------------------------------------------------------------
// Type Library
[
	uuid(E02AD29E-80F5-46c6-B416-9B3EBDDF057E), // LIBID_MessengerUA
	version(1.0),
	helpstring("Messenger UI Automation Type Library")
]
library MessengerUA
{
	importlib("stdole32.tlb");
	interface IMessenger;
	dispinterface DMessengerEvents;
	interface IMessengerWindow;
	interface IMessengerContact;
	interface IMessengerContacts;

	#define DISPID_VALUE	  0
	#define DISPID_NEWENUM	 -4

	typedef enum
	{
		MISTATUS_UNKNOWN						 = 0x0000,
		
		MISTATUS_OFFLINE						 = 0x0001,
		MISTATUS_ONLINE 						 = 0x0002,
		MISTATUS_INVISIBLE						 = 0x0006,
		MISTATUS_BUSY							 = 0x000A,
		MISTATUS_BE_RIGHT_BACK					 = 0x000E,
		MISTATUS_IDLE							 = 0x0012,
		MISTATUS_AWAY							 = 0x0022,
		MISTATUS_ON_THE_PHONE					 = 0x0032,
		MISTATUS_OUT_TO_LUNCH					 = 0x0042,
		
		MISTATUS_LOCAL_FINDING_SERVER			 = 0x0100,
		MISTATUS_LOCAL_CONNECTING_TO_SERVER 	 = 0x0200,
		MISTATUS_LOCAL_SYNCHRONIZING_WITH_SERVER = 0x0300,
		MISTATUS_LOCAL_DISCONNECTING_FROM_SERVER = 0x0400,
	}
		MISTATUS;


	typedef  enum
	{
		MCONTACTPROP_INVALID_PROPERTY	  = -1
	} 
		MCONTACTPROPERTY;

	typedef  enum
	{
		MWINDOWPROP_INVALID_PROPERTY	  = -1
	} 
		MWINDOWPROPERTY;

	typedef  enum
	{				
		MPHONE_TYPE_THIS   = -1,
		MPHONE_TYPE_HOME   = 0,
		MPHONE_TYPE_WORK   = 1,
		MPHONE_TYPE_MOBILE = 2,
	}
		MPHONE_TYPE;


	typedef enum
	{
		MOPT_GENERAL_PAGE					= 0,
		MOPT_PRIVACY_PAGE					= 1,
		MOPT_EXCHANGE_PAGE					= 2,
		MOPT_ACCOUNTS_PAGE					= 3,
		MOPT_CONNECTION_PAGE				= 4,
		MOPT_PREFERENCES_PAGE				= 5,
		MOPT_SERVICES_PAGE					= 6,
		MOPT_PHONE_PAGE 					= 7,
	}
		MOPTIONPAGE;

	typedef enum
	{
		MUAFOLDER_INBOX 						 = 0,
		MUAFOLDER_ALL_OTHER_FOLDERS 			 = 1,	
	}
		MUAFOLDER;


	//--------------------------------------------------------------------------
	// IMessengerWindow Interface
	[
		uuid(D6B0E4C8-FAD6-4885-B271-0DC5A584ADF8), // IID_IMessengerWindow 
		helpstring("Messenger Window Interface"),
		helpcontext(0x0000),
		dual,
		oleautomation
	]
	interface IMessengerWindow : IDispatch
	{
	  [ id(DISPID_MUAW_CLOSE), helpstring("Close the window."), helpcontext(0x0000)]
	  HRESULT Close();
	  [ id(DISPID_MUAW_HWND), propget, helpstring("Returns the Handle of the Application window."), helpcontext(0x0000)]
	  HRESULT HWND([out, retval] LONG *phWnd);

	  [ id(DISPID_MUAW_LEFT), propget, helpstring("The horizontal position (pixels) of the Application window relative to the screen."), helpcontext(0x0000)]
	  HRESULT Left([out, retval] LONG *plLeft);

	  [ id(DISPID_MUAW_LEFT), propput, helpstring("The horizontal position (pixels) of the Application window relative to the screen."), helpcontext(0x0000)]
	  HRESULT Left([in] LONG lLeft);

	  [ id(DISPID_MUAW_TOP), propget, helpstring("The vertical position (pixels) of the Application window relative to the screen."), helpcontext(0x0000)]
	  HRESULT Top([out, retval] LONG *plTop);

	  [ id(DISPID_MUAW_TOP), propput, helpstring("The vertical position (pixels) of the Application window relative to the screen."), helpcontext(0x0000)]
	  HRESULT Top([in] LONG lTop);

	  [ id(DISPID_MUAW_WIDTH), propget, helpstring("The horizontal dimension (pixels) of the Application window."), helpcontext(0x0000)]
	  HRESULT Width([out, retval] LONG *plWidth);

	  [ id(DISPID_MUAW_WIDTH), propput, helpstring("The horizontal dimension (pixels) of the Application window."), helpcontext(0x0000)]
	  HRESULT Width([in] LONG lWidth);

	  [ id(DISPID_MUAW_HEIGHT), propget, helpstring("The vertical dimension (pixels) of the Application window."), helpcontext(0x0000)]
	  HRESULT Height([out, retval] LONG *plHeight);

	  [ id(DISPID_MUAW_HEIGHT), propput, helpstring("The vertical dimension (pixels) of the Application window."), helpcontext(0x0000)]
	  HRESULT Height([in] LONG lHeight);

	  [ id(DISPID_MUAW_ISCLOSED), propget, helpstring("Get visibility of the window."), helpcontext(0x0000)]
	  HRESULT IsClosed([out, retval] VARIANT_BOOL* pBoolClose);

	  [ id(DISPID_MUAW_SHOW), helpstring("Show the window."), helpcontext(0x0000)]
	  HRESULT Show();

	  [id(DISPID_MUAW_PROPERTY), propget, helpstring("Returns an specific property of the window."),  helpcontext(0x0000)]
	  HRESULT Property(
					   [in] MWINDOWPROPERTY ePropType,
					   [out, retval] VARIANT *pvPropVal);					   

	  [id(DISPID_MUAW_PROPERTY), propput, helpstring("Set an specific property of the window."),  helpcontext(0x0000)]
	  HRESULT Property(
					   [in] MWINDOWPROPERTY ePropType,
					   [in] VARIANT vPropVal);					   


	}
	//--------------------------------------------------------------------------
	// IMessenger Interface
	[
		uuid(D50C3186-0F89-48f8-B204-3604629DEE10), // IID_IMessenger
		helpstring("Messenger UI Automation Interface"),
		helpcontext(0x0000),
		dual,
		oleautomation
	]
	interface IMessenger : IDispatch
	{
	  [id(DISPID_MUAM_WINDOW), propget, helpstring("Returns main window IMessengerWindow object.")]
	  HRESULT Window([out, retval] IDispatch ** ppMWindow);		
	  
	  [id(DISPID_MUAM_VIEWPROFILE), helpstring("Initiates view contact profile.")]
	  HRESULT ViewProfile([in] VARIANT vContact);
	  
	  [id(DISPID_MUAM_RECEIVEDIR), propget, helpstring("Returns the path to the receive directory.")]
	  HRESULT ReceiveFileDirectory([out, retval] BSTR * bstrPath );
	  
	  [id(DISPID_MUAM_STARTVOICE), helpstring("Initiates voice conversation.")]
	  HRESULT StartVoice([in] VARIANT vContact, [out, retval] IDispatch ** ppMWindow);
	  
	  [id(DISPID_MUAM_INVITEAPP), helpstring("Initiates invite application.")]
	  HRESULT InviteApp([in] VARIANT vContact, [in] BSTR bstrAppID, [out, retval] IDispatch **ppMWindow);
	  
	  [id(DISPID_MUAM_SENDMAIL), helpstring("Initiates default e-mail provider compose window.")]
	  HRESULT SendMail([in] VARIANT vContact);
	  
	  [id(DISPID_MUAM_OPENINBOX), helpstring("Initiates default e-mail application.")]
	  HRESULT OpenInbox();
	  
	  [id(DISPID_MUAM_SENDFILE), helpstring("Initiates send file invite.")]
	  HRESULT SendFile( [in] VARIANT vContact, 
						[in] BSTR bstrFileName,
						[out, retval] IDispatch ** ppMWindow);

	  [id(DISPID_MUAM_SIGNOUT), helpstring("Initiates a sign out from all services."), helpcontext(0x0000)]
	  HRESULT Signout();

	  [ id(DISPID_MUAM_SIGNIN), helpstring("Initiates signin dialog and populates signin name and password edit boxes."), helpcontext(0x0000)]
	  HRESULT Signin(
					 [in] LONG hwndParent,
					 [in] BSTR bstrSigninName,
					 [in] BSTR bstrPassword);

	  [id(DISPID_MUAM_GETCONTACT), helpstring("Find contact in list.")]
	  HRESULT GetContact( [in] BSTR bstrSigninName,
						  [in] BSTR bstrServiceId,
						  [out, retval] IDispatch ** ppMContact); 
									
	  [ id(DISPID_MUAM_OPTIONUI), helpstring("Initiates Options dialog."), helpcontext(0x0000)]
	  HRESULT OptionsPages(
						   [in] LONG hwndParent,
						   [in] MOPTIONPAGE mOptionPage);

	  [ id(DISPID_MUAM_ADDUI), helpstring("Initiates Add Contact dialog."), helpcontext(0x0000)]
	  HRESULT AddContact(
						 [in] LONG hwndParent,
						 [in] BSTR bstrEMail);

	  [ id(DISPID_MUAM_FINDUI), helpstring("Initiates Find Contact Dialog."), helpcontext(0x0000)]
	  HRESULT FindContact(
						  [in] LONG hwndParent,
						  [in] BSTR bstrFirstName,
						  [in] BSTR bstrLastName,
						  [in, optional] VARIANT vbstrCity,
						  [in, optional] VARIANT vbstrState,
						  [in, optional] VARIANT vbstrCountry);

	  [ id(DISPID_MUAM_INSTANTMESSAGE), helpstring("Initiates IM Window."), helpcontext(0x0000)]
	  HRESULT InstantMessage(
							 [in] VARIANT vContact,
							 [out, retval] IDispatch** ppMWindow); 

	  [ id(DISPID_MUAM_PHONEUI), helpstring("Initiates Phone Window."), helpcontext(0x0000)]
	  HRESULT Phone(
					[in] VARIANT vContact, 
					[in] MPHONE_TYPE ePhoneNumber,
					[in] BSTR bstrNumber,
					[out, retval] IDispatch** ppMWindow); 

	  [ id(DISPID_MUAM_AUDIOUI), helpstring("Initiates audio tuning wizard."), helpcontext(0x0000)]
	  HRESULT MediaWizard(
						  [in] LONG hwndParent);

	  [ id(DISPID_MUAM_PAGERUI), helpstring("Initiates pager instant message  Window."), helpcontext(0x0000)]
	  HRESULT Page(
				   [in] VARIANT vContact,
				   [out, retval] IDispatch** ppMWindow); 
		
	  [ id(DISPID_MUAM_AUTOSIGNIN), helpstring("Initiates a signin without UI if connected to the network and contact saved the password."), helpcontext(0x0000)]
	  HRESULT AutoSignin();

	  [ id(DISPID_MUAM_CONTACTS), propget, helpstring("Returns the contact list.")]
	  HRESULT MyContacts([out, retval] IDispatch ** ppMContacts); 

	  [ id(DISPID_MUAM_SIGNINNAME), propget, helpstring("Returns signin name.")]
	  HRESULT MySigninName([out, retval] BSTR * pbstrName);

	  [ id(DISPID_MUAM_FRIENDLYNAME), propget, helpstring("Returns friendly Name.")]
	  HRESULT MyFriendlyName([out, retval] BSTR * pbstrName);

	  [ id(DISPID_MUAM_STATUS), propput, helpstring("Set my status.")]
	  HRESULT MyStatus([in] MISTATUS mStatus);

	  [ id(DISPID_MUAM_STATUS), propget, helpstring("Returns my status.")]
	  HRESULT MyStatus([out, retval] MISTATUS* pmStatus);

	  [id(DISPID_MUAM_UNREADEMAILCOUNT), propget, helpstring("Returns the number of unread e-mail from default provider.")]
	  HRESULT UnreadEmailCount([in] MUAFOLDER mFolder, [out, retval] LONG * plCount); 

	  [id(DISPID_MUAM_MYSERVICENAME), propget, helpstring("Returns my primary service name."), helpcontext(0x0000)]
	  HRESULT MyServiceName([out, retval] BSTR * pbstrServiceName);
		
	  [id(DISPID_MUAM_MYPHONENUMBER), propget, helpstring("Returns one of my phone numbers."), helpcontext(0x0000)]
	  HRESULT MyPhoneNumber([in] MPHONE_TYPE PhoneType, [out, retval] BSTR * pbstrNumber);

	  [id(DISPID_MUAM_MYPROPERTY), propget, helpstring("Returns my specific property"),  helpcontext(0x0000)]
	  HRESULT MyProperty(
						 [in] MCONTACTPROPERTY ePropType,
						 [out, retval] VARIANT *pvPropVal);					   

	  [id(DISPID_MUAM_MYPROPERTY), propput, helpstring("Set my specific property."),  helpcontext(0x0000)]
	  HRESULT MyProperty(
						 [in] MCONTACTPROPERTY ePropType,
						 [in] VARIANT vPropVal);					   

	  [id(DISPID_MUAM_SERVICEID), propget, helpstring("Return my primary service ID."), helpcontext(0x0000)]
	  HRESULT MyServiceId([out, retval] BSTR * pbstrServiceId);


	  [id(DISPID_MUAM_SERVICES), propget, helpstring("Returns services list."), helpcontext(0x0000)]
	  HRESULT Services([out, retval] IDispatch ** ppdispServices);

	}

	//--------------------------------------------------------------------------
	// DMessengerEvents Interface
	[
		uuid(C9A6A6B6-9BC1-43a5-B06B-E58874EEBC96), // DIID_DMessengerEvents
		helpstring("Messenger Events"),
		hidden
	]
	dispinterface DMessengerEvents
	{
	properties:
	methods:

	  [id(DISPID_MUAE_ONAPPSHUTDOWN), helpstring("Messenger is shutting down."), helpcontext(0x0000)]
		void OnAppShutdown();	

	  [id(DISPID_MUAE_ONSIGNIN), helpstring("Signin attempt complete.")]
		void OnSignin([in] LONG hr);
			
	  [id(DISPID_MUAE_ONSIGNOUT), helpstring("Signout attempt complete.")]
		void OnSignout();

	  [id(DISPID_MUAE_ONLISTADD), helpstring("Resutlt from list add request.")]
		void OnContactListAdd([in] LONG hr,
							  [in] IDispatch* pMContact);
			
	  [id(DISPID_MUAE_ONLISTREMOVE), helpstring("Result from list remove request.")]
		void OnContactListRemove([in] LONG hr,
								 [in] IDispatch * pMContact);

	  [id(DISPID_MUAE_ONMYFRIENDLYNAMECHANGE), helpstring("Result from my friendly name change request.")]
		void OnMyFriendlyNameChange([in] LONG hr,								
									[in] BSTR bstrPrevFriendlyName);

	  [id(DISPID_MUAE_ONMYSTATECHANGE), helpstring("My status changed.")]
		void OnMyStatusChange([in] LONG hr,
							  [in] MISTATUS mMYStatusOE);

	  [id(DISPID_MUAE_ONMYPHONECHANGE), helpstring("Result from one of my phone numbers change request."), helpcontext(0x0000)]
		void OnMyPhoneChange(
							 [in] MPHONE_TYPE PhoneType, 
							 [in] BSTR bstrNUmber);
		
	  [id(DISPID_MUAE_ONMYPROPERTYCHANGE), helpstring("Result from one of my attributes change request."), helpcontext(0x0000)]
		void OnMyPropertyChange([in] LONG hr,
								[in] MCONTACTPROPERTY ePropType,
								[in] VARIANT vPropVal); 		

	  [id(DISPID_MUAE_ONUSERFRIENDLYNAMECHANGE), helpstring("Result from contact friendly name change request.")]
		void OnContactFriendlyNameChange([in] LONG hr,
										 [in] IDispatch* pMContact,
										 [in] BSTR bstrPrevFriendlyName);

	  [id(DISPID_MUAE_ONUSERSTATECHANGE), helpstring("Contact state changed.")]
		void OnContactStatusChange([in] IDispatch* pMContact,
								   [in] MISTATUS mPrevStatusOE);

	  [id(DISPID_MUAE_ONUSERPROPERTYCHANGE), helpstring("Result from one of contact attributes change notification."), helpcontext(0x0000)]
		void OnContactPropertyChange(
									 [in] LONG hr,
									 [in] IDispatch * pContact,
									 [in] MCONTACTPROPERTY ePropType,
									 [in] VARIANT vPropVal); 	

	  [id(DISPID_MUAE_ONUSERBLOCKCHANGE), helpstring("Result from contact block state change notification."), helpcontext(0x0000)]
		void OnContactBlockChange(			
								  [in] LONG hr,
								  [in] IDispatch * pContact,
								  [in] VARIANT_BOOL pBoolBlock);


	  [id(DISPID_MUAE_ONUSERPAGERCHANGE), helpstring("Result from contact pager configuration change notification."), helpcontext(0x0000)]
		void OnContactPagerChange(
								  [in] LONG hr,
								  [in] IDispatch * pContact,
								  [in] VARIANT_BOOL pBoolPage);

	  [id(DISPID_MUAE_ONUSERPHONECHANGE), helpstring("Result from one of contact phone numbers change notification."), helpcontext(0x0000)]
		void OnContactPhoneChange(
								  [in] LONG hr,
								  [in] IDispatch * pContact,
								  [in] MPHONE_TYPE PhoneType, 
								  [in] BSTR bstrNUmber);

	  [id(DISPID_MUAE_ONUNREADEMAILCHANGE), helpstring("Unread email count has changed."), helpcontext(0x0000)]
		void OnUnreadEmailChange(
								 [in] MUAFOLDER mFolder, 		
								 [in] LONG cUnreadEmail,
								 [in, out] VARIANT_BOOL* pBoolfEnableDefault);
		
		
	}
	//--------------------------------------------------------------------------
	// IMessengerContact Interface
	[
		uuid(E7479A0F-BB19-44a5-968F-6F41D93EE0BC), // IID_IMessengerContact
		helpstring("Messenger Contact for IMessenger"),
		dual,
		oleautomation	
	]
	interface IMessengerContact : IDispatch
	{
	  [id(DISPID_MUAC_FRIENDLYNAME), propget, helpstring("Returns friendly Name of the contact."), helpcontext(0x0000)]
	  HRESULT FriendlyName([out, retval] BSTR * pbstrFriendlyName);
			
	  [id(DISPID_MUAC_STATUS), propget, helpstring("Returns status of the contact."), helpcontext(0x0000)]
	  HRESULT Status([out, retval] MISTATUS * pMstate);
	  
	  [id(DISPID_MUAC_SIGNINNAME), propget, helpstring("Returns signin Name of the contact."), helpcontext(0x0000)]
	  HRESULT SigninName([out, retval] BSTR * pbstrSigninName);
	  
	  [id(DISPID_MUAC_SERVICENAME), propget, helpstring("Return service name of the contact."), helpcontext(0x0000)]
	  HRESULT ServiceName([out, retval] BSTR * pbstrServiceName);

	  [id(DISPID_MUAC_BLOCK), propget, helpstring("Block / Unblock the contact"), helpcontext(0x0000)]
	  HRESULT Blocked([out, retval] VARIANT_BOOL * pBoolBlock);

	  [id(DISPID_MUAC_BLOCK), propput, helpstring("Block / Unblock the contact"), helpcontext(0x0000)]
	  HRESULT Blocked([in] VARIANT_BOOL pBoolBlock);

	  [id(DISPID_MUAC_CANPAGE), propget, helpstring("The contact has a pager configured?"), helpcontext(0x0000)]
	  HRESULT CanPage([out, retval] VARIANT_BOOL* pBoolPage);

	  [id(DISPID_MUAC_PHONENUMBER), propget, helpstring("Returns Contact's phone number"), helpcontext(0x0000)]
	  HRESULT PhoneNumber([in] MPHONE_TYPE PhoneType, [out, retval] BSTR * bstrNumber);
	  
	  [id(DISPID_MUAC_ISSELF), propget, helpstring("Is this contact the local contact?"), helpcontext(0x0000)]
	  HRESULT IsSelf([out, retval] VARIANT_BOOL* pBoolSelf);
	
	  [id(DISPID_MUAC_PROPERTY), propget, helpstring("Returns an specific property of the contact."),  helpcontext(0x0000)]
	  HRESULT Property(
					   [in] MCONTACTPROPERTY ePropType,
					   [out, retval] VARIANT *pvPropVal);		

	  [id(DISPID_MUAC_PROPERTY), propput, helpstring("Set an specific property of the contact."),  helpcontext(0x0000)]
	  HRESULT Property(
					   [in] MCONTACTPROPERTY ePropType,
					   [in] VARIANT vPropVal);					   

	  [id(DISPID_MUAC_SERVICEID), propget, helpstring("Return contact's service ID."), helpcontext(0x0000)]
	  HRESULT ServiceId([out, retval] BSTR * pbstrServiceID);
			   
	}

	//--------------------------------------------------------------------------
	// IMessengerContacts Interface
	[
	 uuid(E7479A0D-BB19-44a5-968F-6F41D93EE0BC), // IID_IMessengerContacts
	 helpstring("Messenger Contacts Collection for IMessenger"),
	 dual,
	 oleautomation
	]
	  interface IMessengerContacts : IDispatch
	  {
		[id(DISPID_MUAC_COUNT), propget, helpstring("Returns number of contacts.")]
		HRESULT Count([out, retval] LONG* pcContacts);

		[id(DISPID_VALUE), helpstring("Returns a specific contact by index.")]
		HRESULT Item([in] LONG Index,
					 [out, retval] IDispatch** ppMContact);
		
		[id(DISPID_MUAC_REMOVE), helpstring("Removes a user object from the collection.")]
		HRESULT Remove([in] IDispatch * pMContact);

		[id(DISPID_NEWENUM), propget, restricted, helpstring("Enumerates the users.")]
		HRESULT _NewEnum([out, retval] IUnknown **ppUnknown);
	  }
	
	[
	 uuid(B69003B3-C55E-4b48-836C-BC5946FC3B28), // CLSID_MessengerUIAutomation
	 helpstring("Messenger UI Automation"),
	 appobject
	]
	  coclass MessengerUIAutomation
	  {
		[default] interface IMessenger;
		[default, source] dispinterface DMessengerEvents;
	  };
};