From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- comm/mailnews/db/msgdb/public/nsMsgHdr.h | 92 ++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 comm/mailnews/db/msgdb/public/nsMsgHdr.h (limited to 'comm/mailnews/db/msgdb/public/nsMsgHdr.h') diff --git a/comm/mailnews/db/msgdb/public/nsMsgHdr.h b/comm/mailnews/db/msgdb/public/nsMsgHdr.h new file mode 100644 index 0000000000..94e5b1b8c8 --- /dev/null +++ b/comm/mailnews/db/msgdb/public/nsMsgHdr.h @@ -0,0 +1,92 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef _nsMsgHdr_H +#define _nsMsgHdr_H + +#include "mozilla/MemoryReporting.h" +#include "nsIMsgHdr.h" +#include "nsString.h" +#include "MailNewsTypes.h" +#include "mdb.h" +#include "nsTArray.h" + +class nsMsgDatabase; +class nsIMsgThread; + +class nsMsgHdr : public nsIMsgDBHdr { + public: + NS_DECL_NSIMSGDBHDR + friend class nsMsgDatabase; + friend class nsImapMailDatabase; + friend class nsMsgPropertyEnumerator; + friend class nsMsgThread; + + //////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////// + // nsMsgHdr methods: + nsMsgHdr(nsMsgDatabase* db, nsIMdbRow* dbRow); + + NS_DECL_ISUPPORTS + + size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOfFun) const { + return m_references.ShallowSizeOfExcludingThis(aMallocSizeOfFun); + } + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOfFun) const { + return aMallocSizeOfFun(this) + SizeOfExcludingThis(aMallocSizeOfFun); + } + + protected: + nsIMdbRow* GetMDBRow() { return m_mdbRow; } + void ReleaseMDBRow() { NS_IF_RELEASE(m_mdbRow); } + nsMsgDatabase* GetMdb() { return m_mdb; } + void ClearCachedValues() { m_initedValues = 0; } + + virtual nsresult GetRawFlags(uint32_t* result); + + bool IsParentOf(nsIMsgDBHdr* possibleChild); + bool IsAncestorOf(nsIMsgDBHdr* possibleChild); + + private: + virtual ~nsMsgHdr(); + + void Init(); + virtual nsresult InitFlags(); + virtual nsresult InitCachedValues(); + + bool IsAncestorKilled(uint32_t ancestorsToCheck); + void ReparentInThread(nsIMsgThread* thread); + + nsresult SetStringColumn(const char* str, mdb_token token); + nsresult SetUInt32Column(uint32_t value, mdb_token token); + nsresult GetUInt32Column(mdb_token token, uint32_t* pvalue, + uint32_t defaultValue = 0); + nsresult SetUInt64Column(uint64_t value, mdb_token token); + nsresult GetUInt64Column(mdb_token token, uint64_t* pvalue, + uint64_t defaultValue = 0); + + // reference and threading stuff. + nsresult ParseReferences(const char* references); + const char* GetNextReference(const char* startNextRef, nsCString& reference, + bool acceptNonDelimitedReferences); + + nsMsgKey m_threadId; + nsMsgKey m_messageKey; // news: article number, local mail: key, imap: uid... + nsMsgKey m_threadParent; // message this is a reply to, in thread. + PRTime m_date; + uint32_t m_messageSize; // lines for news articles, bytes for mail messages + uint32_t m_flags; + // avoid parsing references every time we want one + nsTArray m_references; + + // nsMsgHdrs will have to know what db and row they belong to, since they are + // really just a wrapper around the msg row in the mdb. This could cause + // problems, though I hope not. + nsMsgDatabase* m_mdb; + nsIMdbRow* m_mdbRow; + uint32_t m_initedValues; +}; + +#endif -- cgit v1.2.3