#include "nsISupports.idl"

typedef long nsMsgLogonRedirectionState;
interface nsIPrompt;

[scriptable, uuid(e20261f6-df4f-11d3-b9f9-00108335942a)]
interface nsMsgLogonRedirectionStates
{
	const long Idle = 0;
	const long Connecting = 1;
	const long Negotiating = 2;
	const long Waiting = 3;
	const long Validating = 4;
};

typedef long nsMsgLogonRedirectionServiceID;

[scriptable, uuid(182CB845-EB0D-11d3-98B7-001083010E9B)]
interface nsMsgLogonRedirectionServiceIDs
{
	const long Imap = 0;
	const long Smtp = 1;
	const long AbSync = 2;
};

[scriptable, uuid(3c882b66-df4f-11d3-b9f9-00108335942a)]
interface nsIMsgLogonRedirectionRequester : nsISupports
{
  /* Erron on processing the logon redirection */
  void OnLogonRedirectionError(in wstring pErrMsg, in boolean badPassword);
  
  /* Logon Redirection Progress */
  void OnLogonRedirectionProgress(in nsMsgLogonRedirectionState pState);

  /* reply with logon redirection data. */
  void OnLogonRedirectionReply(in wstring pHost, in unsigned short pPort, in string pCookieData, in unsigned short pCookieSize);
}; 

/* this is the service we use to request a logon redirection */ 
[scriptable, uuid(0c2e96ac-e0ae-11d3-a560-0060b0fc04b7)] 
interface nsIMsgLogonRedirector : nsISupports 
{ 
  // RequiresPassword --> if the subsequent logon call still requires a password to succeed, then the
  // redirector will return true for this. If the redirector already has a connection open and doesn't really
  // need a password again, then this will return false. This method gives us a poor man's version of password
  // caching so the redirection requestor doesn't have to prompt for a password every time the requestor
  // wishes to log on.
  // aUserName --> the user name we wish to log in under...
  boolean requiresPassword(in string aUserName, in string aRedirectorType);
  void logon(in string userName, in string password, in string redirectorType, in nsIPrompt aPrompt, in nsIMsgLogonRedirectionRequester listener, in nsMsgLogonRedirectionServiceID aServiceID); 
  void logoff(in string userName); /* might not need this one */ 
}; 

