Back to index

lightning-sunbird  0.9+nobinonly
nsEudoraMac.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
00002  *
00003  * ***** BEGIN LICENSE BLOCK *****
00004  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00005  *
00006  * The contents of this file are subject to the Mozilla Public License Version
00007  * 1.1 (the "License"); you may not use this file except in compliance with
00008  * the License. You may obtain a copy of the License at
00009  * http://www.mozilla.org/MPL/
00010  *
00011  * Software distributed under the License is distributed on an "AS IS" basis,
00012  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00013  * for the specific language governing rights and limitations under the
00014  * License.
00015  *
00016  * The Original Code is mozilla.org Code.
00017  *
00018  * The Initial Developer of the Original Code is
00019  * Netscape Communications Corporation.
00020  * Portions created by the Initial Developer are Copyright (C) 1998
00021  * the Initial Developer. All Rights Reserved.
00022  *
00023  * Contributor(s):
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either of the GNU General Public License Version 2 or later (the "GPL"),
00027  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 #ifndef nsEudoraMac_h__
00040 #define nsEudoraMac_h__
00041 
00042 #include "nscore.h"
00043 #include "nsString.h"
00044 #include "nsIFileSpec.h"
00045 #include "nsISupportsArray.h"
00046 #include "nsEudoraMailbox.h"
00047 #include "nsEudoraAddress.h"
00048 
00049 class nsIImportService;
00050 class nsIMsgAccountManager;
00051 class nsIMsgAccount;
00052 
00053 
00054 class nsEudoraMac : public nsEudoraMailbox, public nsEudoraAddress {
00055 public:
00056        nsEudoraMac();
00057        ~nsEudoraMac();
00058 
00059               // retrieve the mail folder
00060        virtual PRBool              FindMailFolder( nsIFileSpec *pFolder);
00061               // get the list of mailboxes
00062        virtual nsresult     FindMailboxes( nsIFileSpec *pRoot, nsISupportsArray **ppArray);
00063               // get a TOC file from a mailbox file
00064        virtual nsresult     FindTOCFile( nsIFileSpec *pMailFile, nsIFileSpec **pTOCFile, PRBool *pDeleteToc);
00065 
00066        virtual nsresult     GetAttachmentInfo( const char *pFileName, nsIFileSpec *pSpec, nsCString& mimeType, nsCString& aAttachment);
00067 
00068               // Address book stuff
00069        virtual PRBool              FindAddressFolder( nsIFileSpec *pFolder);
00070               // get the list of mailboxes
00071        virtual nsresult     FindAddressBooks( nsIFileSpec *pRoot, nsISupportsArray **ppArray);
00072 
00073               // import settings
00074        static PRBool ImportSettings( nsIFileSpec *pIniFile, nsIMsgAccount **localMailAccount);
00075        static PRBool FindSettingsFile( nsIFileSpec *pIniFile) { return( FindEudoraLocation( pIniFile, PR_TRUE));}
00076 
00077 private:
00078        static PRBool        FindEudoraLocation( nsIFileSpec *pFolder, PRBool findIni = PR_FALSE, nsIFileSpec *pLookIn = nsnull);
00079 
00080 
00081        nsresult      ScanMailDir( nsIFileSpec *pFolder, nsISupportsArray *pArray, nsIImportService *pImport);
00082        nsresult      IterateMailDir( nsIFileSpec *pFolder, nsISupportsArray *pArray, nsIImportService *pImport);
00083        nsresult      FoundMailFolder( nsIFileSpec *mailFolder, const char *pName, nsISupportsArray *pArray, nsIImportService *pImport);
00084        nsresult      FoundMailbox( nsIFileSpec *mailFile, const char *pName, nsISupportsArray *pArray, nsIImportService *pImport);
00085 
00086        PRBool               IsValidMailFolderName( nsCString& name);
00087        PRBool               IsValidMailboxName( nsCString& fName);
00088        PRBool               IsValidMailboxFile( nsIFileSpec *pFile);
00089 
00090        PRBool        CreateTocFromResource( nsIFileSpec *pMail, nsIFileSpec *pToc);
00091 
00092        
00093 
00094               // Settings support
00095        static PRBool BuildPOPAccount( nsIMsgAccountManager *accMgr, nsCString **pStrs, nsIMsgAccount **ppAccount, nsString& accName);
00096        static PRBool BuildIMAPAccount( nsIMsgAccountManager *accMgr, nsCString **pStrs, nsIMsgAccount **ppAccount, nsString& accName);
00097        static void          SetIdentities( nsIMsgAccountManager *accMgr, nsIMsgAccount *acc, const char *userName, const char *serverName, nsCString **pStrs);
00098        static void          SetSmtpServer( nsIMsgAccountManager *pMgr, nsIMsgAccount *pAcc, const char *pServer, const char *pUser);
00099        static PRBool        GetSettingsFromResource( nsIFileSpec *pSettings, short resId, nsCString **pStrs, PRBool *pIMAP);
00100 
00101 
00102 private:
00103        PRUint32             m_depth;
00104        nsIFileSpec * m_mailImportLocation;
00105         PRBool HasResourceFork(FSSpec *fsSpec);
00106 };
00107 
00108 
00109 #endif /* nsEudoraMac_h__ */
00110