convert to idl for nsIDBFolderInfo

This commit is contained in:
bienvenu%netscape.com 1999-06-14 21:46:37 +00:00
Родитель f4b261aa60
Коммит 76525b703d
8 изменённых файлов: 83 добавлений и 25 удалений

Просмотреть файл

@ -38,6 +38,7 @@ EXPORTS= \
$(NULL) $(NULL)
XPIDLSRCS = \ XPIDLSRCS = \
nsIDBFolderInfo.idl \
$(NULL) $(NULL)
include $(topsrcdir)/config/config.mk include $(topsrcdir)/config/config.mk

Просмотреть файл

@ -18,7 +18,8 @@
DEPTH=..\..\..\.. DEPTH=..\..\..\..
MODULE=msgdb MODULE=msgdb
XPIDLSRCS = \ XPIDLSRCS = \
.\nsIDBFolderInfo.idl \
$(NULL) $(NULL)
################################################################################ ################################################################################
@ -39,3 +40,4 @@ EXPORTS = \
include <$(DEPTH)\config\rules.mak> include <$(DEPTH)\config\rules.mak>
include <$(DEPTH)\config\config.mak>

Просмотреть файл

@ -52,18 +52,25 @@ public:
NS_IMETHOD OrFlags(PRInt32 flags, PRInt32 *result); NS_IMETHOD OrFlags(PRInt32 flags, PRInt32 *result);
NS_IMETHOD AndFlags(PRInt32 flags, PRInt32 *result); NS_IMETHOD AndFlags(PRInt32 flags, PRInt32 *result);
NS_IMETHOD SetHighWater(nsMsgKey highWater, PRBool force) ; NS_IMETHOD SetHighWater(nsMsgKey highWater, PRBool force) ;
NS_IMETHOD SetHighWater(nsMsgKey aHighWater);
NS_IMETHOD GetHighWater(nsMsgKey *result) ; NS_IMETHOD GetHighWater(nsMsgKey *result) ;
NS_IMETHOD SetExpiredMark(nsMsgKey expiredKey); NS_IMETHOD SetExpiredMark(nsMsgKey expiredKey);
NS_IMETHOD GetExpiredMark(nsMsgKey *aExpiredMark);
NS_IMETHOD ChangeNumNewMessages(PRInt32 delta); NS_IMETHOD ChangeNumNewMessages(PRInt32 delta);
NS_IMETHOD ChangeNumMessages(PRInt32 delta); NS_IMETHOD ChangeNumMessages(PRInt32 delta);
NS_IMETHOD ChangeNumVisibleMessages(PRInt32 delta); NS_IMETHOD ChangeNumVisibleMessages(PRInt32 delta);
NS_IMETHOD GetNumNewMessages(PRInt32 *result) ; NS_IMETHOD GetNumNewMessages(PRInt32 *result) ;
NS_IMETHOD GetNumMessages(PRInt32 *result) ; NS_IMETHOD GetNumMessages(PRInt32 *result) ;
NS_IMETHOD GetNumVisibleMessages(PRInt32 *result) ; NS_IMETHOD GetNumVisibleMessages(PRInt32 *result) ;
NS_IMETHOD SetNumMessages(PRInt32 aNumMessages);
NS_IMETHOD SetNumNewMessages(PRInt32 aNumNewMessages);
NS_IMETHOD SetNumVisibleMessages(PRInt32 aNumVisibleMessages);
NS_IMETHOD GetImapUidValidity(PRInt32 *result) ; NS_IMETHOD GetImapUidValidity(PRInt32 *result) ;
NS_IMETHOD SetImapUidValidity(PRInt32 uidValidity) ; NS_IMETHOD SetImapUidValidity(PRInt32 uidValidity) ;
NS_IMETHOD GetImapTotalPendingMessages(PRInt32 *result) ; NS_IMETHOD GetImapTotalPendingMessages(PRInt32 *result) ;
NS_IMETHOD GetImapUnreadPendingMessages(PRInt32 *result) ; NS_IMETHOD GetImapUnreadPendingMessages(PRInt32 *result) ;
NS_IMETHOD SetImapTotalPendingMessages(PRInt32 totalPending) ;
NS_IMETHOD SetImapUnreadPendingMessages(PRInt32 unreadPending) ;
NS_IMETHOD GetCharacterSet(nsString *result) ; NS_IMETHOD GetCharacterSet(nsString *result) ;
NS_IMETHOD SetCharacterSet(nsString *charSet) ; NS_IMETHOD SetCharacterSet(nsString *charSet) ;
NS_IMETHOD GetLocale(nsString *result) ; NS_IMETHOD GetLocale(nsString *result) ;
@ -80,17 +87,15 @@ public:
NS_IMETHOD GetFolderSize(PRUint32 *size); NS_IMETHOD GetFolderSize(PRUint32 *size);
NS_IMETHOD SetFolderSize(PRUint32 size); NS_IMETHOD SetFolderSize(PRUint32 size);
NS_IMETHOD GetFolderDate(time_t *date); NS_IMETHOD GetFolderDate(PRInt32 *date);
NS_IMETHOD SetFolderDate(time_t date); NS_IMETHOD SetFolderDate(PRInt32 date);
NS_IMETHOD GetDiskVersion(int *version);
NS_IMETHOD ChangeExpungedBytes(PRInt32 delta); NS_IMETHOD ChangeExpungedBytes(PRInt32 delta);
NS_IMETHOD GetProperty(const char *propertyName, nsString *resultProperty); NS_IMETHOD GetProperty(const char *propertyName, nsString *resultProperty);
NS_IMETHOD SetProperty(const char *propertyName, nsString *propertyStr); NS_IMETHOD SetProperty(const char *propertyName, nsString *propertyStr);
NS_IMETHOD SetUint32Property(const char *propertyName, PRUint32 propertyValue); NS_IMETHOD SetUint32Property(const char *propertyName, PRUint32 propertyValue);
NS_IMETHOD GetUint32Property(const char *propertyName, PRUint32 &propertyValue); NS_IMETHOD GetUint32Property(const char *propertyName, PRUint32 *propertyValue);
NS_IMETHOD SetKnownArtsSet(nsString *newsArtSet); NS_IMETHOD SetKnownArtsSet(nsString *newsArtSet);
NS_IMETHOD GetKnownArtsSet(nsString *newsArtSet); NS_IMETHOD GetKnownArtsSet(nsString *newsArtSet);

Просмотреть файл

Просмотреть файл

@ -252,6 +252,7 @@ nsresult nsDBFolderInfo::LoadMemberVariables()
GetInt32PropertyWithToken(m_folderSizeColumnToken, m_folderSize); GetInt32PropertyWithToken(m_folderSizeColumnToken, m_folderSize);
GetInt32PropertyWithToken(m_folderDateColumnToken, (PRInt32 &) m_folderDate); GetInt32PropertyWithToken(m_folderDateColumnToken, (PRInt32 &) m_folderDate);
GetInt32PropertyWithToken(m_imapUidValidityColumnToken, m_ImapUidValidity); GetInt32PropertyWithToken(m_imapUidValidityColumnToken, m_ImapUidValidity);
GetInt32PropertyWithToken(m_expiredMarkColumnToken, (PRInt32 &) m_expiredMark);
return ret; return ret;
} }
@ -276,10 +277,17 @@ NS_IMETHODIMP nsDBFolderInfo::SetHighWater(nsMsgKey highWater, PRBool force)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsDBFolderInfo::SetHighWater(nsMsgKey highWater)
{
return SetHighWater(highWater, PR_TRUE);
}
NS_IMETHODIMP NS_IMETHODIMP
nsDBFolderInfo::GetFolderSize(PRUint32 *size) nsDBFolderInfo::GetFolderSize(PRUint32 *size)
{ {
if (!size) return NS_ERROR_NULL_POINTER; if (!size)
return NS_ERROR_NULL_POINTER;
*size = m_folderSize; *size = m_folderSize;
return NS_OK; return NS_OK;
} }
@ -291,14 +299,15 @@ NS_IMETHODIMP nsDBFolderInfo::SetFolderSize(PRUint32 size)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDBFolderInfo::GetFolderDate(time_t *folderDate) nsDBFolderInfo::GetFolderDate(PRInt32 *folderDate)
{ {
if (!folderDate) return NS_ERROR_NULL_POINTER; if (!folderDate)
return NS_ERROR_NULL_POINTER;
*folderDate = m_folderDate; *folderDate = m_folderDate;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsDBFolderInfo::SetFolderDate(time_t folderDate) NS_IMETHODIMP nsDBFolderInfo::SetFolderDate(PRInt32 folderDate)
{ {
m_folderDate = folderDate; m_folderDate = folderDate;
return SetUint32PropertyWithToken(m_folderDateColumnToken, folderDate); return SetUint32PropertyWithToken(m_folderDateColumnToken, folderDate);
@ -317,11 +326,10 @@ NS_IMETHODIMP nsDBFolderInfo::SetExpiredMark(nsMsgKey expiredKey)
return SetUint32PropertyWithToken(m_expiredMarkColumnToken, expiredKey); return SetUint32PropertyWithToken(m_expiredMarkColumnToken, expiredKey);
} }
NS_IMETHODIMP nsDBFolderInfo::GetDiskVersion(int *version) NS_IMETHODIMP nsDBFolderInfo::GetExpiredMark(nsMsgKey *result)
{ {
if (!version) return NS_ERROR_NULL_POINTER; *result = m_expiredMark;
*version = m_version; return NS_OK;
return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
@ -423,18 +431,36 @@ NS_IMETHODIMP nsDBFolderInfo::GetNumNewMessages(PRInt32 *result)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsDBFolderInfo::SetNumNewMessages(PRInt32 numNewMessages)
{
m_numNewMessages = numNewMessages;
return SetUint32PropertyWithToken(m_numNewMessagesColumnToken, m_numNewMessages);
}
NS_IMETHODIMP nsDBFolderInfo::GetNumMessages(PRInt32 *result) NS_IMETHODIMP nsDBFolderInfo::GetNumMessages(PRInt32 *result)
{ {
*result = m_numMessages; *result = m_numMessages;
return NS_OK;; return NS_OK;;
} }
NS_IMETHODIMP nsDBFolderInfo::SetNumMessages(PRInt32 numMessages)
{
m_numMessages = numMessages;
return SetUint32PropertyWithToken(m_numMessagesColumnToken, m_numMessages);
}
NS_IMETHODIMP nsDBFolderInfo::GetNumVisibleMessages(PRInt32 *result) NS_IMETHODIMP nsDBFolderInfo::GetNumVisibleMessages(PRInt32 *result)
{ {
*result = m_numVisibleMessages; *result = m_numVisibleMessages;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsDBFolderInfo::SetNumVisibleMessages(PRInt32 numVisibleMessages)
{
m_numVisibleMessages = numVisibleMessages;
return SetUint32PropertyWithToken(m_numVisibleMessagesColumnToken, m_numVisibleMessages);
}
NS_IMETHODIMP nsDBFolderInfo::GetFlags(PRInt32 *result) NS_IMETHODIMP nsDBFolderInfo::GetFlags(PRInt32 *result)
{ {
*result = m_flags; *result = m_flags;
@ -536,7 +562,8 @@ void nsDBFolderInfo::SetIMAPHierarchySeparator(PRInt16 hierarchySeparator)
NS_IMETHODIMP NS_IMETHODIMP
nsDBFolderInfo::GetImapTotalPendingMessages(PRInt32 *result) nsDBFolderInfo::GetImapTotalPendingMessages(PRInt32 *result)
{ {
if (!result) return NS_ERROR_NULL_POINTER; if (!result)
return NS_ERROR_NULL_POINTER;
*result = m_totalPendingMessages; *result = m_totalPendingMessages;
return NS_OK; return NS_OK;
} }
@ -550,11 +577,26 @@ void nsDBFolderInfo::ChangeImapTotalPendingMessages(PRInt32 delta)
NS_IMETHODIMP NS_IMETHODIMP
nsDBFolderInfo::GetImapUnreadPendingMessages(PRInt32 *result) nsDBFolderInfo::GetImapUnreadPendingMessages(PRInt32 *result)
{ {
if (!result) return NS_ERROR_NULL_POINTER; if (!result)
return NS_ERROR_NULL_POINTER;
*result = m_unreadPendingMessages; *result = m_unreadPendingMessages;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsDBFolderInfo::SetImapUnreadPendingMessages(PRInt32 numUnreadPendingMessages)
{
m_unreadPendingMessages = numUnreadPendingMessages;
return SetUint32PropertyWithToken(m_unreadPendingMessagesColumnToken, m_unreadPendingMessages);
}
NS_IMETHODIMP nsDBFolderInfo::SetImapTotalPendingMessages(PRInt32 numTotalPendingMessages)
{
m_totalPendingMessages = numTotalPendingMessages;
return SetUint32PropertyWithToken(m_totalPendingMessagesColumnToken, m_totalPendingMessages);
}
void nsDBFolderInfo::ChangeImapUnreadPendingMessages(PRInt32 delta) void nsDBFolderInfo::ChangeImapUnreadPendingMessages(PRInt32 delta)
{ {
m_unreadPendingMessages+=delta; m_unreadPendingMessages+=delta;
@ -579,6 +621,8 @@ NS_IMETHODIMP nsDBFolderInfo::GetProperty(const char *propertyName, nsString *re
nsresult err = NS_OK; nsresult err = NS_OK;
mdb_token property_token; mdb_token property_token;
if (!resultProperty)
return NS_ERROR_NULL_POINTER;
err = m_mdb->GetStore()->StringToToken(m_mdb->GetEnv(), propertyName, &property_token); err = m_mdb->GetStore()->StringToToken(m_mdb->GetEnv(), propertyName, &property_token);
if (err == NS_OK) if (err == NS_OK)
err = m_mdb->RowCellColumnTonsString(m_mdbRow, property_token, *resultProperty); err = m_mdb->RowCellColumnTonsString(m_mdbRow, property_token, *resultProperty);
@ -651,6 +695,8 @@ nsresult nsDBFolderInfo::SetInt32PropertyWithToken(mdb_token aProperty, PRInt32
nsresult nsDBFolderInfo::GetPropertyWithToken(mdb_token aProperty, nsString *resultProperty) nsresult nsDBFolderInfo::GetPropertyWithToken(mdb_token aProperty, nsString *resultProperty)
{ {
if (!resultProperty)
return NS_ERROR_NULL_POINTER;
return m_mdb->RowCellColumnTonsString(m_mdbRow, aProperty, *resultProperty); return m_mdb->RowCellColumnTonsString(m_mdbRow, aProperty, *resultProperty);
} }
@ -664,14 +710,16 @@ nsresult nsDBFolderInfo::GetInt32PropertyWithToken(mdb_token aProperty, PRInt32
return m_mdb->RowCellColumnToUInt32(m_mdbRow, aProperty, (PRUint32 &) propertyValue); return m_mdb->RowCellColumnToUInt32(m_mdbRow, aProperty, (PRUint32 &) propertyValue);
} }
NS_IMETHODIMP nsDBFolderInfo::GetUint32Property(const char *propertyName, PRUint32 &propertyValue) NS_IMETHODIMP nsDBFolderInfo::GetUint32Property(const char *propertyName, PRUint32 *propertyValue)
{ {
nsresult err = NS_OK; nsresult err = NS_OK;
mdb_token property_token; mdb_token property_token;
if (!propertyValue)
return NS_ERROR_NULL_POINTER;
err = m_mdb->GetStore()->StringToToken(m_mdb->GetEnv(), propertyName, &property_token); err = m_mdb->GetStore()->StringToToken(m_mdb->GetEnv(), propertyName, &property_token);
if (err == NS_OK) if (err == NS_OK)
return GetUint32PropertyWithToken(property_token, propertyValue); return GetUint32PropertyWithToken(property_token, *propertyValue);
return err; return err;
} }

Просмотреть файл

@ -92,8 +92,8 @@ NS_IMETHODIMP nsImapMailDatabase::Open(nsFileSpec &folderName, PRBool create, ns
else else
{ {
// compare current version of db versus filed out version info. // compare current version of db versus filed out version info.
int version; PRUint32 version;
folderInfo->GetDiskVersion(&version); folderInfo->GetVersion(&version);
if (mailDB->GetCurVersion() != version) if (mailDB->GetCurVersion() != version)
err = NS_MSG_ERROR_FOLDER_SUMMARY_OUT_OF_DATE; err = NS_MSG_ERROR_FOLDER_SUMMARY_OUT_OF_DATE;
NS_RELEASE(folderInfo); NS_RELEASE(folderInfo);

Просмотреть файл

@ -95,6 +95,7 @@ NS_IMETHODIMP nsMailDatabase::Open(nsFileSpec &folderName, PRBool create, nsIMsg
{ {
PRInt32 numNewMessages; PRInt32 numNewMessages;
PRUint32 folderSize; PRUint32 folderSize;
PRInt32 folderDateInSeconds;
time_t folderDate; time_t folderDate;
nsFileSpec::TimeStamp actualFolderTimeStamp; nsFileSpec::TimeStamp actualFolderTimeStamp;
@ -103,15 +104,16 @@ NS_IMETHODIMP nsMailDatabase::Open(nsFileSpec &folderName, PRBool create, nsIMsg
folderInfo->GetNumNewMessages(&numNewMessages); folderInfo->GetNumNewMessages(&numNewMessages);
folderInfo->GetFolderSize(&folderSize); folderInfo->GetFolderSize(&folderSize);
folderInfo->GetFolderDate(&folderDate); folderInfo->GetFolderDate(&folderDateInSeconds);
folderDate = folderDateInSeconds;
if (folderSize != mailDB->m_folderSpec->GetFileSize()|| if (folderSize != mailDB->m_folderSpec->GetFileSize()||
folderDate != actualFolderTimeStamp || folderDate != actualFolderTimeStamp ||
numNewMessages < 0) numNewMessages < 0)
err = NS_MSG_ERROR_FOLDER_SUMMARY_OUT_OF_DATE; err = NS_MSG_ERROR_FOLDER_SUMMARY_OUT_OF_DATE;
} }
// compare current version of db versus filed out version info. // compare current version of db versus filed out version info.
int version; PRUint32 version;
folderInfo->GetDiskVersion(&version); folderInfo->GetVersion(&version);
if (mailDB->GetCurVersion() != version) if (mailDB->GetCurVersion() != version)
err = NS_MSG_ERROR_FOLDER_SUMMARY_OUT_OF_DATE; err = NS_MSG_ERROR_FOLDER_SUMMARY_OUT_OF_DATE;
NS_RELEASE(folderInfo); NS_RELEASE(folderInfo);

Просмотреть файл

@ -276,7 +276,7 @@ void nsMsgDatabase::RemoveFromCache(nsMsgDatabase* pMessageDB)
void nsMsgDatabase::DumpCache() void nsMsgDatabase::DumpCache()
{ {
nsMsgDatabase* pMessageDB = nsnull; nsMsgDatabase* pMessageDB = nsnull;
for (PRUint32 i = 0; i < GetDBCache()->Count(); i++) for (PRInt32 i = 0; i < GetDBCache()->Count(); i++)
{ {
pMessageDB = NS_STATIC_CAST(nsMsgDatabase*, GetDBCache()->ElementAt(i)); pMessageDB = NS_STATIC_CAST(nsMsgDatabase*, GetDBCache()->ElementAt(i));
} }
@ -893,7 +893,7 @@ NS_IMETHODIMP nsMsgDatabase::DeleteMessages(nsMsgKeyArray* nsMsgKeys, nsIDBChang
{ {
nsresult err = NS_OK; nsresult err = NS_OK;
PRInt32 kindex; PRUint32 kindex;
for (kindex = 0; kindex < nsMsgKeys->GetSize(); kindex++) for (kindex = 0; kindex < nsMsgKeys->GetSize(); kindex++)
{ {
nsMsgKey key = nsMsgKeys->ElementAt(kindex); nsMsgKey key = nsMsgKeys->ElementAt(kindex);