summaryrefslogtreecommitdiffstats
path: root/comm/mailnews/import/public/nsIImportMail.idl
blob: 336fede8f4e86485f29a3c999d4fb0db75111a89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/* -*- 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 nsIImportMailboxDescriptor;
interface nsIMsgFolder;

[scriptable, uuid(a14a3308-0849-420b-86d3-13a2948b5504)]
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 array which contains an nsIImportMailboxDescriptor for each
    mailbox.  The array is not sorted before display to the user.
  */
  Array<nsIImportMailboxDescriptor> 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"
%}