зеркало из https://github.com/mozilla/pjs.git
remove duplicate implementations of nsNewsSet. rename nsNewsSet to nsMsgKeySet.
heed the news set. this fixes #6730 and #6244.
This commit is contained in:
Родитель
472f030470
Коммит
8e519c68fe
|
@ -19,7 +19,7 @@
|
|||
nsMsgLineBuffer.h
|
||||
nsMsgGroupRecord.h
|
||||
nsUInt32Array.h
|
||||
nsNewsSet.h
|
||||
nsMsgKeySet.h
|
||||
nsMsgFolder.h
|
||||
nsMsgDBFolder.h
|
||||
nsLocalFolderSummarySpec.h
|
||||
|
|
|
@ -29,7 +29,7 @@ EXPORTS = \
|
|||
nsMsgGroupRecord.h \
|
||||
nsMsgLineBuffer.h \
|
||||
nsUInt32Array.h \
|
||||
nsNewsSet.h \
|
||||
nsMsgKeySet.h \
|
||||
nsMsgFolder.h \
|
||||
nsMsgDBFolder.h \
|
||||
nsLocalFolderSummarySpec.h \
|
||||
|
@ -46,7 +46,7 @@ CPPSRCS = \
|
|||
nsMsgFolder.cpp \
|
||||
nsMsgDBFolder.cpp \
|
||||
nsUInt32Array.cpp \
|
||||
nsNewsSet.cpp \
|
||||
nsMsgKeySet.cpp \
|
||||
nsLocalFolderSummarySpec.cpp \
|
||||
nsNewsSummarySpec.cpp \
|
||||
nsMsgIdentity.cpp \
|
||||
|
|
|
@ -49,7 +49,7 @@ CPPSRCS= \
|
|||
nsMsgGroupRecord.cpp \
|
||||
nsMsgLineBuffer.cpp \
|
||||
nsUInt32Array.cpp \
|
||||
nsNewsSet.cpp \
|
||||
nsMsgKeySet.cpp \
|
||||
nsMsgFolder.cpp \
|
||||
nsMsgDBFolder.cpp \
|
||||
nsLocalFolderSummarySpec.cpp \
|
||||
|
@ -66,7 +66,7 @@ CPP_OBJS= \
|
|||
.\$(OBJDIR)\nsMsgGroupRecord.obj \
|
||||
.\$(OBJDIR)\nsMsgLineBuffer.obj \
|
||||
.\$(OBJDIR)\nsUInt32Array.obj \
|
||||
.\$(OBJDIR)\nsNewsSet.obj \
|
||||
.\$(OBJDIR)\nsMsgKeySet.obj \
|
||||
.\$(OBJDIR)\nsMsgFolder.obj \
|
||||
.\$(OBJDIR)\nsMsgDBFolder.obj \
|
||||
.\$(OBJDIR)\nsLocalFolderSummarySpec.obj \
|
||||
|
@ -83,7 +83,7 @@ EXPORTS= \
|
|||
nsMsgLineBuffer.h \
|
||||
nsMsgGroupRecord.h \
|
||||
nsUInt32Array.h \
|
||||
nsNewsSet.h \
|
||||
nsMsgKeySet.h \
|
||||
nsMsgFolder.h \
|
||||
nsMsgDBFolder.h \
|
||||
nsLocalFolderSummarySpec.h \
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,115 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef _nsMsgKeySet_H_
|
||||
#define _nsMsgKeySet_H_
|
||||
|
||||
#include "msgCore.h"
|
||||
|
||||
// nsMsgKeySet represents a set of articles. Typically, it is the set of
|
||||
// read articles from a .newsrc file, but it can be used for other purposes
|
||||
// too.
|
||||
|
||||
#if 0
|
||||
// If a MSG_NewsHost* is supplied to the creation routine, then that
|
||||
// MSG_NewsHost will be notified whenever a change is made to set.
|
||||
class MSG_NewsHost;
|
||||
#endif
|
||||
|
||||
class NS_MSG_BASE nsMsgKeySet {
|
||||
public:
|
||||
// Creates an empty set.
|
||||
static nsMsgKeySet* Create(/* MSG_NewsHost* host = NULL*/);
|
||||
|
||||
// Creates a set from the list of numbers, as might be found in a
|
||||
// newsrc file.
|
||||
static nsMsgKeySet* Create(const char* str/* , MSG_NewsHost* host = NULL*/);
|
||||
~nsMsgKeySet();
|
||||
|
||||
// FirstNonMember() returns the lowest non-member of the set that is
|
||||
// greater than 0.
|
||||
PRInt32 FirstNonMember();
|
||||
|
||||
// Output() converts to a string representation suitable for writing to a
|
||||
// .newsrc file. (The result must be freed by the caller using delete[].)
|
||||
char* Output();
|
||||
|
||||
// IsMember() returns whether the given article is a member of this set.
|
||||
PRBool IsMember(PRInt32 art);
|
||||
|
||||
// Add() adds the given article to the set. (Returns 1 if a change was
|
||||
// made, 0 if it was already there, and negative on error.)
|
||||
int Add(PRInt32 art);
|
||||
|
||||
// Remove() removes the given article from the set.
|
||||
int Remove(PRInt32 art);
|
||||
|
||||
// AddRange() adds the (inclusive) given range of articles to the set.
|
||||
int AddRange(PRInt32 first, PRInt32 last);
|
||||
|
||||
// CountMissingInRange() takes an inclusive range of articles and returns
|
||||
// the number of articles in that range which are not in the set.
|
||||
PRInt32 CountMissingInRange(PRInt32 start, PRInt32 end);
|
||||
|
||||
// FirstMissingRange() takes an inclusive range and finds the first range
|
||||
// of articles that are not in the set. If none, return zeros.
|
||||
int FirstMissingRange(PRInt32 min, PRInt32 max, PRInt32* first, PRInt32* last);
|
||||
|
||||
|
||||
// LastMissingRange() takes an inclusive range and finds the last range
|
||||
// of articles that are not in the set. If none, return zeros.
|
||||
int LastMissingRange(PRInt32 min, PRInt32 max, PRInt32* first, PRInt32* last);
|
||||
|
||||
PRInt32 GetLastMember();
|
||||
PRInt32 GetFirstMember();
|
||||
void SetLastMember(PRInt32 highWaterMark);
|
||||
// For debugging only...
|
||||
PRInt32 getLength() {return m_length;}
|
||||
|
||||
#ifdef DEBUG
|
||||
static void RunTests();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
nsMsgKeySet(/* MSG_NewsHost* host */);
|
||||
nsMsgKeySet(const char* /* , MSG_NewsHost* host */);
|
||||
PRBool Grow();
|
||||
PRBool Optimize();
|
||||
|
||||
#ifdef DEBUG
|
||||
static void test_decoder(const char*);
|
||||
static void test_adder();
|
||||
static void test_ranges();
|
||||
static void test_member(PRBool with_cache);
|
||||
#endif
|
||||
|
||||
PRInt32 *m_data; /* the numbers composing the `chunks' */
|
||||
PRInt32 m_data_size; /* size of that malloc'ed block */
|
||||
PRInt32 m_length; /* active area */
|
||||
|
||||
PRInt32 m_cached_value; /* a potential set member, or -1 if unset*/
|
||||
PRInt32 m_cached_value_index; /* the index into `data' at which a search
|
||||
to determine whether `cached_value' was
|
||||
a member of the set ended. */
|
||||
#ifdef NEWSRC_DOES_HOST_STUFF
|
||||
MSG_NewsHost* m_host;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
#endif /* _nsMsgKeySet_H_ */
|
|
@ -91,6 +91,10 @@ public:
|
|||
NS_IMETHOD SetProperty(const char *propertyName, nsString &propertyStr);
|
||||
NS_IMETHOD SetUint32Property(const char *propertyName, PRUint32 propertyValue);
|
||||
NS_IMETHOD GetUint32Property(const char *propertyName, PRUint32 &propertyValue);
|
||||
|
||||
NS_IMETHOD SetKnownArtsSet(nsString &newsArtSet);
|
||||
NS_IMETHOD GetKnownArtsSet(nsString &newsArtSet);
|
||||
|
||||
// create the appropriate table and row in a new db.
|
||||
nsresult AddToNewMDB();
|
||||
// accessor methods.
|
||||
|
@ -111,10 +115,6 @@ public:
|
|||
void ChangeImapTotalPendingMessages(PRInt32 delta);
|
||||
void ChangeImapUnreadPendingMessages(PRInt32 delta) ;
|
||||
|
||||
|
||||
virtual void SetKnownArtsSet(nsString &newsArtSet);
|
||||
virtual void GetKnownArtsSet(nsString &newsArtSet);
|
||||
|
||||
// get and set arbitrary property, aka row cell value.
|
||||
nsresult SetPropertyWithToken(mdb_token aProperty, nsString &propertyStr);
|
||||
nsresult SetUint32PropertyWithToken(mdb_token aProperty, PRUint32 propertyValue);
|
||||
|
|
|
@ -78,6 +78,8 @@ public:
|
|||
NS_IMETHOD SetProperty(const char *propertyName, nsString &propertyStr) = 0;
|
||||
NS_IMETHOD SetUint32Property(const char *propertyName, PRUint32 propertyValue) = 0;
|
||||
NS_IMETHOD GetUint32Property(const char *propertyName, PRUint32 &propertyValue) = 0;
|
||||
NS_IMETHOD SetKnownArtsSet(nsString &newsArtSet) = 0;
|
||||
NS_IMETHOD GetKnownArtsSet(nsString &newsArtSet) =0;
|
||||
};
|
||||
|
||||
#endif // nsIDBFolderInfo_h__
|
||||
|
|
|
@ -27,6 +27,7 @@ class nsIDBChangeListener;
|
|||
class nsIEnumerator;
|
||||
class nsThreadMessageHdr; // XXX where's the public interface to this?
|
||||
class nsMsgKeyArray;
|
||||
class nsMsgKeySet;
|
||||
class nsIDBFolderInfo;
|
||||
class nsIMsgThread;
|
||||
|
||||
|
@ -196,6 +197,11 @@ public:
|
|||
// thread interfaces.
|
||||
NS_IMETHOD GetThreadForMsgKey(nsMsgKey msgKey, nsIMsgThread **result) = 0;
|
||||
NS_IMETHOD GetThreadContainingMsgHdr(nsIMsgDBHdr *msgHdr, nsIMsgThread **result) = 0;
|
||||
|
||||
NS_IMETHOD GetMsgKeySet(nsMsgKeySet **pSet) = 0;
|
||||
|
||||
NS_IMETHOD GetHighWaterArticleNum(nsMsgKey *key) =0;
|
||||
NS_IMETHOD GetLowWaterArticleNum(nsMsgKey *key) =0;
|
||||
};
|
||||
|
||||
#endif // nsIMsgDatabase_h__
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
class ListContext;
|
||||
class nsMsgKeyArray;
|
||||
class nsNewsSet;
|
||||
class nsMsgKeySet;
|
||||
class nsMsgThread;
|
||||
class nsIMsgThread;
|
||||
class nsIDBFolderInfo;
|
||||
|
@ -186,6 +186,11 @@ public:
|
|||
|
||||
NS_IMETHOD GetThreadForMsgKey(nsMsgKey msgKey, nsIMsgThread **result);
|
||||
NS_IMETHOD GetThreadContainingMsgHdr(nsIMsgDBHdr *msgHdr, nsIMsgThread **result) ;
|
||||
|
||||
NS_IMETHOD GetMsgKeySet(nsMsgKeySet **pSet) ;
|
||||
|
||||
NS_IMETHOD GetHighWaterArticleNum(nsMsgKey *key);
|
||||
NS_IMETHOD GetLowWaterArticleNum(nsMsgKey *key);
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// nsMsgDatabase methods:
|
||||
nsMsgDatabase();
|
||||
|
@ -287,7 +292,7 @@ protected:
|
|||
nsIMdbStore *m_mdbStore;
|
||||
nsIMdbTable *m_mdbAllMsgHeadersTable;
|
||||
nsFileSpec m_dbName;
|
||||
nsNewsSet *m_newSet; // new messages since last open.
|
||||
nsMsgKeySet *m_newSet; // new messages since last open.
|
||||
PRBool m_mdbTokensInitialized;
|
||||
nsVoidArray/*<nsIDBChangeListener>*/ *m_ChangeListeners;
|
||||
mdb_token m_hdrRowScopeToken;
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
class nsIDBChangeListener;
|
||||
class nsMsgKeyArray;
|
||||
class nsNewsSet;
|
||||
class MSG_RetrieveArtInfo;
|
||||
class MSG_PurgeInfo;
|
||||
// news group database
|
||||
|
@ -52,15 +51,13 @@ public:
|
|||
NS_IMETHOD AddHdrToDB(nsMsgHdr *newHdr, PRBool *newThread, PRBool notify = PR_FALSE);
|
||||
|
||||
NS_IMETHOD ListNextUnread(ListContext **pContext, nsMsgHdr **pResult);
|
||||
// return highest article number we've seen.
|
||||
virtual nsMsgKey GetHighwaterArticleNum();
|
||||
virtual nsMsgKey GetLowWaterArticleNum();
|
||||
NS_IMETHOD GetHighWaterArticleNum(nsMsgKey *key);
|
||||
NS_IMETHOD GetLowWaterArticleNum(nsMsgKey *key);
|
||||
|
||||
virtual nsresult ExpireUpTo(nsMsgKey expireKey);
|
||||
virtual nsresult ExpireRange(nsMsgKey startRange, nsMsgKey endRange);
|
||||
|
||||
nsNewsSet *GetNewsArtSet() ;
|
||||
virtual nsNewsDatabase *GetNewsDB() ;
|
||||
virtual nsNewsDatabase *GetNewsDB() ;
|
||||
|
||||
virtual PRBool PurgeNeeded(MSG_PurgeInfo *hdrPurgeInfo, MSG_PurgeInfo *artPurgeInfo);
|
||||
PRBool IsCategory();
|
||||
|
@ -88,7 +85,6 @@ protected:
|
|||
|
||||
PRUint32 m_headerIndex; // index of unthreaded headers
|
||||
// at a specified entry.
|
||||
nsNewsSet *m_set;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -562,14 +562,14 @@ void nsDBFolderInfo::ChangeImapUnreadPendingMessages(PRInt32 delta)
|
|||
}
|
||||
|
||||
|
||||
void nsDBFolderInfo::SetKnownArtsSet(nsString &newsArtSet)
|
||||
NS_IMETHODIMP nsDBFolderInfo::SetKnownArtsSet(nsString &newsArtSet)
|
||||
{
|
||||
SetProperty(kKnownArtsSetColumnName, newsArtSet);
|
||||
return SetProperty(kKnownArtsSetColumnName, newsArtSet);
|
||||
}
|
||||
|
||||
void nsDBFolderInfo::GetKnownArtsSet(nsString &newsArtSet)
|
||||
NS_IMETHODIMP nsDBFolderInfo::GetKnownArtsSet(nsString &newsArtSet)
|
||||
{
|
||||
GetProperty(kKnownArtsSetColumnName, newsArtSet);
|
||||
return GetProperty(kKnownArtsSetColumnName, newsArtSet);
|
||||
}
|
||||
|
||||
// get arbitrary property, aka row cell value.
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "msgCore.h"
|
||||
#include "nsMsgDatabase.h"
|
||||
#include "nsDBFolderInfo.h"
|
||||
#include "nsNewsSet.h"
|
||||
#include "nsMsgKeySet.h"
|
||||
#include "nsIEnumerator.h"
|
||||
#include "nsMsgThread.h"
|
||||
#include "nsFileStream.h"
|
||||
|
@ -1381,10 +1381,24 @@ NS_IMETHODIMP nsMsgDatabase::MarkLater(nsMsgKey key, time_t *until)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgDatabase::GetMsgKeySet(nsMsgKeySet **pSet)
|
||||
{
|
||||
// if it doesn't exist, try to create it
|
||||
if (m_newSet == nsnull) {
|
||||
m_newSet = nsMsgKeySet::Create();
|
||||
if (m_newSet == nsnull) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
*pSet = m_newSet;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgDatabase::AddToNewList(nsMsgKey key)
|
||||
{
|
||||
if (m_newSet == NULL)
|
||||
m_newSet = nsNewsSet::Create();
|
||||
if (m_newSet == nsnull)
|
||||
m_newSet = nsMsgKeySet::Create();
|
||||
if (m_newSet)
|
||||
m_newSet->Add(key);
|
||||
return (m_newSet) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -2463,6 +2477,15 @@ NS_IMETHODIMP nsMsgDatabase::ListAllOfflineDeletes(nsMsgKeyArray *offlineDeletes
|
|||
// technically, notimplemented, but no one's putting offline ops in anyway.
|
||||
return ret;
|
||||
}
|
||||
NS_IMETHODIMP nsMsgDatabase::GetHighWaterArticleNum(nsMsgKey *key)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
NS_IMETHODIMP nsMsgDatabase::GetLowWaterArticleNum(nsMsgKey *key)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
nsresult nsMsgDatabase::DumpContents()
|
||||
|
@ -2483,7 +2506,7 @@ nsresult nsMsgDatabase::DumpContents()
|
|||
nsresult rv = ListAllKeys(keys);
|
||||
for (i = 0; i < keys.GetSize(); i++) {
|
||||
key = keys[i];
|
||||
#endif
|
||||
#endif /* HAVE_INT_ENUMERATORS */
|
||||
nsIMsgDBHdr *msg = NULL;
|
||||
rv = GetMsgHdrForKey(key, &msg);
|
||||
nsMsgHdr* msgHdr = NS_STATIC_CAST(nsMsgHdr*, msg); // closed system, cast ok
|
||||
|
@ -2552,7 +2575,7 @@ nsresult nsMsgDatabase::DumpThread(nsMsgKey threadId)
|
|||
|
||||
printf("message in thread %u %s\n", key, (const char *) &nsAutoString(subject));
|
||||
}
|
||||
#endif
|
||||
#endif /* DEBUG_bienvenu */
|
||||
// NS_RELEASE(pMessage);
|
||||
pMessage = nsnull;
|
||||
}
|
||||
|
@ -2562,7 +2585,6 @@ nsresult nsMsgDatabase::DumpThread(nsMsgKey threadId)
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* DEBUG */
|
||||
|
||||
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
#include "msgCore.h"
|
||||
#include "nsNewsDatabase.h"
|
||||
#include "nsNewsSummarySpec.h"
|
||||
|
||||
#include "nsMsgKeySet.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
nsNewsDatabase::nsNewsDatabase()
|
||||
{
|
||||
|
@ -122,15 +123,18 @@ PRUint32 nsNewsDatabase::GetCurVersion()
|
|||
NS_IMETHODIMP nsNewsDatabase::MarkHdrRead(nsIMsgDBHdr *msgHdr, PRBool bRead,
|
||||
nsIDBChangeListener *instigator)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
#if 0
|
||||
nsMsgKey messageKey = msgHdr->GetMessageKey();
|
||||
nsresult rv = NS_OK;
|
||||
nsMsgKey messageKey;
|
||||
rv = msgHdr->GetMessageKey(&messageKey);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (bRead)
|
||||
rv = m_set->Add(messageKey);
|
||||
rv = m_newSet->Add(messageKey);
|
||||
else
|
||||
rv = m_set->Remove(messageKey);
|
||||
#endif /* 0 */
|
||||
rv = m_newSet->Remove(messageKey);
|
||||
|
||||
// give parent class chance to update data structures
|
||||
rv = nsMsgDatabase::MarkHdrRead(msgHdr, bRead, instigator);
|
||||
|
||||
|
@ -142,10 +146,9 @@ NS_IMETHODIMP nsNewsDatabase::IsRead(nsMsgKey key, PRBool *pRead)
|
|||
NS_ASSERTION(pRead != NULL, "null out param in IsRead");
|
||||
if (pRead == NULL)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
#if 0
|
||||
PRBool isRead = m_set->IsMember(messageKey);
|
||||
|
||||
PRBool isRead = m_newSet->IsMember(key);
|
||||
*pRead = isRead;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -174,15 +177,42 @@ NS_IMETHODIMP nsNewsDatabase::ListNextUnread(ListContext **pContext, nsMsgHdr *
|
|||
}
|
||||
|
||||
// return highest article number we've seen.
|
||||
nsMsgKey nsNewsDatabase::GetHighwaterArticleNum()
|
||||
NS_IMETHODIMP nsNewsDatabase::GetHighWaterArticleNum(nsMsgKey *key)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
nsMsgKey nsNewsDatabase::GetLowWaterArticleNum()
|
||||
{
|
||||
return 0;
|
||||
PR_ASSERT(m_dbFolderInfo);
|
||||
if (!m_dbFolderInfo) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return m_dbFolderInfo->GetHighWater(key);
|
||||
}
|
||||
|
||||
// return the key of the first article number we know about.
|
||||
// Since the iterator iterates in id order, we can just grab the
|
||||
// messagekey of the first header it returns.
|
||||
// ### dmb
|
||||
// This will not deal with the situation where we get holes in
|
||||
// the headers we know about. Need to figure out how and when
|
||||
// to solve that. This could happen if a transfer is interrupted.
|
||||
// Do we need to keep track of known arts permanently?
|
||||
NS_IMETHODIMP nsNewsDatabase::GetLowWaterArticleNum(nsMsgKey *key)
|
||||
{
|
||||
nsresult rv;
|
||||
nsMsgHdr *pHeader;
|
||||
|
||||
nsCOMPtr<nsIEnumerator> hdrs;
|
||||
rv = EnumerateMessages(getter_AddRefs(hdrs));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
hdrs->First();
|
||||
rv = hdrs->CurrentItem((nsISupports**)&pHeader);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "nsMsgDBEnumerator broken");
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
return pHeader->GetMessageKey(key);
|
||||
}
|
||||
|
||||
nsresult nsNewsDatabase::ExpireUpTo(nsMsgKey expireKey)
|
||||
{
|
||||
return 0;
|
||||
|
@ -192,11 +222,6 @@ nsresult nsNewsDatabase::ExpireRange(nsMsgKey startRange, nsMsgKey endRange)
|
|||
return 0;
|
||||
}
|
||||
|
||||
nsNewsSet *nsNewsDatabase::GetNewsArtSet()
|
||||
{
|
||||
return m_set;
|
||||
}
|
||||
|
||||
nsNewsDatabase *nsNewsDatabase::GetNewsDB()
|
||||
{
|
||||
return this;
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
nsNNTPProtocol.h
|
||||
nsNntpUrl.h
|
||||
nsNNTPArticleSet.h
|
||||
nsNNTPNewsgroupList.h
|
||||
nsNNTPNewsgroup.h
|
||||
nntpCore.h
|
||||
|
|
|
@ -28,7 +28,6 @@ LIBRARY_NAME=nntp
|
|||
EXPORTS = \
|
||||
nsNNTPProtocol.h \
|
||||
nsNntpUrl.h \
|
||||
nsNNTPArticleSet.h \
|
||||
nsNNTPNewsgroupList.h \
|
||||
nsNNTPNewsgroup.h \
|
||||
nsNNTPNewsgroupPost.h \
|
||||
|
@ -42,7 +41,6 @@ EXPORTS = \
|
|||
|
||||
CPPSRCS = \
|
||||
nsNNTPArticleList.cpp \
|
||||
nsNNTPArticleSet.cpp \
|
||||
nsNNTPNewsgroup.cpp \
|
||||
nsNNTPNewsgroupList.cpp \
|
||||
nsNNTPNewsgroupPost.cpp \
|
||||
|
|
|
@ -27,7 +27,6 @@ REQUIRES=xpcom js nspr netlib
|
|||
|
||||
CPPSRCS= nsNNTPProtocol.cpp \
|
||||
nsNntpUrl.cpp \
|
||||
nsNNTPArticleSet.cpp \
|
||||
nsNNTPArticleList.cpp \
|
||||
nsNNTPNewsgroupList.cpp \
|
||||
nsNNTPNewsgroupPost.cpp \
|
||||
|
@ -43,7 +42,6 @@ CPPSRCS= nsNNTPProtocol.cpp \
|
|||
|
||||
CPP_OBJS= .\$(OBJDIR)\nsNNTPProtocol.obj \
|
||||
.\$(OBJDIR)\nsNntpUrl.obj \
|
||||
.\$(OBJDIR)\nsNNTPArticleSet.obj \
|
||||
.\$(OBJDIR)\nsNNTPArticleList.obj \
|
||||
.\$(OBJDIR)\nsNNTPNewsgroupList.obj \
|
||||
.\$(OBJDIR)\nsNNTPNewsgroupPost.obj \
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
#include "nsNNTPNewsgroupList.h"
|
||||
#include "nsINNTPHost.h"
|
||||
#include "nsINNTPArticleList.h"
|
||||
#include "nsMsgKeySet.h"
|
||||
|
||||
/* XXX - temporary hack so this will compile */
|
||||
|
||||
typedef PRUint32 nsMsgKey;
|
||||
|
||||
class nsNNTPArticleList : public nsINNTPArticleList
|
||||
|
@ -87,7 +87,7 @@ nsNNTPArticleList::Init(nsINNTPHost * newsHost,
|
|||
#ifdef HAVE_NEWSDB
|
||||
m_newsDB = NULL;
|
||||
#endif
|
||||
m_idsOnServer.set = nsNNTPArticleSet::Create();
|
||||
m_idsOnServer.set = nsMsgKeySet::Create();
|
||||
#ifdef HAVE_PANES
|
||||
nsINNTPNewsgroup *newsFolder = m_pane->GetMaster()->FindNewsFolder(host, groupName, PR_FALSE);
|
||||
if (newsFolder)
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "nsNNTPCategoryContainer.h"
|
||||
|
||||
#include "nsNNTPHost.h"
|
||||
#include "nsNNTPArticleSet.h"
|
||||
#include "nsMsgKeySet.h"
|
||||
|
||||
#include "nsMsgGroupRecord.h"
|
||||
|
||||
|
@ -892,7 +892,7 @@ nsNNTPHost::ProcessLine(char* line, PRUint32 line_size)
|
|||
|
||||
char *s;
|
||||
char *end = line + line_size;
|
||||
static nsNNTPArticleSet *set;
|
||||
static nsMsgKeySet *set;
|
||||
|
||||
for (s = line; s < end; s++)
|
||||
if (*s == ':' || *s == '!')
|
||||
|
@ -903,7 +903,7 @@ nsNNTPHost::ProcessLine(char* line, PRUint32 line_size)
|
|||
return RememberLine(line);
|
||||
}
|
||||
|
||||
set = nsNNTPArticleSet::Create(s + 1, this);
|
||||
set = nsMsgKeySet::Create(s + 1 /* , this */);
|
||||
if (!set) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
PRBool subscribed = (*s == ':');
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
#include "nsISupports.h" /* interface nsISupports */
|
||||
|
||||
#include "nsINNTPNewsgroup.h"
|
||||
#include "nsNNTPArticleSet.h"
|
||||
#include "nsINNTPHost.h"
|
||||
#include "nsMsgKeySet.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
|
@ -335,7 +336,7 @@ extern "C" {
|
|||
|
||||
nsresult NS_NewNewsgroup(nsINNTPNewsgroup **info,
|
||||
char *line,
|
||||
nsNNTPArticleSet *set,
|
||||
nsMsgKeySet *set,
|
||||
PRBool subscribed,
|
||||
nsINNTPHost *host,
|
||||
int depth)
|
||||
|
|
|
@ -20,14 +20,15 @@
|
|||
#define __nsNNTPNewsgroup_h
|
||||
|
||||
#include "nsINNTPNewsgroup.h"
|
||||
#include "nsNNTPArticleSet.h"
|
||||
#include "nsMsgKeySet.h"
|
||||
#include "nsINNTPHost.h"
|
||||
|
||||
NS_BEGIN_EXTERN_C
|
||||
|
||||
nsresult
|
||||
NS_NewNewsgroup(nsINNTPNewsgroup **info,
|
||||
char *line,
|
||||
nsNNTPArticleSet *set,
|
||||
nsMsgKeySet *set,
|
||||
PRBool subscribed,
|
||||
nsINNTPHost *host,
|
||||
int depth);
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
#include "msgCore.h" // precompiled header...
|
||||
#include "MailNewsTypes.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDBFolderInfo.h"
|
||||
|
||||
#ifdef HAVE_PANES
|
||||
class MSG_Master;
|
||||
|
@ -36,7 +38,7 @@ class MSG_Master;
|
|||
#include "nsNNTPNewsgroupList.h"
|
||||
|
||||
#include "nsINNTPArticleList.h"
|
||||
#include "nsNNTPArticleSet.h"
|
||||
#include "nsMsgKeySet.h"
|
||||
|
||||
#include "nsINNTPNewsgroup.h"
|
||||
#include "nsNNTPNewsgroup.h"
|
||||
|
@ -55,7 +57,7 @@ class MSG_Master;
|
|||
|
||||
#include "nsNewsDatabase.h"
|
||||
|
||||
//#include "nsDBFolderInfo.h"
|
||||
#include "nsIDBFolderInfo.h"
|
||||
|
||||
#ifdef HAVE_PANES
|
||||
#include "msgpane.h"
|
||||
|
@ -153,8 +155,7 @@ protected:
|
|||
PRInt32 m_lastMsgToDownload;
|
||||
|
||||
struct MSG_NewsKnown m_knownArts;
|
||||
nsNNTPArticleSet *m_set;
|
||||
|
||||
nsMsgKeySet *m_set;
|
||||
};
|
||||
|
||||
|
||||
|
@ -185,7 +186,7 @@ nsNNTPNewsgroupList::Init(nsINNTPHost *host, nsINNTPNewsgroup *newsgroup, const
|
|||
m_url = PR_smprintf("%s/%s/%s",kNewsRootURI,hostname,name);
|
||||
m_lastProcessedNumber = 0;
|
||||
m_lastMsgNumber = 0;
|
||||
m_set = NULL;
|
||||
m_set = nsnull;
|
||||
#ifdef HAVE_PANES
|
||||
PR_ASSERT(pane);
|
||||
m_pane = pane;
|
||||
|
@ -199,7 +200,7 @@ nsNNTPNewsgroupList::Init(nsINNTPHost *host, nsINNTPNewsgroup *newsgroup, const
|
|||
m_host = host;
|
||||
m_newsgroup = newsgroup;
|
||||
m_knownArts.host = m_host;
|
||||
m_knownArts.set = nsNNTPArticleSet::Create();
|
||||
m_knownArts.set = nsMsgKeySet::Create();
|
||||
m_getOldMessages = PR_FALSE;
|
||||
m_promptedAlready = PR_FALSE;
|
||||
m_downloadAll = PR_FALSE;
|
||||
|
@ -298,35 +299,50 @@ nsNNTPNewsgroupList::GetRangeOfArtsToDownload(
|
|||
if (!m_newsDB)
|
||||
{
|
||||
nsresult err;
|
||||
if ((err = GetDatabase(GetURL(), &m_newsDB)) != NS_OK)
|
||||
{
|
||||
return err;
|
||||
if ((err = GetDatabase(GetURL(), &m_newsDB)) != NS_OK) {
|
||||
return err;
|
||||
}
|
||||
else {
|
||||
nsresult rv = NS_OK;
|
||||
rv = m_newsDB->GetMsgKeySet(&m_set);
|
||||
if (NS_FAILED(rv) || !m_set) {
|
||||
return rv;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef NOT_READY_YET
|
||||
m_set = m_newsDB->GetNewsArtSet();
|
||||
|
||||
m_set->SetLastMember(last_possible); // make sure highwater mark is valid.
|
||||
nsDBFolderInfo *newsGroupInfo = m_newsDB->GetDBFolderInfo();
|
||||
if (newsGroupInfo)
|
||||
nsIDBFolderInfo *newsGroupInfo = nsnull;
|
||||
rv = m_newsDB->GetDBFolderInfo(&newsGroupInfo);
|
||||
if (NS_SUCCEEDED(rv) && newsGroupInfo)
|
||||
{
|
||||
nsString knownArtsString;
|
||||
nsMsgKey mark;
|
||||
newsGroupInfo->GetKnownArtsSet(knownArtsString);
|
||||
if (last_possible < newsGroupInfo->GetHighWater())
|
||||
|
||||
rv = newsGroupInfo->GetHighWater(&mark);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
if (last_possible < mark)
|
||||
newsGroupInfo->SetHighWater(last_possible, TRUE);
|
||||
if (m_knownArts.set) {
|
||||
delete m_knownArts.set;
|
||||
}
|
||||
m_knownArts.set = nsNNTPArticleSet::Create(knownArtsString);
|
||||
m_knownArts.set = nsMsgKeySet::Create(nsAutoCString(knownArtsString));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_knownArts.set) {
|
||||
delete m_knownArts.set;
|
||||
}
|
||||
m_knownArts.set = nsNNTPArticleSet::Create();
|
||||
m_knownArts.set->AddRange(m_newsDB->GetLowWaterArticleNum(), m_newsDB->GetHighwaterArticleNum());
|
||||
}
|
||||
m_knownArts.set = nsMsgKeySet::Create();
|
||||
nsMsgKey low, high;
|
||||
rv = m_newsDB->GetLowWaterArticleNum(&low);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = m_newsDB->GetHighWaterArticleNum(&high);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
m_knownArts.set->AddRange(low,high);
|
||||
}
|
||||
#ifdef HAVE_PANES
|
||||
m_pane->StartingUpdate(MSG_NotifyNone, 0, 0);
|
||||
m_newsDB->ExpireUpTo(first_possible, m_pane->GetContext());
|
||||
|
@ -344,7 +360,6 @@ nsNNTPNewsgroupList::GetRangeOfArtsToDownload(
|
|||
FE_Progress (context, noNewMsgs);
|
||||
#endif /* HAVE_PANES */
|
||||
}
|
||||
#endif /* NOT_READY_YET */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -447,9 +462,8 @@ nsNNTPNewsgroupList::GetRangeOfArtsToDownload(
|
|||
*first = *last - maxextra + 1;
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG_bienvenu
|
||||
PR_LogPrint("GetRangeOfArtsToDownload(first possible = %ld, last possible = %ld, first = %ld, last = %ld maxextra = %ld\n",
|
||||
first_possible, last_possible, *first, *last, maxextra);
|
||||
#if defined(DEBUG_bienvenu) || defined(DEBUG_sspitzer)
|
||||
printf("GetRangeOfArtsToDownload(first possible = %ld, last possible = %ld, first = %ld, last = %ld maxextra = %ld\n",first_possible, last_possible, *first, *last, maxextra);
|
||||
#endif
|
||||
m_firstMsgToDownload = *first;
|
||||
m_lastMsgToDownload = *last;
|
||||
|
@ -476,7 +490,7 @@ nsNNTPNewsgroupList::AddToKnownArticles(PRInt32 first, PRInt32 last)
|
|||
if (m_knownArts.set) {
|
||||
delete m_knownArts.set;
|
||||
}
|
||||
m_knownArts.set = nsNNTPArticleSet::Create();
|
||||
m_knownArts.set = nsMsgKeySet::Create();
|
||||
|
||||
if (!m_knownArts.group_name || !m_knownArts.set) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -485,20 +499,21 @@ nsNNTPNewsgroupList::AddToKnownArticles(PRInt32 first, PRInt32 last)
|
|||
}
|
||||
|
||||
status = m_knownArts.set->AddRange(first, last);
|
||||
#ifdef HAVE_NEWSDB
|
||||
if (m_newsDB)
|
||||
{
|
||||
|
||||
nsDBFolderInfo *newsGroupInfo = m_newsDB->GetDBFolderInfo();
|
||||
if (newsGroupInfo)
|
||||
{
|
||||
if (m_newsDB) {
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr <nsIDBFolderInfo> newsGroupInfo;
|
||||
rv = m_newsDB->GetDBFolderInfo(getter_AddRefs(newsGroupInfo));
|
||||
if (NS_SUCCEEDED(rv) && newsGroupInfo) {
|
||||
char *output = m_knownArts.set->Output();
|
||||
if (output)
|
||||
newsGroupInfo->SetKnownArtsSet(output);
|
||||
if (output) {
|
||||
nsString str(output);
|
||||
newsGroupInfo->SetKnownArtsSet(str);
|
||||
}
|
||||
delete[] output;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -754,7 +769,7 @@ nsNNTPNewsgroupList::ProcessXOVERLINE(const char *line, PRUint32 *status)
|
|||
|
||||
PR_ASSERT (line);
|
||||
if (!line)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (m_newsDB != nsnull)
|
||||
{
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "nsINNTPNewsgroupList.h"
|
||||
#include "nsINNTPNewsgroup.h"
|
||||
|
||||
#include "nsNNTPArticleSet.h"
|
||||
#include "nsMsgKeySet.h"
|
||||
|
||||
/* The below is all stuff that we remember for netlib about which
|
||||
articles we've already seen in the current newsgroup. */
|
||||
|
@ -37,7 +37,7 @@
|
|||
typedef struct MSG_NewsKnown {
|
||||
nsINNTPHost* host;
|
||||
char* group_name;
|
||||
nsNNTPArticleSet* set; /* Set of articles we've already gotten
|
||||
nsMsgKeySet* set; /* Set of articles we've already gotten
|
||||
from the newsserver (if it's marked
|
||||
"read", then we've already gotten it).
|
||||
If an article is marked "read", it
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
|
||||
#include "nsINntpUrl.h"
|
||||
#include "nsNNTPHost.h"
|
||||
#include "nsNNTPArticleSet.h"
|
||||
#include "nsMsgKeySet.h"
|
||||
|
||||
#include "nsNewsUtils.h"
|
||||
|
||||
|
@ -230,7 +230,7 @@ PRInt32 net_NewsChunkSize=-1; /* default */
|
|||
extern "C"
|
||||
{
|
||||
nsresult NS_NewArticleList(nsINNTPArticleList **articleList, const nsINNTPHost* newsHost, nsINNTPNewsgroup* newsgroup);
|
||||
nsresult NS_NewNewsgroup(nsINNTPNewsgroup **info, char *line, nsNNTPArticleSet *set, PRBool subscribed, nsINNTPHost *host, int depth);
|
||||
nsresult NS_NewNewsgroup(nsINNTPNewsgroup **info, char *line, nsMsgKeySet *set, PRBool subscribed, nsINNTPHost *host, int depth);
|
||||
nsresult NS_NewNewsgroupList(nsINNTPNewsgroupList **aInstancePtrResult, nsINNTPHost *newsHost, nsINNTPNewsgroup *newsgroup);
|
||||
}
|
||||
|
||||
|
@ -2054,6 +2054,7 @@ PRInt32 nsNNTPProtocol::ReadArticle(nsIInputStream * inputStream, PRUint32 lengt
|
|||
// mWebShell->LoadURL(nsAutoString("http://www.netscape.com"),
|
||||
// nsnull, PR_TRUE, nsURLReload, 0);
|
||||
m_displayConsumer->LoadURL(nsAutoString(fileUrl).GetUnicode(), nsnull, PR_TRUE, nsURLReload, 0);
|
||||
|
||||
}
|
||||
|
||||
// mscott: we may need to release our reference on the url....
|
||||
|
@ -2530,8 +2531,8 @@ PRInt32 nsNNTPProtocol::ProcessNewsgroups(nsIInputStream * inputStream, PRUint32
|
|||
rv = m_newsHost->FindGroup(groupName, &m_newsgroup);
|
||||
PR_ASSERT(NS_SUCCEEDED(rv));
|
||||
m_nextState = NNTP_LIST_XACTIVE;
|
||||
#ifdef DEBUG_bienvenu1
|
||||
PR_LogPrint("listing xactive for %s\n", m_groupName);
|
||||
#ifdef DEBUG_sspitzer
|
||||
printf("listing xactive for %s\n", groupName);
|
||||
#endif
|
||||
PR_FREEIF(line);
|
||||
return 0;
|
||||
|
@ -3830,8 +3831,8 @@ PRInt32 nsNNTPProtocol::ListPrettyNames()
|
|||
NS_SUCCEEDED(rv) ? group_name : "");
|
||||
|
||||
status = SendData(outputBuffer);
|
||||
#ifdef DEBUG_bienvenu1
|
||||
PR_LogPrint(outputBuffer);
|
||||
#ifdef DEBUG_sspitzer
|
||||
printf(outputBuffer);
|
||||
#endif
|
||||
m_nextState = NNTP_RESPONSE;
|
||||
m_nextStateAfterResponse = NNTP_LIST_PRETTY_NAMES_RESPONSE;
|
||||
|
@ -3881,8 +3882,8 @@ PRInt32 nsNNTPProtocol::ListPrettyNamesResponse(nsIInputStream * inputStream, PR
|
|||
line[i] = 0; /* terminate group name */
|
||||
if (i > 0)
|
||||
m_newsHost->SetPrettyName(line,prettyName);
|
||||
#ifdef DEBUG_bienvenu1
|
||||
PR_LogPrint("adding pretty name %s\n", prettyName);
|
||||
#ifdef DEBUG_sspitzer
|
||||
printf("adding pretty name %s\n", prettyName);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
@ -3979,8 +3980,8 @@ PRInt32 nsNNTPProtocol::ListXActiveResponse(nsIInputStream * inputStream, PRUint
|
|||
/* we're either going to list prettynames first, or list
|
||||
all prettynames every time, so we won't care so much
|
||||
if it gets interrupted. */
|
||||
#ifdef DEBUG_bienvenu1
|
||||
PR_LogPrint("got xactive for %s of %s\n", line, flags);
|
||||
#ifdef DEBUG_sspitzer
|
||||
printf("got xactive for %s of %s\n", line, flags);
|
||||
#endif
|
||||
/* This isn't required, because the extra info is
|
||||
initialized to false for new groups. And it's
|
||||
|
@ -4009,8 +4010,8 @@ PRInt32 nsNNTPProtocol::ListXActiveResponse(nsIInputStream * inputStream, PRUint
|
|||
/* make sure we're not stuck on the same group */
|
||||
{
|
||||
NS_RELEASE(old_newsgroup);
|
||||
#ifdef DEBUG_bienvenu1
|
||||
PR_LogPrint("listing xactive for %s\n", m_groupName);
|
||||
#ifdef DEBUG_sspitzer
|
||||
printf("listing xactive for %s\n", groupName);
|
||||
#endif
|
||||
m_nextState = NNTP_LIST_XACTIVE;
|
||||
ClearFlag(NNTP_PAUSE_FOR_READ);
|
||||
|
|
|
@ -1134,7 +1134,7 @@ NS_IMETHODIMP nsMsgNewsFolder::CreateMessageFromMsgDBHdr(nsIMsgDBHdr *msgDBHdr,
|
|||
char* msgURI = nsnull;
|
||||
nsFileSpec path;
|
||||
nsMsgKey key;
|
||||
nsIRDFResource* res;
|
||||
nsIRDFResource* res;
|
||||
|
||||
rv = msgDBHdr->GetMessageKey(&key);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче