/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* 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/. */

/*

  Interface for importing mail - ui provided by the import module.  If
  you wish to provide your own UI then implement the nsIImportGeneric
  interface.

*/

/*
  If you support this interface then the standard mailbox import UI
  can be used to drive your import of mailboxes, which means you don't have
  to worry about anything other than implementing this interface
  (and nsIImportModule) to import mailboxes.
*/

/*
  The general process is:
  1) Do you know where the mail is located
  2) Do you want the user to "verify" this location and have
  the option of specifying a different mail directory?
  3) Given a directory (either specified in 1 or 2) build a list
  of all of the mailboxes to be imported.
  4) Import each mail box to the destination provided!
  5) Update the portion of the mailbox imported so far.  This should
  always be less than the mailbox size until you are done.  This
  is used for progress bar updating and MAY BE CALLED FROM ANOTHER
  THREAD!

*/

#include "nsISupports.idl"

interface nsIFile;
interface nsISupportsArray;
interface nsIImportMailboxDescriptor;
interface nsIOutputStream;
interface nsIMsgFolder;

[scriptable, uuid(306561d3-ed2f-425d-87ee-eb129a84a6af)]
interface nsIImportMail : nsISupports
{

  /*
    If found and userVerify BOTH return false, then it is assumed that this
    means an error - mail cannot be found on this machine.
    If userVerify is true, the user will have an opportunity to specify
    a different location to import mail from.
  */
  void   GetDefaultLocation( out nsIFile location,
                out boolean  found,
                out boolean  userVerify);
  /*
    Returns an nsISupportsArray which contains an nsIImportMailboxID for each
    mailbox.  The array is not sorted before display to the user.
  */
  nsISupportsArray FindMailboxes( in nsIFile location);

  /*
    Import a specific mailbox into the destination folder supplied.  If an error
    occurs that is non-fatal, the destination will be deleted and other mailboxes
    will be imported.  If a fatal error occurs, the destination will be deleted
    and the import operation will abort.
  */
  void   ImportMailbox(in nsIImportMailboxDescriptor source,
                       in nsIMsgFolder dstFolder,
                       out wstring errorLog,
                       out wstring successLog,
                       out boolean fatalError);

  /*
    Return the amount of the mailbox that has been imported so far.  This number
    is used to present progress information and must never be larger than the
    size specified in nsIImportMailboxID.GetSize();  May be called from
    a different thread than ImportMailbox()
  */
  unsigned long GetImportProgress();

    /*
   * When migrating the local folders from the import source into mozilla,
   * we want to translate reserved folder names from the import source to
   * equivalent values for Mozilla.
   * Localization Impact is unknown here.
   */
  AString translateFolderName(in AString aFolderName);
};



%{ C++
#define kDestTrashFolderName "Trash"
#define kDestUnsentMessagesFolderName "Unsent Messages"
#define kDestSentFolderName "Sent"
#define kDestInboxFolderName "Inbox"
%}
