gecko-dev/mailnews/db/msgdb/public/nsMailDatabase.h

84 lines
2.9 KiB
C
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef _nsMailDatabase_H_
#define _nsMailDatabase_H_
1999-01-28 05:32:58 +00:00
#include "nsMsgDatabase.h"
#include "nsMsgMessageFlags.h"
1999-01-28 05:32:58 +00:00
// This is the subclass of nsMsgDatabase that handles local mail messages.
class nsOfflineImapOperation;
class nsMsgKeyArray;
1999-02-01 02:55:32 +00:00
class MSG_Master;
class MSG_FolderInfo;
class nsIOFileStream;
class nsFileSpec;
1999-02-01 02:55:32 +00:00
1999-04-04 17:48:16 +00:00
1999-02-01 02:55:32 +00:00
// this is the version number for the mail db. If the file format changes, we
// just reparse the mail folder.
const int kMailDBVersion = 1;
class nsMailDatabase : public nsMsgDatabase
{
public:
1999-04-04 17:48:16 +00:00
nsMailDatabase();
virtual ~nsMailDatabase();
1999-07-13 18:43:04 +00:00
NS_IMETHOD Open(nsIFileSpec *aFolderName, PRBool create, PRBool upgrading, nsIMsgDatabase** pMessageDB);
static nsresult CloneInvalidDBInfoIntoNewDB(nsFileSpec &pathName, nsMailDatabase** pMailDB);
NS_IMETHOD OnNewPath(nsFileSpec &newPath);
NS_IMETHOD DeleteMessages(nsMsgKeyArray* nsMsgKeys, nsIDBChangeListener *instigator);
1999-04-04 17:48:16 +00:00
static nsresult SetFolderInfoValid(nsFileSpec *folderSpec, int num, int numunread);
1999-02-01 02:55:32 +00:00
nsresult GetFolderName(nsString &folderName);
virtual nsMailDatabase *GetMailDB() {return this;}
1999-03-01 23:34:30 +00:00
virtual PRUint32 GetCurVersion() {return kMailDBVersion;}
1999-02-01 02:55:32 +00:00
virtual MSG_FolderInfo *GetFolderInfo();
nsresult GetOfflineOpForKey(nsMsgKey opKey, PRBool create, nsOfflineImapOperation **);
nsresult AddOfflineOp(nsOfflineImapOperation *op);
nsresult DeleteOfflineOp(nsMsgKey opKey);
nsresult SetSourceMailbox(nsOfflineImapOperation *op, const char *mailbox, nsMsgKey key);
1999-04-04 17:48:16 +00:00
NS_IMETHOD SetSummaryValid(PRBool valid);
nsresult GetIdsWithNoBodies (nsMsgKeyArray &bodylessIds);
1999-02-17 23:18:46 +00:00
#ifdef DEBUG // strictly for testing purposes
virtual nsresult PrePopulate();
#endif
protected:
virtual PRBool SetHdrFlag(nsIMsgDBHdr *, PRBool bSet, MsgFlags flag);
virtual void UpdateFolderFlag(nsIMsgDBHdr *msgHdr, PRBool bSet,
MsgFlags flag, nsIOFileStream **ppFileStream);
virtual void SetReparse(PRBool reparse);
1999-03-28 21:03:11 +00:00
protected:
virtual PRBool ThreadBySubjectWithoutRe() ;
PRBool m_reparse;
1999-04-04 17:48:16 +00:00
nsFileSpec *m_folderSpec;
nsIOFileStream *m_folderStream; /* this is a cache for loops which want file left open */
};
#endif