summaryrefslogtreecommitdiffstats
path: root/mailnews/base/search/public/nsMsgSearchCore.idl
blob: 6431aa8c367b0dea931c14506581532718162418 (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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
/* -*- 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/. */

#include "nsISupports.idl"
#include "MailNewsTypes2.idl"

interface nsIMsgFolder;

interface nsIMsgDatabase;
interface nsIMsgDBHdr;

[scriptable, uuid(6e893e59-af98-4f62-a326-0f00f32147cd)]

interface nsMsgSearchScope {
  const nsMsgSearchScopeValue offlineMail = 0;
  const nsMsgSearchScopeValue offlineMailFilter = 1;
  const nsMsgSearchScopeValue onlineMail = 2;
  const nsMsgSearchScopeValue onlineMailFilter = 3;
  /// offline news, base table, no body or junk
  const nsMsgSearchScopeValue localNews = 4;
  const nsMsgSearchScopeValue news = 5;
  const nsMsgSearchScopeValue newsEx = 6;
  const nsMsgSearchScopeValue LDAP = 7;
  const nsMsgSearchScopeValue LocalAB = 8;
  const nsMsgSearchScopeValue allSearchableGroups = 9;
  const nsMsgSearchScopeValue newsFilter = 10;
  const nsMsgSearchScopeValue LocalABAnd = 11;
  const nsMsgSearchScopeValue LDAPAnd = 12;
  // IMAP and NEWS, searched using local headers
  const nsMsgSearchScopeValue onlineManual = 13;
  /// local news + junk
  const nsMsgSearchScopeValue localNewsJunk = 14;
  /// local news + body
  const nsMsgSearchScopeValue localNewsBody = 15;
  /// local news + junk + body
  const nsMsgSearchScopeValue localNewsJunkBody = 16;
};

typedef long nsMsgSearchAttribValue;

/**
 * Definitions of search attribute types. The numerical order
 * from here will also be used to determine the order that the
 * attributes display in the filter editor.
 */
[scriptable, uuid(a83ca7e8-4591-4111-8fb8-fd76ac73c866)]
interface nsMsgSearchAttrib {
    const nsMsgSearchAttribValue Custom = -2;  /* a custom term, see nsIMsgSearchCustomTerm */
    const nsMsgSearchAttribValue Default = -1;
    const nsMsgSearchAttribValue Subject = 0;  /* mail and news */
    const nsMsgSearchAttribValue Sender = 1;
    const nsMsgSearchAttribValue Body = 2;
    const nsMsgSearchAttribValue Date = 3;

    const nsMsgSearchAttribValue Priority = 4;      /* mail only */
    const nsMsgSearchAttribValue MsgStatus = 5;
    const nsMsgSearchAttribValue To = 6;
    const nsMsgSearchAttribValue CC = 7;
    const nsMsgSearchAttribValue ToOrCC = 8;
    const nsMsgSearchAttribValue AllAddresses = 9;

    const nsMsgSearchAttribValue Location = 10;          /* result list only */
    const nsMsgSearchAttribValue MessageKey = 11;        /* message result elems */
    const nsMsgSearchAttribValue AgeInDays = 12;
    const nsMsgSearchAttribValue FolderInfo = 13;        /* for "view thread context" from result */
    const nsMsgSearchAttribValue Size = 14;
    const nsMsgSearchAttribValue AnyText = 15;
    const nsMsgSearchAttribValue Keywords = 16; // keywords are the internal representation of tags.

    const nsMsgSearchAttribValue Name = 17;
    const nsMsgSearchAttribValue DisplayName = 18;
    const nsMsgSearchAttribValue Nickname = 19;
    const nsMsgSearchAttribValue ScreenName = 20;
    const nsMsgSearchAttribValue Email = 21;
    const nsMsgSearchAttribValue AdditionalEmail = 22;
    const nsMsgSearchAttribValue PhoneNumber = 23;
    const nsMsgSearchAttribValue WorkPhone = 24;
    const nsMsgSearchAttribValue HomePhone = 25;
    const nsMsgSearchAttribValue Fax = 26;
    const nsMsgSearchAttribValue Pager = 27;
    const nsMsgSearchAttribValue Mobile = 28;
    const nsMsgSearchAttribValue City = 29;
    const nsMsgSearchAttribValue Street = 30;
    const nsMsgSearchAttribValue Title = 31;
    const nsMsgSearchAttribValue Organization = 32;
    const nsMsgSearchAttribValue Department = 33;

    // 34 - 43, reserved for ab / LDAP;
    const nsMsgSearchAttribValue HasAttachmentStatus = 44;
    const nsMsgSearchAttribValue JunkStatus = 45;
    const nsMsgSearchAttribValue JunkPercent = 46;
    const nsMsgSearchAttribValue JunkScoreOrigin = 47;
    const nsMsgSearchAttribValue Label = 48; /* mail only...can search by label */
    const nsMsgSearchAttribValue HdrProperty = 49; // uses nsIMsgSearchTerm::hdrProperty
    const nsMsgSearchAttribValue FolderFlag = 50; // uses nsIMsgSearchTerm::status
    const nsMsgSearchAttribValue Uint32HdrProperty = 51; // uses nsIMsgSearchTerm::hdrProperty

    // 52 is for showing customize - in ui headers start from 53 onwards up until 99.

     /** OtherHeader MUST ALWAYS BE LAST attribute since 
       * we can have an arbitrary # of these. The number can be changed,
       * however, because we never persist AttribValues as integers.
      */
    const nsMsgSearchAttribValue OtherHeader = 52; 
    // must be last attribute
    const nsMsgSearchAttribValue kNumMsgSearchAttributes = 100;
};

typedef long nsMsgSearchOpValue;

[scriptable, uuid(9160b196-6fcb-4eba-aaaf-6c806c4ee420)]
interface nsMsgSearchOp {
    const nsMsgSearchOpValue Contains = 0; /* for text attributes      */
    const nsMsgSearchOpValue DoesntContain = 1;
    const nsMsgSearchOpValue Is = 2; /* is and isn't also apply to some non-text attrs */
    const nsMsgSearchOpValue Isnt = 3;
    const nsMsgSearchOpValue IsEmpty = 4;

    const nsMsgSearchOpValue IsBefore = 5; /* for date attributes              */
    const nsMsgSearchOpValue IsAfter = 6;

    const nsMsgSearchOpValue IsHigherThan = 7; /* for priority. Is also applies  */
    const nsMsgSearchOpValue IsLowerThan = 8;

    const nsMsgSearchOpValue BeginsWith = 9;
    const nsMsgSearchOpValue EndsWith = 10;

    const nsMsgSearchOpValue SoundsLike = 11; /* for LDAP phoenetic matching      */
    const nsMsgSearchOpValue LdapDwim = 12; /* Do What I Mean for simple search */

    const nsMsgSearchOpValue IsGreaterThan = 13;
    const nsMsgSearchOpValue IsLessThan = 14;

    const nsMsgSearchOpValue NameCompletion = 15; /* Name Completion operator...as the name implies =) */
    const nsMsgSearchOpValue IsInAB = 16;
    const nsMsgSearchOpValue IsntInAB = 17;
    const nsMsgSearchOpValue IsntEmpty = 18; /* primarily for tags */
    const nsMsgSearchOpValue Matches = 19; /* generic term for use by custom terms */
    const nsMsgSearchOpValue DoesntMatch = 20; /* generic term for use by custom terms */
    const nsMsgSearchOpValue kNumMsgSearchOperators  = 21;     /* must be last operator */
};

typedef long nsMsgSearchWidgetValue;

/* FEs use this to help build the search dialog box */
[scriptable,uuid(903dd2e8-304e-11d3-92e6-00a0c900d445)]
interface nsMsgSearchWidget {
    const nsMsgSearchWidgetValue Text = 0;
    const nsMsgSearchWidgetValue Date = 1;
    const nsMsgSearchWidgetValue Menu = 2;
  const nsMsgSearchWidgetValue Int = 3;          /* added to account for age in days which requires an integer field */
    const nsMsgSearchWidgetValue None = 4;
};

typedef long nsMsgSearchTypeValue;


/* Used to specify type of search to be performed */
[scriptable,uuid(964b7f32-304e-11d3-ae13-00a0c900d445)]
interface nsMsgSearchType {
  const nsMsgSearchTypeValue None = 0;
  const nsMsgSearchTypeValue RootDSE = 1;
  const nsMsgSearchTypeValue Normal = 2;
  const nsMsgSearchTypeValue LdapVLV = 3;
  const nsMsgSearchTypeValue NameCompletion = 4;
};

typedef long nsMsgSearchBooleanOperator;

[scriptable, uuid(a37f3f4a-304e-11d3-8f94-00a0c900d445)]
interface nsMsgSearchBooleanOp {
    const nsMsgSearchBooleanOperator BooleanOR = 0;
    const nsMsgSearchBooleanOperator BooleanAND = 1;
};

/* Use this to specify the value of a search term */

[ptr] native nsMsgSearchValue(nsMsgSearchValue);

%{C++
#include "nsStringGlue.h"

typedef struct nsMsgSearchValue
{
    nsMsgSearchAttribValue attribute;
    union
    {
      nsMsgPriorityValue priority;
      PRTime date;
      uint32_t msgStatus; /* see MSG_FLAG in msgcom.h */
      uint32_t size;
      nsMsgKey key;
      int32_t age; /* in days */
      nsIMsgFolder *folder;
      nsMsgLabelValue label;
      uint32_t junkStatus;
      uint32_t junkPercent;
    } u;
    char *string;
    nsString utf16String;
} nsMsgSearchValue;
%}

[ptr] native nsMsgSearchTerm(nsMsgSearchTerm);

// Please note the ! at the start of this macro, which means the macro
// needs to enumerate the non-string attributes.
%{C++
#define IS_STRING_ATTRIBUTE(_a) \
(!(_a == nsMsgSearchAttrib::Priority || _a == nsMsgSearchAttrib::Date || \
   _a == nsMsgSearchAttrib::MsgStatus || _a == nsMsgSearchAttrib::MessageKey || \
   _a == nsMsgSearchAttrib::Size || _a == nsMsgSearchAttrib::AgeInDays || \
   _a == nsMsgSearchAttrib::FolderInfo || _a == nsMsgSearchAttrib::Location || \
   _a == nsMsgSearchAttrib::Label || _a == nsMsgSearchAttrib::JunkStatus || \
   _a == nsMsgSearchAttrib::FolderFlag || _a == nsMsgSearchAttrib::Uint32HdrProperty || \
   _a == nsMsgSearchAttrib::JunkPercent || _a == nsMsgSearchAttrib::HasAttachmentStatus))
%}

[ptr] native nsSearchMenuItem(nsSearchMenuItem);