summaryrefslogtreecommitdiffstats
path: root/mailnews/base/search/public/nsIMsgFilter.idl
blob: 5571b2f9a9907f3920545f27160b78dcd5a2e503 (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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/* -*- Mode: IDL; 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/. */


#include "nsISupports.idl"
#include "nsMsgFilterCore.idl"
// Disable deprecation warnings generated by nsISupportsArray and associated
// classes.
%{C++
#if defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#elif defined(_MSC_VER)
#pragma warning (disable : 4996)
#endif
%}
interface nsISupportsArray;

interface nsIArray;
interface nsIOutputStream;
interface nsIMsgFilterCustomAction;
interface nsIMsgFilterList;
interface nsIMsgSearchScopeTerm;
interface nsIMsgSearchValue;
interface nsIMsgSearchTerm;

[scriptable, uuid(36d2748e-9246-44f3-bb74-46cbb0b8c23a)]
interface nsIMsgRuleAction : nsISupports {

  attribute nsMsgRuleActionType type;

  // target priority.. throws an exception if the action is not priority
  attribute nsMsgPriorityValue priority;

  // target folder.. throws an exception if the action is not move to folder
  attribute ACString targetFolderUri;

  // target label. throws an exception if the action is not label
  attribute nsMsgLabelValue label;

  attribute long junkScore;

  attribute AUTF8String strValue;

  // action id if type is Custom
  attribute ACString customId;

  // custom action associated with customId
  // (which must be set prior to reading this attribute)
  readonly attribute nsIMsgFilterCustomAction customAction;

};

[scriptable, uuid(d304fcfc-b588-11e4-981c-770e1e5d46b0)]
interface nsIMsgFilter : nsISupports {
    attribute nsMsgFilterTypeType filterType;
    /**
     * some filters are "temporary".  For example, the filters we create when the user
     * filters return receipts to the Sent folder.
     * we don't show temporary filters in the UI
     * and we don't write them to disk.
     */
    attribute boolean temporary;
    attribute boolean enabled;
    attribute AString filterName;
    attribute ACString filterDesc;
    attribute ACString unparsedBuffer; //holds the entire filter if we don't know how to handle it
    attribute boolean unparseable;  //whether we could parse the filter or not

    attribute nsIMsgFilterList filterList; // owning filter list

    void AddTerm(in nsMsgSearchAttribValue attrib,
                 in nsMsgSearchOpValue op,
                 in nsIMsgSearchValue value,
                 in boolean BooleanAND,
                 in ACString arbitraryHeader);

    void GetTerm(in long termIndex,
                 out nsMsgSearchAttribValue attrib,
                 out nsMsgSearchOpValue op,
                 out nsIMsgSearchValue value, // bad! using shared structure
                 out boolean BooleanAND,
                 out ACString arbitraryHeader);

    void appendTerm(in nsIMsgSearchTerm term);

    nsIMsgSearchTerm createTerm();

    attribute nsISupportsArray searchTerms;

    attribute nsIMsgSearchScopeTerm scope;

    // Marking noscript because "headers" is actually a null-separated
    // list of headers, which is not scriptable.
    [noscript] void MatchHdr(in nsIMsgDBHdr msgHdr, in nsIMsgFolder folder,
                  in nsIMsgDatabase db,
                  in string headers,
                  //                  [array, size_is(headerSize)] in string headers,
                  in unsigned long headerSize, out boolean result);


    /*
     * Report that Rule was matched and executed when filter logging is enabled.
     *
     * @param aFilterAction  The filter rule that was invoked.
     * @param aHeader        The header information of the message acted on by
     *                       the filter.
     */
    void logRuleHit(in nsIMsgRuleAction aFilterAction,
                    in nsIMsgDBHdr aHeader);

    /* Report that filtering failed for some reason when filter logging is enabled.
     *
     * @param aFilterAction Filter rule that was invoked.
     * @param aHeader Header of the message acted on by the filter.
     * @param aRcode  Error code returned by low-level routine that
     *                led to the filter failure.
     * @param aErrmsg Error message
     */
    void logRuleHitFail(in nsIMsgRuleAction aFilterAction,
                        in nsIMsgDBHdr aHeader,
                        in nsresult aRcode,
                        in string aErrmsg );

    nsIMsgRuleAction createAction();

    nsIMsgRuleAction getActionAt(in unsigned long aIndex);

    long getActionIndex(in nsIMsgRuleAction aAction);

    void appendAction(in nsIMsgRuleAction action);

    readonly attribute unsigned long actionCount;

    void clearActionList();

    // Returns the action list in the order it will be really executed in.
    readonly attribute nsIArray sortedActionList;

    void SaveToTextFile(in nsIOutputStream aStream);
};