зеркало из https://github.com/mozilla/pjs.git
cleanup unused mailnews methods r/sr=mscott 218888
This commit is contained in:
Родитель
5f50ab557c
Коммит
7f964c5b7b
|
@ -60,10 +60,6 @@ interface nsIMessenger : nsISupports {
|
|||
readonly attribute nsITransactionManager transactionManager;
|
||||
|
||||
void SetWindow(in nsIDOMWindowInternal ptr, in nsIMsgWindow msgWindow);
|
||||
void DeleteMessages(in nsIRDFCompositeDataSource database,
|
||||
in nsIRDFResource srcFolderResource,
|
||||
in nsISupportsArray messages,
|
||||
in boolean reallyDelete);
|
||||
|
||||
void DeleteFolders(in nsIRDFCompositeDataSource db,
|
||||
in nsIRDFResource parentFolder,
|
||||
|
|
|
@ -227,7 +227,6 @@ interface nsMsgNavigationType
|
|||
const nsMsgNavigationTypeValue nextUnreadFolder = 11;
|
||||
const nsMsgNavigationTypeValue nextFolder = 12;
|
||||
const nsMsgNavigationTypeValue readMore = 13;
|
||||
const nsMsgNavigationTypeValue laterMessage = 14;
|
||||
/**
|
||||
* Go back to the previous visited message
|
||||
*/
|
||||
|
|
|
@ -66,6 +66,5 @@ interface nsIMsgThread : nsISupports {
|
|||
nsIMsgDBHdr GetFirstUnreadChild();
|
||||
|
||||
nsISimpleEnumerator EnumerateMessages(in nsMsgKey parent);
|
||||
nsISimpleEnumerator EnumerateUnreadMessages(in nsMsgKey parent);
|
||||
|
||||
};
|
||||
|
|
|
@ -63,19 +63,18 @@ interface nsIMsgMessagePaneController : nsISupports {
|
|||
[scriptable, uuid(BD85A416-5433-11d3-8AC5-0060B0FC04D2)]
|
||||
interface nsIMsgWindow : nsISupports {
|
||||
|
||||
attribute nsIMsgMessagePaneController messagePaneController;
|
||||
attribute nsIMsgMessagePaneController messagePaneController;
|
||||
attribute nsIMsgStatusFeedback statusFeedback;
|
||||
attribute nsIMsgHeaderSink msgHeaderSink;
|
||||
attribute nsITransactionManager transactionManager;
|
||||
attribute nsITransactionManager transactionManager;
|
||||
attribute nsIMsgFolder openFolder;
|
||||
attribute nsIDocShell rootDocShell;
|
||||
void displayHTMLInMessagePane(in wstring title, in wstring body);
|
||||
void displayHTMLInMessagePane(in wstring title, in wstring body);
|
||||
|
||||
readonly attribute nsIPrompt promptDialog;
|
||||
readonly attribute nsIAuthPrompt authPromptDialog;
|
||||
attribute string mailCharacterSet;
|
||||
// Remember the message's charaset was overridden, so it can be inherited (e.g for quoting).
|
||||
attribute boolean charsetOverride;
|
||||
readonly attribute nsIPrompt promptDialog;
|
||||
attribute string mailCharacterSet;
|
||||
// Remember the message's charaset was overridden, so it can be inherited (e.g for quoting).
|
||||
attribute boolean charsetOverride;
|
||||
|
||||
/* has a running url been stopped? If you care about checking
|
||||
this flag, you need to clear it before you start your operation since
|
||||
|
|
|
@ -331,80 +331,80 @@ nsMessenger::SetWindow(nsIDOMWindowInternal *aWin, nsIMsgWindow *aMsgWindow)
|
|||
if (prefBranch)
|
||||
pbi = do_QueryInterface(prefBranch);
|
||||
}
|
||||
if(!aWin)
|
||||
{
|
||||
if(!aWin)
|
||||
{
|
||||
// it isn't an error to pass in null for aWin, in fact it means we are shutting
|
||||
// down and we should start cleaning things up...
|
||||
|
||||
if (mMsgWindow)
|
||||
{
|
||||
nsCOMPtr<nsIMsgStatusFeedback> aStatusFeedback;
|
||||
|
||||
mMsgWindow->GetStatusFeedback(getter_AddRefs(aStatusFeedback));
|
||||
if (aStatusFeedback)
|
||||
aStatusFeedback->SetDocShell(nsnull, nsnull);
|
||||
|
||||
|
||||
if (mMsgWindow)
|
||||
{
|
||||
nsCOMPtr<nsIMsgStatusFeedback> aStatusFeedback;
|
||||
|
||||
mMsgWindow->GetStatusFeedback(getter_AddRefs(aStatusFeedback));
|
||||
if (aStatusFeedback)
|
||||
aStatusFeedback->SetDocShell(nsnull, nsnull);
|
||||
|
||||
// Remove pref observer
|
||||
if (pbi)
|
||||
pbi->RemoveObserver(MAILNEWS_ALLOW_PLUGINS_PREF_NAME, this);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mMsgWindow = aMsgWindow;
|
||||
|
||||
|
||||
NS_IF_RELEASE(mWindow);
|
||||
mWindow = aWin;
|
||||
NS_ADDREF(aWin);
|
||||
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> globalObj( do_QueryInterface(aWin) );
|
||||
NS_ENSURE_TRUE(globalObj, NS_ERROR_FAILURE);
|
||||
|
||||
|
||||
nsCOMPtr<nsIDocShell> docShell;
|
||||
globalObj->GetDocShell(getter_AddRefs(docShell));
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(docShell));
|
||||
NS_ENSURE_TRUE(docShellAsItem, NS_ERROR_FAILURE);
|
||||
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> rootDocShellAsItem;
|
||||
docShellAsItem->GetSameTypeRootTreeItem(getter_AddRefs(rootDocShellAsItem));
|
||||
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeNode>
|
||||
rootDocShellAsNode(do_QueryInterface(rootDocShellAsItem));
|
||||
rootDocShellAsNode(do_QueryInterface(rootDocShellAsItem));
|
||||
if (rootDocShellAsNode)
|
||||
{
|
||||
nsCOMPtr<nsIDocShellTreeItem> childAsItem;
|
||||
nsresult rv = rootDocShellAsNode->FindChildWithName(NS_LITERAL_STRING("messagepane").get(),
|
||||
PR_TRUE, PR_FALSE, nsnull, getter_AddRefs(childAsItem));
|
||||
|
||||
|
||||
mDocShell = do_QueryInterface(childAsItem);
|
||||
|
||||
|
||||
if (NS_SUCCEEDED(rv) && mDocShell) {
|
||||
|
||||
if (aMsgWindow)
|
||||
{
|
||||
nsCOMPtr<nsIMsgStatusFeedback> aStatusFeedback;
|
||||
|
||||
aMsgWindow->GetStatusFeedback(getter_AddRefs(aStatusFeedback));
|
||||
if (aStatusFeedback)
|
||||
aStatusFeedback->SetDocShell(mDocShell, mWindow);
|
||||
|
||||
if (aMsgWindow) {
|
||||
nsCOMPtr<nsIMsgStatusFeedback> aStatusFeedback;
|
||||
|
||||
aMsgWindow->GetStatusFeedback(getter_AddRefs(aStatusFeedback));
|
||||
if (aStatusFeedback)
|
||||
{
|
||||
aStatusFeedback->SetDocShell(mDocShell, mWindow);
|
||||
}
|
||||
aMsgWindow->GetTransactionManager(getter_AddRefs(mTxnMgr));
|
||||
|
||||
// Add pref observer
|
||||
if (pbi)
|
||||
pbi->AddObserver(MAILNEWS_ALLOW_PLUGINS_PREF_NAME, this, PR_TRUE);
|
||||
SetDisplayProperties();
|
||||
}
|
||||
aMsgWindow->GetTransactionManager(getter_AddRefs(mTxnMgr));
|
||||
|
||||
// Add pref observer
|
||||
if (pbi)
|
||||
pbi->AddObserver(MAILNEWS_ALLOW_PLUGINS_PREF_NAME, this, PR_TRUE);
|
||||
SetDisplayProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// we don't always have a message pane, like in the addressbook
|
||||
// so if we don't havea docshell, use the one for the xul window.
|
||||
// we do this so OpenURL() will work.
|
||||
if (!mDocShell)
|
||||
mDocShell = docShell;
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -421,11 +421,9 @@ NS_IMETHODIMP nsMessenger::SetDisplayCharset(const char * aCharset)
|
|||
if (cv)
|
||||
{
|
||||
nsCOMPtr<nsIMarkupDocumentViewer> muDV = do_QueryInterface(cv);
|
||||
if (muDV) {
|
||||
if (muDV)
|
||||
muDV->SetForceCharacterSet(nsDependentCString(aCharset));
|
||||
|
||||
}
|
||||
|
||||
mCurrentDisplayCharset = aCharset;
|
||||
}
|
||||
}
|
||||
|
@ -1194,36 +1192,6 @@ nsMessenger::DoCommand(nsIRDFCompositeDataSource* db, const nsACString& command,
|
|||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMessenger::DeleteMessages(nsIRDFCompositeDataSource *database,
|
||||
nsIRDFResource *srcFolderResource,
|
||||
nsISupportsArray *resourceArray,
|
||||
PRBool reallyDelete)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
if(!database || !srcFolderResource || !resourceArray)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsCOMPtr<nsISupportsArray> folderArray;
|
||||
|
||||
rv = NS_NewISupportsArray(getter_AddRefs(folderArray));
|
||||
if(NS_FAILED(rv))
|
||||
{
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
folderArray->AppendElement(srcFolderResource);
|
||||
|
||||
if(reallyDelete)
|
||||
rv = DoCommand(database, NS_LITERAL_CSTRING(NC_RDF_REALLY_DELETE), folderArray, resourceArray);
|
||||
else
|
||||
rv = DoCommand(database, NS_LITERAL_CSTRING(NC_RDF_DELETE), folderArray, resourceArray);
|
||||
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMessenger::DeleteFolders(nsIRDFCompositeDataSource *db,
|
||||
nsIRDFResource *parentResource,
|
||||
nsIRDFResource *deletedFolderResource)
|
||||
|
|
|
@ -525,26 +525,6 @@ NS_IMETHODIMP nsMsgWindow::GetPromptDialog(nsIPrompt **aPrompt)
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgWindow::GetAuthPromptDialog(nsIAuthPrompt **aPrompt)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
NS_ENSURE_ARG_POINTER(aPrompt);
|
||||
nsCOMPtr<nsIDocShell> rootShell(do_QueryReferent(mRootDocShellWeak));
|
||||
if (rootShell)
|
||||
{
|
||||
nsCOMPtr<nsIAuthPrompt> dialog;
|
||||
dialog = do_GetInterface(rootShell, &rv);
|
||||
if (dialog)
|
||||
{
|
||||
*aPrompt = dialog;
|
||||
NS_ADDREF(*aPrompt);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
else
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgWindow::DisplayHTMLInMessagePane(const PRUnichar *title, const PRUnichar *body)
|
||||
{
|
||||
|
|
|
@ -60,103 +60,96 @@ class nsMsgDatabase;
|
|||
class nsDBFolderInfo : public nsIDBFolderInfo
|
||||
{
|
||||
public:
|
||||
friend class nsMsgDatabase;
|
||||
|
||||
nsDBFolderInfo(nsMsgDatabase *mdb);
|
||||
virtual ~nsDBFolderInfo();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
// interface methods.
|
||||
NS_DECL_NSIDBFOLDERINFO
|
||||
// create the appropriate table and row in a new db.
|
||||
nsresult AddToNewMDB();
|
||||
// accessor methods.
|
||||
|
||||
PRBool AddLaterKey(nsMsgKey key, PRTime until);
|
||||
PRInt32 GetNumLatered();
|
||||
nsMsgKey GetLateredAt(PRInt32 laterIndex, PRTime pUntil);
|
||||
void RemoveLateredAt(PRInt32 laterIndex);
|
||||
|
||||
PRBool TestFlag(PRInt32 flags);
|
||||
PRInt16 GetIMAPHierarchySeparator() ;
|
||||
void SetIMAPHierarchySeparator(PRInt16 hierarchySeparator) ;
|
||||
void ChangeImapTotalPendingMessages(PRInt32 delta);
|
||||
void ChangeImapUnreadPendingMessages(PRInt32 delta) ;
|
||||
|
||||
nsresult InitFromExistingDB();
|
||||
// get and set arbitrary property, aka row cell value.
|
||||
nsresult SetPropertyWithToken(mdb_token aProperty, nsString *propertyStr);
|
||||
nsresult SetUint32PropertyWithToken(mdb_token aProperty, PRUint32 propertyValue);
|
||||
nsresult SetInt32PropertyWithToken(mdb_token aProperty, PRInt32 propertyValue);
|
||||
nsresult GetPropertyWithToken(mdb_token aProperty, nsString *resultProperty);
|
||||
nsresult GetUint32PropertyWithToken(mdb_token aProperty, PRUint32 &propertyValue, PRUint32 defaultValue = 0);
|
||||
nsresult GetInt32PropertyWithToken(mdb_token aProperty, PRInt32 &propertyValue, PRInt32 defaultValue = 0);
|
||||
nsresult GetConstCharPtrCharacterSet(const char**result);
|
||||
|
||||
|
||||
nsMsgKeyArray m_lateredKeys; // list of latered messages
|
||||
|
||||
friend class nsMsgDatabase;
|
||||
|
||||
nsDBFolderInfo(nsMsgDatabase *mdb);
|
||||
virtual ~nsDBFolderInfo();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
// interface methods.
|
||||
NS_DECL_NSIDBFOLDERINFO
|
||||
// create the appropriate table and row in a new db.
|
||||
nsresult AddToNewMDB();
|
||||
// accessor methods.
|
||||
|
||||
PRBool TestFlag(PRInt32 flags);
|
||||
PRInt16 GetIMAPHierarchySeparator() ;
|
||||
void SetIMAPHierarchySeparator(PRInt16 hierarchySeparator) ;
|
||||
void ChangeImapTotalPendingMessages(PRInt32 delta);
|
||||
void ChangeImapUnreadPendingMessages(PRInt32 delta) ;
|
||||
|
||||
nsresult InitFromExistingDB();
|
||||
// get and set arbitrary property, aka row cell value.
|
||||
nsresult SetPropertyWithToken(mdb_token aProperty, nsString *propertyStr);
|
||||
nsresult SetUint32PropertyWithToken(mdb_token aProperty, PRUint32 propertyValue);
|
||||
nsresult SetInt32PropertyWithToken(mdb_token aProperty, PRInt32 propertyValue);
|
||||
nsresult GetPropertyWithToken(mdb_token aProperty, nsString *resultProperty);
|
||||
nsresult GetUint32PropertyWithToken(mdb_token aProperty, PRUint32 &propertyValue, PRUint32 defaultValue = 0);
|
||||
nsresult GetInt32PropertyWithToken(mdb_token aProperty, PRInt32 &propertyValue, PRInt32 defaultValue = 0);
|
||||
nsresult GetConstCharPtrCharacterSet(const char**result);
|
||||
|
||||
|
||||
nsMsgKeyArray m_lateredKeys; // list of latered messages
|
||||
|
||||
protected:
|
||||
|
||||
// initialize from appropriate table and row in existing db.
|
||||
nsresult InitMDBInfo();
|
||||
nsresult LoadMemberVariables();
|
||||
|
||||
void ReleaseExternalReferences(); // let go of any references to other objects.
|
||||
|
||||
PRInt32 m_folderSize;
|
||||
PRInt32 m_expungedBytes; // sum of size of deleted messages in folder
|
||||
PRUint32 m_folderDate;
|
||||
nsMsgKey m_highWaterMessageKey; // largest news article number or imap uid whose header we've seen
|
||||
|
||||
// m_numVisibleMessages, m_numNewMessages and m_numMessages can never be negative. 0 means 'no msgs'.
|
||||
PRInt32 m_numVisibleMessages; // doesn't include expunged or ignored messages (but does include collapsed).
|
||||
PRInt32 m_numNewMessages;
|
||||
PRInt32 m_numMessages; // includes expunged and ignored messages
|
||||
|
||||
PRInt32 m_flags; // folder specific flags. This holds things like re-use thread pane,
|
||||
// configured for off-line use, use default retrieval, purge article/header options
|
||||
|
||||
PRUint16 m_version; // for upgrading...
|
||||
PRInt16 m_IMAPHierarchySeparator; // imap path separator
|
||||
|
||||
// mail only (for now)
|
||||
|
||||
// IMAP only
|
||||
PRInt32 m_ImapUidValidity;
|
||||
PRInt32 m_totalPendingMessages;
|
||||
PRInt32 m_unreadPendingMessages;
|
||||
|
||||
// news only (for now)
|
||||
nsMsgKey m_expiredMark; // Highest invalid article number in group - for expiring
|
||||
// the db folder info will have to know what db and row it belongs to, since it is really
|
||||
// just a wrapper around the singleton folder info row in the mdb.
|
||||
nsMsgDatabase *m_mdb;
|
||||
nsIMdbTable *m_mdbTable; // singleton table in db
|
||||
nsIMdbRow *m_mdbRow; // singleton row in table;
|
||||
|
||||
nsCString m_charSet;
|
||||
PRBool m_charSetOverride;
|
||||
PRBool m_mdbTokensInitialized;
|
||||
|
||||
mdb_token m_rowScopeToken;
|
||||
mdb_token m_tableKindToken;
|
||||
// tokens for the pre-set columns - we cache these for speed, which may be silly
|
||||
mdb_token m_mailboxNameColumnToken;
|
||||
mdb_token m_numVisibleMessagesColumnToken;
|
||||
mdb_token m_numMessagesColumnToken;
|
||||
mdb_token m_numNewMessagesColumnToken;
|
||||
mdb_token m_flagsColumnToken;
|
||||
mdb_token m_folderSizeColumnToken;
|
||||
mdb_token m_expungedBytesColumnToken;
|
||||
mdb_token m_folderDateColumnToken;
|
||||
mdb_token m_highWaterMessageKeyColumnToken;
|
||||
|
||||
mdb_token m_imapUidValidityColumnToken;
|
||||
mdb_token m_totalPendingMessagesColumnToken;
|
||||
mdb_token m_unreadPendingMessagesColumnToken;
|
||||
mdb_token m_expiredMarkColumnToken;
|
||||
mdb_token m_versionColumnToken;
|
||||
|
||||
// initialize from appropriate table and row in existing db.
|
||||
nsresult InitMDBInfo();
|
||||
nsresult LoadMemberVariables();
|
||||
|
||||
void ReleaseExternalReferences(); // let go of any references to other objects.
|
||||
|
||||
PRInt32 m_folderSize;
|
||||
PRInt32 m_expungedBytes; // sum of size of deleted messages in folder
|
||||
PRUint32 m_folderDate;
|
||||
nsMsgKey m_highWaterMessageKey; // largest news article number or imap uid whose header we've seen
|
||||
|
||||
// m_numNewMessages and m_numMessages can never be negative. 0 means 'no msgs'.
|
||||
PRInt32 m_numNewMessages;
|
||||
PRInt32 m_numMessages; // includes expunged and ignored messages
|
||||
|
||||
PRInt32 m_flags; // folder specific flags. This holds things like re-use thread pane,
|
||||
// configured for off-line use, use default retrieval, purge article/header options
|
||||
|
||||
PRUint16 m_version; // for upgrading...
|
||||
PRInt16 m_IMAPHierarchySeparator; // imap path separator
|
||||
|
||||
// mail only (for now)
|
||||
|
||||
// IMAP only
|
||||
PRInt32 m_ImapUidValidity;
|
||||
PRInt32 m_totalPendingMessages;
|
||||
PRInt32 m_unreadPendingMessages;
|
||||
|
||||
// news only (for now)
|
||||
nsMsgKey m_expiredMark; // Highest invalid article number in group - for expiring
|
||||
// the db folder info will have to know what db and row it belongs to, since it is really
|
||||
// just a wrapper around the singleton folder info row in the mdb.
|
||||
nsMsgDatabase *m_mdb;
|
||||
nsIMdbTable *m_mdbTable; // singleton table in db
|
||||
nsIMdbRow *m_mdbRow; // singleton row in table;
|
||||
|
||||
nsCString m_charSet;
|
||||
PRBool m_charSetOverride;
|
||||
PRBool m_mdbTokensInitialized;
|
||||
|
||||
mdb_token m_rowScopeToken;
|
||||
mdb_token m_tableKindToken;
|
||||
// tokens for the pre-set columns - we cache these for speed, which may be silly
|
||||
mdb_token m_mailboxNameColumnToken;
|
||||
mdb_token m_numMessagesColumnToken;
|
||||
mdb_token m_numNewMessagesColumnToken;
|
||||
mdb_token m_flagsColumnToken;
|
||||
mdb_token m_folderSizeColumnToken;
|
||||
mdb_token m_expungedBytesColumnToken;
|
||||
mdb_token m_folderDateColumnToken;
|
||||
mdb_token m_highWaterMessageKeyColumnToken;
|
||||
|
||||
mdb_token m_imapUidValidityColumnToken;
|
||||
mdb_token m_totalPendingMessagesColumnToken;
|
||||
mdb_token m_unreadPendingMessagesColumnToken;
|
||||
mdb_token m_expiredMarkColumnToken;
|
||||
mdb_token m_versionColumnToken;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -56,13 +56,11 @@ interface nsIDBFolderInfo : nsISupports {
|
|||
void ChangeNumNewMessages(in long delta);
|
||||
void ChangeNumMessages(in long delta);
|
||||
|
||||
// ChangeNumVisibleMessages, NumNewMessages and NumMessages will never return negative numbers. 0 means 'no msgs'.
|
||||
void ChangeNumVisibleMessages(in long delta);
|
||||
// NumNewMessages and NumMessages will never return negative numbers. 0 means 'no msgs'.
|
||||
attribute long NumNewMessages;
|
||||
attribute long NumMessages;
|
||||
|
||||
attribute long expungedBytes;
|
||||
attribute long NumVisibleMessages;
|
||||
attribute long ImapUidValidity;
|
||||
attribute unsigned long Version;
|
||||
attribute long ImapTotalPendingMessages;
|
||||
|
|
|
@ -211,7 +211,6 @@ interface nsIMsgDatabase : nsIDBChangeAnnouncer {
|
|||
|
||||
void UndoDelete(in nsIMsgDBHdr msgHdr);
|
||||
|
||||
void MarkLater(in nsMsgKey key, in PRTime until);
|
||||
void MarkMarked(in nsMsgKey key, in boolean mark,
|
||||
in nsIDBChangeListener instigator);
|
||||
void MarkOffline(in nsMsgKey key, in boolean offline,
|
||||
|
@ -255,6 +254,9 @@ interface nsIMsgDatabase : nsIDBChangeAnnouncer {
|
|||
[noscript] void ListAllOfflineDeletes(in nsMsgKeyArrayPtr offlineDeletes);
|
||||
[noscript] void ListAllOfflineMsgs(in nsMsgKeyArrayPtr offlineMsgs);
|
||||
|
||||
void setAttributesOnPendingHdr(in nsIMsgDBHdr pendingHdr, in string property,
|
||||
in string propertyVal, in long flags);
|
||||
|
||||
readonly attribute nsMsgKey lowWaterArticleNum;
|
||||
readonly attribute nsMsgKey highWaterArticleNum;
|
||||
attribute nsMsgKey nextPseudoMsgKey; //for undo-redo of move pop->imap
|
||||
|
|
|
@ -50,36 +50,28 @@ class nsOfflineImapOperation;
|
|||
class nsMailDatabase : public nsMsgDatabase
|
||||
{
|
||||
public:
|
||||
nsMailDatabase();
|
||||
virtual ~nsMailDatabase();
|
||||
NS_IMETHOD Open(nsIFileSpec *aFolderName, PRBool create, PRBool upgrading, nsIMsgDatabase** pMessageDB);
|
||||
NS_IMETHOD ForceClosed();
|
||||
|
||||
static nsresult CloneInvalidDBInfoIntoNewDB(nsFileSpec &pathName, nsMailDatabase** pMailDB);
|
||||
|
||||
NS_IMETHOD OnNewPath(nsFileSpec &newPath);
|
||||
|
||||
NS_IMETHOD DeleteMessages(nsMsgKeyArray* nsMsgKeys, nsIDBChangeListener *instigator);
|
||||
nsMailDatabase();
|
||||
virtual ~nsMailDatabase();
|
||||
NS_IMETHOD Open(nsIFileSpec *aFolderName, PRBool create, PRBool upgrading, nsIMsgDatabase** pMessageDB);
|
||||
NS_IMETHOD ForceClosed();
|
||||
NS_IMETHOD DeleteMessages(nsMsgKeyArray* nsMsgKeys, nsIDBChangeListener *instigator);
|
||||
|
||||
NS_IMETHOD StartBatch();
|
||||
NS_IMETHOD EndBatch();
|
||||
|
||||
static nsresult SetFolderInfoValid(nsFileSpec *folderSpec, int num, int numunread);
|
||||
nsresult GetFolderName(nsString &folderName);
|
||||
virtual nsMailDatabase *GetMailDB() {return this;}
|
||||
static nsresult SetFolderInfoValid(nsFileSpec *folderSpec, int num, int numunread);
|
||||
nsresult GetFolderName(nsString &folderName);
|
||||
virtual nsMailDatabase *GetMailDB() {return this;}
|
||||
|
||||
virtual PRUint32 GetCurVersion() {return kMsgDBVersion;}
|
||||
|
||||
NS_IMETHOD GetOfflineOpForKey(nsMsgKey opKey, PRBool create, nsIMsgOfflineImapOperation **op);
|
||||
NS_IMETHOD RemoveOfflineOp(nsIMsgOfflineImapOperation *op);
|
||||
virtual PRUint32 GetCurVersion() {return kMsgDBVersion;}
|
||||
|
||||
NS_IMETHOD GetOfflineOpForKey(nsMsgKey opKey, PRBool create, nsIMsgOfflineImapOperation **op);
|
||||
NS_IMETHOD RemoveOfflineOp(nsIMsgOfflineImapOperation *op);
|
||||
|
||||
nsresult SetSourceMailbox(nsOfflineImapOperation *op, const char *mailbox, nsMsgKey key);
|
||||
|
||||
NS_IMETHOD SetSummaryValid(PRBool valid);
|
||||
NS_IMETHOD GetSummaryValid(PRBool *valid);
|
||||
|
||||
NS_IMETHOD EnumerateOfflineOps(nsISimpleEnumerator **enumerator);
|
||||
nsresult GetIdsWithNoBodies (nsMsgKeyArray &bodylessIds);
|
||||
NS_IMETHOD ListAllOfflineOpIds(nsMsgKeyArray *offlineOpIds);
|
||||
NS_IMETHOD ListAllOfflineDeletes(nsMsgKeyArray *offlineDeletes);
|
||||
|
||||
|
@ -90,7 +82,7 @@ protected:
|
|||
|
||||
nsresult GetAllOfflineOpsTable(); // get this on demand
|
||||
|
||||
nsIMdbTable *m_mdbAllOfflineOpsTable;
|
||||
nsCOMPtr <nsIMdbTable> m_mdbAllOfflineOpsTable;
|
||||
mdb_token m_offlineOpsRowScopeToken;
|
||||
mdb_token m_offlineOpsTableKindToken;
|
||||
|
||||
|
|
|
@ -77,36 +77,37 @@ public:
|
|||
virtual nsresult CloseMDB(PRBool commit);
|
||||
virtual nsresult CreateMsgHdr(nsIMdbRow* hdrRow, nsMsgKey key, nsIMsgDBHdr **result);
|
||||
virtual nsresult GetThreadForMsgKey(nsMsgKey msgKey, nsIMsgThread **result);
|
||||
virtual nsresult EnumerateUnreadMessages(nsISimpleEnumerator* *result);
|
||||
virtual nsresult EnumerateReadMessages(nsISimpleEnumerator* *result);
|
||||
virtual nsresult EnumerateMessagesWithFlag(nsISimpleEnumerator* *result, PRUint32 *pFlag);
|
||||
|
||||
// this might just be for debugging - we'll see.
|
||||
nsresult ListAllThreads(nsMsgKeyArray *threadIds);
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// nsMsgDatabase methods:
|
||||
nsMsgDatabase();
|
||||
virtual ~nsMsgDatabase();
|
||||
nsMsgDatabase();
|
||||
virtual ~nsMsgDatabase();
|
||||
|
||||
|
||||
static nsIMdbFactory *GetMDBFactory();
|
||||
nsIMdbEnv *GetEnv() {return m_mdbEnv;}
|
||||
nsIMdbStore *GetStore() {return m_mdbStore;}
|
||||
virtual PRUint32 GetCurVersion();
|
||||
nsIMsgHeaderParser *GetHeaderParser();
|
||||
nsresult GetCollationKeyGenerator();
|
||||
nsIMimeConverter * GetMimeConverter();
|
||||
static nsIMdbFactory *GetMDBFactory();
|
||||
nsIMdbEnv *GetEnv() {return m_mdbEnv;}
|
||||
nsIMdbStore *GetStore() {return m_mdbStore;}
|
||||
virtual PRUint32 GetCurVersion();
|
||||
nsIMsgHeaderParser *GetHeaderParser();
|
||||
nsresult GetCollationKeyGenerator();
|
||||
nsIMimeConverter * GetMimeConverter();
|
||||
|
||||
static nsMsgDatabase* FindInCache(nsFileSpec &dbName);
|
||||
nsresult GetTableCreateIfMissing(const char *scope, const char *kind, nsIMdbTable **table,
|
||||
mdb_token &scopeToken, mdb_token &kindToken);
|
||||
|
||||
//helper function to fill in nsStrings from hdr row cell contents.
|
||||
nsresult RowCellColumnTonsString(nsIMdbRow *row, mdb_token columnToken, nsString &resultStr);
|
||||
nsresult RowCellColumnToUInt32(nsIMdbRow *row, mdb_token columnToken, PRUint32 *uint32Result, PRUint32 defaultValue = 0);
|
||||
nsresult RowCellColumnToUInt32(nsIMdbRow *row, mdb_token columnToken, PRUint32 &uint32Result, PRUint32 defaultValue = 0);
|
||||
nsresult RowCellColumnToMime2DecodedString(nsIMdbRow *row, mdb_token columnToken, PRUnichar **);
|
||||
nsresult RowCellColumnToCollationKey(nsIMdbRow *row, mdb_token columnToken, PRUint8 **result, PRUint32 *len);
|
||||
nsresult RowCellColumnToConstCharPtr(nsIMdbRow *row, mdb_token columnToken, const char **ptr);
|
||||
nsresult RowCellColumnToAddressCollationKey(nsIMdbRow *row, mdb_token colToken, PRUint8 **result, PRUint32 *len);
|
||||
static nsMsgDatabase* FindInCache(nsFileSpec &dbName);
|
||||
|
||||
//helper function to fill in nsStrings from hdr row cell contents.
|
||||
nsresult RowCellColumnTonsString(nsIMdbRow *row, mdb_token columnToken, nsString &resultStr);
|
||||
nsresult RowCellColumnToUInt32(nsIMdbRow *row, mdb_token columnToken, PRUint32 *uint32Result, PRUint32 defaultValue = 0);
|
||||
nsresult RowCellColumnToUInt32(nsIMdbRow *row, mdb_token columnToken, PRUint32 &uint32Result, PRUint32 defaultValue = 0);
|
||||
nsresult RowCellColumnToMime2DecodedString(nsIMdbRow *row, mdb_token columnToken, PRUnichar **);
|
||||
nsresult RowCellColumnToCollationKey(nsIMdbRow *row, mdb_token columnToken, PRUint8 **result, PRUint32 *len);
|
||||
nsresult RowCellColumnToConstCharPtr(nsIMdbRow *row, mdb_token columnToken, const char **ptr);
|
||||
nsresult RowCellColumnToAddressCollationKey(nsIMdbRow *row, mdb_token colToken, PRUint8 **result, PRUint32 *len);
|
||||
|
||||
// these methods take the property name as a string, not a token.
|
||||
// they should be used when the properties aren't accessed a lot
|
||||
|
@ -120,27 +121,27 @@ public:
|
|||
nsresult SetNSStringPropertyWithToken(nsIMdbRow *row, mdb_token aProperty, nsString *propertyStr);
|
||||
|
||||
// helper functions to put values in cells for the passed-in row
|
||||
nsresult UInt32ToRowCellColumn(nsIMdbRow *row, mdb_token columnToken, PRUint32 value);
|
||||
nsresult CharPtrToRowCellColumn(nsIMdbRow *row, mdb_token columnToken, const char *charPtr);
|
||||
nsresult RowCellColumnToCharPtr(nsIMdbRow *row, mdb_token columnToken, char **result);
|
||||
nsresult UInt32ToRowCellColumn(nsIMdbRow *row, mdb_token columnToken, PRUint32 value);
|
||||
nsresult CharPtrToRowCellColumn(nsIMdbRow *row, mdb_token columnToken, const char *charPtr);
|
||||
nsresult RowCellColumnToCharPtr(nsIMdbRow *row, mdb_token columnToken, char **result);
|
||||
|
||||
|
||||
// helper functions to copy an nsString to a yarn, int32 to yarn, and vice versa.
|
||||
static struct mdbYarn *nsStringToYarn(struct mdbYarn *yarn, nsString *str);
|
||||
static struct mdbYarn *UInt32ToYarn(struct mdbYarn *yarn, PRUint32 i);
|
||||
static void YarnTonsString(struct mdbYarn *yarn, nsString *str);
|
||||
static void YarnTonsCString(struct mdbYarn *yarn, nsCString *str);
|
||||
static void YarnToUInt32(struct mdbYarn *yarn, PRUint32 *i);
|
||||
static struct mdbYarn *nsStringToYarn(struct mdbYarn *yarn, nsString *str);
|
||||
static struct mdbYarn *UInt32ToYarn(struct mdbYarn *yarn, PRUint32 i);
|
||||
static void YarnTonsString(struct mdbYarn *yarn, nsString *str);
|
||||
static void YarnTonsCString(struct mdbYarn *yarn, nsCString *str);
|
||||
static void YarnToUInt32(struct mdbYarn *yarn, PRUint32 *i);
|
||||
|
||||
|
||||
// helper functions to convert a 64bits PRTime into a 32bits value (compatible time_t) and vice versa.
|
||||
static void PRTime2Seconds(PRTime prTime, PRUint32 *seconds);
|
||||
static void Seconds2PRTime(PRUint32 seconds, PRTime *prTime);
|
||||
static void PRTime2Seconds(PRTime prTime, PRUint32 *seconds);
|
||||
static void Seconds2PRTime(PRUint32 seconds, PRTime *prTime);
|
||||
|
||||
static void CleanupCache();
|
||||
static void CleanupCache();
|
||||
#ifdef DEBUG
|
||||
static int GetNumInCache(void) {return(GetDBCache()->Count());}
|
||||
static void DumpCache();
|
||||
static int GetNumInCache(void) {return(GetDBCache()->Count());}
|
||||
static void DumpCache();
|
||||
virtual nsresult DumpContents();
|
||||
nsresult DumpThread(nsMsgKey threadId);
|
||||
nsresult DumpMsgChildren(nsIMsgDBHdr *msgHdr);
|
||||
|
@ -155,14 +156,14 @@ protected:
|
|||
nsresult GetBoolPref(const char *prefName, PRBool *result);
|
||||
nsresult GetIntPref(const char *prefName, PRInt32 *result);
|
||||
// retrieval methods
|
||||
nsIMsgThread * GetThreadForReference(nsCString &msgID, nsIMsgDBHdr **pMsgHdr);
|
||||
nsIMsgThread * GetThreadForSubject(nsCString &subject);
|
||||
nsIMsgThread * GetThreadForThreadId(nsMsgKey threadId);
|
||||
nsMsgHdr * GetMsgHdrForReference(nsCString &reference);
|
||||
nsIMsgDBHdr * GetMsgHdrForSubject(nsCString &msgID);
|
||||
nsIMsgThread * GetThreadForReference(nsCString &msgID, nsIMsgDBHdr **pMsgHdr);
|
||||
nsIMsgThread * GetThreadForSubject(nsCString &subject);
|
||||
nsIMsgThread * GetThreadForThreadId(nsMsgKey threadId);
|
||||
nsMsgHdr * GetMsgHdrForReference(nsCString &reference);
|
||||
nsIMsgDBHdr * GetMsgHdrForSubject(nsCString &msgID);
|
||||
// threading interfaces
|
||||
virtual nsresult CreateNewThread(nsMsgKey key, const char *subject, nsMsgThread **newThread);
|
||||
virtual PRBool ThreadBySubjectWithoutRe();
|
||||
virtual PRBool ThreadBySubjectWithoutRe();
|
||||
virtual nsresult ThreadNewHdr(nsMsgHdr* hdr, PRBool &newThread);
|
||||
virtual nsresult AddNewThread(nsMsgHdr *msgHdr);
|
||||
virtual nsresult AddToThread(nsMsgHdr *newHdr, nsIMsgThread *thread, nsIMsgDBHdr *pMsgHdr, PRBool threadInThread);
|
||||
|
@ -181,17 +182,17 @@ protected:
|
|||
|
||||
// Flag handling routines
|
||||
virtual nsresult SetKeyFlag(nsMsgKey key, PRBool set, PRUint32 flag,
|
||||
nsIDBChangeListener *instigator = NULL);
|
||||
nsIDBChangeListener *instigator = NULL);
|
||||
virtual nsresult SetMsgHdrFlag(nsIMsgDBHdr *msgHdr, PRBool set, PRUint32 flag,
|
||||
nsIDBChangeListener *instigator);
|
||||
nsIDBChangeListener *instigator);
|
||||
|
||||
virtual PRBool SetHdrFlag(nsIMsgDBHdr *, PRBool bSet, MsgFlags flag);
|
||||
virtual PRBool SetHdrFlag(nsIMsgDBHdr *, PRBool bSet, MsgFlags flag);
|
||||
virtual PRBool SetHdrReadFlag(nsIMsgDBHdr *, PRBool pRead);
|
||||
virtual PRUint32 GetStatusFlags(nsIMsgDBHdr *msgHdr, PRUint32 origFlags);
|
||||
// helper function which doesn't involve thread object
|
||||
|
||||
virtual nsresult RemoveHeaderFromDB(nsMsgHdr *msgHdr);
|
||||
virtual nsresult RemoveHeaderFromThread(nsMsgHdr *msgHdr);
|
||||
virtual nsresult RemoveHeaderFromDB(nsMsgHdr *msgHdr);
|
||||
virtual nsresult RemoveHeaderFromThread(nsMsgHdr *msgHdr);
|
||||
virtual nsresult AdjustExpungedBytesOnDelete(nsIMsgDBHdr *msgHdr);
|
||||
|
||||
|
||||
|
@ -205,69 +206,69 @@ protected:
|
|||
|
||||
nsresult PurgeMessagesOlderThan(PRUint32 daysToKeepHdrs, PRBool keepUnreadMessagesOnly);
|
||||
nsresult PurgeExcessMessages(PRUint32 numHeadersToKeep, PRBool keepUnreadMessagesOnly);
|
||||
|
||||
// mdb bookkeeping stuff
|
||||
virtual nsresult InitExistingDB();
|
||||
virtual nsresult InitNewDB();
|
||||
virtual nsresult InitMDBInfo();
|
||||
|
||||
|
||||
// mdb bookkeeping stuff
|
||||
virtual nsresult InitExistingDB();
|
||||
virtual nsresult InitNewDB();
|
||||
virtual nsresult InitMDBInfo();
|
||||
|
||||
nsCOMPtr <nsIMsgFolder> m_folder;
|
||||
nsDBFolderInfo *m_dbFolderInfo;
|
||||
nsMsgKey m_nextPseudoMsgKey;
|
||||
nsIMdbEnv *m_mdbEnv; // to be used in all the db calls.
|
||||
nsIMdbStore *m_mdbStore;
|
||||
nsIMdbTable *m_mdbAllMsgHeadersTable;
|
||||
nsIMdbTable *m_mdbAllThreadsTable;
|
||||
nsFileSpec m_dbName;
|
||||
nsMsgKeySet *m_newSet; // new messages since last open.
|
||||
PRBool m_mdbTokensInitialized;
|
||||
nsDBFolderInfo *m_dbFolderInfo;
|
||||
nsMsgKey m_nextPseudoMsgKey;
|
||||
nsIMdbEnv *m_mdbEnv; // to be used in all the db calls.
|
||||
nsIMdbStore *m_mdbStore;
|
||||
nsIMdbTable *m_mdbAllMsgHeadersTable;
|
||||
nsIMdbTable *m_mdbAllThreadsTable;
|
||||
nsFileSpec m_dbName;
|
||||
nsMsgKeySet *m_newSet; // new messages since last open.
|
||||
PRBool m_mdbTokensInitialized;
|
||||
nsCOMPtr <nsISupportsArray> m_ChangeListeners;
|
||||
mdb_token m_hdrRowScopeToken;
|
||||
mdb_token m_threadRowScopeToken;
|
||||
mdb_token m_hdrTableKindToken;
|
||||
mdb_token m_threadTableKindToken;
|
||||
mdb_token m_allThreadsTableKindToken;
|
||||
mdb_token m_subjectColumnToken;
|
||||
mdb_token m_senderColumnToken;
|
||||
mdb_token m_messageIdColumnToken;
|
||||
mdb_token m_referencesColumnToken;
|
||||
mdb_token m_recipientsColumnToken;
|
||||
mdb_token m_dateColumnToken;
|
||||
mdb_token m_messageSizeColumnToken;
|
||||
mdb_token m_flagsColumnToken;
|
||||
mdb_token m_priorityColumnToken;
|
||||
mdb_token m_labelColumnToken;
|
||||
mdb_token m_statusOffsetColumnToken;
|
||||
mdb_token m_numLinesColumnToken;
|
||||
mdb_token m_ccListColumnToken;
|
||||
mdb_token m_threadFlagsColumnToken;
|
||||
mdb_token m_threadIdColumnToken;
|
||||
mdb_token m_threadChildrenColumnToken;
|
||||
mdb_token m_threadUnreadChildrenColumnToken;
|
||||
mdb_token m_messageThreadIdColumnToken;
|
||||
mdb_token m_threadSubjectColumnToken;
|
||||
mdb_token m_numReferencesColumnToken;
|
||||
mdb_token m_messageCharSetColumnToken;
|
||||
mdb_token m_threadParentColumnToken;
|
||||
mdb_token m_threadRootKeyColumnToken;
|
||||
mdb_token m_offlineMsgOffsetColumnToken;
|
||||
mdb_token m_offlineMessageSizeColumnToken;
|
||||
nsIMsgHeaderParser *m_HeaderParser;
|
||||
|
||||
// header caching stuff - MRU headers, keeps them around in memory
|
||||
nsresult GetHdrFromCache(nsMsgKey key, nsIMsgDBHdr* *result);
|
||||
nsresult AddHdrToCache(nsIMsgDBHdr *hdr, nsMsgKey key);
|
||||
nsresult ClearHdrCache(PRBool reInit);
|
||||
nsresult RemoveHdrFromCache(nsIMsgDBHdr *hdr, nsMsgKey key);
|
||||
// all headers currently instantiated, doesn't hold refs
|
||||
// these get added when msg hdrs get constructed, and removed when they get destroyed.
|
||||
nsresult GetHdrFromUseCache(nsMsgKey key, nsIMsgDBHdr* *result);
|
||||
nsresult AddHdrToUseCache(nsIMsgDBHdr *hdr, nsMsgKey key);
|
||||
nsresult ClearUseHdrCache();
|
||||
nsresult RemoveHdrFromUseCache(nsIMsgDBHdr *hdr, nsMsgKey key);
|
||||
|
||||
void ClearCachedObjects(PRBool dbGoingAway);
|
||||
// all instantiated headers, but doesn't hold refs.
|
||||
mdb_token m_hdrRowScopeToken;
|
||||
mdb_token m_threadRowScopeToken;
|
||||
mdb_token m_hdrTableKindToken;
|
||||
mdb_token m_threadTableKindToken;
|
||||
mdb_token m_allThreadsTableKindToken;
|
||||
mdb_token m_subjectColumnToken;
|
||||
mdb_token m_senderColumnToken;
|
||||
mdb_token m_messageIdColumnToken;
|
||||
mdb_token m_referencesColumnToken;
|
||||
mdb_token m_recipientsColumnToken;
|
||||
mdb_token m_dateColumnToken;
|
||||
mdb_token m_messageSizeColumnToken;
|
||||
mdb_token m_flagsColumnToken;
|
||||
mdb_token m_priorityColumnToken;
|
||||
mdb_token m_labelColumnToken;
|
||||
mdb_token m_statusOffsetColumnToken;
|
||||
mdb_token m_numLinesColumnToken;
|
||||
mdb_token m_ccListColumnToken;
|
||||
mdb_token m_threadFlagsColumnToken;
|
||||
mdb_token m_threadIdColumnToken;
|
||||
mdb_token m_threadChildrenColumnToken;
|
||||
mdb_token m_threadUnreadChildrenColumnToken;
|
||||
mdb_token m_messageThreadIdColumnToken;
|
||||
mdb_token m_threadSubjectColumnToken;
|
||||
mdb_token m_numReferencesColumnToken;
|
||||
mdb_token m_messageCharSetColumnToken;
|
||||
mdb_token m_threadParentColumnToken;
|
||||
mdb_token m_threadRootKeyColumnToken;
|
||||
mdb_token m_offlineMsgOffsetColumnToken;
|
||||
mdb_token m_offlineMessageSizeColumnToken;
|
||||
nsIMsgHeaderParser *m_HeaderParser;
|
||||
|
||||
// header caching stuff - MRU headers, keeps them around in memory
|
||||
nsresult GetHdrFromCache(nsMsgKey key, nsIMsgDBHdr* *result);
|
||||
nsresult AddHdrToCache(nsIMsgDBHdr *hdr, nsMsgKey key);
|
||||
nsresult ClearHdrCache(PRBool reInit);
|
||||
nsresult RemoveHdrFromCache(nsIMsgDBHdr *hdr, nsMsgKey key);
|
||||
// all headers currently instantiated, doesn't hold refs
|
||||
// these get added when msg hdrs get constructed, and removed when they get destroyed.
|
||||
nsresult GetHdrFromUseCache(nsMsgKey key, nsIMsgDBHdr* *result);
|
||||
nsresult AddHdrToUseCache(nsIMsgDBHdr *hdr, nsMsgKey key);
|
||||
nsresult ClearUseHdrCache();
|
||||
nsresult RemoveHdrFromUseCache(nsIMsgDBHdr *hdr, nsMsgKey key);
|
||||
|
||||
void ClearCachedObjects(PRBool dbGoingAway);
|
||||
// all instantiated headers, but doesn't hold refs.
|
||||
PLDHashTable *m_headersInUse;
|
||||
static const void* PR_CALLBACK GetKey(PLDHashTable* aTable, PLDHashEntryHdr* aEntry);
|
||||
static PLDHashNumber PR_CALLBACK HashKey(PLDHashTable* aTable, const void* aKey);
|
||||
|
@ -322,9 +323,9 @@ public:
|
|||
NS_DECL_NSIMSGDOWNLOADSETTINGS
|
||||
protected:
|
||||
PRBool m_useServerDefaults;
|
||||
PRBool m_downloadUnreadOnly;
|
||||
PRBool m_downloadByDate;
|
||||
PRInt32 m_ageLimitOfMsgsToDownload;
|
||||
PRBool m_downloadUnreadOnly;
|
||||
PRBool m_downloadByDate;
|
||||
PRInt32 m_ageLimitOfMsgsToDownload;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -55,18 +55,17 @@ static const char *kDBFolderInfoTableKind = "ns:msg:db:table:kind:dbfolderinfo";
|
|||
|
||||
struct mdbOid gDBFolderInfoOID;
|
||||
|
||||
static const char * kNumVisibleMessagesColumnName = "numVisMsgs";
|
||||
static const char * kNumMessagesColumnName ="numMsgs";
|
||||
static const char * kNumNewMessagesColumnName = "numNewMsgs";
|
||||
static const char * kFlagsColumnName = "flags";
|
||||
static const char * kFolderSizeColumnName = "folderSize";
|
||||
static const char * kExpungedBytesColumnName = "expungedBytes";
|
||||
static const char * kFolderDateColumnName = "folderDate";
|
||||
static const char * kHighWaterMessageKeyColumnName = "highWaterKey";
|
||||
static const char * kNumMessagesColumnName ="numMsgs";
|
||||
static const char * kNumNewMessagesColumnName = "numNewMsgs";
|
||||
static const char * kFlagsColumnName = "flags";
|
||||
static const char * kFolderSizeColumnName = "folderSize";
|
||||
static const char * kExpungedBytesColumnName = "expungedBytes";
|
||||
static const char * kFolderDateColumnName = "folderDate";
|
||||
static const char * kHighWaterMessageKeyColumnName = "highWaterKey";
|
||||
|
||||
static const char * kImapUidValidityColumnName = "UIDValidity";
|
||||
static const char * kTotalPendingMessagesColumnName = "totPendingMsgs";
|
||||
static const char * kUnreadPendingMessagesColumnName = "unreadPendingMsgs";
|
||||
static const char * kImapUidValidityColumnName = "UIDValidity";
|
||||
static const char * kTotalPendingMessagesColumnName = "totPendingMsgs";
|
||||
static const char * kUnreadPendingMessagesColumnName = "unreadPendingMsgs";
|
||||
static const char * kMailboxNameColumnName = "mailboxName";
|
||||
static const char * kKnownArtsSetColumnName = "knownArts";
|
||||
static const char * kExpiredMarkColumnName = "expiredMark";
|
||||
|
@ -117,7 +116,8 @@ NS_IMETHODIMP nsFolderCharsetObserver::Observe(nsISupports *aSubject, const char
|
|||
nsCOMPtr<nsIPrefLocalizedString> pls;
|
||||
rv = prefBranch->GetComplexValue(kMAILNEWS_VIEW_DEFAULT_CHARSET,
|
||||
NS_GET_IID(nsIPrefLocalizedString), getter_AddRefs(pls));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsXPIDLString ucsval;
|
||||
pls->ToString(getter_Copies(ucsval));
|
||||
if (ucsval)
|
||||
|
@ -132,7 +132,8 @@ NS_IMETHODIMP nsFolderCharsetObserver::Observe(nsISupports *aSubject, const char
|
|||
else if (!nsCRT::strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID))
|
||||
{
|
||||
nsCOMPtr<nsIPrefBranchInternal> pbi = do_QueryInterface(prefBranch);
|
||||
if (pbi) {
|
||||
if (pbi)
|
||||
{
|
||||
rv = pbi->RemoveObserver(kMAILNEWS_VIEW_DEFAULT_CHARSET, this);
|
||||
rv = pbi->RemoveObserver(kMAILNEWS_DEFAULT_CHARSET_OVERRIDE, this);
|
||||
}
|
||||
|
@ -149,25 +150,25 @@ NS_IMPL_RELEASE(nsDBFolderInfo)
|
|||
NS_IMETHODIMP
|
||||
nsDBFolderInfo::QueryInterface(REFNSIID iid, void** result)
|
||||
{
|
||||
if (! result)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*result = nsnull;
|
||||
if(iid.Equals(NS_GET_IID(nsIDBFolderInfo)) ||
|
||||
iid.Equals(NS_GET_IID(nsISupports))) {
|
||||
*result = NS_STATIC_CAST(nsIDBFolderInfo*, this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
if (! result)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*result = nsnull;
|
||||
if(iid.Equals(NS_GET_IID(nsIDBFolderInfo)) ||
|
||||
iid.Equals(NS_GET_IID(nsISupports)))
|
||||
{
|
||||
*result = NS_STATIC_CAST(nsIDBFolderInfo*, this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
|
||||
nsDBFolderInfo::nsDBFolderInfo(nsMsgDatabase *mdb)
|
||||
: m_flags(0),
|
||||
m_expiredMark(0),
|
||||
m_numVisibleMessagesColumnToken(0),
|
||||
m_expiredMarkColumnToken(0)
|
||||
: m_flags(0),
|
||||
m_expiredMark(0),
|
||||
m_expiredMarkColumnToken(0)
|
||||
{
|
||||
m_mdbTable = NULL;
|
||||
m_mdbRow = NULL;
|
||||
|
@ -181,7 +182,6 @@ nsDBFolderInfo::nsDBFolderInfo(nsMsgDatabase *mdb)
|
|||
|
||||
m_numNewMessages = 0;
|
||||
m_numMessages = 0;
|
||||
m_numVisibleMessages = 0;
|
||||
// IMAP only
|
||||
m_ImapUidValidity = 0;
|
||||
m_totalPendingMessages =0;
|
||||
|
@ -189,7 +189,7 @@ nsDBFolderInfo::nsDBFolderInfo(nsMsgDatabase *mdb)
|
|||
|
||||
m_mdbTokensInitialized = PR_FALSE;
|
||||
m_charSetOverride = PR_FALSE;
|
||||
|
||||
|
||||
if (!gInitializeObserver)
|
||||
{
|
||||
gInitializeObserver = PR_TRUE;
|
||||
|
@ -204,18 +204,19 @@ nsDBFolderInfo::nsDBFolderInfo(nsMsgDatabase *mdb)
|
|||
{
|
||||
nsCOMPtr<nsIPrefLocalizedString> pls;
|
||||
rv = prefBranch->GetComplexValue(kMAILNEWS_VIEW_DEFAULT_CHARSET,
|
||||
NS_GET_IID(nsIPrefLocalizedString), getter_AddRefs(pls));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
NS_GET_IID(nsIPrefLocalizedString), getter_AddRefs(pls));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsXPIDLString ucsval;
|
||||
pls->ToString(getter_Copies(ucsval));
|
||||
if (ucsval)
|
||||
gDefaultCharacterSet.AssignWithConversion(ucsval.get());
|
||||
}
|
||||
rv = prefBranch->GetBoolPref(kMAILNEWS_DEFAULT_CHARSET_OVERRIDE, &gDefaultCharacterOverride);
|
||||
|
||||
|
||||
gFolderCharsetObserver = new nsFolderCharsetObserver();
|
||||
NS_ASSERTION(gFolderCharsetObserver, "failed to create observer");
|
||||
|
||||
|
||||
// register prefs callbacks
|
||||
if (gFolderCharsetObserver)
|
||||
{
|
||||
|
@ -225,7 +226,7 @@ nsDBFolderInfo::nsDBFolderInfo(nsMsgDatabase *mdb)
|
|||
rv = pbi->AddObserver(kMAILNEWS_VIEW_DEFAULT_CHARSET, gFolderCharsetObserver, PR_FALSE);
|
||||
rv = pbi->AddObserver(kMAILNEWS_DEFAULT_CHARSET_OVERRIDE, gFolderCharsetObserver, PR_FALSE);
|
||||
}
|
||||
|
||||
|
||||
// also register for shutdown
|
||||
nsCOMPtr<nsIObserverService> observerService = do_GetService("@mozilla.org/observer-service;1", &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
|
@ -235,25 +236,25 @@ nsDBFolderInfo::nsDBFolderInfo(nsMsgDatabase *mdb)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_mdb = mdb;
|
||||
if (mdb)
|
||||
{
|
||||
mdb_err err;
|
||||
|
||||
// mdb->AddRef();
|
||||
err = m_mdb->GetStore()->StringToToken(mdb->GetEnv(), kDBFolderInfoScope, &m_rowScopeToken);
|
||||
if (err == NS_OK)
|
||||
{
|
||||
err = m_mdb->GetStore()->StringToToken(mdb->GetEnv(), kDBFolderInfoTableKind, &m_tableKindToken);
|
||||
if (err == NS_OK)
|
||||
{
|
||||
gDBFolderInfoOID.mOid_Scope = m_rowScopeToken;
|
||||
gDBFolderInfoOID.mOid_Id = 1;
|
||||
}
|
||||
}
|
||||
InitMDBInfo();
|
||||
}
|
||||
|
||||
m_mdb = mdb;
|
||||
if (mdb)
|
||||
{
|
||||
mdb_err err;
|
||||
|
||||
// mdb->AddRef();
|
||||
err = m_mdb->GetStore()->StringToToken(mdb->GetEnv(), kDBFolderInfoScope, &m_rowScopeToken);
|
||||
if (err == NS_OK)
|
||||
{
|
||||
err = m_mdb->GetStore()->StringToToken(mdb->GetEnv(), kDBFolderInfoTableKind, &m_tableKindToken);
|
||||
if (err == NS_OK)
|
||||
{
|
||||
gDBFolderInfoOID.mOid_Scope = m_rowScopeToken;
|
||||
gDBFolderInfoOID.mOid_Id = 1;
|
||||
}
|
||||
}
|
||||
InitMDBInfo();
|
||||
}
|
||||
}
|
||||
|
||||
nsDBFolderInfo::~nsDBFolderInfo()
|
||||
|
@ -267,9 +268,8 @@ nsDBFolderInfo::~nsDBFolderInfo()
|
|||
void nsDBFolderInfo::ReleaseExternalReferences()
|
||||
{
|
||||
if (gReleaseObserver)
|
||||
{
|
||||
|
||||
NS_IF_RELEASE(gFolderCharsetObserver);
|
||||
}
|
||||
|
||||
if (m_mdb)
|
||||
{
|
||||
|
@ -290,111 +290,109 @@ void nsDBFolderInfo::ReleaseExternalReferences()
|
|||
// this routine sets up a new db to know about the dbFolderInfo stuff...
|
||||
nsresult nsDBFolderInfo::AddToNewMDB()
|
||||
{
|
||||
nsresult ret = NS_OK;
|
||||
if (m_mdb && m_mdb->GetStore())
|
||||
{
|
||||
nsIMdbStore *store = m_mdb->GetStore();
|
||||
// create the unique table for the dbFolderInfo.
|
||||
mdb_err err = store->NewTable(m_mdb->GetEnv(), m_rowScopeToken,
|
||||
m_tableKindToken, PR_TRUE, nsnull, &m_mdbTable);
|
||||
|
||||
// make sure the oid of the table is 1.
|
||||
struct mdbOid folderInfoTableOID;
|
||||
folderInfoTableOID.mOid_Id = 1;
|
||||
folderInfoTableOID.mOid_Scope = m_rowScopeToken;
|
||||
|
||||
// m_mdbTable->BecomeContent(m_mdb->GetEnv(), &folderInfoTableOID);
|
||||
|
||||
// create the singleton row for the dbFolderInfo.
|
||||
err = store->NewRowWithOid(m_mdb->GetEnv(),
|
||||
&gDBFolderInfoOID, &m_mdbRow);
|
||||
|
||||
// add the row to the singleton table.
|
||||
if (m_mdbRow && NS_SUCCEEDED(err))
|
||||
{
|
||||
err = m_mdbTable->AddRow(m_mdb->GetEnv(), m_mdbRow);
|
||||
}
|
||||
|
||||
ret = err; // what are we going to do about mdb_err's?
|
||||
}
|
||||
return ret;
|
||||
nsresult ret = NS_OK;
|
||||
if (m_mdb && m_mdb->GetStore())
|
||||
{
|
||||
nsIMdbStore *store = m_mdb->GetStore();
|
||||
// create the unique table for the dbFolderInfo.
|
||||
mdb_err err = store->NewTable(m_mdb->GetEnv(), m_rowScopeToken,
|
||||
m_tableKindToken, PR_TRUE, nsnull, &m_mdbTable);
|
||||
|
||||
// make sure the oid of the table is 1.
|
||||
struct mdbOid folderInfoTableOID;
|
||||
folderInfoTableOID.mOid_Id = 1;
|
||||
folderInfoTableOID.mOid_Scope = m_rowScopeToken;
|
||||
|
||||
// m_mdbTable->BecomeContent(m_mdb->GetEnv(), &folderInfoTableOID);
|
||||
|
||||
// create the singleton row for the dbFolderInfo.
|
||||
err = store->NewRowWithOid(m_mdb->GetEnv(),
|
||||
&gDBFolderInfoOID, &m_mdbRow);
|
||||
|
||||
// add the row to the singleton table.
|
||||
if (m_mdbRow && NS_SUCCEEDED(err))
|
||||
{
|
||||
err = m_mdbTable->AddRow(m_mdb->GetEnv(), m_mdbRow);
|
||||
}
|
||||
|
||||
ret = err; // what are we going to do about mdb_err's?
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
nsresult nsDBFolderInfo::InitFromExistingDB()
|
||||
{
|
||||
nsresult ret = NS_OK;
|
||||
if (m_mdb && m_mdb->GetStore())
|
||||
{
|
||||
nsIMdbStore *store = m_mdb->GetStore();
|
||||
if (store)
|
||||
{
|
||||
mdb_pos rowPos;
|
||||
mdb_count outTableCount; // current number of such tables
|
||||
mdb_bool mustBeUnique; // whether port can hold only one of these
|
||||
mdb_bool hasOid;
|
||||
ret = store->GetTableKind(m_mdb->GetEnv(), m_rowScopeToken, m_tableKindToken, &outTableCount,
|
||||
&mustBeUnique, &m_mdbTable);
|
||||
// NS_ASSERTION(mustBeUnique && outTableCount == 1, "only one global db info allowed");
|
||||
|
||||
if (m_mdbTable)
|
||||
{
|
||||
// find singleton row for global info.
|
||||
ret = m_mdbTable->HasOid(m_mdb->GetEnv(), &gDBFolderInfoOID, &hasOid);
|
||||
if (ret == NS_OK)
|
||||
{
|
||||
nsIMdbTableRowCursor *rowCursor;
|
||||
rowPos = -1;
|
||||
ret= m_mdbTable->GetTableRowCursor(m_mdb->GetEnv(), rowPos, &rowCursor);
|
||||
if (ret == NS_OK)
|
||||
{
|
||||
ret = rowCursor->NextRow(m_mdb->GetEnv(), &m_mdbRow, &rowPos);
|
||||
NS_RELEASE(rowCursor);
|
||||
if (ret == NS_OK && m_mdbRow)
|
||||
{
|
||||
LoadMemberVariables();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
nsresult ret = NS_OK;
|
||||
if (m_mdb && m_mdb->GetStore())
|
||||
{
|
||||
nsIMdbStore *store = m_mdb->GetStore();
|
||||
if (store)
|
||||
{
|
||||
mdb_pos rowPos;
|
||||
mdb_count outTableCount; // current number of such tables
|
||||
mdb_bool mustBeUnique; // whether port can hold only one of these
|
||||
mdb_bool hasOid;
|
||||
ret = store->GetTableKind(m_mdb->GetEnv(), m_rowScopeToken, m_tableKindToken, &outTableCount,
|
||||
&mustBeUnique, &m_mdbTable);
|
||||
// NS_ASSERTION(mustBeUnique && outTableCount == 1, "only one global db info allowed");
|
||||
|
||||
if (m_mdbTable)
|
||||
{
|
||||
// find singleton row for global info.
|
||||
ret = m_mdbTable->HasOid(m_mdb->GetEnv(), &gDBFolderInfoOID, &hasOid);
|
||||
if (ret == NS_OK)
|
||||
{
|
||||
nsIMdbTableRowCursor *rowCursor;
|
||||
rowPos = -1;
|
||||
ret= m_mdbTable->GetTableRowCursor(m_mdb->GetEnv(), rowPos, &rowCursor);
|
||||
if (ret == NS_OK)
|
||||
{
|
||||
ret = rowCursor->NextRow(m_mdb->GetEnv(), &m_mdbRow, &rowPos);
|
||||
NS_RELEASE(rowCursor);
|
||||
if (ret == NS_OK && m_mdbRow)
|
||||
{
|
||||
LoadMemberVariables();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
nsresult nsDBFolderInfo::InitMDBInfo()
|
||||
{
|
||||
nsresult ret = NS_OK;
|
||||
if (!m_mdbTokensInitialized && m_mdb && m_mdb->GetStore())
|
||||
{
|
||||
nsIMdbStore *store = m_mdb->GetStore();
|
||||
nsIMdbEnv *env = m_mdb->GetEnv();
|
||||
|
||||
store->StringToToken(env, kNumVisibleMessagesColumnName, &m_numVisibleMessagesColumnToken);
|
||||
store->StringToToken(env, kNumMessagesColumnName, &m_numMessagesColumnToken);
|
||||
store->StringToToken(env, kNumNewMessagesColumnName, &m_numNewMessagesColumnToken);
|
||||
store->StringToToken(env, kFlagsColumnName, &m_flagsColumnToken);
|
||||
store->StringToToken(env, kFolderSizeColumnName, &m_folderSizeColumnToken);
|
||||
store->StringToToken(env, kExpungedBytesColumnName, &m_expungedBytesColumnToken);
|
||||
store->StringToToken(env, kFolderDateColumnName, &m_folderDateColumnToken);
|
||||
|
||||
store->StringToToken(env, kHighWaterMessageKeyColumnName, &m_highWaterMessageKeyColumnToken);
|
||||
store->StringToToken(env, kMailboxNameColumnName, &m_mailboxNameColumnToken);
|
||||
|
||||
store->StringToToken(env, kImapUidValidityColumnName, &m_imapUidValidityColumnToken);
|
||||
store->StringToToken(env, kTotalPendingMessagesColumnName, &m_totalPendingMessagesColumnToken);
|
||||
store->StringToToken(env, kUnreadPendingMessagesColumnName, &m_unreadPendingMessagesColumnToken);
|
||||
store->StringToToken(env, kExpiredMarkColumnName, &m_expiredMarkColumnToken);
|
||||
store->StringToToken(env, kVersionColumnName, &m_versionColumnToken);
|
||||
m_mdbTokensInitialized = PR_TRUE;
|
||||
}
|
||||
return ret;
|
||||
nsresult ret = NS_OK;
|
||||
if (!m_mdbTokensInitialized && m_mdb && m_mdb->GetStore())
|
||||
{
|
||||
nsIMdbStore *store = m_mdb->GetStore();
|
||||
nsIMdbEnv *env = m_mdb->GetEnv();
|
||||
|
||||
store->StringToToken(env, kNumMessagesColumnName, &m_numMessagesColumnToken);
|
||||
store->StringToToken(env, kNumNewMessagesColumnName, &m_numNewMessagesColumnToken);
|
||||
store->StringToToken(env, kFlagsColumnName, &m_flagsColumnToken);
|
||||
store->StringToToken(env, kFolderSizeColumnName, &m_folderSizeColumnToken);
|
||||
store->StringToToken(env, kExpungedBytesColumnName, &m_expungedBytesColumnToken);
|
||||
store->StringToToken(env, kFolderDateColumnName, &m_folderDateColumnToken);
|
||||
|
||||
store->StringToToken(env, kHighWaterMessageKeyColumnName, &m_highWaterMessageKeyColumnToken);
|
||||
store->StringToToken(env, kMailboxNameColumnName, &m_mailboxNameColumnToken);
|
||||
|
||||
store->StringToToken(env, kImapUidValidityColumnName, &m_imapUidValidityColumnToken);
|
||||
store->StringToToken(env, kTotalPendingMessagesColumnName, &m_totalPendingMessagesColumnToken);
|
||||
store->StringToToken(env, kUnreadPendingMessagesColumnName, &m_unreadPendingMessagesColumnToken);
|
||||
store->StringToToken(env, kExpiredMarkColumnName, &m_expiredMarkColumnToken);
|
||||
store->StringToToken(env, kVersionColumnName, &m_versionColumnToken);
|
||||
m_mdbTokensInitialized = PR_TRUE;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
nsresult nsDBFolderInfo::LoadMemberVariables()
|
||||
{
|
||||
nsresult ret = NS_OK;
|
||||
// it's really not an error for these properties to not exist...
|
||||
GetInt32PropertyWithToken(m_numVisibleMessagesColumnToken, m_numVisibleMessages);
|
||||
GetInt32PropertyWithToken(m_numMessagesColumnToken, m_numMessages);
|
||||
GetInt32PropertyWithToken(m_numNewMessagesColumnToken, m_numNewMessages);
|
||||
GetInt32PropertyWithToken(m_flagsColumnToken, m_flags);
|
||||
|
@ -444,7 +442,7 @@ NS_IMETHODIMP nsDBFolderInfo::SetHighWater(nsMsgKey highWater, PRBool force)
|
|||
|
||||
NS_IMETHODIMP nsDBFolderInfo::SetHighWater(nsMsgKey highWater)
|
||||
{
|
||||
return SetHighWater(highWater, PR_TRUE);
|
||||
return SetHighWater(highWater, PR_TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -452,49 +450,49 @@ NS_IMETHODIMP
|
|||
nsDBFolderInfo::GetFolderSize(PRUint32 *size)
|
||||
{
|
||||
if (!size)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
*size = m_folderSize;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::SetFolderSize(PRUint32 size)
|
||||
{
|
||||
m_folderSize = size;
|
||||
return SetUint32PropertyWithToken(m_folderSizeColumnToken, m_folderSize);
|
||||
m_folderSize = size;
|
||||
return SetUint32PropertyWithToken(m_folderSizeColumnToken, m_folderSize);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDBFolderInfo::GetFolderDate(PRUint32 *folderDate)
|
||||
{
|
||||
if (!folderDate)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
*folderDate = m_folderDate;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::SetFolderDate(PRUint32 folderDate)
|
||||
{
|
||||
m_folderDate = folderDate;
|
||||
return SetUint32PropertyWithToken(m_folderDateColumnToken, folderDate);
|
||||
m_folderDate = folderDate;
|
||||
return SetUint32PropertyWithToken(m_folderDateColumnToken, folderDate);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::GetHighWater(nsMsgKey *result)
|
||||
{
|
||||
*result = m_highWaterMessageKey;
|
||||
return NS_OK;
|
||||
*result = m_highWaterMessageKey;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::SetExpiredMark(nsMsgKey expiredKey)
|
||||
{
|
||||
m_expiredMark = expiredKey;
|
||||
return SetUint32PropertyWithToken(m_expiredMarkColumnToken, expiredKey);
|
||||
m_expiredMark = expiredKey;
|
||||
return SetUint32PropertyWithToken(m_expiredMarkColumnToken, expiredKey);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::GetExpiredMark(nsMsgKey *result)
|
||||
{
|
||||
*result = m_expiredMark;
|
||||
return NS_OK;
|
||||
*result = m_expiredMark;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -503,196 +501,146 @@ nsDBFolderInfo::ChangeExpungedBytes(PRInt32 delta)
|
|||
return SetExpungedBytes(m_expungedBytes + delta);
|
||||
}
|
||||
|
||||
PRBool nsDBFolderInfo::AddLaterKey(nsMsgKey key, PRTime until)
|
||||
{
|
||||
//ducarroz: if until represente a folder time stamp,
|
||||
// therefore it should be declared as a PRInt32.
|
||||
// Else, it should be a PRTime.
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRInt32 nsDBFolderInfo::GetNumLatered()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
nsMsgKey nsDBFolderInfo::GetLateredAt(PRInt32 laterIndex, PRTime pUntil)
|
||||
{
|
||||
//ducarroz: if until represente a folder time stamp,
|
||||
// therefore it should be declared as a PRInt32.
|
||||
// Else, it should be a PRTime.
|
||||
return nsMsgKey_None;
|
||||
}
|
||||
|
||||
void nsDBFolderInfo::RemoveLateredAt(PRInt32 laterIndex)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::SetMailboxName(nsString *newBoxName)
|
||||
{
|
||||
return SetPropertyWithToken(m_mailboxNameColumnToken, newBoxName);
|
||||
return SetPropertyWithToken(m_mailboxNameColumnToken, newBoxName);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::GetMailboxName(nsString *boxName)
|
||||
{
|
||||
return GetPropertyWithToken(m_mailboxNameColumnToken, boxName);
|
||||
return GetPropertyWithToken(m_mailboxNameColumnToken, boxName);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::ChangeNumNewMessages(PRInt32 delta)
|
||||
{
|
||||
m_numNewMessages += delta;
|
||||
m_numNewMessages += delta;
|
||||
// m_numNewMessages can never be set to negative.
|
||||
if (m_numNewMessages < 0)
|
||||
{
|
||||
if (m_numNewMessages < 0)
|
||||
{
|
||||
#ifdef DEBUG_bienvenu1
|
||||
NS_ASSERTION(PR_FALSE, "Hardcoded assertion");
|
||||
NS_ASSERTION(PR_FALSE, "Hardcoded assertion");
|
||||
#endif
|
||||
m_numNewMessages = 0;
|
||||
}
|
||||
return SetUint32PropertyWithToken(m_numNewMessagesColumnToken, m_numNewMessages);
|
||||
m_numNewMessages = 0;
|
||||
}
|
||||
return SetUint32PropertyWithToken(m_numNewMessagesColumnToken, m_numNewMessages);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::ChangeNumMessages(PRInt32 delta)
|
||||
{
|
||||
m_numMessages += delta;
|
||||
m_numMessages += delta;
|
||||
// m_numMessages can never be set to negative.
|
||||
if (m_numMessages < 0)
|
||||
{
|
||||
if (m_numMessages < 0)
|
||||
{
|
||||
#ifdef DEBUG_bienvenu
|
||||
NS_ASSERTION(PR_FALSE, "num messages can't be < 0");
|
||||
NS_ASSERTION(PR_FALSE, "num messages can't be < 0");
|
||||
#endif
|
||||
m_numMessages = 0;
|
||||
}
|
||||
return SetUint32PropertyWithToken(m_numMessagesColumnToken, m_numMessages);
|
||||
m_numMessages = 0;
|
||||
}
|
||||
return SetUint32PropertyWithToken(m_numMessagesColumnToken, m_numMessages);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::ChangeNumVisibleMessages(PRInt32 delta)
|
||||
{
|
||||
m_numVisibleMessages += delta;
|
||||
// m_numVisibleMessages can never be set to negative.
|
||||
if (m_numVisibleMessages < 0)
|
||||
{
|
||||
#ifdef DEBUG_bienvenu
|
||||
NS_ASSERTION(PR_FALSE, "num visible messages can't be < 0");
|
||||
#endif
|
||||
m_numVisibleMessages = 0;
|
||||
}
|
||||
return SetUint32PropertyWithToken(m_numVisibleMessagesColumnToken, m_numVisibleMessages);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::GetNumNewMessages(PRInt32 *result)
|
||||
{
|
||||
*result = m_numNewMessages;
|
||||
return NS_OK;
|
||||
*result = m_numNewMessages;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::SetNumNewMessages(PRInt32 numNewMessages)
|
||||
{
|
||||
m_numNewMessages = numNewMessages;
|
||||
return SetUint32PropertyWithToken(m_numNewMessagesColumnToken, m_numNewMessages);
|
||||
m_numNewMessages = numNewMessages;
|
||||
return SetUint32PropertyWithToken(m_numNewMessagesColumnToken, m_numNewMessages);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::GetNumMessages(PRInt32 *result)
|
||||
{
|
||||
*result = m_numMessages;
|
||||
return NS_OK;
|
||||
*result = m_numMessages;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::SetNumMessages(PRInt32 numMessages)
|
||||
{
|
||||
m_numMessages = numMessages;
|
||||
return SetUint32PropertyWithToken(m_numMessagesColumnToken, m_numMessages);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::GetNumVisibleMessages(PRInt32 *result)
|
||||
{
|
||||
*result = m_numVisibleMessages;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::SetNumVisibleMessages(PRInt32 numVisibleMessages)
|
||||
{
|
||||
m_numVisibleMessages = numVisibleMessages;
|
||||
return SetUint32PropertyWithToken(m_numVisibleMessagesColumnToken, m_numVisibleMessages);
|
||||
m_numMessages = numMessages;
|
||||
return SetUint32PropertyWithToken(m_numMessagesColumnToken, m_numMessages);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::GetExpungedBytes(PRInt32 *result)
|
||||
{
|
||||
*result = m_expungedBytes;
|
||||
return NS_OK;
|
||||
*result = m_expungedBytes;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::SetExpungedBytes(PRInt32 expungedBytes)
|
||||
{
|
||||
m_expungedBytes = expungedBytes;
|
||||
return SetUint32PropertyWithToken(m_expungedBytesColumnToken, m_expungedBytes);
|
||||
m_expungedBytes = expungedBytes;
|
||||
return SetUint32PropertyWithToken(m_expungedBytesColumnToken, m_expungedBytes);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::GetFlags(PRInt32 *result)
|
||||
{
|
||||
*result = m_flags;
|
||||
return NS_OK;
|
||||
*result = m_flags;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::SetFlags(PRInt32 flags)
|
||||
{
|
||||
nsresult ret = NS_OK;
|
||||
|
||||
if (m_flags != flags)
|
||||
{
|
||||
nsresult ret = NS_OK;
|
||||
|
||||
if (m_flags != flags)
|
||||
{
|
||||
NS_ASSERTION((m_flags & MSG_FOLDER_FLAG_INBOX) == 0 || (flags & MSG_FOLDER_FLAG_INBOX) != 0, "lost inbox flag");
|
||||
m_flags = flags;
|
||||
ret = SetInt32PropertyWithToken(m_flagsColumnToken, m_flags);
|
||||
}
|
||||
return ret;
|
||||
m_flags = flags;
|
||||
ret = SetInt32PropertyWithToken(m_flagsColumnToken, m_flags);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::OrFlags(PRInt32 flags, PRInt32 *result)
|
||||
{
|
||||
m_flags |= flags;
|
||||
*result = m_flags;
|
||||
return SetInt32PropertyWithToken(m_flagsColumnToken, m_flags);
|
||||
m_flags |= flags;
|
||||
*result = m_flags;
|
||||
return SetInt32PropertyWithToken(m_flagsColumnToken, m_flags);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::AndFlags(PRInt32 flags, PRInt32 *result)
|
||||
{
|
||||
m_flags &= flags;
|
||||
*result = m_flags;
|
||||
return SetInt32PropertyWithToken(m_flagsColumnToken, m_flags);
|
||||
m_flags &= flags;
|
||||
*result = m_flags;
|
||||
return SetInt32PropertyWithToken(m_flagsColumnToken, m_flags);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::GetImapUidValidity(PRInt32 *result)
|
||||
{
|
||||
*result = m_ImapUidValidity;
|
||||
return NS_OK;
|
||||
*result = m_ImapUidValidity;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::SetImapUidValidity(PRInt32 uidValidity)
|
||||
{
|
||||
m_ImapUidValidity = uidValidity;
|
||||
return SetUint32PropertyWithToken(m_imapUidValidityColumnToken, m_ImapUidValidity);
|
||||
m_ImapUidValidity = uidValidity;
|
||||
return SetUint32PropertyWithToken(m_imapUidValidityColumnToken, m_ImapUidValidity);
|
||||
}
|
||||
|
||||
PRBool nsDBFolderInfo::TestFlag(PRInt32 flags)
|
||||
{
|
||||
return (m_flags & flags) != 0;
|
||||
return (m_flags & flags) != 0;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDBFolderInfo::GetCharacterSet(nsString *result, PRBool *usedDefault)
|
||||
{
|
||||
nsresult rv = GetProperty(kCharacterSetColumnName, result);
|
||||
|
||||
*usedDefault = PR_FALSE;
|
||||
|
||||
if (NS_SUCCEEDED(rv) && result->IsEmpty())
|
||||
{
|
||||
result->AssignWithConversion(gDefaultCharacterSet.get());
|
||||
*usedDefault = PR_TRUE;
|
||||
}
|
||||
|
||||
return rv;
|
||||
nsresult rv = GetProperty(kCharacterSetColumnName, result);
|
||||
|
||||
*usedDefault = PR_FALSE;
|
||||
|
||||
if (NS_SUCCEEDED(rv) && result->IsEmpty())
|
||||
{
|
||||
result->AssignWithConversion(gDefaultCharacterSet.get());
|
||||
*usedDefault = PR_TRUE;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsDBFolderInfo::GetConstCharPtrCharacterSet(const char**result)
|
||||
|
@ -710,10 +658,10 @@ nsDBFolderInfo::GetCharPtrCharacterSet(char **result)
|
|||
*result = ToNewCString(m_charSet);
|
||||
|
||||
if ((*result == nsnull || **result == '\0'))
|
||||
{
|
||||
PR_FREEIF(*result);
|
||||
*result = ToNewCString(gDefaultCharacterSet);
|
||||
}
|
||||
{
|
||||
PR_Free(*result);
|
||||
*result = ToNewCString(gDefaultCharacterSet);
|
||||
}
|
||||
|
||||
return (*result) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -739,72 +687,72 @@ NS_IMETHODIMP nsDBFolderInfo::SetCharacterSetOverride(PRBool characterSetOverrid
|
|||
NS_IMETHODIMP
|
||||
nsDBFolderInfo::GetLocale(nsString *result)
|
||||
{
|
||||
GetProperty(kLocaleColumnName, result);
|
||||
return NS_OK;
|
||||
GetProperty(kLocaleColumnName, result);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::SetLocale(nsString *locale)
|
||||
{
|
||||
return SetProperty(kLocaleColumnName, locale);
|
||||
return SetProperty(kLocaleColumnName, locale);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::GetIMAPHierarchySeparator(PRUnichar *hierarchySeparator)
|
||||
{
|
||||
if (!hierarchySeparator)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
*hierarchySeparator = m_IMAPHierarchySeparator;
|
||||
return NS_OK;
|
||||
if (!hierarchySeparator)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
*hierarchySeparator = m_IMAPHierarchySeparator;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::SetIMAPHierarchySeparator(PRUnichar hierarchySeparator)
|
||||
{
|
||||
m_IMAPHierarchySeparator = hierarchySeparator;
|
||||
return NS_OK;
|
||||
m_IMAPHierarchySeparator = hierarchySeparator;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDBFolderInfo::GetImapTotalPendingMessages(PRInt32 *result)
|
||||
{
|
||||
if (!result)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
*result = m_totalPendingMessages;
|
||||
return NS_OK;
|
||||
if (!result)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
*result = m_totalPendingMessages;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsDBFolderInfo::ChangeImapTotalPendingMessages(PRInt32 delta)
|
||||
{
|
||||
m_totalPendingMessages+=delta;
|
||||
SetInt32PropertyWithToken(m_totalPendingMessagesColumnToken, m_totalPendingMessages);
|
||||
m_totalPendingMessages+=delta;
|
||||
SetInt32PropertyWithToken(m_totalPendingMessagesColumnToken, m_totalPendingMessages);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDBFolderInfo::GetImapUnreadPendingMessages(PRInt32 *result)
|
||||
{
|
||||
if (!result)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
*result = m_unreadPendingMessages;
|
||||
return NS_OK;
|
||||
if (!result)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
*result = m_unreadPendingMessages;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::SetImapUnreadPendingMessages(PRInt32 numUnreadPendingMessages)
|
||||
{
|
||||
m_unreadPendingMessages = numUnreadPendingMessages;
|
||||
return SetUint32PropertyWithToken(m_unreadPendingMessagesColumnToken, m_unreadPendingMessages);
|
||||
m_unreadPendingMessages = numUnreadPendingMessages;
|
||||
return SetUint32PropertyWithToken(m_unreadPendingMessagesColumnToken, m_unreadPendingMessages);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::SetImapTotalPendingMessages(PRInt32 numTotalPendingMessages)
|
||||
{
|
||||
m_totalPendingMessages = numTotalPendingMessages;
|
||||
return SetUint32PropertyWithToken(m_totalPendingMessagesColumnToken, m_totalPendingMessages);
|
||||
m_totalPendingMessages = numTotalPendingMessages;
|
||||
return SetUint32PropertyWithToken(m_totalPendingMessagesColumnToken, m_totalPendingMessages);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void nsDBFolderInfo::ChangeImapUnreadPendingMessages(PRInt32 delta)
|
||||
{
|
||||
m_unreadPendingMessages+=delta;
|
||||
SetInt32PropertyWithToken(m_unreadPendingMessagesColumnToken, m_unreadPendingMessages);
|
||||
m_unreadPendingMessages+=delta;
|
||||
SetInt32PropertyWithToken(m_unreadPendingMessagesColumnToken, m_unreadPendingMessages);
|
||||
}
|
||||
|
||||
/* attribute nsMsgViewTypeValue viewType; */
|
||||
|
@ -879,26 +827,25 @@ NS_IMETHODIMP nsDBFolderInfo::GetKnownArtsSet(char **newsArtSet)
|
|||
return m_mdb->GetProperty(m_mdbRow, kKnownArtsSetColumnName, newsArtSet);
|
||||
}
|
||||
|
||||
// get arbitrary property, aka row cell value.
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::GetProperty(const char *propertyName, nsString *resultProperty)
|
||||
// get arbitrary property, aka row cell value.
|
||||
NS_IMETHODIMP nsDBFolderInfo::GetProperty(const char *propertyName, nsString *resultProperty)
|
||||
{
|
||||
return m_mdb->GetPropertyAsNSString(m_mdbRow, propertyName, resultProperty);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::SetCharPtrProperty(const char *aPropertyName, const char *aPropertyValue)
|
||||
NS_IMETHODIMP nsDBFolderInfo::SetCharPtrProperty(const char *aPropertyName, const char *aPropertyValue)
|
||||
{
|
||||
return m_mdb->SetProperty(m_mdbRow, aPropertyName, aPropertyValue);
|
||||
}
|
||||
|
||||
// Caller must PR_FREEIF resultProperty.
|
||||
NS_IMETHODIMP nsDBFolderInfo::GetCharPtrProperty(const char *propertyName, char **resultProperty)
|
||||
// Caller must PR_Free resultProperty.
|
||||
NS_IMETHODIMP nsDBFolderInfo::GetCharPtrProperty(const char *propertyName, char **resultProperty)
|
||||
{
|
||||
return m_mdb->GetProperty(m_mdbRow, propertyName, resultProperty);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::SetUint32Property(const char *propertyName, PRUint32 propertyValue)
|
||||
NS_IMETHODIMP nsDBFolderInfo::SetUint32Property(const char *propertyName, PRUint32 propertyValue)
|
||||
{
|
||||
return m_mdb->SetUint32Property(m_mdbRow, propertyName, propertyValue);
|
||||
}
|
||||
|
@ -913,33 +860,33 @@ nsresult nsDBFolderInfo::SetPropertyWithToken(mdb_token aProperty, nsString *pro
|
|||
return m_mdb->SetNSStringPropertyWithToken(m_mdbRow, aProperty, propertyStr);
|
||||
}
|
||||
|
||||
nsresult nsDBFolderInfo::SetUint32PropertyWithToken(mdb_token aProperty, PRUint32 propertyValue)
|
||||
nsresult nsDBFolderInfo::SetUint32PropertyWithToken(mdb_token aProperty, PRUint32 propertyValue)
|
||||
{
|
||||
return m_mdb->UInt32ToRowCellColumn(m_mdbRow, aProperty, propertyValue);
|
||||
}
|
||||
|
||||
nsresult nsDBFolderInfo::SetInt32PropertyWithToken(mdb_token aProperty, PRInt32 propertyValue)
|
||||
nsresult nsDBFolderInfo::SetInt32PropertyWithToken(mdb_token aProperty, PRInt32 propertyValue)
|
||||
{
|
||||
nsString propertyStr;
|
||||
propertyStr.AppendInt(propertyValue, 16);
|
||||
return SetPropertyWithToken(aProperty, &propertyStr);
|
||||
nsString propertyStr;
|
||||
propertyStr.AppendInt(propertyValue, 16);
|
||||
return SetPropertyWithToken(aProperty, &propertyStr);
|
||||
}
|
||||
|
||||
nsresult nsDBFolderInfo::GetPropertyWithToken(mdb_token aProperty, nsString *resultProperty)
|
||||
{
|
||||
if (!resultProperty)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
return m_mdb->RowCellColumnTonsString(m_mdbRow, aProperty, *resultProperty);
|
||||
if (!resultProperty)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
return m_mdb->RowCellColumnTonsString(m_mdbRow, aProperty, *resultProperty);
|
||||
}
|
||||
|
||||
nsresult nsDBFolderInfo::GetUint32PropertyWithToken(mdb_token aProperty, PRUint32 &propertyValue, PRUint32 defaultValue)
|
||||
{
|
||||
return m_mdb->RowCellColumnToUInt32(m_mdbRow, aProperty, propertyValue, defaultValue);
|
||||
return m_mdb->RowCellColumnToUInt32(m_mdbRow, aProperty, propertyValue, defaultValue);
|
||||
}
|
||||
|
||||
nsresult nsDBFolderInfo::GetInt32PropertyWithToken(mdb_token aProperty, PRInt32 &propertyValue, PRInt32 defaultValue)
|
||||
{
|
||||
return m_mdb->RowCellColumnToUInt32(m_mdbRow, aProperty, (PRUint32 &) propertyValue, defaultValue);
|
||||
return m_mdb->RowCellColumnToUInt32(m_mdbRow, aProperty, (PRUint32 &) propertyValue, defaultValue);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::GetUint32Property(const char *propertyName, PRUint32 *propertyValue, PRUint32 defaultValue)
|
||||
|
|
|
@ -67,8 +67,6 @@ nsMailDatabase::~nsMailDatabase()
|
|||
{
|
||||
if(m_folderSpec)
|
||||
delete m_folderSpec;
|
||||
if (m_mdbAllOfflineOpsTable)
|
||||
m_mdbAllOfflineOpsTable->Release();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMailDatabase::SetFolderStream(nsIOFileStream *aFileStream)
|
||||
|
@ -203,11 +201,7 @@ NS_IMETHODIMP nsMailDatabase::Open(nsIFileSpec *aFolderName, PRBool create, PRBo
|
|||
|
||||
NS_IMETHODIMP nsMailDatabase::ForceClosed()
|
||||
{
|
||||
if (m_mdbAllOfflineOpsTable)
|
||||
{
|
||||
m_mdbAllOfflineOpsTable->Release();
|
||||
m_mdbAllOfflineOpsTable = nsnull;
|
||||
}
|
||||
m_mdbAllOfflineOpsTable = nsnull;
|
||||
return nsMsgDatabase::ForceClosed();
|
||||
}
|
||||
|
||||
|
@ -217,42 +211,11 @@ nsresult nsMailDatabase::GetAllOfflineOpsTable()
|
|||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (!m_mdbAllOfflineOpsTable)
|
||||
{
|
||||
mdb_err err = GetStore()->StringToToken(GetEnv(), kOfflineOpsScope, &m_offlineOpsRowScopeToken);
|
||||
err = GetStore()->StringToToken(GetEnv(), kOfflineOpsTableKind, &m_offlineOpsTableKindToken);
|
||||
gAllOfflineOpsTableOID.mOid_Scope = m_offlineOpsRowScopeToken;
|
||||
gAllOfflineOpsTableOID.mOid_Id = 1;
|
||||
|
||||
rv = GetStore()->GetTable(GetEnv(), &gAllOfflineOpsTableOID, &m_mdbAllOfflineOpsTable);
|
||||
if (rv != NS_OK)
|
||||
rv = NS_ERROR_FAILURE;
|
||||
|
||||
// create new all msg hdrs table, if it doesn't exist.
|
||||
if (NS_SUCCEEDED(rv) && !m_mdbAllOfflineOpsTable)
|
||||
{
|
||||
nsIMdbStore *store = GetStore();
|
||||
mdb_err mdberr = (nsresult) store->NewTable(GetEnv(), m_offlineOpsRowScopeToken,
|
||||
m_offlineOpsTableKindToken, PR_FALSE, nsnull, &m_mdbAllOfflineOpsTable);
|
||||
if (mdberr != NS_OK || !m_mdbAllOfflineOpsTable)
|
||||
rv = NS_ERROR_FAILURE;
|
||||
}
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "couldn't create offline ops table");
|
||||
}
|
||||
rv = GetTableCreateIfMissing(kOfflineOpsScope, kOfflineOpsTableKind, getter_AddRefs(m_mdbAllOfflineOpsTable),
|
||||
m_offlineOpsRowScopeToken, m_offlineOpsTableKindToken) ;
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* static */ nsresult nsMailDatabase::CloneInvalidDBInfoIntoNewDB(nsFileSpec &pathName, nsMailDatabase** pMailDB)
|
||||
{
|
||||
nsresult ret = NS_OK;
|
||||
return ret;
|
||||
}
|
||||
|
||||
nsresult nsMailDatabase::OnNewPath (nsFileSpec &newPath)
|
||||
{
|
||||
nsresult ret = NS_OK;
|
||||
return ret;
|
||||
}
|
||||
|
||||
// cache m_folderStream to make updating mozilla status flags fast
|
||||
NS_IMETHODIMP nsMailDatabase::StartBatch()
|
||||
{
|
||||
|
@ -624,22 +587,8 @@ NS_IMETHODIMP nsMailDatabase::RemoveOfflineOp(nsIMsgOfflineImapOperation *op)
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsresult SetSourceMailbox(nsOfflineImapOperation *op, const char *mailbox, nsMsgKey key)
|
||||
{
|
||||
nsresult ret = NS_OK;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
nsresult nsMailDatabase::GetIdsWithNoBodies (nsMsgKeyArray &bodylessIds)
|
||||
{
|
||||
nsresult ret = NS_OK;
|
||||
return ret;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMailDatabase::GetOfflineOpForKey(nsMsgKey msgKey, PRBool create, nsIMsgOfflineImapOperation **offlineOp)
|
||||
{
|
||||
PRBool newOp = PR_FALSE;
|
||||
mdb_bool hasOid;
|
||||
mdbOid rowObjectId;
|
||||
mdb_err err;
|
||||
|
@ -668,10 +617,7 @@ NS_IMETHODIMP nsMailDatabase::GetOfflineOpForKey(nsMsgKey msgKey, PRBool create,
|
|||
NS_ENSURE_SUCCESS(err, err);
|
||||
}
|
||||
if (offlineOpRow && !hasOid)
|
||||
{
|
||||
m_mdbAllOfflineOpsTable->AddRow(GetEnv(), offlineOpRow);
|
||||
newOp = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (err == NS_OK && offlineOpRow)
|
||||
|
@ -854,7 +800,6 @@ nsresult nsMailDatabase::SetFolderInfoValid(nsFileSpec *folderName, int num, int
|
|||
|
||||
pMessageDB->m_dbFolderInfo->SetFolderSize(folderName->GetFileSize());
|
||||
pMessageDB->m_dbFolderInfo->SetFolderDate(actualFolderTimeStamp);
|
||||
pMessageDB->m_dbFolderInfo->ChangeNumVisibleMessages(num);
|
||||
pMessageDB->m_dbFolderInfo->ChangeNumNewMessages(numunread);
|
||||
pMessageDB->m_dbFolderInfo->ChangeNumMessages(num);
|
||||
}
|
||||
|
@ -877,7 +822,7 @@ nsresult nsMailDatabase::SetFolderInfoValid(nsFileSpec *folderName, int num, int
|
|||
// and needs to be regenerated.
|
||||
void nsMailDatabase::SetReparse(PRBool reparse)
|
||||
{
|
||||
m_reparse = reparse;
|
||||
m_reparse = reparse;
|
||||
}
|
||||
|
||||
|
||||
|
@ -886,7 +831,7 @@ void nsMailDatabase::SetReparse(PRBool reparse)
|
|||
PRBool nsMailDatabase::ThreadBySubjectWithoutRe()
|
||||
{
|
||||
GetGlobalPrefs();
|
||||
return gThreadWithoutRe;
|
||||
return gThreadWithoutRe;
|
||||
}
|
||||
|
||||
class nsMsgOfflineOpEnumerator : public nsISimpleEnumerator {
|
||||
|
|
|
@ -516,8 +516,8 @@ NS_IMETHODIMP nsMsgDatabase::NotifyKeyDeletedAll(nsMsgKey keyDeleted, nsMsgKey p
|
|||
return NS_OK;
|
||||
PRUint32 count;
|
||||
m_ChangeListeners->Count(&count);
|
||||
for (PRUint32 i = 0; i < count; i++)
|
||||
{
|
||||
for (PRUint32 i = 0; i < count; i++)
|
||||
{
|
||||
nsCOMPtr<nsIDBChangeListener> changeListener;
|
||||
m_ChangeListeners->QueryElementAt(i, NS_GET_IID(nsIDBChangeListener), (void **) getter_AddRefs(changeListener));
|
||||
nsresult rv = changeListener->OnKeyDeleted(keyDeleted, parentKey, flags, instigator);
|
||||
|
@ -607,11 +607,11 @@ nsVoidArray *nsMsgDatabase::m_dbCache = NULL;
|
|||
nsVoidArray/*<nsMsgDatabase>*/*
|
||||
nsMsgDatabase::GetDBCache()
|
||||
{
|
||||
if (!m_dbCache)
|
||||
m_dbCache = new nsVoidArray();
|
||||
|
||||
return m_dbCache;
|
||||
|
||||
if (!m_dbCache)
|
||||
m_dbCache = new nsVoidArray();
|
||||
|
||||
return m_dbCache;
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -680,9 +680,7 @@ int nsMsgDatabase::FindInCache(nsMsgDatabase* pMessageDB)
|
|||
for (PRInt32 i = 0; i < GetDBCache()->Count(); i++)
|
||||
{
|
||||
if (GetDBCache()->ElementAt(i) == pMessageDB)
|
||||
{
|
||||
return(i);
|
||||
}
|
||||
}
|
||||
return(-1);
|
||||
}
|
||||
|
@ -699,9 +697,7 @@ void nsMsgDatabase::RemoveFromCache(nsMsgDatabase* pMessageDB)
|
|||
{
|
||||
int i = FindInCache(pMessageDB);
|
||||
if (i != -1)
|
||||
{
|
||||
GetDBCache()->RemoveElementAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -774,6 +770,11 @@ nsMsgDatabase::~nsMsgDatabase()
|
|||
DumpCache();
|
||||
}
|
||||
#endif
|
||||
// if the db folder info refers to the mdb db, we must clear it because
|
||||
// the reference will be a dangling one soon.
|
||||
if (m_dbFolderInfo)
|
||||
m_dbFolderInfo->ReleaseExternalReferences();
|
||||
|
||||
NS_IF_RELEASE(m_dbFolderInfo);
|
||||
if (m_HeaderParser)
|
||||
{
|
||||
|
@ -803,11 +804,13 @@ nsMsgDatabase::~nsMsgDatabase()
|
|||
m_ChangeListeners = nsnull;
|
||||
}
|
||||
|
||||
if (m_newSet) {
|
||||
if (m_newSet)
|
||||
{
|
||||
#ifdef DEBUG_MSGKEYSET
|
||||
char *str = nsnull;
|
||||
nsresult rv = m_newSet->Output(&str);
|
||||
if (NS_SUCCEEDED(rv) && str) {
|
||||
if (NS_SUCCEEDED(rv) && str)
|
||||
{
|
||||
printf("setStr = %s on destroy\n",str);
|
||||
nsMemory::Free(str);
|
||||
str = nsnull;
|
||||
|
@ -1300,6 +1303,33 @@ nsresult nsMsgDatabase::InitNewDB()
|
|||
return err;
|
||||
}
|
||||
|
||||
nsresult nsMsgDatabase::GetTableCreateIfMissing(const char *scope, const char *kind, nsIMdbTable **table,
|
||||
mdb_token &scopeToken, mdb_token &kindToken)
|
||||
{
|
||||
struct mdbOid tableOID;
|
||||
|
||||
mdb_err err = GetStore()->StringToToken(GetEnv(), scope, &scopeToken);
|
||||
err = GetStore()->StringToToken(GetEnv(), kind, &kindToken);
|
||||
tableOID.mOid_Scope = scopeToken;
|
||||
tableOID.mOid_Id = 1;
|
||||
|
||||
nsresult rv = GetStore()->GetTable(GetEnv(), &tableOID, table);
|
||||
if (rv != NS_OK)
|
||||
rv = NS_ERROR_FAILURE;
|
||||
|
||||
// create new all all offline ops table, if it doesn't exist.
|
||||
if (NS_SUCCEEDED(rv) && !*table)
|
||||
{
|
||||
nsIMdbStore *store = GetStore();
|
||||
err = (nsresult) store->NewTable(GetEnv(), scopeToken,kindToken,
|
||||
PR_FALSE, nsnull, table);
|
||||
if (err != NS_OK || !*table)
|
||||
rv = NS_ERROR_FAILURE;
|
||||
}
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "couldn't create offline ops table");
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsMsgDatabase::InitExistingDB()
|
||||
{
|
||||
nsresult err = NS_OK;
|
||||
|
@ -1485,14 +1515,14 @@ NS_IMETHODIMP nsMsgDatabase::EndBatch()
|
|||
|
||||
NS_IMETHODIMP nsMsgDatabase::DeleteMessage(nsMsgKey key, nsIDBChangeListener *instigator, PRBool commit)
|
||||
{
|
||||
nsCOMPtr <nsIMsgDBHdr> msgHdr;
|
||||
|
||||
nsresult rv = GetMsgHdrForKey(key, getter_AddRefs(msgHdr));
|
||||
if (!msgHdr)
|
||||
return NS_MSG_MESSAGE_NOT_FOUND;
|
||||
|
||||
rv = DeleteHeader(msgHdr, instigator, commit, PR_TRUE);
|
||||
return rv;
|
||||
nsCOMPtr <nsIMsgDBHdr> msgHdr;
|
||||
|
||||
nsresult rv = GetMsgHdrForKey(key, getter_AddRefs(msgHdr));
|
||||
if (!msgHdr)
|
||||
return NS_MSG_MESSAGE_NOT_FOUND;
|
||||
|
||||
rv = DeleteHeader(msgHdr, instigator, commit, PR_TRUE);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1548,7 +1578,6 @@ NS_IMETHODIMP nsMsgDatabase::DeleteHeader(nsIMsgDBHdr *msg, nsIDBChangeListener
|
|||
{
|
||||
PRBool isRead;
|
||||
m_dbFolderInfo->ChangeNumMessages(-1);
|
||||
m_dbFolderInfo->ChangeNumVisibleMessages(-1);
|
||||
IsRead(key, &isRead);
|
||||
if (!isRead)
|
||||
m_dbFolderInfo->ChangeNumNewMessages(-1);
|
||||
|
@ -1920,14 +1949,11 @@ NS_IMETHODIMP nsMsgDatabase::SetLabel(nsMsgKey key, nsMsgLabelValue label)
|
|||
|
||||
rv = GetMsgHdrForKey(key, getter_AddRefs(msgHdr));
|
||||
if (NS_FAILED(rv) || !msgHdr)
|
||||
return NS_MSG_MESSAGE_NOT_FOUND; // XXX return rv?
|
||||
return NS_MSG_MESSAGE_NOT_FOUND;
|
||||
|
||||
msgHdr->SetLabel(label);
|
||||
// set the flag in the x-mozilla-status2 line.
|
||||
return SetKeyFlag(key, PR_TRUE, label << 25, nsnull);
|
||||
// ### dmb need to use persistent flags in x-mozilla-status2 for this.
|
||||
// so that we don't lose the labels when we reparse the folder.
|
||||
// return SetKeyFlag(key, offline, MSG_FLAG_OFFLINE, instigator);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -2221,15 +2247,6 @@ NS_IMETHODIMP nsMsgDatabase::MarkReadByDate (PRTime startDate, PRTime endDate, n
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgDatabase::MarkLater(nsMsgKey key, PRTime until)
|
||||
{
|
||||
PR_ASSERT(m_dbFolderInfo);
|
||||
if (m_dbFolderInfo != NULL)
|
||||
{
|
||||
m_dbFolderInfo->AddLaterKey(key, until);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgDatabase::AddToNewList(nsMsgKey key)
|
||||
{
|
||||
|
@ -2293,13 +2310,10 @@ NS_IMETHODIMP nsMsgDatabase::HasNew(PRBool *_retval)
|
|||
|
||||
NS_IMETHODIMP nsMsgDatabase::GetFirstNew(nsMsgKey *result)
|
||||
{
|
||||
// even though getLength is supposedly for debugging only, it's the only
|
||||
// way I can tell if the set is empty (as opposed to having a member 0.
|
||||
PRBool hasnew;
|
||||
nsresult rv = HasNew(&hasnew);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (hasnew)
|
||||
*result = (hasnew) ? m_newSet->GetFirstMember() : nsMsgKey_None;
|
||||
*result = (hasnew) ? m_newSet->GetFirstMember() : nsMsgKey_None;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2653,28 +2667,6 @@ nsMsgFlagSetFilter(nsIMsgDBHdr *msg, void *closure)
|
|||
return (msgFlags & desiredFlags) ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
static nsresult
|
||||
nsMsgUnreadFilter(nsIMsgDBHdr* msg, void* closure)
|
||||
{
|
||||
nsMsgDatabase* db = (nsMsgDatabase*)closure;
|
||||
PRBool wasRead = PR_TRUE;
|
||||
nsresult rv = db->IsHeaderRead(msg, &wasRead);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
return !wasRead ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMsgDatabase::EnumerateUnreadMessages(nsISimpleEnumerator* *result)
|
||||
{
|
||||
nsMsgDBEnumerator* e = new nsMsgDBEnumerator(this, nsMsgUnreadFilter, this);
|
||||
if (e == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(e);
|
||||
*result = e;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMsgDatabase::EnumerateMessagesWithFlag(nsISimpleEnumerator* *result, PRUint32 *pFlag)
|
||||
{
|
||||
|
@ -2697,19 +2689,6 @@ nsMsgReadFilter(nsIMsgDBHdr* msg, void* closure)
|
|||
return wasRead ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// note that we can't just use EnumerateMessagesWithFlag(MSG_FLAG_READ) because we need
|
||||
// to call IsHeaderRead.
|
||||
nsresult
|
||||
nsMsgDatabase::EnumerateReadMessages(nsISimpleEnumerator* *result)
|
||||
{
|
||||
nsMsgDBEnumerator* e = new nsMsgDBEnumerator(this, nsMsgReadFilter, this);
|
||||
if (e == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(e);
|
||||
*result = e;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgDatabase::CreateNewHdr(nsMsgKey key, nsIMsgDBHdr **pnewHdr)
|
||||
{
|
||||
nsresult err = NS_OK;
|
||||
|
@ -2761,7 +2740,6 @@ NS_IMETHODIMP nsMsgDatabase::AddNewHdrToDB(nsIMsgDBHdr *newHdr, PRBool notify)
|
|||
if (m_dbFolderInfo != NULL)
|
||||
{
|
||||
m_dbFolderInfo->ChangeNumMessages(1);
|
||||
m_dbFolderInfo->ChangeNumVisibleMessages(1);
|
||||
PRBool isRead = PR_TRUE;
|
||||
IsHeaderRead(newHdr, &isRead);
|
||||
if (!isRead)
|
||||
|
@ -3741,6 +3719,12 @@ nsresult nsMsgDatabase::ListAllThreads(nsMsgKeyArray *threadIds)
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgDatabase::SetAttributesOnPendingHdr(nsIMsgDBHdr *pendingHdr, const char *property,
|
||||
const char *propertyVal, PRInt32 flags)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgDatabase::GetOfflineOpForKey(nsMsgKey msgKey, PRBool create, nsIMsgOfflineImapOperation **offlineOp)
|
||||
{
|
||||
NS_ASSERTION(PR_FALSE, "overridden by nsMailDatabase");
|
||||
|
|
|
@ -240,7 +240,7 @@ nsresult nsMsgThread::RerootThread(nsIMsgDBHdr *newParentOfOldRoot, nsIMsgDBHdr
|
|||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgThread::AddChild(nsIMsgDBHdr *child, nsIMsgDBHdr *inReplyTo, PRBool threadInThread,
|
||||
nsIDBChangeAnnouncer *announcer)
|
||||
nsIDBChangeAnnouncer *announcer)
|
||||
{
|
||||
nsresult ret = NS_OK;
|
||||
nsMsgHdr* hdr = NS_STATIC_CAST(nsMsgHdr*, child); // closed system, cast ok
|
||||
|
@ -865,19 +865,6 @@ nsMsgThreadUnreadFilter(nsIMsgDBHdr* msg, void* closure)
|
|||
return !wasRead ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgThread::EnumerateUnreadMessages(nsMsgKey parentKey, nsISimpleEnumerator* *result)
|
||||
{
|
||||
nsresult ret = NS_OK;
|
||||
nsMsgThreadEnumerator* e = new nsMsgThreadEnumerator(this, parentKey, nsMsgThreadUnreadFilter, m_mdbDB);
|
||||
if (e == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(e);
|
||||
*result = e;
|
||||
return NS_OK;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgThread::EnumerateMessages(nsMsgKey parentKey, nsISimpleEnumerator* *result)
|
||||
{
|
||||
nsresult ret = NS_OK;
|
||||
|
|
Загрузка…
Ссылка в новой задаче