1999-01-26 04:50:54 +00:00
|
|
|
/* -*- 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"
|
1999-01-29 03:05:30 +00:00
|
|
|
#include "nsMsgMessageFlags.h"
|
1999-01-28 05:32:58 +00:00
|
|
|
|
1999-01-26 04:50:54 +00:00
|
|
|
// This is the subclass of nsMsgDatabase that handles local mail messages.
|
|
|
|
class nsOfflineImapOperation;
|
1999-01-29 03:05:30 +00:00
|
|
|
class nsMsgKeyArray;
|
1999-02-01 02:55:32 +00:00
|
|
|
class MSG_Master;
|
|
|
|
class MSG_FolderInfo;
|
1999-02-08 00:46:47 +00:00
|
|
|
class nsIOFileStream;
|
1999-03-09 09:52:30 +00:00
|
|
|
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;
|
1999-01-26 04:50:54 +00:00
|
|
|
|
|
|
|
class nsMailDatabase : public nsMsgDatabase
|
|
|
|
{
|
|
|
|
public:
|
1999-04-04 17:48:16 +00:00
|
|
|
nsMailDatabase();
|
1999-01-26 04:50:54 +00:00
|
|
|
virtual ~nsMailDatabase();
|
1999-07-13 18:43:04 +00:00
|
|
|
NS_IMETHOD Open(nsIFileSpec *aFolderName, PRBool create, PRBool upgrading, nsIMsgDatabase** pMessageDB);
|
1999-01-26 04:50:54 +00:00
|
|
|
|
1999-03-09 09:52:30 +00:00
|
|
|
static nsresult CloneInvalidDBInfoIntoNewDB(nsFileSpec &pathName, nsMailDatabase** pMailDB);
|
1999-01-26 04:50:54 +00:00
|
|
|
|
1999-03-09 09:52:30 +00:00
|
|
|
NS_IMETHOD OnNewPath(nsFileSpec &newPath);
|
1999-01-26 04:50:54 +00:00
|
|
|
|
1999-03-09 09:52:30 +00:00
|
|
|
NS_IMETHOD DeleteMessages(nsMsgKeyArray* nsMsgKeys, nsIDBChangeListener *instigator);
|
1999-01-26 04:50:54 +00:00
|
|
|
|
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);
|
1999-01-26 04:50:54 +00:00
|
|
|
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();
|
1999-01-26 04:50:54 +00:00
|
|
|
|
1999-02-13 10:39:59 +00:00
|
|
|
nsresult GetOfflineOpForKey(nsMsgKey opKey, PRBool create, nsOfflineImapOperation **);
|
1999-01-26 04:50:54 +00:00
|
|
|
nsresult AddOfflineOp(nsOfflineImapOperation *op);
|
1999-02-13 10:39:59 +00:00
|
|
|
nsresult DeleteOfflineOp(nsMsgKey opKey);
|
|
|
|
nsresult SetSourceMailbox(nsOfflineImapOperation *op, const char *mailbox, nsMsgKey key);
|
1999-01-26 04:50:54 +00:00
|
|
|
|
1999-04-04 17:48:16 +00:00
|
|
|
NS_IMETHOD SetSummaryValid(PRBool valid);
|
1999-01-26 04:50:54 +00:00
|
|
|
|
1999-01-29 03:05:30 +00:00
|
|
|
nsresult GetIdsWithNoBodies (nsMsgKeyArray &bodylessIds);
|
1999-02-17 23:18:46 +00:00
|
|
|
#ifdef DEBUG // strictly for testing purposes
|
|
|
|
virtual nsresult PrePopulate();
|
|
|
|
#endif
|
1999-01-26 04:50:54 +00:00
|
|
|
protected:
|
1999-04-24 20:40:47 +00:00
|
|
|
virtual PRBool SetHdrFlag(nsIMsgDBHdr *, PRBool bSet, MsgFlags flag);
|
|
|
|
virtual void UpdateFolderFlag(nsIMsgDBHdr *msgHdr, PRBool bSet,
|
1999-02-08 00:46:47 +00:00
|
|
|
MsgFlags flag, nsIOFileStream **ppFileStream);
|
1999-01-26 04:50:54 +00:00
|
|
|
virtual void SetReparse(PRBool reparse);
|
|
|
|
|
1999-03-28 21:03:11 +00:00
|
|
|
protected:
|
|
|
|
virtual PRBool ThreadBySubjectWithoutRe() ;
|
|
|
|
|
1999-02-24 10:39:06 +00:00
|
|
|
PRBool m_reparse;
|
1999-04-04 17:48:16 +00:00
|
|
|
nsFileSpec *m_folderSpec;
|
1999-02-24 10:39:06 +00:00
|
|
|
nsIOFileStream *m_folderStream; /* this is a cache for loops which want file left open */
|
1999-01-26 04:50:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|