Bug 1806770 - Add nsIMsgHdr.uidOnServer attr. r=mkmelin

Differential Revision: https://phabricator.services.mozilla.com/D221591

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ben Campbell 2024-09-24 21:55:17 +00:00
Родитель 5e72458b60
Коммит 8815b97218
5 изменённых файлов: 34 добавлений и 0 удалений

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

@ -105,5 +105,13 @@ interface nsIMsgDBHdr : nsISupports
/// Array of names of all database properties in the header.
readonly attribute Array<AUTF8String> properties;
/**
* Server-assigned unique ID for message. 0 = unset.
* IMAP sequence number or UID, NNTP article number, etc...
* NOTE: Added in support of Bug 1806770, but not yet in use.
*/
attribute unsigned long uidOnServer;
};
/* *******************************************************************************/

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

@ -329,6 +329,7 @@ class nsMsgDatabase : public nsIMsgOfflineOpsDatabase {
mdb_token m_threadNewestMsgDateColumnToken;
mdb_token m_offlineMsgOffsetColumnToken;
mdb_token m_offlineMessageSizeColumnToken;
mdb_token m_uidOnServerColumnToken;
// header caching stuff - MRU headers, keeps them around in memory
nsresult AddHdrToCache(nsIMsgDBHdr* hdr, nsMsgKey key);

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

@ -982,6 +982,7 @@ nsMsgDatabase::nsMsgDatabase()
m_threadNewestMsgDateColumnToken(0),
m_offlineMsgOffsetColumnToken(0),
m_offlineMessageSizeColumnToken(0),
m_uidOnServerColumnToken(0),
m_headersInUse(nullptr),
m_cachedHeaders(nullptr),
m_bCacheHeaders(true),
@ -1479,6 +1480,7 @@ const char* kThreadRootColumnName = "threadRoot";
const char* kThreadNewestMsgDateColumnName = "threadNewestMsgDate";
const char* kOfflineMsgOffsetColumnName = "msgOffset";
const char* kOfflineMsgSizeColumnName = "offlineMsgSize";
const char* kUidOnServerColumnName = "uidOnServer";
struct mdbOid gAllMsgHdrsTableOID;
struct mdbOid gAllThreadsTableOID;
const char* kFixedBadRefThreadingProp = "fixedBadRefThreading";
@ -1707,6 +1709,8 @@ nsresult nsMsgDatabase::InitMDBInfo() {
&m_offlineMsgOffsetColumnToken);
err = GetStore()->StringToToken(GetEnv(), kOfflineMsgSizeColumnName,
&m_offlineMessageSizeColumnToken);
err = GetStore()->StringToToken(GetEnv(), kUidOnServerColumnName,
&m_uidOnServerColumnToken);
if (NS_SUCCEEDED(err)) {
// The table of all message hdrs will have table id 1.

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

@ -939,3 +939,14 @@ NS_IMETHODIMP nsMsgHdr::GetProperties(nsTArray<nsCString>& headers) {
}
return NS_OK;
}
NS_IMETHODIMP nsMsgHdr::GetUidOnServer(uint32_t* result) {
uint32_t uid;
nsresult rv = GetUInt32Column(m_mdb->m_uidOnServerColumnToken, &uid);
*result = uid;
return rv;
}
NS_IMETHODIMP nsMsgHdr::SetUidOnServer(uint32_t uid) {
return SetUInt32Column(uid, m_mdb->m_uidOnServerColumnToken);
}

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

@ -235,6 +235,16 @@ NS_IMETHODIMP nsMsgFileHdr::SetOfflineMessageSize(
return NS_OK;
}
NS_IMETHODIMP nsMsgFileHdr::GetUidOnServer(uint32_t* result) {
*result = 0;
return NS_OK;
}
NS_IMETHODIMP nsMsgFileHdr::SetUidOnServer(uint32_t uid) {
// Message is not linked to an IMAP server, so we should never get here.
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsMsgFileHdr::GetDate(PRTime* aDate) {
nsresult rv = ReadFile();
NS_ENSURE_SUCCESS(rv, rv);