diff options
author | Matt A. Tobin <email@mattatobin.com> | 2019-11-03 00:17:46 -0400 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2019-11-03 00:17:46 -0400 |
commit | 302bf1b523012e11b60425d6eee1221ebc2724eb (patch) | |
tree | b191a895f8716efcbe42f454f37597a545a6f421 /mailnews/base/util/nsMsgIdentity.h | |
parent | 21b3f6247403c06f85e1f45d219f87549862198f (diff) | |
download | UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.tar UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.tar.gz UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.tar.lz UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.tar.xz UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.zip |
Issue #1258 - Part 1: Import mailnews, ldap, and mork from comm-esr52.9.1
Diffstat (limited to 'mailnews/base/util/nsMsgIdentity.h')
-rw-r--r-- | mailnews/base/util/nsMsgIdentity.h | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/mailnews/base/util/nsMsgIdentity.h b/mailnews/base/util/nsMsgIdentity.h new file mode 100644 index 000000000..7b17ae3f6 --- /dev/null +++ b/mailnews/base/util/nsMsgIdentity.h @@ -0,0 +1,97 @@ +/* -*- 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 "nsStringGlue.h" + +class NS_MSG_BASE 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, nsCString&, const char *, uint32_t); + nsresult setFolderPref(const char *pref, const nsACString&, uint32_t); +}; + + +#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___ */ |