Back to index

lightning-sunbird  0.9+nobinonly
nsComm4xMailImport.h
Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK *****
00002  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00003  *
00004  * The contents of this file are subject to the Mozilla Public License Version
00005  * 1.1 (the "License"); you may not use this file except in compliance with
00006  * the License. You may obtain a copy of the License at
00007  * http://www.mozilla.org/MPL/
00008  *
00009  * Software distributed under the License is distributed on an "AS IS" basis,
00010  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00011  * for the specific language governing rights and limitations under the
00012  * License.
00013  *
00014  * The Original Code is mozilla.org code.
00015  *
00016  * The Initial Developer of the Original Code is
00017  * Netscape Communications Corporation.
00018  * Portions created by the Initial Developer are Copyright (C) 2002
00019  * the Initial Developer. All Rights Reserved.
00020  *
00021  * Contributor(s):
00022  *   Srilatha Moturi <srilatha@netscape.com>
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either of the GNU General Public License Version 2 or later (the "GPL"),
00026  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 #ifndef nsComm4xMailImport_h___
00039 #define nsComm4xMailImport_h___
00040 
00041 #include "nsIImportModule.h"
00042 #include "nsCOMPtr.h"
00043 #include "nsIStringBundle.h"
00044 #include "nsIImportMail.h"
00045 #include "nsISupportsArray.h"
00046 #include "nsIFileSpec.h"
00047 #include "nsComm4xMail.h"
00048 
00049 //{7792e9e0-412a-11d6-92bf-0010a4b26cda}
00050 #define NS_COMM4XMAILIMPL_CID \
00051 { 0x7792e9e0, 0x412a, 0x11d6, { 0x92, 0xbf, 0x0, 0x10, 0xa4, 0xb2, 0x6c, 0xda } }
00052 #define NS_COMM4XMAILIMPL_CONTRACTID "@mozilla.org/import/import-comm4xMailImpl;1" 
00053 // {647cc990-2bdb-11d6-92a0-0010a4b26cda}
00054 #define NS_COMM4XMAILIMPORT_CID                 \
00055 { 0x647ff990, 0x2bdb, 0x11d6, { 0x92, 0xa0, 0x0, 0x10, 0xa4, 0xb2, 0x6c, 0xda } }
00056 
00057 #define kComm4xMailSupportsString NS_IMPORT_MAIL_STR
00058 
00059 class nsComm4xMailImport : public nsIImportModule
00060 {
00061 public:
00062 
00063     nsComm4xMailImport();
00064     virtual ~nsComm4xMailImport();
00065     
00066     NS_DECL_ISUPPORTS
00067 
00069     // we suppport the nsIImportModule interface 
00071 
00072     NS_DECL_NSIIMPORTMODULE
00073 
00074 protected:
00075      nsCOMPtr <nsIStringBundle>  m_pBundle;
00076 };
00077 
00078 class ImportComm4xMailImpl : public nsIImportMail
00079 {
00080 public:
00081     ImportComm4xMailImpl();
00082     virtual ~ImportComm4xMailImpl();
00083 
00084     // nsISupports interface
00085     NS_DECL_ISUPPORTS
00086 
00087     // nsIImportMail interface
00088     
00089     /* void GetDefaultLocation (out nsIFileSpec location, out boolean found, out boolean userVerify); */
00090     NS_IMETHOD GetDefaultLocation(nsIFileSpec **location, PRBool *found, PRBool *userVerify);
00091 
00092     /* nsISupportsArray FindMailboxes (in nsIFileSpec location); */
00093     NS_IMETHOD FindMailboxes(nsIFileSpec *location, nsISupportsArray **_retval);
00094 
00095     /* void ImportMailbox (in nsIImportMailboxDescriptor source, in nsIFileSpec destination, out boolean fatalError); */
00096     NS_IMETHOD ImportMailbox(nsIImportMailboxDescriptor *source, nsIFileSpec *destination, 
00097                              PRUnichar **pErrorLog, PRUnichar **pSuccessLog, PRBool *fatalError);
00098 
00099     /* unsigned long GetImportProgress (); */
00100     NS_IMETHOD GetImportProgress(PRUint32 *_retval);
00101 
00102     NS_IMETHOD TranslateFolderName(const nsAString & aFolderName, nsAString & _retval);
00103 
00104 public:
00105     static void SetLogs(nsString& success, nsString& error, PRUnichar **pError, PRUnichar **pSuccess);
00106     void ReportStatus(PRInt32 errorNum, nsString& name, nsString *pStream);
00107     nsresult Initialize();
00108 
00109 private:
00110     nsComm4xMail  m_mail;
00111     PRUint32      m_bytesDone;
00112     nsCOMPtr<nsIStringBundle>  m_pBundleProxy;
00113 };
00114 
00115 
00116 #endif /* nsComm4xMailImport_h___ */