mailnews/import/public/nsIImportMail.idl
author Philipp Kewisch <mozilla@kewis.ch>
Fri, 16 Sep 2011 12:12:06 +0200
changeset 9183 69c4e650e7b52a985969318a7766413f2b0c19a9
parent 1797 2a898db448627c32e37c1a352a18e31540dfbd97
child 12080 c752678985e4fd526cda8c3a729efd64cfa43f2d
permissions -rw-r--r--
Fix bug 678343 - Adapt to the new chrome worker code / Cannot parse ICS files / workerfactory undefined. r=mmecca

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** 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.org code.
 *
 * The Initial Developer of the Original Code is
 * Netscape Communications Corporation.
 * Portions created by the Initial Developer are Copyright (C) 1998
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *
 * Alternatively, the contents of this file may be used under the terms of
 * either of 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 ***** */

/*

  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;

[scriptable, uuid(cf208fac-b275-449d-9dc9-0d8f16c59fe1)]
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 file 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 nsIFile destination,
               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"
%}