summaryrefslogtreecommitdiffstats
path: root/mailnews/import/public
diff options
context:
space:
mode:
Diffstat (limited to 'mailnews/import/public')
-rw-r--r--mailnews/import/public/moz.build21
-rw-r--r--mailnews/import/public/nsIImportABDescriptor.idl70
-rw-r--r--mailnews/import/public/nsIImportAddressBooks.idl153
-rw-r--r--mailnews/import/public/nsIImportFieldMap.idl72
-rw-r--r--mailnews/import/public/nsIImportFilters.idl32
-rw-r--r--mailnews/import/public/nsIImportGeneric.idl89
-rw-r--r--mailnews/import/public/nsIImportMail.idl98
-rw-r--r--mailnews/import/public/nsIImportMailboxDescriptor.idl46
-rw-r--r--mailnews/import/public/nsIImportMimeEncode.idl42
-rw-r--r--mailnews/import/public/nsIImportModule.idl32
-rw-r--r--mailnews/import/public/nsIImportService.idl59
-rw-r--r--mailnews/import/public/nsIImportSettings.idl39
12 files changed, 753 insertions, 0 deletions
diff --git a/mailnews/import/public/moz.build b/mailnews/import/public/moz.build
new file mode 100644
index 000000000..69efefb66
--- /dev/null
+++ b/mailnews/import/public/moz.build
@@ -0,0 +1,21 @@
+# vim: set filetype=python:
+# 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/.
+
+XPIDL_SOURCES += [
+ 'nsIImportABDescriptor.idl',
+ 'nsIImportAddressBooks.idl',
+ 'nsIImportFieldMap.idl',
+ 'nsIImportFilters.idl',
+ 'nsIImportGeneric.idl',
+ 'nsIImportMail.idl',
+ 'nsIImportMailboxDescriptor.idl',
+ 'nsIImportMimeEncode.idl',
+ 'nsIImportModule.idl',
+ 'nsIImportService.idl',
+ 'nsIImportSettings.idl',
+]
+
+XPIDL_MODULE = 'import'
+
diff --git a/mailnews/import/public/nsIImportABDescriptor.idl b/mailnews/import/public/nsIImportABDescriptor.idl
new file mode 100644
index 000000000..fe0ca1b31
--- /dev/null
+++ b/mailnews/import/public/nsIImportABDescriptor.idl
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* 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.
+
+ Can I get an attribute set method to take a const value???
+
+ */
+
+#include "nsISupports.idl"
+
+interface nsIFile;
+
+/**
+ * Implementation Note:
+ *
+ * The default implementation can be obtained from
+ * nsIImportService::CreateNewABDescriptor();
+ *
+ * You should only be interested in using this class if you implement
+ * the nsIImportAddressBooks interface in which case, just using the service to
+ * create new ones should work fine for you. If not, implement your
+ * own.
+ */
+[scriptable, uuid(2d8983b2-cea6-4ae2-9145-eb772481fa18)]
+interface nsIImportABDescriptor : nsISupports
+{
+ /**
+ * use the following 2 attributes however you'd like to
+ * refer to a specific address book
+ */
+ attribute unsigned long identifier;
+ attribute unsigned long ref;
+
+ /**
+ * Doesn't have to be accurate, this is merely used to report progress.
+ * If you're importing a file, using file size and reporting progress
+ * as the number of bytes processed so far makes sense. For other formats
+ * returning the number of records may make more sense.
+ */
+ attribute unsigned long size;
+
+ /**
+ * The preferred name for this address book. Depending upon how the
+ * user selected import, the caller of the nsIImportAddressBooks interface
+ * may use this name to create the destination address book or it may
+ * ignore it. However, this must be provided in all cases as it is
+ * also displayed in the UI to the user.
+ */
+ attribute AString preferredName;
+
+ /**
+ * For address books that want a file descriptor to locate the address book.
+ * For formats that do not, use identifier & ref to refer to the address book
+ * OR implement your own nsIImportABDescriptor that contains additional data
+ * necessary to identify specific address books,
+ */
+ attribute nsIFile abFile;
+
+ /**
+ * Set by the UI to indicate whether or not this address book should be imported.
+ */
+ attribute boolean import;
+};
diff --git a/mailnews/import/public/nsIImportAddressBooks.idl b/mailnews/import/public/nsIImportAddressBooks.idl
new file mode 100644
index 000000000..a6f9a7800
--- /dev/null
+++ b/mailnews/import/public/nsIImportAddressBooks.idl
@@ -0,0 +1,153 @@
+/* -*- 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 address books using the standard UI. Address
+ book import occurs in several forms (yuck!).
+ The destination can be 1..n new address books corresponding to the source
+ format. For instance a text file would import into a new address book
+ with the same name as the text file.
+ The destination can be 1 pre-defined address book, all entries will be
+ added to the supplied address book - this allows the address book UI so provide
+ an import command specific for an individual address book.
+
+ The source can import 1 or multiple address books.
+ The address books can be auto-discoverable or user specified.
+ The address books can require field mapping or not.
+
+ All of this is rather complicated but it should work out OK.
+ 1) The first UI
+ panel will allow selection of the address book and will indicate to the user
+ if the address book will be imported into an existing address book or new address
+ books. (This could be 2 separate xul UI's?).
+ 2) The second panel will show field mapping if it is required - if it is required then
+ there will be one panel per address book for formats that support multiple
+ address books. If it is not required then there will be no second panel.
+ 3) Show the progress dialog for the import - this could be per address book if
+ mapping is required? what to do, what to doooooo.....
+ 4) All done, maybe a what was done panel??
+*/
+
+#include "nsISupports.idl"
+
+interface nsIFile;
+interface nsIArray;
+interface nsIImportABDescriptor;
+interface nsIAddrDatabase;
+interface nsIImportFieldMap;
+
+[scriptable, uuid(6bba48be-331c-41e3-bc9f-c2ea3754d977)]
+interface nsIImportAddressBooks : nsISupports
+{
+
+ /*
+ Does this interface supports 1 or 1..n address books. You only
+ get to choose 1 location so for formats where 1..n address books
+ are imported from a directory, then return true. For a 1 to 1 relationship
+ between location and address books return false.
+ */
+ boolean GetSupportsMultiple();
+
+ /*
+ If the address book is not found via a file location.then return true
+ along with a description string of how or where the address book is
+ located. If it is a file location then return false.
+ If true, return a string like: "Outlook Express standard address book,
+ also known as the Windows address book" or just "Outlook Express address book".
+ If false, GetDefaultLocation will be called.
+ */
+
+ boolean GetAutoFind( out wstring description);
+
+ /*
+ Returns true if the address book needs the user to specify a field map
+ for address books imported from this format.
+ */
+ boolean GetNeedsFieldMap( in nsIFile location);
+
+ /*
+ If found and userVerify BOTH return false, then it is assumed that this
+ means an error - address book cannot be found on this machine.
+ If userVerify is true, the user will have an opportunity to specify
+ a different location to import address book from.
+ */
+ void GetDefaultLocation( out nsIFile location,
+ out boolean found,
+ out boolean userVerify);
+ /*
+ Returns an nsIArray which contains an nsIImportABDescriptor for each
+ address book. The array is not sorted before display to the user.
+ location is null if GetAutoFind returned true.
+ */
+ nsIArray FindAddressBooks(in nsIFile location);
+
+ /*
+ Fill in defaults (if any) for a field map for importing address
+ books from this location.
+ */
+ void InitFieldMap(in nsIImportFieldMap fieldMap);
+
+ /**
+ * Import a specific address book into the destination file supplied.
+ * If an error occurs that is non-fatal, the destination will be deleted and
+ * other adress book will be imported. If a fatal error occurs, the
+ * destination will be deleted and the import operation will abort.
+ *
+ * @param aSource The source data for the import.
+ * @param aDestination The proxy database for the destination of the
+ * import.
+ * @param aFieldMap The field map containing the mapping of fields to be
+ * used in cvs and tab type imports.
+ * @param aSupportService An optional proxy support service (nullptr is
+ * acceptable if it is not required), may be required
+ * for certain import types (e.g. nsIAbLDIFService for
+ * LDIF import).
+ * @param aErrorLog The error log from the import.
+ * @param aSuccessLog The success log from the import.
+ * @param aFatalError True if there was a fatal error doing the import.
+ */
+ void ImportAddressBook(in nsIImportABDescriptor aSource,
+ in nsIAddrDatabase aDestination,
+ in nsIImportFieldMap aFieldMap,
+ in nsISupports aSupportService,
+ out wstring aErrorLog,
+ out wstring aSuccessLog,
+ out boolean aFatalError);
+
+ /*
+ Return the amount of the address book that has been imported so far. This number
+ is used to present progress information and must never be larger than the
+ size specified in nsIImportABDescriptor.GetSize(); May be called from
+ a different thread than ImportAddressBook()
+ */
+ unsigned long GetImportProgress();
+
+ /*
+ Set the location for reading sample data, this should be the same
+ as what is passed later to FindAddressBooks
+ */
+ void SetSampleLocation( in nsIFile location);
+
+ /*
+ * Return a string of sample data for a record, each field
+ * is separated by a newline (which means no newlines in the fields!)
+ * This is only supported by address books which use field maps and
+ * is used by the field map UI to allow the user to properly
+ * align fields to be imported.
+ *
+ * @param recordNumber index of the recrds, starting from 0.
+ * @param recordExists true if the record exists.
+ *
+ * @returns a string of sample data for the desired record
+ */
+ wstring GetSampleData(in long recordNumber, out boolean recordExists);
+
+};
+
+
+
+%{ C++
+
+%}
diff --git a/mailnews/import/public/nsIImportFieldMap.idl b/mailnews/import/public/nsIImportFieldMap.idl
new file mode 100644
index 000000000..693e4be87
--- /dev/null
+++ b/mailnews/import/public/nsIImportFieldMap.idl
@@ -0,0 +1,72 @@
+/* -*- 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/. */
+
+/*
+ Field map interface for importing address books
+
+ A field map is an arbitrary sized list of mozilla address book fields.
+ The field map is used by import to map fields from the import format
+ to mozilla fields.
+ For export, the map contains the ordered list of mozilla fields to
+ export!
+*/
+
+#include "nsISupports.idl"
+
+interface nsIAddrDatabase;
+interface nsIMdbRow;
+interface nsIAbCard;
+
+[scriptable, uuid(deee9264-1fe3-47b1-b745-47b22de454e2)]
+interface nsIImportFieldMap : nsISupports
+{
+ /*
+ Flag to indicate whether or not to skip the first record,
+ for instance csv files often have field names as the first
+ record
+ */
+ attribute boolean skipFirstRecord;
+
+ readonly attribute long numMozFields;
+ readonly attribute long mapSize;
+
+ wstring GetFieldDescription( in long index);
+
+ /*
+ Set the size of the field map, all unpopulated entries
+ will default to -1
+ */
+ void SetFieldMapSize( in long size);
+
+ /*
+ Initialize the field map to a given size with default values
+ */
+ void DefaultFieldMap( in long size);
+
+ /*
+ Return the field number that this index maps to, -1 for no field
+ */
+ long GetFieldMap( in long index);
+
+ /*
+ Set the field that this index maps to, -1 for no field
+ */
+ void SetFieldMap( in long index, in long fieldNum);
+
+ /*
+ Return if this field is "active" in the map.
+ */
+ boolean GetFieldActive( in long index);
+
+ /*
+ Set the active state of this field
+ */
+ void SetFieldActive( in long index, in boolean active);
+
+ /*
+ Set the value of the given field in the database row
+ */
+ void SetFieldValue( in nsIAddrDatabase database, in nsIMdbRow row, in long fieldNum, in wstring value);
+};
diff --git a/mailnews/import/public/nsIImportFilters.idl b/mailnews/import/public/nsIImportFilters.idl
new file mode 100644
index 000000000..d8e480617
--- /dev/null
+++ b/mailnews/import/public/nsIImportFilters.idl
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* 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 filters.
+*/
+
+#include "nsISupports.idl"
+
+interface nsIMsgAccount;
+interface nsIFile;
+
+[scriptable, uuid(f2680ccf-d110-4b5b-954d-e072d4a16129)]
+interface nsIImportFilters : nsISupports
+{
+ boolean AutoLocate( out wstring aDescription, out nsIFile aLocation);
+
+ void SetLocation( in nsIFile aLocation);
+
+ /*
+ Import filters and put any problems in the error out parameter.
+ */
+ boolean Import( out wstring aError);
+};
+
+
+
+%{ C++
+
+%}
diff --git a/mailnews/import/public/nsIImportGeneric.idl b/mailnews/import/public/nsIImportGeneric.idl
new file mode 100644
index 000000000..1496bac65
--- /dev/null
+++ b/mailnews/import/public/nsIImportGeneric.idl
@@ -0,0 +1,89 @@
+/* -*- 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 anything. You are responsible for opening
+ up UI and doing all of the work to make it happen.
+
+*/
+
+#include "nsISupports.idl"
+
+interface nsISupportsString;
+
+[scriptable, uuid(469d7d5f-144c-4f07-9661-e49e40156348)]
+interface nsIImportGeneric : nsISupports
+{
+ /* Use these to prepare for the import */
+ /*
+ "mailInterface" - nsIImportMail interface
+ "mailBoxes" - nsIArray of nsIImportMailboxDescriptors
+ "mailLocation" - nsIFile, source location for mail
+
+ "addressInterface" - nsIImportAddressBooks interface
+ "addressBooks" - nsIArray of nsIImportABDescriptors
+ "addressLocation" - src location of address books (if needed!)
+ "addressDestination" - uri of destination address book or null if
+ new address books will be created.
+ */
+ nsISupports GetData( in string dataId);
+
+ void SetData( in string dataId, in nsISupports pData);
+
+ /*
+ "isInstalled" - if true then mail can be automatically located.
+ "canUserSetLocation" - if true then the user can specify the location
+ to look for mail. If both are false, then there is no way
+ to import mail from this format!
+ TBD: How to specify whether or not a file or a directory
+ should be specified?
+ "autoFind" - for address books, is the address book located without
+ using the file system - i.e. addressLocation is irrelevant.
+ "supportsMultiple" - 1 or 1..n address books are imported by this format?
+
+ */
+ long GetStatus( in string statusKind);
+
+ /*
+ When you are ready to import call this. If it returns TRUE then
+ you must call BeginImport and then repeatedly call GetProgress until
+ it returns 100 % done or until ContinueImport returns FALSE.
+ If this returns FALSE then BeginImport will begin and finish the import
+ before it returns.
+ */
+ boolean WantsProgress();
+
+ /* Use these for the actual import */
+ /* Begin import is expected to start a new thread UNLESS WantsProgress returned
+ FALSE. It is REQUIRED to call WantsProgress before calling BeginImport.
+ If WantsProgress was false then this will return the success or
+ failure of the import. Failure can be reported even if WantsProgress
+ returned TRUE.
+ */
+ boolean BeginImport(in nsISupportsString successLog,
+ in nsISupportsString errorLog);
+ /*
+ If WantsProgress returned TRUE then this will indicate if the import should
+ continue. If this returns FALSE then no other methods should be called
+ and the error log should be shown to the user.
+ */
+ boolean ContinueImport();
+ /*
+ Returns the percentage done. When this returns 100 then the import is done.
+ (only valid if WantsProgress returned true)
+ */
+ long GetProgress();
+ /*
+ Cancel an import in progress. Again, this is only valid if WantsProgress
+ returned true.
+ */
+ void CancelImport();
+};
+
+
+
+%{ C++
+
+%}
diff --git a/mailnews/import/public/nsIImportMail.idl b/mailnews/import/public/nsIImportMail.idl
new file mode 100644
index 000000000..dcc4dd7ba
--- /dev/null
+++ b/mailnews/import/public/nsIImportMail.idl
@@ -0,0 +1,98 @@
+/* -*- 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 nsIArray;
+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 nsIArray which contains an nsIImportMailboxID for each
+ mailbox. The array is not sorted before display to the user.
+ */
+ nsIArray 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"
+%}
diff --git a/mailnews/import/public/nsIImportMailboxDescriptor.idl b/mailnews/import/public/nsIImportMailboxDescriptor.idl
new file mode 100644
index 000000000..24d24e694
--- /dev/null
+++ b/mailnews/import/public/nsIImportMailboxDescriptor.idl
@@ -0,0 +1,46 @@
+/* -*- 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.
+
+ */
+
+#include "nsISupports.idl"
+
+interface nsIFile;
+
+[scriptable, uuid(69eba744-9c4f-4f79-a964-2134746b3656)]
+interface nsIImportMailboxDescriptor : nsISupports
+{
+ attribute unsigned long identifier;
+ attribute unsigned long depth;
+ attribute unsigned long size;
+
+ wstring GetDisplayName();
+ void SetDisplayName( [const] in wstring name);
+
+ attribute boolean import;
+ readonly attribute nsIFile file;
+};
+
+
+
+%{ C++
+
+/*
+ The default implementation can be obtained from
+ nsIImportService::CreateNewMailboxDescriptor();
+
+ You should only be interested in using this class if you implement
+ the nsIImportMail interface in which case, just using the service to
+ create new ones should work fine for you. If not, implement your
+ own.
+*/
+
+%}
diff --git a/mailnews/import/public/nsIImportMimeEncode.idl b/mailnews/import/public/nsIImportMimeEncode.idl
new file mode 100644
index 000000000..a03646831
--- /dev/null
+++ b/mailnews/import/public/nsIImportMimeEncode.idl
@@ -0,0 +1,42 @@
+/* -*- 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/. */
+
+/*
+ Encodes a file from disk into an output stream including properly
+ encoded mime headers.
+*/
+
+#include "nsISupports.idl"
+
+interface nsIFile;
+
+[noscript, uuid(1d63892f-f660-465c-a550-95d4cb089de4)]
+interface nsIImportMimeEncode : nsISupports
+{
+
+ void EncodeFile( in nsIFile inFile, in nsIFile outFile, [const] in string fileName, [const] in string mimeType);
+
+ boolean DoWork( out boolean done);
+
+ long NumBytesProcessed();
+
+ boolean DoEncoding();
+ void Initialize( in nsIFile inFile, in nsIFile outFile, [const] in string fileName, [const] in string mimeType);
+
+};
+
+
+
+%{ C++
+
+#define NS_IMPORTMIMEENCODE_CID \
+{ /* e4a1a340-8de2-11d3-a206-00a0cc26da63 */ \
+ 0xe4a1a340, \
+ 0x8de2, \
+ 0x11d3, \
+ {0xa2, 0x06, 0x00, 0xa0, 0xcc, 0x26, 0xda, 0x63} \
+}
+
+%}
diff --git a/mailnews/import/public/nsIImportModule.idl b/mailnews/import/public/nsIImportModule.idl
new file mode 100644
index 000000000..116cad767
--- /dev/null
+++ b/mailnews/import/public/nsIImportModule.idl
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* 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/. */
+
+/*
+
+ An import module.
+
+ */
+
+#include "nsISupports.idl"
+
+
+[scriptable, uuid(624f0280-173f-11d3-a206-00a0cc26da63)]
+interface nsIImportModule : nsISupports
+{
+ readonly attribute wstring name;
+ readonly attribute wstring description;
+ readonly attribute string supports;
+ readonly attribute boolean supportsUpgrade;
+
+ nsISupports GetImportInterface( in string importType);
+};
+
+
+%{ C++
+#define NS_IMPORT_MAIL_STR "mail"
+#define NS_IMPORT_ADDRESS_STR "addressbook"
+#define NS_IMPORT_SETTINGS_STR "settings"
+#define NS_IMPORT_FILTERS_STR "filters"
+%}
diff --git a/mailnews/import/public/nsIImportService.idl b/mailnews/import/public/nsIImportService.idl
new file mode 100644
index 000000000..160fdccdf
--- /dev/null
+++ b/mailnews/import/public/nsIImportService.idl
@@ -0,0 +1,59 @@
+/* -*- 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/. */
+
+/*
+
+ The import service.
+
+ */
+
+#include "nsISupports.idl"
+
+interface nsIImportModule;
+interface nsIImportMailboxDescriptor;
+interface nsIImportABDescriptor;
+interface nsIImportGeneric;
+interface nsIImportFieldMap;
+interface nsIMsgSendListener;
+interface nsIMsgIdentity;
+interface nsIMsgCompFields;
+interface nsIArray;
+
+[scriptable, uuid(d0ed4c50-5997-49c9-8a6a-045f0680ed29)]
+interface nsIImportService : nsISupports
+{
+ void DiscoverModules();
+
+ long GetModuleCount( in string filter);
+ void GetModuleInfo( in string filter, in long index, out wstring name, out wstring description);
+ wstring GetModuleName( in string filter, in long index);
+ wstring GetModuleDescription( in string filter, in long index);
+ nsIImportModule GetModule( in string filter, in long index);
+ nsIImportModule GetModuleWithCID( in nsCIDRef cid);
+
+ nsIImportFieldMap CreateNewFieldMap();
+ nsIImportMailboxDescriptor CreateNewMailboxDescriptor();
+ nsIImportABDescriptor CreateNewABDescriptor();
+ nsIImportGeneric CreateNewGenericMail();
+ nsIImportGeneric CreateNewGenericAddressBooks();
+ void CreateRFC822Message(in nsIMsgIdentity aIdentity,
+ in nsIMsgCompFields aMsgFields,
+ in string aBodytype,
+ in ACString aBody,
+ in boolean aCreateAsDraft,
+ in nsIArray aLoadedAttachments,
+ in nsIArray aEmbeddedObjects,
+ in nsIMsgSendListener aListener);
+
+};
+
+%{ C++
+#define NS_IMPORTSERVICE_CID \
+{ /* 5df96d60-1726-11d3-a206-00a0cc26da63 */ \
+ 0x5df96d60, 0x1726, 0x11d3, \
+ {0xa2, 0x06, 0x0, 0xa0, 0xcc, 0x26, 0xda, 0x63}}
+
+#define NS_IMPORTSERVICE_CONTRACTID "@mozilla.org/import/import-service;1"
+%}
diff --git a/mailnews/import/public/nsIImportSettings.idl b/mailnews/import/public/nsIImportSettings.idl
new file mode 100644
index 000000000..9ff90d168
--- /dev/null
+++ b/mailnews/import/public/nsIImportSettings.idl
@@ -0,0 +1,39 @@
+/* -*- 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 settings. Settings can be auto-located or
+ specified by a specific file. Depends upon the app that the settings
+ are coming from.
+
+*/
+
+#include "nsISupports.idl"
+
+interface nsIMsgAccount;
+interface nsIFile;
+
+[scriptable, uuid(1c0e3012-bc4d-4fb2-be6a-0335c7bab9ac)]
+interface nsIImportSettings : nsISupports
+{
+ boolean AutoLocate( out wstring description, out nsIFile location);
+
+ void SetLocation( in nsIFile location);
+
+ /*
+ Create all of the accounts, identities, and servers. Return an
+ account where any local mail from this app should be imported.
+ The returned account can be null which indicates that no suitable
+ account for local mail was created and a new account specifically for
+ the imported mail should be created.
+ */
+ boolean Import( out nsIMsgAccount localMailAccount);
+};
+
+
+
+%{ C++
+
+%}