diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /comm/mailnews/base/src/nsMsgIdentity.h | |
parent | Initial commit. (diff) | |
download | thunderbird-upstream.tar.xz thunderbird-upstream.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'comm/mailnews/base/src/nsMsgIdentity.h')
-rw-r--r-- | comm/mailnews/base/src/nsMsgIdentity.h | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/comm/mailnews/base/src/nsMsgIdentity.h b/comm/mailnews/base/src/nsMsgIdentity.h new file mode 100644 index 0000000000..1b9e0f1635 --- /dev/null +++ b/comm/mailnews/base/src/nsMsgIdentity.h @@ -0,0 +1,87 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* 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 nsMsgIdentity_h___ +#define nsMsgIdentity_h___ + +#include "nsIMsgIdentity.h" +#include "nsIPrefBranch.h" +#include "msgCore.h" +#include "nsCOMPtr.h" +#include "nsString.h" + +class nsMsgIdentity final : public nsIMsgIdentity { + public: + NS_DECL_THREADSAFE_ISUPPORTS + NS_DECL_NSIMSGIDENTITY + + private: + ~nsMsgIdentity() {} + nsCString mKey; + nsCOMPtr<nsIPrefBranch> mPrefBranch; + nsCOMPtr<nsIPrefBranch> mDefPrefBranch; + + protected: + nsresult getFolderPref(const char* pref, nsACString& retval, + const nsACString& folderName, uint32_t folderFlag); + nsresult setFolderPref(const char* pref, const nsACString& retval, + uint32_t folderFlag); +}; + +#define NS_IMPL_IDPREF_STR(_postfix, _prefname) \ + NS_IMETHODIMP \ + nsMsgIdentity::Get##_postfix(nsACString& retval) { \ + return GetCharAttribute(_prefname, retval); \ + } \ + NS_IMETHODIMP \ + nsMsgIdentity::Set##_postfix(const nsACString& value) { \ + return SetCharAttribute(_prefname, value); \ + } + +#define NS_IMPL_IDPREF_WSTR(_postfix, _prefname) \ + NS_IMETHODIMP \ + nsMsgIdentity::Get##_postfix(nsAString& retval) { \ + return GetUnicharAttribute(_prefname, retval); \ + } \ + NS_IMETHODIMP \ + nsMsgIdentity::Set##_postfix(const nsAString& value) { \ + return SetUnicharAttribute(_prefname, value); \ + } + +#define NS_IMPL_IDPREF_BOOL(_postfix, _prefname) \ + NS_IMETHODIMP \ + nsMsgIdentity::Get##_postfix(bool* retval) { \ + return GetBoolAttribute(_prefname, retval); \ + } \ + NS_IMETHODIMP \ + nsMsgIdentity::Set##_postfix(bool value) { \ + return mPrefBranch->SetBoolPref(_prefname, value); \ + } + +#define NS_IMPL_IDPREF_INT(_postfix, _prefname) \ + NS_IMETHODIMP \ + nsMsgIdentity::Get##_postfix(int32_t* retval) { \ + return GetIntAttribute(_prefname, retval); \ + } \ + NS_IMETHODIMP \ + nsMsgIdentity::Set##_postfix(int32_t value) { \ + return mPrefBranch->SetIntPref(_prefname, value); \ + } + +#define NS_IMPL_FOLDERPREF_STR(_postfix, _prefname, _foldername, _flag) \ + NS_IMETHODIMP \ + nsMsgIdentity::Get##_postfix(nsACString& retval) { \ + nsresult rv; \ + nsCString folderPref; \ + rv = getFolderPref(_prefname, folderPref, _foldername, _flag); \ + retval = folderPref; \ + return rv; \ + } \ + NS_IMETHODIMP \ + nsMsgIdentity::Set##_postfix(const nsACString& value) { \ + return setFolderPref(_prefname, value, _flag); \ + } + +#endif /* nsMsgIdentity_h___ */ |