зеркало из https://github.com/mozilla/gecko-dev.git
part of fix for 64476 news counts getting off r=sspitzer, sr=mscott
This commit is contained in:
Родитель
ddfda0c0a9
Коммит
c9e2381cd0
|
@ -40,8 +40,6 @@ public:
|
|||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSINEWSDATABASE
|
||||
|
||||
virtual nsresult MessageDBOpenUsingURL(const char * groupURL);
|
||||
char *GetGroupURL() { return m_groupURL; }
|
||||
NS_IMETHOD Open(nsIFileSpec *newsgroupName, PRBool create, PRBool upgrading, nsIMsgDatabase** pMessageDB);
|
||||
NS_IMETHOD Close(PRBool forceCommit);
|
||||
NS_IMETHOD ForceClosed();
|
||||
|
@ -52,11 +50,6 @@ public:
|
|||
NS_IMETHOD IsRead(nsMsgKey key, PRBool *pRead);
|
||||
virtual nsresult IsHeaderRead(nsIMsgDBHdr *msgHdr, PRBool *pRead);
|
||||
|
||||
virtual PRBool IsArticleOffline(nsMsgKey key);
|
||||
virtual nsresult AddHdrFromXOver(const char * line, nsMsgKey *msgId);
|
||||
NS_IMETHOD AddHdrToDB(nsMsgHdr *newHdr, PRBool *newThread, PRBool notify = PR_FALSE);
|
||||
|
||||
NS_IMETHOD ListNextUnread(ListContext **pContext, nsMsgHdr **pResult);
|
||||
NS_IMETHOD GetHighWaterArticleNum(nsMsgKey *key);
|
||||
NS_IMETHOD GetLowWaterArticleNum(nsMsgKey *key);
|
||||
NS_IMETHOD MarkAllRead(nsMsgKeyArray *thoseMarked);
|
||||
|
@ -70,22 +63,11 @@ public:
|
|||
|
||||
virtual nsresult AdjustExpungedBytesOnDelete(nsIMsgDBHdr *msgHdr);
|
||||
|
||||
virtual PRBool PurgeNeeded(MSG_PurgeInfo *hdrPurgeInfo, MSG_PurgeInfo *artPurgeInfo);
|
||||
PRBool IsCategory();
|
||||
nsresult SetOfflineRetrievalInfo(MSG_RetrieveArtInfo *);
|
||||
nsresult SetPurgeHeaderInfo(MSG_PurgeInfo *purgeInfo);
|
||||
nsresult SetPurgeArticleInfo(MSG_PurgeInfo *purgeInfo);
|
||||
nsresult GetOfflineRetrievalInfo(MSG_RetrieveArtInfo *info);
|
||||
nsresult GetPurgeHeaderInfo(MSG_PurgeInfo *purgeInfo);
|
||||
nsresult GetPurgeArticleInfo(MSG_PurgeInfo *purgeInfo);
|
||||
|
||||
// used to handle filters editing on open news groups.
|
||||
//static void NotifyOpenDBsOfFilterChange(MSG_FolderInfo *folder);
|
||||
void ClearFilterList(); // filter was changed by user.
|
||||
void OpenFilterList();
|
||||
// void OnFolderFilterListChanged(MSG_FolderInfo *folder);
|
||||
// caller needs to free
|
||||
static char *GetGroupNameFromURL(const char *url);
|
||||
|
||||
NS_IMETHOD GetDefaultViewFlags(nsMsgViewFlagsTypeValue *aDefaultViewFlags);
|
||||
NS_IMETHOD GetDefaultSortType(nsMsgViewSortTypeValue *aDefaultSortType);
|
||||
|
@ -93,10 +75,8 @@ public:
|
|||
protected:
|
||||
virtual PRBool ThreadBySubjectWithoutRe() ;
|
||||
|
||||
char *m_groupURL;
|
||||
// MSG_FilterList* m_filterList;
|
||||
|
||||
PRUint32 m_headerIndex; // index of unthreaded headers
|
||||
// at a specified entry.
|
||||
|
||||
nsMsgKeySet *m_readSet;
|
||||
|
|
|
@ -1600,38 +1600,38 @@ nsresult nsMsgDatabase::HasAttachments(nsMsgKey key, PRBool *pHasThem)
|
|||
|
||||
PRBool nsMsgDatabase::SetHdrReadFlag(nsIMsgDBHdr *msgHdr, PRBool bRead)
|
||||
{
|
||||
return SetHdrFlag(msgHdr, bRead, MSG_FLAG_READ);
|
||||
return SetHdrFlag(msgHdr, bRead, MSG_FLAG_READ);
|
||||
}
|
||||
|
||||
nsresult nsMsgDatabase::MarkHdrReadInDB(nsIMsgDBHdr *msgHdr, PRBool bRead,
|
||||
nsIDBChangeListener *instigator)
|
||||
{
|
||||
nsresult rv;
|
||||
nsMsgKey key;
|
||||
PRUint32 oldFlags;
|
||||
(void)msgHdr->GetMessageKey(&key);
|
||||
msgHdr->GetFlags(&oldFlags);
|
||||
|
||||
if (m_newSet)
|
||||
m_newSet->Remove(key);
|
||||
|
||||
if (m_dbFolderInfo != NULL)
|
||||
{
|
||||
if (bRead)
|
||||
m_dbFolderInfo->ChangeNumNewMessages(-1);
|
||||
else
|
||||
m_dbFolderInfo->ChangeNumNewMessages(1);
|
||||
}
|
||||
|
||||
SetHdrReadFlag(msgHdr, bRead); // this will cause a commit, at least for local mail, so do it after we change
|
||||
// the folder counts above, so they will get committed too.
|
||||
PRUint32 flags;
|
||||
rv = msgHdr->GetFlags(&flags);
|
||||
flags &= ~MSG_FLAG_NEW;
|
||||
msgHdr->SetFlags(flags);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return NotifyKeyChangeAll(key, oldFlags, flags, instigator);
|
||||
nsresult rv;
|
||||
nsMsgKey key;
|
||||
PRUint32 oldFlags;
|
||||
(void)msgHdr->GetMessageKey(&key);
|
||||
msgHdr->GetFlags(&oldFlags);
|
||||
|
||||
if (m_newSet)
|
||||
m_newSet->Remove(key);
|
||||
|
||||
if (m_dbFolderInfo != NULL)
|
||||
{
|
||||
if (bRead)
|
||||
m_dbFolderInfo->ChangeNumNewMessages(-1);
|
||||
else
|
||||
m_dbFolderInfo->ChangeNumNewMessages(1);
|
||||
}
|
||||
|
||||
SetHdrReadFlag(msgHdr, bRead); // this will cause a commit, at least for local mail, so do it after we change
|
||||
// the folder counts above, so they will get committed too.
|
||||
PRUint32 flags;
|
||||
rv = msgHdr->GetFlags(&flags);
|
||||
flags &= ~MSG_FLAG_NEW;
|
||||
msgHdr->SetFlags(flags);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return NotifyKeyChangeAll(key, oldFlags, flags, instigator);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgDatabase::MarkRead(nsMsgKey key, PRBool bRead,
|
||||
|
@ -1913,24 +1913,30 @@ PRBool nsMsgDatabase::SetHdrFlag(nsIMsgDBHdr *msgHdr, PRBool bSet, MsgFlags flag
|
|||
NS_IMETHODIMP nsMsgDatabase::MarkHdrRead(nsIMsgDBHdr *msgHdr, PRBool bRead,
|
||||
nsIDBChangeListener *instigator)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
PRBool isRead = PR_TRUE;
|
||||
IsHeaderRead(msgHdr, &isRead);
|
||||
// if the flag is already correct in the db, don't change it
|
||||
if (!!isRead != !!bRead)
|
||||
{
|
||||
nsCOMPtr <nsIMsgThread> threadHdr;
|
||||
nsMsgKey msgKey;
|
||||
msgHdr->GetMessageKey(&msgKey);
|
||||
nsresult rv = NS_OK;
|
||||
PRBool isRead = PR_TRUE;
|
||||
PRUint32 msgFlags;
|
||||
|
||||
rv = GetThreadForMsgKey(msgKey, getter_AddRefs(threadHdr));
|
||||
if (threadHdr)
|
||||
{
|
||||
threadHdr->MarkChildRead(bRead);
|
||||
}
|
||||
rv = MarkHdrReadInDB(msgHdr, bRead, instigator);
|
||||
}
|
||||
return rv;
|
||||
(void) msgHdr->GetFlags(&msgFlags);
|
||||
IsHeaderRead(msgHdr, &isRead);
|
||||
// if the flag is already correct in the db, don't change it.
|
||||
// Check msg flags as well as IsHeaderRead in case it's a newsgroup
|
||||
// and the msghdr flags are out of sync with the newsrc settings.
|
||||
// (we could override this method for news db's, but it's a trivial fix here.
|
||||
if (!!isRead != !!bRead || (msgFlags & MSG_FLAG_READ != 0) != !!isRead)
|
||||
{
|
||||
nsCOMPtr <nsIMsgThread> threadHdr;
|
||||
nsMsgKey msgKey;
|
||||
msgHdr->GetMessageKey(&msgKey);
|
||||
|
||||
rv = GetThreadForMsgKey(msgKey, getter_AddRefs(threadHdr));
|
||||
if (threadHdr)
|
||||
{
|
||||
threadHdr->MarkChildRead(bRead);
|
||||
}
|
||||
rv = MarkHdrReadInDB(msgHdr, bRead, instigator);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgDatabase::MarkHdrReplied(nsIMsgDBHdr *msgHdr, PRBool bReplied,
|
||||
|
|
|
@ -69,11 +69,6 @@ NS_IMETHODIMP nsNewsDatabase::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
return nsMsgDatabase::QueryInterface(aIID, aInstancePtr);
|
||||
}
|
||||
|
||||
nsresult nsNewsDatabase::MessageDBOpenUsingURL(const char * groupURL)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsNewsDatabase::Open(nsIFileSpec *aNewsgroupName, PRBool create, PRBool upgrading, nsIMsgDatabase** pMessageDB)
|
||||
{
|
||||
nsNewsDatabase *newsDB;
|
||||
|
@ -222,27 +217,6 @@ nsresult nsNewsDatabase::IsHeaderRead(nsIMsgDBHdr *msgHdr, PRBool *pRead)
|
|||
return rv;
|
||||
}
|
||||
|
||||
PRBool nsNewsDatabase::IsArticleOffline(nsMsgKey key)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsNewsDatabase::AddHdrFromXOver(const char * line, nsMsgKey *msgId)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsNewsDatabase::AddHdrToDB(nsMsgHdr *newHdr, PRBool *newThread, PRBool notify)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsNewsDatabase::ListNextUnread(ListContext **pContext, nsMsgHdr **pResult)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
// return highest article number we've seen.
|
||||
NS_IMETHODIMP nsNewsDatabase::GetHighWaterArticleNum(nsMsgKey *key)
|
||||
{
|
||||
|
@ -293,36 +267,6 @@ nsNewsDatabase *nsNewsDatabase::GetNewsDB()
|
|||
return this;
|
||||
}
|
||||
|
||||
PRBool nsNewsDatabase::PurgeNeeded(MSG_PurgeInfo *hdrPurgeInfo, MSG_PurgeInfo *artPurgeInfo) { return PR_FALSE; };
|
||||
|
||||
PRBool nsNewsDatabase::IsCategory() {
|
||||
return PR_FALSE;
|
||||
}
|
||||
nsresult nsNewsDatabase::SetOfflineRetrievalInfo(MSG_RetrieveArtInfo *)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
nsresult nsNewsDatabase::SetPurgeHeaderInfo(MSG_PurgeInfo *purgeInfo)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
nsresult nsNewsDatabase::SetPurgeArticleInfo(MSG_PurgeInfo *purgeInfo)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
nsresult nsNewsDatabase::GetOfflineRetrievalInfo(MSG_RetrieveArtInfo *info)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
nsresult nsNewsDatabase::GetPurgeHeaderInfo(MSG_PurgeInfo *purgeInfo)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
nsresult nsNewsDatabase::GetPurgeArticleInfo(MSG_PurgeInfo *purgeInfo)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
// used to handle filters editing on open news groups.
|
||||
// static void NotifyOpenDBsOfFilterChange(MSG_FolderInfo *folder);
|
||||
void nsNewsDatabase::ClearFilterList()
|
||||
|
@ -336,11 +280,6 @@ void nsNewsDatabase::OpenFilterList()
|
|||
}
|
||||
//void OnFolderFilterListChanged(MSG_FolderInfo *folder);
|
||||
//caller needs to free
|
||||
/* static */
|
||||
char *nsNewsDatabase::GetGroupNameFromURL(const char *url)
|
||||
{
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
// should we thread messages with common subjects that don't start with Re: together?
|
||||
// I imagine we might have separate preferences for mail and news, so this is a virtual method.
|
||||
|
@ -395,8 +334,11 @@ PRBool nsNewsDatabase::SetHdrReadFlag(nsIMsgDBHdr *msgHdr, PRBool bRead)
|
|||
PRBool isRead;
|
||||
rv = IsHeaderRead(msgHdr, &isRead);
|
||||
|
||||
if (isRead == bRead) {
|
||||
return PR_FALSE;
|
||||
if (isRead == bRead)
|
||||
{
|
||||
// give the base class a chance to update m_flags.
|
||||
nsMsgDatabase::SetHdrReadFlag(msgHdr, bRead);
|
||||
return PR_FALSE;
|
||||
}
|
||||
else {
|
||||
nsMsgKey messageKey;
|
||||
|
|
Загрузка…
Ссылка в новой задаче