blob: 2bb441d38ff3925df6f5040f453eeb5d1224d23b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
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<nsIMsgFolder> m_folder;
nsMsgFilter *m_curFilter; // filter we're filing in or out(?)
nsCString m_filterFileName;
nsTArray<nsCOMPtr<nsIMsgFilter> > m_filters;
nsCString m_arbitraryHeaders;
nsCOMPtr<nsIFile> m_defaultFile;
nsCString m_unparsedFilterBuffer; //holds one entire filter unparsed
private:
nsresult TruncateLog();
nsresult GetLogFile(nsIFile **aFile);
nsresult EnsureLogFile(nsIFile *file);
nsCOMPtr<nsIOutputStream> m_logStream;
};
#endif
|