summaryrefslogtreecommitdiffstats
path: root/comm/mailnews/search/public/nsIMsgFilterService.idl
blob: 439dd40f93a98e600de17813b235aae60ad5bccc (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
/* -*- 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"

interface nsIMsgFilterList;
interface nsIMsgWindow;
interface nsIMsgFilterCustomAction;
interface nsIFile;
interface nsIMsgFolder;
interface nsIMsgSearchCustomTerm;
interface nsIMsgOperationListener;

[scriptable, uuid(78a74023-1692-4567-8d72-9ca58fbbd427)]
interface nsIMsgFilterService : nsISupports {

    nsIMsgFilterList OpenFilterList(in nsIFile filterFile, in nsIMsgFolder rootFolder, in nsIMsgWindow msgWindow);
    void CloseFilterList(in nsIMsgFilterList filterList);

    void SaveFilterList(in nsIMsgFilterList filterList,
                        in nsIFile filterFile);

    void CancelFilterList(in nsIMsgFilterList filterList);
    nsIMsgFilterList getTempFilterList(in nsIMsgFolder aFolder);
    void applyFiltersToFolders(in nsIMsgFilterList aFilterList,
                               in Array<nsIMsgFolder> aFolders,
                               in nsIMsgWindow aMsgWindow,
                               [optional] in nsIMsgOperationListener aCallback);

    /**
     * Apply filters to a specific list of messages in a folder.
     * @param  aFilterType  The type of filter to match against
     * @param  aMsgHdrList  The list of message headers (nsIMsgDBHdr objects)
     * @param  aFolder      The folder the messages belong to
     * @param  aMsgWindow   A UI window for attaching progress/dialogs
     * @param  aCallback    A listener that gets notified of any filtering error
     */
    void applyFilters(in nsMsgFilterTypeType aFilterType,
                      in Array<nsIMsgDBHdr> aMsgHdrList,
                      in nsIMsgFolder aFolder,
                      in nsIMsgWindow aMsgWindow,
                      [optional] in nsIMsgOperationListener aCallback);

    /**
     * Add a custom filter action.
     *
     * @param  aAction   the custom action to add
     */
    void addCustomAction(in nsIMsgFilterCustomAction aAction);

    /**
     * get the list of custom actions
     *
     * @return an array of nsIMsgFilterCustomAction objects
     */
    Array<nsIMsgFilterCustomAction> getCustomActions();

    /**
     * Lookup a custom action given its id.
     *
     * @param  id  unique identifier for a particular custom action
     *
     * @return     the custom action, or null if not found
     */
    nsIMsgFilterCustomAction getCustomAction(in ACString id);

    /**
     * Add a custom search term.
     *
     * @param  aTerm   the custom term to add
     */
    void addCustomTerm(in nsIMsgSearchCustomTerm aTerm);

    /**
     * get the list of custom search terms
     *
     * @return an array of nsIMsgSearchCustomTerm objects
     */
    Array<nsIMsgSearchCustomTerm> getCustomTerms();

    /**
     * Lookup a custom search term given its id.
     *
     * @param  id  unique identifier for a particular custom search term
     *
     * @return     the custom search term, or null if not found
     */
    nsIMsgSearchCustomTerm getCustomTerm(in ACString id);

    /**
     * Translate the filter type flag into human readable type names.
     * In case of multiple flag they are delimited by '&'.
     *
     * @param  filterType  nsMsgFilterType flags of filter type
     *
     * @return             A string describing the filter type.
     */
    ACString filterTypeName(in nsMsgFilterTypeType filterType);
};