1999-05-11 01:47:07 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
1999-11-06 06:43:54 +03:00
|
|
|
* The contents of this file are subject to the Netscape Public
|
|
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.mozilla.org/NPL/
|
1999-05-11 01:47:07 +04:00
|
|
|
*
|
1999-11-06 06:43:54 +03:00
|
|
|
* Software distributed under the License is distributed on an "AS
|
|
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
* implied. See the License for the specific language governing
|
|
|
|
* rights and limitations under the License.
|
1999-05-11 01:47:07 +04:00
|
|
|
*
|
1999-11-06 06:43:54 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape
|
1999-05-11 01:47:07 +04:00
|
|
|
* Communications Corporation. Portions created by Netscape are
|
1999-11-06 06:43:54 +03:00
|
|
|
* Copyright (C) 1999 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
1999-05-11 01:47:07 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef nsMsgDBFolder_h__
|
|
|
|
#define nsMsgDBFolder_h__
|
|
|
|
|
|
|
|
#include "msgCore.h"
|
|
|
|
#include "nsMsgFolder.h"
|
|
|
|
#include "nsIDBFolderInfo.h"
|
|
|
|
#include "nsIMsgDatabase.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsIDBChangeListener.h"
|
1999-09-15 04:59:03 +04:00
|
|
|
#include "nsIUrlListener.h"
|
2000-12-06 22:35:43 +03:00
|
|
|
#include "nsIMsgHdr.h"
|
2000-12-22 05:05:48 +03:00
|
|
|
#include "nsIOutputStream.h"
|
2001-02-21 23:38:08 +03:00
|
|
|
#include "nsITransport.h"
|
1999-07-17 07:26:24 +04:00
|
|
|
class nsIMsgFolderCacheElement;
|
2000-02-04 08:48:50 +03:00
|
|
|
|
1999-05-11 01:47:07 +04:00
|
|
|
/*
|
|
|
|
* nsMsgDBFolder
|
|
|
|
* class derived from nsMsgFolder for those folders that use an nsIMsgDatabase
|
|
|
|
*/
|
|
|
|
|
1999-10-21 01:58:21 +04:00
|
|
|
class NS_MSG_BASE nsMsgDBFolder: public nsMsgFolder,
|
|
|
|
public nsIDBChangeListener,
|
|
|
|
public nsIUrlListener
|
1999-05-11 01:47:07 +04:00
|
|
|
{
|
|
|
|
public:
|
2001-05-27 01:49:14 +04:00
|
|
|
nsMsgDBFolder(void);
|
|
|
|
virtual ~nsMsgDBFolder(void);
|
1999-09-09 10:02:05 +04:00
|
|
|
NS_DECL_NSIDBCHANGELISTENER
|
|
|
|
|
2001-05-27 01:49:14 +04:00
|
|
|
NS_IMETHOD StartFolderLoading(void);
|
|
|
|
NS_IMETHOD EndFolderLoading(void);
|
|
|
|
NS_IMETHOD GetCharset(PRUnichar * *aCharset);
|
|
|
|
NS_IMETHOD SetCharset(const PRUnichar * aCharset);
|
|
|
|
NS_IMETHOD GetCharsetOverride(PRBool *aCharsetOverride);
|
|
|
|
NS_IMETHOD SetCharsetOverride(PRBool aCharsetOverride);
|
|
|
|
NS_IMETHOD GetFirstNewMessage(nsIMsgDBHdr **firstNewMessage);
|
|
|
|
NS_IMETHOD ClearNewMessages();
|
2000-03-15 09:26:31 +03:00
|
|
|
NS_IMETHOD GetFlags(PRUint32 *aFlags);
|
2000-05-15 18:55:22 +04:00
|
|
|
NS_IMETHOD GetExpungedBytes(PRUint32 *count);
|
1999-05-11 01:47:07 +04:00
|
|
|
|
2000-02-04 02:40:09 +03:00
|
|
|
NS_IMETHOD GetMsgDatabase(nsIMsgWindow *aMsgWindow,
|
|
|
|
nsIMsgDatabase** aMsgDatabase);
|
1999-06-22 02:56:18 +04:00
|
|
|
|
2001-05-27 01:49:14 +04:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
1999-05-11 01:47:07 +04:00
|
|
|
|
2001-05-27 01:49:14 +04:00
|
|
|
NS_DECL_NSIURLLISTENER
|
1999-09-15 04:59:03 +04:00
|
|
|
|
2001-05-27 01:49:14 +04:00
|
|
|
NS_IMETHOD WriteToFolderCache(nsIMsgFolderCache *folderCache, PRBool deep);
|
|
|
|
NS_IMETHOD WriteToFolderCacheElem(nsIMsgFolderCacheElement *element);
|
|
|
|
NS_IMETHOD ReadFromFolderCacheElem(nsIMsgFolderCacheElement *element);
|
|
|
|
NS_IMETHOD ManyHeadersToDownload(PRBool *_retval);
|
1999-07-17 07:26:24 +04:00
|
|
|
|
2001-03-17 04:59:34 +03:00
|
|
|
NS_IMETHOD AddMessageDispositionState(nsIMsgDBHdr *aMessage, nsMsgDispositionState aDispositionFlag);
|
2001-05-27 01:49:14 +04:00
|
|
|
NS_IMETHOD MarkAllMessagesRead(void);
|
2000-11-14 04:11:15 +03:00
|
|
|
NS_IMETHOD MarkThreadRead(nsIMsgThread *thread);
|
2000-09-05 03:35:40 +04:00
|
|
|
NS_IMETHOD SetFlag(PRUint32 flag);
|
2000-03-14 08:34:42 +03:00
|
|
|
|
1999-07-25 01:10:53 +04:00
|
|
|
|
2001-05-27 01:49:14 +04:00
|
|
|
NS_IMETHOD Shutdown(PRBool shutdownChildren);
|
2000-03-01 08:17:53 +03:00
|
|
|
NS_IMETHOD ForceDBClosed();
|
2001-05-27 01:49:14 +04:00
|
|
|
NS_IMETHOD GetHasNewMessages(PRBool *hasNewMessages);
|
|
|
|
NS_IMETHOD SetHasNewMessages(PRBool hasNewMessages);
|
2000-07-27 01:24:28 +04:00
|
|
|
NS_IMETHOD GetGettingNewMessages(PRBool *gettingNewMessages);
|
|
|
|
NS_IMETHOD SetGettingNewMessages(PRBool gettingNewMessages);
|
1999-11-14 23:36:22 +03:00
|
|
|
|
2001-06-16 11:20:15 +04:00
|
|
|
NS_IMETHOD GetSupportsOffline(PRBool *aSupportsOffline);
|
2000-12-06 22:35:43 +03:00
|
|
|
NS_IMETHOD ShouldStoreMsgOffline(nsMsgKey msgKey, PRBool *result);
|
2001-02-21 23:38:08 +03:00
|
|
|
NS_IMETHOD GetOfflineFileTransport(nsMsgKey msgKey, PRUint32 *offset, PRUint32 *size, nsITransport **_retval);
|
2000-12-09 04:15:16 +03:00
|
|
|
NS_IMETHOD HasMsgOffline(nsMsgKey msgKey, PRBool *result);
|
2001-03-17 04:59:34 +03:00
|
|
|
NS_IMETHOD DownloadMessagesForOffline(nsISupportsArray *messages, nsIMsgWindow *msgWindow);
|
2001-01-31 23:34:12 +03:00
|
|
|
NS_IMETHOD DownloadAllForOffline(nsIUrlListener *listener, nsIMsgWindow *msgWindow);
|
2001-01-02 01:00:17 +03:00
|
|
|
NS_IMETHOD GetRetentionSettings(nsIMsgRetentionSettings **settings);
|
|
|
|
NS_IMETHOD SetRetentionSettings(nsIMsgRetentionSettings *settings);
|
2001-03-17 04:59:34 +03:00
|
|
|
NS_IMETHOD GetDownloadSettings(nsIMsgDownloadSettings **settings);
|
|
|
|
NS_IMETHOD SetDownloadSettings(nsIMsgDownloadSettings *settings);
|
2001-07-03 01:36:48 +04:00
|
|
|
NS_IMETHOD GetOfflineStoreOutputStream(nsIOutputStream **outputStream);
|
2001-07-03 03:32:28 +04:00
|
|
|
NS_IMETHOD GetOfflineStoreInputStream(nsIInputStream **outputStream);
|
1999-05-11 01:47:07 +04:00
|
|
|
protected:
|
2001-05-27 01:49:14 +04:00
|
|
|
virtual nsresult ReadDBFolderInfo(PRBool force);
|
2000-07-27 01:24:28 +04:00
|
|
|
virtual nsresult FlushToFolderCache();
|
2001-05-27 01:49:14 +04:00
|
|
|
virtual nsresult GetDatabase(nsIMsgWindow *aMsgWindow) = 0;
|
|
|
|
virtual nsresult SendFlagNotifications(nsISupports *item, PRUint32 oldFlags, PRUint32 newFlags);
|
|
|
|
nsresult CheckWithNewMessagesStatus(PRBool messageAdded);
|
|
|
|
nsresult OnKeyAddedOrDeleted(nsMsgKey aKeyChanged, nsMsgKey aParentKey , PRInt32 aFlags,
|
|
|
|
nsIDBChangeListener * aInstigator, PRBool added, PRBool doFlat, PRBool doThread);
|
2001-05-31 09:26:08 +04:00
|
|
|
nsresult CreateFileSpecForDB(const char *userLeafName, nsFileSpec &baseDir, nsIFileSpec **dbFileSpec);
|
2001-05-27 01:49:14 +04:00
|
|
|
|
|
|
|
nsresult GetFolderCacheKey(nsIFileSpec **aFileSpec);
|
|
|
|
nsresult GetFolderCacheElemFromFileSpec(nsIFileSpec *fileSpec, nsIMsgFolderCacheElement **cacheElement);
|
2000-11-09 03:14:22 +03:00
|
|
|
nsresult NotifyStoreClosedAllHeaders();
|
2000-12-06 22:35:43 +03:00
|
|
|
|
2000-12-22 05:05:48 +03:00
|
|
|
// offline support methods.
|
|
|
|
nsresult StartNewOfflineMessage();
|
|
|
|
nsresult WriteStartOfNewLocalMessage();
|
|
|
|
nsresult EndNewOfflineMessage();
|
2001-01-11 17:40:50 +03:00
|
|
|
nsresult CompactOfflineStore(nsIMsgWindow *inWindow);
|
2001-04-12 08:42:28 +04:00
|
|
|
// this is a helper routine that ignores whether MSG_FLAG_OFFLINE is set for the folder
|
|
|
|
nsresult MsgFitsDownloadCriteria(nsMsgKey msgKey, PRBool *result);
|
2000-12-06 22:35:43 +03:00
|
|
|
|
1999-05-11 01:47:07 +04:00
|
|
|
protected:
|
2001-05-27 01:49:14 +04:00
|
|
|
nsCOMPtr<nsIMsgDatabase> mDatabase;
|
|
|
|
nsString mCharset;
|
|
|
|
PRBool mCharsetOverride;
|
|
|
|
PRBool mAddListener;
|
|
|
|
PRBool mNewMessages;
|
2000-07-27 01:24:28 +04:00
|
|
|
PRBool mGettingNewMessages;
|
1999-05-11 01:47:07 +04:00
|
|
|
|
2000-12-06 22:35:43 +03:00
|
|
|
nsCOMPtr <nsIMsgDBHdr> m_offlineHeader;
|
2001-05-27 01:49:14 +04:00
|
|
|
PRInt32 m_numOfflineMsgLines;
|
2000-12-22 05:05:48 +03:00
|
|
|
// this is currently used when we do a save as of an imap or news message..
|
2001-05-27 01:49:14 +04:00
|
|
|
nsCOMPtr<nsIOutputStream> m_tempMessageStream;
|
2000-12-06 22:35:43 +03:00
|
|
|
|
2001-01-02 01:00:17 +03:00
|
|
|
nsCOMPtr <nsIMsgRetentionSettings> m_retentionSettings;
|
2001-03-17 04:59:34 +03:00
|
|
|
nsCOMPtr <nsIMsgDownloadSettings> m_downloadSettings;
|
2000-05-15 00:35:46 +04:00
|
|
|
static nsIAtom* mFolderLoadedAtom;
|
|
|
|
static nsIAtom* mDeleteOrMoveMsgCompletedAtom;
|
2000-09-21 04:16:23 +04:00
|
|
|
static nsIAtom* mDeleteOrMoveMsgFailedAtom;
|
1999-05-11 01:47:07 +04:00
|
|
|
|
2000-05-15 00:35:46 +04:00
|
|
|
private:
|
|
|
|
static nsrefcnt mInstanceCount;
|
1999-05-11 01:47:07 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|