add support for pending counts for imap folders r=mscott

This commit is contained in:
bienvenu%netscape.com 1999-11-01 01:06:29 +00:00
parent 2c586468ca
commit 10e0f64b8b
4 changed files with 37 additions and 21 deletions

View File

@ -83,6 +83,7 @@ NS_IMETHODIMP nsMsgDBFolder::EndFolderLoading(void)
if(mDatabase)
mDatabase->AddListener(this);
mAddListener = PR_TRUE;
UpdateSummaryTotals(PR_FALSE);
return NS_OK;
}

View File

@ -897,7 +897,7 @@ NS_IMETHODIMP nsMsgFolder::GetNumUnread(PRBool deep, PRInt32 *numUnread)
return NS_ERROR_NULL_POINTER;
nsresult rv;
PRUint32 total = mNumUnreadMessages;
PRUint32 total = mNumUnreadMessages + mNumPendingUnreadMessages;
if (deep)
{
nsCOMPtr<nsIMsgFolder> folder;
@ -930,7 +930,7 @@ NS_IMETHODIMP nsMsgFolder::GetTotalMessages(PRBool deep, PRInt32 *totalMessages)
return NS_ERROR_NULL_POINTER;
nsresult rv;
PRInt32 total = mNumTotalMessages;
PRInt32 total = mNumTotalMessages + mNumPendingTotalMessages;
if (deep)
{
nsCOMPtr<nsIMsgFolder> folder;
@ -960,18 +960,33 @@ NS_IMETHODIMP nsMsgFolder::GetTotalMessages(PRBool deep, PRInt32 *totalMessages)
NS_IMETHOD GetTotalMessagesInDB(PRUint32 *totalMessages) const; // How many messages in database.
#endif
PRInt32 nsMsgFolder::GetNumPendingUnread()
{
return mNumPendingUnreadMessages;
}
PRInt32 nsMsgFolder::GetNumPendingTotalMessages()
{
return mNumPendingTotalMessages;
}
void nsMsgFolder::ChangeNumPendingUnread(PRInt32 delta)
{
mNumPendingTotalMessages += delta;
}
void nsMsgFolder::ChangeNumPendingTotalMessages(PRInt32 delta)
{
mNumPendingTotalMessages += delta;
}
#ifdef HAVE_DB
// These functions are used for tricking the front end into thinking that we have more
// messages than are really in the DB. This is usually after and IMAP message copy where
// we don't want to do an expensive select until the user actually opens that folder
// These functions are called when MSG_Master::GetFolderLineById is populating a MSG_FolderLine
// struct used by the FE
int32 GetNumPendingUnread(PRBool deep = PR_FALSE) const;
int32 GetNumPendingTotalMessages(PRBool deep = PR_FALSE) const;
void ChangeNumPendingUnread(int32 delta);
void ChangeNumPendingTotalMessages(int32 delta);
NS_IMETHODIMP nsMsgFolder::SetFolderPrefFlags(PRUint32 flags)
{

View File

@ -150,24 +150,24 @@ public:
// created string that must be free'd using XP_FREE().
// If the db is NULL, then returns a URL that represents the entire
// folder as a whole.
// These functions are used for tricking the front end into thinking that we have more
// messages than are really in the DB. This is usually after and IMAP message copy where
// we don't want to do an expensive select until the user actually opens that folder
// These functions are called when MSG_Master::GetFolderLineById is populating a MSG_FolderLine
// struct used by the FE
PRInt32 GetNumPendingUnread();
PRInt32 GetNumPendingTotalMessages();
void ChangeNumPendingUnread(PRInt32 delta);
void ChangeNumPendingTotalMessages(PRInt32 delta);
#ifdef HAVE_DB
NS_IMETHOD BuildUrl(nsMsgDatabase *db, nsMsgKey key, char ** url);
// updates num messages and num unread - should be pure virtual
// when I get around to implementing in all subclasses?
NS_IMETHOD GetTotalMessagesInDB(PRUint32 *totalMessages) const; // How many messages in database.
// These functions are used for tricking the front end into thinking that we have more
// messages than are really in the DB. This is usually after and IMAP message copy where
// we don't want to do an expensive select until the user actually opens that folder
// These functions are called when MSG_Master::GetFolderLineById is populating a MSG_FolderLine
// struct used by the FE
int32 GetNumPendingUnread(PRBool deep = PR_FALSE);
int32 GetNumPendingTotalMessages(PRBool deep = PR_FALSE);
void ChangeNumPendingUnread(int32 delta);
void ChangeNumPendingTotalMessages(int32 delta);
NS_IMETHOD SetFolderPrefFlags(PRUint32 flags);
NS_IMETHOD GetFolderPrefFlags(PRUint32 *flags);

View File

@ -381,7 +381,7 @@ nsMsgIncomingServer::SetCharValue(const char *prefname,
rv = m_prefs->SetCharPref(fullPrefName, val);
PR_FREEIF(defaultVal);
PR_Free(fullPrefName);
PR_smprintf_free(fullPrefName);
return rv;
}