Back to index

lightning-sunbird  0.9+nobinonly
nsImapService.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
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 nsImapService_h___
00039 #define nsImapService_h___
00040 
00041 #include "nsIImapService.h"
00042 #include "nsIMsgMessageService.h"
00043 #include "nsISupportsArray.h"
00044 #include "nsCOMPtr.h"
00045 #include "nsIFileSpec.h"
00046 #include "nsIProtocolHandler.h"
00047 #include "nsIMsgProtocolInfo.h"
00048 #include "nsIContentHandler.h"
00049 #include "nsICacheSession.h"
00050 
00051 class nsIImapHostSessionList; 
00052 class nsCString;
00053 class nsIImapUrl;
00054 class nsIMsgFolder;
00055 class nsIMsgStatusFeedback;
00056 class nsIMsgIncomingServer;
00057 
00058 class nsImapService : public nsIImapService,
00059                       public nsIMsgMessageService,
00060                       public nsIMsgMessageFetchPartService,
00061                       public nsIProtocolHandler,
00062                       public nsIMsgProtocolInfo,
00063                       public nsIContentHandler
00064 {
00065 public:
00066 
00067   nsImapService();
00068   virtual ~nsImapService();
00069        
00070   NS_DECL_ISUPPORTS
00071   NS_DECL_NSIMSGPROTOCOLINFO
00072 
00074   // we suppport the nsIImapService interface 
00076   NS_DECL_NSIIMAPSERVICE
00077 
00079   // we suppport the nsIMsgMessageService Interface 
00081   NS_DECL_NSIMSGMESSAGESERVICE
00082 
00084   // we suppport the nsIProtocolHandler interface 
00086   NS_DECL_NSIPROTOCOLHANDLER
00087 
00088   NS_DECL_NSIMSGMESSAGEFETCHPARTSERVICE
00089   NS_DECL_NSICONTENTHANDLER
00090 protected:
00091 
00092   PRUnichar GetHierarchyDelimiter(nsIMsgFolder* aMsgFolder);
00093   nsresult GetFolderName(nsIMsgFolder* aImapFolder,
00094                          char **folderName);
00095   nsresult CreateStartOfImapUrl(const char * aImapURI /* a RDF URI for the current message / folder, can be null */,
00096                           nsIImapUrl  **imapUrl,
00097                           nsIMsgFolder* aImapFolder,
00098                           nsIUrlListener * aUrlListener,
00099                           nsCString & urlSpec,
00100                                                                         PRUnichar &hierarchyDelimiter);
00101   nsresult GetImapConnectionAndLoadUrl(nsIEventQueue* aClientEventQueue, 
00102                                        nsIImapUrl* aImapUrl,
00103                                        nsISupports* aConsumer,
00104                                        nsIURI** aURL);
00105   nsresult SetImapUrlSink(nsIMsgFolder* aMsgFolder,
00106                             nsIImapUrl* aImapUrl);
00107 
00108   nsresult FetchMimePart(nsIImapUrl * aImapUrl,
00109                           nsImapAction aImapAction,
00110                           nsIMsgFolder * aImapMailFolder, 
00111                           nsIImapMessageSink * aImapMessage,
00112                           nsIURI ** aURL,
00113                           nsISupports * aDisplayConsumer, 
00114                           const char *messageIdentifierList,
00115                           const char *mimePart);
00116 
00117   nsresult FolderCommand(nsIEventQueue * clientEventQueue, 
00118                     nsIMsgFolder * imapMailFolder,
00119                     nsIUrlListener * urlListener,
00120                     const char *command,
00121                     nsImapAction imapAction,
00122                     nsIURI ** url);
00123 
00124   nsresult ChangeFolderSubscription(nsIEventQueue* eventQueue, 
00125                                nsIMsgFolder* folder,
00126                                const PRUnichar* folderName, 
00127                                const char *command,
00128                                nsIUrlListener* urlListener, nsIURI** url);
00129 
00130   nsresult DiddleFlags(nsIEventQueue * aClientEventQueue,
00131                        nsIMsgFolder * aImapMailFolder, 
00132                        nsIUrlListener * aUrlListener, 
00133                        nsIURI ** aURL,
00134                        const char *messageIdentifierList,
00135                        const char *howToDiddle,
00136                        imapMessageFlagsType flags,
00137                        PRBool messageIdsAreUID);
00138 
00139   nsresult OfflineAppendFromFile(nsIFileSpec* aFileSpec,
00140                                  nsIURI *aUrl,
00141                                  nsIMsgFolder* aDstFolder,
00142                                  const char* messageId, // te be replaced
00143                                  PRBool inSelectedState, // needs to be in
00144                                  nsIUrlListener* aListener,
00145                                  nsIURI** aURL,
00146                                  nsISupports* aCopyState);
00147 
00148   nsresult GetServerFromUrl(nsIImapUrl *aImapUrl, nsIMsgIncomingServer **aServer);
00149 
00150   // just a little helper method...maybe it should be a macro? which helps break down a imap message uri
00151   // into the folder and message key equivalents
00152   nsresult DecomposeImapURI(const char * aMessageURI, nsIMsgFolder ** aFolder,  char ** msgKey);
00153   nsresult DecomposeImapURI(const char * aMessageURI, nsIMsgFolder ** aFolder,  nsMsgKey *msgKey);
00154 
00155   PRBool                mPrintingOperation;  // Flag for printing operations
00156 
00157   // handle to the cache session for imap.....
00158   nsCOMPtr<nsICacheSession> mCacheSession;
00159 };
00160 
00161 #endif /* nsImapService_h___ */