/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 *
 * The contents of this file are subject to the Netscape 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/NPL/
 *
 * 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.org code.
 *
 * The Initial Developer of the Original Code is Netscape
 * Communications Corporation.  Portions created by Netscape are
 * Copyright (C) 1998 Netscape Communications Corporation. All
 * Rights Reserved.
 *
 * Contributor(s): 
 */

#include "nsISupports.idl"
#include "nsIURL.idl"

interface nsIFileSpec;
interface nsIUrlListener;
interface nsIMsgStatusFeedback;
interface nsIMsgIncomingServer;
interface nsIMsgWindow;
interface nsILoadGroup;

[scriptable, uuid(6CFFCEB0-CB8C-11d2-8065-006008128C4E)]
interface nsIMsgMailNewsUrl : nsIURL {
	///////////////////////////////////////////////////////////////////////////////
	// Eventually we'd like to push this type of functionality up into nsIURI.
	// The idea is to allow the "application" (the part of the code which wants to 
	// run a url in order to perform some action) to register itself as a listener
	// on url. As a url listener, the app will be informed when the url begins to run
	// and when the url is finished. 
	////////////////////////////////////////////////////////////////////////////////
	void RegisterListener (in nsIUrlListener aUrlListener);
	void UnRegisterListener (in nsIUrlListener aUrlListener);

	// Eventually these will be removed and replaced with calls to nsIMsgStatusFeedback
	void SetErrorMessage (in string errorMessage);
	void GetErrorMessage (out string errorMessage);

	// if you really want to know what the current state of the url is (running or not
	// running) you should look into becoming a urlListener...
	void SetUrlState(in boolean runningUrl, in nsresult aStatusCode);
	void GetUrlState(out boolean runningUrl);

	void GetServer(out nsIMsgIncomingServer aIncomingServer);

	// the ownership model for msg feedback
	void SetStatusFeedback(in nsIMsgStatusFeedback aMsgFeedback);
	void GetStatusFeedback(out nsIMsgStatusFeedback aMsgFeedback); 

	void SetMsgWindow(in nsIMsgWindow aMsgWindow);
	void GetMsgWindow(out nsIMsgWindow aMsgWindow);

	// the load group is computed from the msgWindow
	readonly attribute nsILoadGroup loadGroup;
	attribute boolean updatingFolder;
	attribute boolean addToMemoryCache; 
};

//////////////////////////////////////////////////////////////////////////////////
// This is a very small interface which I'm grouping with the mailnewsUrl interface.
// Several url types (mailbox, imap, nntp) have similar properties because they can
// represent mail messages. For instance, these urls can be have URI 
// equivalents which represent a message. 
// We want to provide the app the ability to get the URI for the 
// url. This URI to URL mapping doesn't exist for all mailnews urls...hence I'm
// grouping it into a separate interface...
//////////////////////////////////////////////////////////////////////////////////

[scriptable, uuid(02338DD2-E7B9-11d2-8070-006008128C4E)]
interface nsIMsgMessageUrl : nsISupports {
	void GetURI(out string aURI); 
	// used by imap, pop and nntp in order to implement save message to disk
	attribute nsIFileSpec messageFile;
	attribute boolean AddDummyEnvelope;	
    attribute boolean canonicalLineEnding;
};
