From 302bf1b523012e11b60425d6eee1221ebc2724eb Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Sun, 3 Nov 2019 00:17:46 -0400 Subject: Issue #1258 - Part 1: Import mailnews, ldap, and mork from comm-esr52.9.1 --- mailnews/base/search/src/nsMsgFilterList.h | 75 ++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 mailnews/base/search/src/nsMsgFilterList.h (limited to 'mailnews/base/search/src/nsMsgFilterList.h') diff --git a/mailnews/base/search/src/nsMsgFilterList.h b/mailnews/base/search/src/nsMsgFilterList.h new file mode 100644 index 000000000..2bb441d38 --- /dev/null +++ b/mailnews/base/search/src/nsMsgFilterList.h @@ -0,0 +1,75 @@ +/* -*- 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 _nsMsgFilterList_H_ +#define _nsMsgFilterList_H_ + +#include "nscore.h" +#include "nsIMsgFolder.h" +#include "nsIMsgFilterList.h" +#include "nsCOMPtr.h" +#include "nsTArray.h" +#include "nsIFile.h" +#include "nsIOutputStream.h" + +const int16_t kFileVersion = 9; +const int16_t kManualContextVersion = 9; +const int16_t k60Beta1Version = 7; +const int16_t k45Version = 6; + +//////////////////////////////////////////////////////////////////////////////////////// +// The Msg Filter List is an interface designed to make accessing filter lists +// easier. Clients typically open a filter list and either enumerate the filters, +// or add new filters, or change the order around... +// +//////////////////////////////////////////////////////////////////////////////////////// + +class nsIMsgFilter; +class nsMsgFilter; + +class nsMsgFilterList : public nsIMsgFilterList +{ +public: + NS_DECL_ISUPPORTS + NS_DECL_NSIMSGFILTERLIST + + nsMsgFilterList(); + + nsresult Close(); + nsresult LoadTextFilters(nsIInputStream *aStream); + + bool m_temporaryList; + +protected: + virtual ~nsMsgFilterList(); + + nsresult ComputeArbitraryHeaders(); + nsresult SaveTextFilters(nsIOutputStream *aStream); + // file streaming methods + int ReadChar(nsIInputStream *aStream); + int SkipWhitespace(nsIInputStream *aStream); + bool StrToBool(nsCString &str); + int LoadAttrib(nsMsgFilterFileAttribValue &attrib, nsIInputStream *aStream); + const char *GetStringForAttrib(nsMsgFilterFileAttribValue attrib); + nsresult LoadValue(nsCString &value, nsIInputStream *aStream); + int16_t m_fileVersion; + bool m_loggingEnabled; + bool m_startWritingToBuffer; //tells us when to start writing one whole filter to m_unparsedBuffer + nsCOMPtr m_folder; + nsMsgFilter *m_curFilter; // filter we're filing in or out(?) + nsCString m_filterFileName; + nsTArray > m_filters; + nsCString m_arbitraryHeaders; + nsCOMPtr m_defaultFile; + nsCString m_unparsedFilterBuffer; //holds one entire filter unparsed + +private: + nsresult TruncateLog(); + nsresult GetLogFile(nsIFile **aFile); + nsresult EnsureLogFile(nsIFile *file); + nsCOMPtr m_logStream; +}; + +#endif -- cgit v1.2.3