зеркало из https://github.com/mozilla/pjs.git
add version number to msg database
This commit is contained in:
Родитель
7fafbce4ff
Коммит
fead44362c
|
@ -64,7 +64,8 @@ public:
|
|||
NS_IMETHOD GetImapUidValidity(PRInt32 *result) ;
|
||||
NS_IMETHOD SetImapUidValidity(PRInt32 uidValidity) ;
|
||||
|
||||
NS_IMETHOD SetVersion(PRUint16 version) ;
|
||||
NS_IMETHOD SetVersion(PRUint32 version) ;
|
||||
NS_IMETHOD GetVersion(PRUint32 *result);
|
||||
|
||||
NS_IMETHOD GetLastMessageLoaded(nsMsgKey *result);
|
||||
NS_IMETHOD SetLastMessageLoaded(nsMsgKey lastLoaded);
|
||||
|
@ -76,7 +77,6 @@ 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);
|
||||
|
||||
// create the appropriate table and row in a new db.
|
||||
nsresult AddToNewMDB();
|
||||
// accessor methods.
|
||||
|
@ -179,7 +179,7 @@ protected:
|
|||
mdb_token m_totalPendingMessagesColumnToken;
|
||||
mdb_token m_unreadPendingMessagesColumnToken;
|
||||
mdb_token m_expiredMarkColumnToken;
|
||||
|
||||
mdb_token m_versionColumnToken;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -50,7 +50,8 @@ public:
|
|||
NS_IMETHOD GetImapUidValidity(PRInt32 *result) = 0;
|
||||
NS_IMETHOD SetImapUidValidity(PRInt32 uidValidity) = 0;
|
||||
|
||||
NS_IMETHOD SetVersion(PRUint16 version) = 0;
|
||||
NS_IMETHOD SetVersion(PRUint32 version) = 0;
|
||||
NS_IMETHOD GetVersion(PRUint32 *result) = 0;
|
||||
|
||||
NS_IMETHOD GetLastMessageLoaded(nsMsgKey *result) = 0;
|
||||
NS_IMETHOD SetLastMessageLoaded(nsMsgKey lastLoaded) = 0;
|
||||
|
|
|
@ -48,14 +48,13 @@ public:
|
|||
|
||||
virtual nsresult DeleteMessages(nsMsgKeyArray &nsMsgKeys, nsIDBChangeListener *instigator);
|
||||
|
||||
// virtual int GetCurVersion() {return kMailDBVersion;}
|
||||
static nsresult SetFolderInfoValid(nsFilePath &pathname, int num, int numunread);
|
||||
nsresult GetFolderName(nsString &folderName);
|
||||
virtual nsMailDatabase *GetMailDB() {return this;}
|
||||
MSG_Master *GetMaster() {return m_master;}
|
||||
void SetMaster(MSG_Master *master) {m_master = master;}
|
||||
|
||||
virtual int GetCurVersion() {return kMailDBVersion;}
|
||||
virtual PRUint32 GetCurVersion() {return kMailDBVersion;}
|
||||
virtual MSG_FolderInfo *GetFolderInfo();
|
||||
|
||||
// for offline imap queued operations
|
||||
|
|
|
@ -209,6 +209,7 @@ public:
|
|||
nsDBFolderInfo *GetDBFolderInfo() {return m_dbFolderInfo;}
|
||||
nsIMdbEnv *GetEnv() {return m_mdbEnv;}
|
||||
nsIMdbStore *GetStore() {return m_mdbStore;}
|
||||
virtual PRUint32 GetCurVersion();
|
||||
|
||||
static nsMsgDatabase* FindInCache(nsFilePath &dbName);
|
||||
|
||||
|
|
|
@ -587,11 +587,12 @@ mdb_err nsIMdbTableRowCursor::NextRowOid ( // get row id of next row in the tab
|
|||
mdbOid* outOid, // out row oid
|
||||
mdb_pos* outRowPos)
|
||||
{
|
||||
nsIMdbRow *curRow;
|
||||
nsIMdbRow *curRow = NULL;
|
||||
if (m_pos < 0)
|
||||
m_pos = 0;
|
||||
|
||||
*outRowPos = m_pos;
|
||||
if (m_table)
|
||||
curRow = (nsIMdbRow *) m_table->m_rows.ElementAt(m_pos++);
|
||||
if (curRow)
|
||||
*outOid = curRow->m_oid;
|
||||
|
@ -680,7 +681,7 @@ mdb_err mdbCellImpl::Write(nsIOFileStream *stream)
|
|||
return 0;
|
||||
}
|
||||
|
||||
const int kLineBufLength = 400;
|
||||
const int kLineBufLength = 1000;
|
||||
|
||||
mdb_err mdbCellImpl::Read(nsIOFileStream *stream)
|
||||
{
|
||||
|
|
|
@ -41,6 +41,7 @@ static const char * kUnreadPendingMessagesColumnName = "unreadPendingMsgs";
|
|||
static const char * kMailboxNameColumnName = "mailboxName";
|
||||
static const char * kKnownArtsSetColumnName = "knownArts";
|
||||
static const char * kExpiredMarkColumnName = "expiredMark";
|
||||
static const char * kVersionColumnName = "version";
|
||||
|
||||
// we need this because of an egcs 1.0 (and possibly gcc) compiler bug
|
||||
// that doesn't allow you to call ::nsISupports::IID() inside of a class
|
||||
|
@ -215,6 +216,7 @@ nsresult nsDBFolderInfo::InitMDBInfo()
|
|||
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;
|
||||
|
@ -230,15 +232,23 @@ nsresult nsDBFolderInfo::LoadMemberVariables()
|
|||
GetInt32PropertyWithToken(m_flagsColumnToken, m_flags);
|
||||
GetInt32PropertyWithToken(m_folderSizeColumnToken, m_folderSize);
|
||||
GetInt32PropertyWithToken(m_folderDateColumnToken, (PRInt32 &) m_folderDate);
|
||||
GetInt32PropertyWithToken(m_folderDateColumnToken, (PRInt32 &) m_folderDate);
|
||||
return ret;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::SetVersion(PRUint16 version)
|
||||
NS_IMETHODIMP nsDBFolderInfo::SetVersion(PRUint32 version)
|
||||
{
|
||||
m_version = version;
|
||||
return SetUint32PropertyWithToken(m_versionColumnToken, (PRUint32) m_version);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::GetVersion(PRUint32 *version)
|
||||
{
|
||||
*version = m_version;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::SetHighWater(nsMsgKey highWater, PRBool force /* = FALSE */)
|
||||
{
|
||||
if (force || m_highWaterMessageKey < highWater)
|
||||
|
@ -370,12 +380,14 @@ NS_IMETHODIMP nsDBFolderInfo::GetNumNewMessages(PRInt32 *result)
|
|||
|
||||
NS_IMETHODIMP nsDBFolderInfo::GetNumMessages(PRInt32 *result)
|
||||
{
|
||||
return m_numMessages;
|
||||
*result = m_numMessages;
|
||||
return NS_OK;;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::GetNumVisibleMessages(PRInt32 *result)
|
||||
{
|
||||
return m_numVisibleMessages;
|
||||
*result = m_numVisibleMessages;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::GetFlags(PRInt32 *result)
|
||||
|
|
|
@ -38,7 +38,7 @@ static NS_DEFINE_CID(kIMBBCID, NS_IMBB_IID);
|
|||
#endif
|
||||
|
||||
|
||||
|
||||
const int kMsgDBVersion = 1;
|
||||
|
||||
nsDBChangeAnnouncer::nsDBChangeAnnouncer()
|
||||
{
|
||||
|
@ -449,6 +449,7 @@ nsresult nsMsgDatabase::InitNewDB()
|
|||
if (dbFolderInfo)
|
||||
{
|
||||
err = dbFolderInfo->AddToNewMDB();
|
||||
dbFolderInfo->SetVersion(GetCurVersion());
|
||||
nsIMdbStore *store = GetStore();
|
||||
// create the unique table for the dbFolderInfo.
|
||||
mdb_err err = store->NewTable(GetEnv(), m_hdrRowScopeToken,
|
||||
|
@ -1407,6 +1408,11 @@ nsresult nsMsgDatabase::RowCellColumnToUInt32(nsIMdbRow *hdrRow, mdb_token colum
|
|||
*pResult = result;
|
||||
}
|
||||
|
||||
PRUint32 nsMsgDatabase::GetCurVersion()
|
||||
{
|
||||
return kMsgDBVersion;
|
||||
}
|
||||
|
||||
nsresult nsMsgDatabase::SetSummaryValid(PRBool valid /* = PR_TRUE */)
|
||||
{
|
||||
// setting the version to -1 ought to make it pretty invalid.
|
||||
|
|
Загрузка…
Ссылка в новой задаче