diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /comm/mailnews/import/public | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'comm/mailnews/import/public')
-rw-r--r-- | comm/mailnews/import/public/moz.build | 20 | ||||
-rw-r--r-- | comm/mailnews/import/public/nsIImportABDescriptor.idl | 70 | ||||
-rw-r--r-- | comm/mailnews/import/public/nsIImportABFile.idl | 24 | ||||
-rw-r--r-- | comm/mailnews/import/public/nsIImportAddressBooks.idl | 142 | ||||
-rw-r--r-- | comm/mailnews/import/public/nsIImportFieldMap.idl | 71 | ||||
-rw-r--r-- | comm/mailnews/import/public/nsIImportFilters.idl | 25 | ||||
-rw-r--r-- | comm/mailnews/import/public/nsIImportGeneric.idl | 81 | ||||
-rw-r--r-- | comm/mailnews/import/public/nsIImportMail.idl | 94 | ||||
-rw-r--r-- | comm/mailnews/import/public/nsIImportMailboxDescriptor.idl | 44 | ||||
-rw-r--r-- | comm/mailnews/import/public/nsIImportModule.idl | 30 | ||||
-rw-r--r-- | comm/mailnews/import/public/nsIImportService.idl | 59 | ||||
-rw-r--r-- | comm/mailnews/import/public/nsIImportSettings.idl | 33 |
12 files changed, 693 insertions, 0 deletions
diff --git a/comm/mailnews/import/public/moz.build b/comm/mailnews/import/public/moz.build new file mode 100644 index 0000000000..1ece3d15f5 --- /dev/null +++ b/comm/mailnews/import/public/moz.build @@ -0,0 +1,20 @@ +# 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", + "nsIImportABFile.idl", + "nsIImportAddressBooks.idl", + "nsIImportFieldMap.idl", + "nsIImportFilters.idl", + "nsIImportGeneric.idl", + "nsIImportMail.idl", + "nsIImportMailboxDescriptor.idl", + "nsIImportModule.idl", + "nsIImportService.idl", + "nsIImportSettings.idl", +] + +XPIDL_MODULE = "import" diff --git a/comm/mailnews/import/public/nsIImportABDescriptor.idl b/comm/mailnews/import/public/nsIImportABDescriptor.idl new file mode 100644 index 0000000000..fe0ca1b313 --- /dev/null +++ b/comm/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/comm/mailnews/import/public/nsIImportABFile.idl b/comm/mailnews/import/public/nsIImportABFile.idl new file mode 100644 index 0000000000..b6e5334f0a --- /dev/null +++ b/comm/mailnews/import/public/nsIImportABFile.idl @@ -0,0 +1,24 @@ +/* -*- 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/. */ + +/** + * General interface for importing from a file to an address book. + */ + +#include "nsISupports.idl" + +interface nsIFile; +interface nsIAbDirectory; + +[scriptable, uuid(265209a6-9e1c-4910-97d4-d5ee3f13479b)] +interface nsIImportABFile : nsISupports { + /** + * Import entries from a file into an address book directory. + * @param sourceFile - The source file. + * @param targetDirectory - The target address book directory. + */ + void readFileToDirectory(in nsIFile sourceFile, + in nsIAbDirectory targetDirectory); +}; diff --git a/comm/mailnews/import/public/nsIImportAddressBooks.idl b/comm/mailnews/import/public/nsIImportAddressBooks.idl new file mode 100644 index 0000000000..1b5e1b8e38 --- /dev/null +++ b/comm/mailnews/import/public/nsIImportAddressBooks.idl @@ -0,0 +1,142 @@ +/* -*- 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 nsIImportABDescriptor; +interface nsIAbDirectory; +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 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 array containing an nsIImportABDescriptor for each + * address book. The array is not sorted before display to the user. + * location is null if GetAutoFind returned true. + */ + Array<nsIImportABDescriptor> 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 address 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 nsIAbDirectory 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); +}; diff --git a/comm/mailnews/import/public/nsIImportFieldMap.idl b/comm/mailnews/import/public/nsIImportFieldMap.idl new file mode 100644 index 0000000000..83dc0ddfb1 --- /dev/null +++ b/comm/mailnews/import/public/nsIImportFieldMap.idl @@ -0,0 +1,71 @@ +/* -*- 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 nsIAbCard; +interface nsIAbDirectory; + +[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 nsIAbDirectory database, in nsIAbCard row, in long fieldNum, in AString value); +}; diff --git a/comm/mailnews/import/public/nsIImportFilters.idl b/comm/mailnews/import/public/nsIImportFilters.idl new file mode 100644 index 0000000000..cac242e827 --- /dev/null +++ b/comm/mailnews/import/public/nsIImportFilters.idl @@ -0,0 +1,25 @@ +/* -*- 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 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); +}; diff --git a/comm/mailnews/import/public/nsIImportGeneric.idl b/comm/mailnews/import/public/nsIImportGeneric.idl new file mode 100644 index 0000000000..eab152973b --- /dev/null +++ b/comm/mailnews/import/public/nsIImportGeneric.idl @@ -0,0 +1,81 @@ +/* -*- 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 + "mailLocation" - nsIFile, source location for mail + + "addressInterface" - nsIImportAddressBooks interface + "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(); +}; diff --git a/comm/mailnews/import/public/nsIImportMail.idl b/comm/mailnews/import/public/nsIImportMail.idl new file mode 100644 index 0000000000..336fede8f4 --- /dev/null +++ b/comm/mailnews/import/public/nsIImportMail.idl @@ -0,0 +1,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" +%} diff --git a/comm/mailnews/import/public/nsIImportMailboxDescriptor.idl b/comm/mailnews/import/public/nsIImportMailboxDescriptor.idl new file mode 100644 index 0000000000..f0da7f7f79 --- /dev/null +++ b/comm/mailnews/import/public/nsIImportMailboxDescriptor.idl @@ -0,0 +1,44 @@ +/* -*- 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/comm/mailnews/import/public/nsIImportModule.idl b/comm/mailnews/import/public/nsIImportModule.idl new file mode 100644 index 0000000000..00eb10601c --- /dev/null +++ b/comm/mailnews/import/public/nsIImportModule.idl @@ -0,0 +1,30 @@ +/* -*- 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/comm/mailnews/import/public/nsIImportService.idl b/comm/mailnews/import/public/nsIImportService.idl new file mode 100644 index 0000000000..1cfaf7fbaa --- /dev/null +++ b/comm/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 nsIMsgAttachedFile; +interface nsIMsgEmbeddedImageData; + +[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 AString name, out AString description); + AString GetModuleName(in string filter, in long index); + AString GetModuleDescription(in string filter, in long index); + nsIImportModule GetModule(in string filter, in long index); + + 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 Array<nsIMsgAttachedFile> aLoadedAttachments, + in Array<nsIMsgEmbeddedImageData> 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/comm/mailnews/import/public/nsIImportSettings.idl b/comm/mailnews/import/public/nsIImportSettings.idl new file mode 100644 index 0000000000..b9a123bfc6 --- /dev/null +++ b/comm/mailnews/import/public/nsIImportSettings.idl @@ -0,0 +1,33 @@ +/* -*- 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); +}; |