summaryrefslogtreecommitdiffstats
path: root/mailnews/base/search/src/nsMsgSearchNews.cpp
blob: 72d2bd6488343dab83a21d761043c0663795f1ab (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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
/* -*- 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 "msgCore.h"
#include "nsMsgSearchAdapter.h"
#include "nsUnicharUtils.h"
#include "nsMsgSearchScopeTerm.h"
#include "nsMsgResultElement.h"
#include "nsMsgSearchTerm.h"
#include "nsIMsgHdr.h"
#include "nsMsgSearchNews.h"
#include "nsIDBFolderInfo.h"
#include "prprf.h"
#include "nsIMsgDatabase.h"
#include "nsMemory.h"
#include <ctype.h>
// Disable deprecation warnings generated by nsISupportsArray and associated
// classes.
#if defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#elif defined(_MSC_VER)
#pragma warning (disable : 4996)
#endif
#include "nsISupportsArray.h"

// Implementation of search for IMAP mail folders


// Implementation of search for newsgroups


//-----------------------------------------------------------------------------
//----------- Adapter class for searching XPAT-capable news servers -----------
//-----------------------------------------------------------------------------


const char *nsMsgSearchNews::m_kNntpFrom = "FROM ";
const char *nsMsgSearchNews::m_kNntpSubject = "SUBJECT ";
const char *nsMsgSearchNews::m_kTermSeparator = "/";


nsMsgSearchNews::nsMsgSearchNews (nsMsgSearchScopeTerm *scope, nsISupportsArray *termList) : nsMsgSearchAdapter (scope, termList)
{
}


nsMsgSearchNews::~nsMsgSearchNews ()
{
}


nsresult nsMsgSearchNews::ValidateTerms ()
{
  nsresult err = nsMsgSearchAdapter::ValidateTerms ();
  if (NS_OK == err)
  {
    err = Encode (&m_encoding);
  }

  return err;
}


nsresult nsMsgSearchNews::Search (bool *aDone)
{
  // the state machine runs in the news: handler
  nsresult err = NS_ERROR_NOT_IMPLEMENTED;
  return err;
}

char16_t *nsMsgSearchNews::EncodeToWildmat (const char16_t *value)
{
  // Here we take advantage of XPAT's use of the wildmat format, which allows
  // a case-insensitive match by specifying each case possibility for each character
  // So, "FooBar" is encoded as "[Ff][Oo][Bb][Aa][Rr]"

  char16_t *caseInsensitiveValue = (char16_t*) moz_xmalloc(sizeof(char16_t) * ((4 * NS_strlen(value)) + 1));
  if (caseInsensitiveValue)
  {
    char16_t *walkValue = caseInsensitiveValue;
    while (*value)
    {
      if (isalpha(*value))
      {
        *walkValue++ = (char16_t)'[';
        *walkValue++ = ToUpperCase((char16_t)*value);
        *walkValue++ = ToLowerCase((char16_t)*value);
        *walkValue++ = (char16_t)']';
      }
      else
        *walkValue++ = *value;
      value++;
    }
    *walkValue = 0;
  }
  return caseInsensitiveValue;
}


char *nsMsgSearchNews::EncodeTerm (nsIMsgSearchTerm *term)
{
  // Develop an XPAT-style encoding for the search term

  NS_ASSERTION(term, "null term");
  if (!term)
    return nullptr;

  // Find a string to represent the attribute
  const char *attribEncoding = nullptr;
  nsMsgSearchAttribValue attrib;

  term->GetAttrib(&attrib);

  switch (attrib)
  {
  case nsMsgSearchAttrib::Sender:
    attribEncoding = m_kNntpFrom;
    break;
  case nsMsgSearchAttrib::Subject:
    attribEncoding = m_kNntpSubject;
    break;
  default:
    nsCString header;
    term->GetArbitraryHeader(header);
    if (header.IsEmpty())
    {
      NS_ASSERTION(false,"malformed search"); // malformed search term?
      return nullptr;
    }
    attribEncoding = header.get();
  }

  // Build a string to represent the string pattern
  bool leadingStar = false;
  bool trailingStar = false;
  nsMsgSearchOpValue op;
  term->GetOp(&op);

  switch (op)
  {
  case nsMsgSearchOp::Contains:
    leadingStar = true;
    trailingStar = true;
    break;
  case nsMsgSearchOp::Is:
    break;
  case nsMsgSearchOp::BeginsWith:
    trailingStar = true;
    break;
  case nsMsgSearchOp::EndsWith:
    leadingStar = true;
    break;
  default:
    NS_ASSERTION(false,"malformed search"); // malformed search term?
    return nullptr;
  }

    // ### i18N problem Get the csid from FE, which is the correct csid for term
//  int16 wincsid = INTL_GetCharSetID(INTL_DefaultTextWidgetCsidSel);

  // Do INTL_FormatNNTPXPATInRFC1522Format trick for non-ASCII string
//  unsigned char *intlNonRFC1522Value = INTL_FormatNNTPXPATInNonRFC1522Format (wincsid, (unsigned char*)term->m_value.u.string);
  nsCOMPtr <nsIMsgSearchValue> searchValue;

  nsresult rv = term->GetValue(getter_AddRefs(searchValue));
  if (NS_FAILED(rv) || !searchValue)
    return nullptr;


  nsString intlNonRFC1522Value;
  rv = searchValue->GetStr(intlNonRFC1522Value);
  if (NS_FAILED(rv) || intlNonRFC1522Value.IsEmpty())
    return nullptr;

  char16_t *caseInsensitiveValue = EncodeToWildmat (intlNonRFC1522Value.get());
  if (!caseInsensitiveValue)
    return nullptr;

  // TO DO: Do INTL_FormatNNTPXPATInRFC1522Format trick for non-ASCII string
  // Unfortunately, we currently do not handle xxx or xxx search in XPAT
  // Need to add the INTL_FormatNNTPXPATInRFC1522Format call after we can do that
  // so we should search a string in either RFC1522 format and non-RFC1522 format

  char16_t *escapedValue = EscapeSearchUrl (caseInsensitiveValue);
  free(caseInsensitiveValue);
  if (!escapedValue)
    return nullptr;

  nsAutoCString pattern;

  if (leadingStar)
      pattern.Append('*');
    pattern.Append(NS_ConvertUTF16toUTF8(escapedValue));
  if (trailingStar)
      pattern.Append('*');

  // Combine the XPAT command syntax with the attribute and the pattern to
  // form the term encoding
  const char xpatTemplate[] = "XPAT %s 1- %s";
  int termLength = (sizeof(xpatTemplate) - 1) + strlen(attribEncoding) + pattern.Length() + 1;
  char *termEncoding = new char [termLength];
  if (termEncoding)
    PR_snprintf (termEncoding, termLength, xpatTemplate, attribEncoding, pattern.get());

  return termEncoding;
}

nsresult nsMsgSearchNews::GetEncoding(char **result)
{
  NS_ENSURE_ARG(result);
  *result = ToNewCString(m_encoding);
  return (*result) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}

nsresult nsMsgSearchNews::Encode (nsCString *outEncoding)
{
  NS_ASSERTION(outEncoding, "no out encoding");
  if (!outEncoding)
    return NS_ERROR_NULL_POINTER;

  nsresult err = NS_OK;

  uint32_t numTerms;

  m_searchTerms->Count(&numTerms);
  char **intermediateEncodings = new char * [numTerms];
  if (intermediateEncodings)
  {
    // Build an XPAT command for each term
    int encodingLength = 0;
    uint32_t i;
    for (i = 0; i < numTerms; i++)
    {
      nsCOMPtr<nsIMsgSearchTerm> pTerm;
      m_searchTerms->QueryElementAt(i, NS_GET_IID(nsIMsgSearchTerm),
                               (void **)getter_AddRefs(pTerm));
      // set boolean OR term if any of the search terms are an OR...this only works if we are using
      // homogeneous boolean operators.
      bool isBooleanOpAnd;
      pTerm->GetBooleanAnd(&isBooleanOpAnd);
      m_ORSearch = !isBooleanOpAnd;

      intermediateEncodings[i] = EncodeTerm (pTerm);
      if (intermediateEncodings[i])
        encodingLength += strlen(intermediateEncodings[i]) + strlen(m_kTermSeparator);
    }
    encodingLength += strlen("?search");
    // Combine all the term encodings into one big encoding
    char *encoding = new char [encodingLength + 1];
    if (encoding)
    {
      PL_strcpy (encoding, "?search");

      m_searchTerms->Count(&numTerms);

      for (i = 0; i < numTerms; i++)
      {
        if (intermediateEncodings[i])
        {
          PL_strcat (encoding, m_kTermSeparator);
          PL_strcat (encoding, intermediateEncodings[i]);
          delete [] intermediateEncodings[i];
        }
      }
      *outEncoding = encoding;
    }
    else
      err = NS_ERROR_OUT_OF_MEMORY;
  }
  else
    err = NS_ERROR_OUT_OF_MEMORY;
  delete [] intermediateEncodings;

  return err;
}

NS_IMETHODIMP nsMsgSearchNews::AddHit(nsMsgKey key)
{
  m_candidateHits.AppendElement(key);
  return NS_OK;
}

/* void CurrentUrlDone (in nsresult exitCode); */
NS_IMETHODIMP nsMsgSearchNews::CurrentUrlDone(nsresult exitCode)
{
  CollateHits();
  ReportHits();
  return NS_OK;
}


#if 0 // need to switch this to a notify stop loading handler, I think.
void nsMsgSearchNews::PreExitFunction (URL_Struct * /*url*/, int status, MWContext *context)
{
  MSG_SearchFrame *frame = MSG_SearchFrame::FromContext (context);
  nsMsgSearchNews *adapter = (nsMsgSearchNews*) frame->GetRunningAdapter();
  adapter->CollateHits();
  adapter->ReportHits();

  if (status == MK_INTERRUPTED)
  {
    adapter->Abort();
    frame->EndCylonMode();
  }
  else
  {
    frame->m_idxRunningScope++;
    if (frame->m_idxRunningScope >= frame->m_scopeList.Count())
      frame->EndCylonMode();
  }
}
#endif // 0

void nsMsgSearchNews::CollateHits()
{
  // Since the XPAT commands are processed one at a time, the result set for the
  // entire query is the intersection of results for each XPAT command if an AND search,
  // otherwise we want the union of all the search hits (minus the duplicates of course).

  uint32_t size = m_candidateHits.Length();
  if (!size)
    return;

  // Sort the article numbers first, so it's easy to tell how many hits
  // on a given article we got
  m_candidateHits.Sort();

  // For an OR search we only need to count the first occurrence of a candidate.
  uint32_t termCount = 1;
  if (!m_ORSearch)
  {
    // We have a traditional AND search which must be collated. In order to
    // get promoted into the hits list, a candidate article number must appear
    // in the results of each XPAT command. So if we fire 3 XPAT commands (one
    // per search term), the article number must appear 3 times. If it appears
    // fewer than 3 times, it matched some search terms, but not all.
    m_searchTerms->Count(&termCount);
  }
  uint32_t candidateCount = 0;
  uint32_t candidate = m_candidateHits[0];
  for (uint32_t index = 0; index < size; ++index)   
  {
    uint32_t possibleCandidate = m_candidateHits[index];
    if (candidate == possibleCandidate)
    {
      ++candidateCount;
    }
    else
    {
      candidateCount = 1;
      candidate = possibleCandidate;
    }
    if (candidateCount == termCount)
      m_hits.AppendElement(candidate);
  }
}

void nsMsgSearchNews::ReportHits ()
{
  nsCOMPtr <nsIMsgDatabase> db;
  nsCOMPtr <nsIDBFolderInfo>  folderInfo;
  nsCOMPtr <nsIMsgFolder> scopeFolder;

  nsresult err = m_scope->GetFolder(getter_AddRefs(scopeFolder));
  if (NS_SUCCEEDED(err) && scopeFolder)
  {
    err = scopeFolder->GetDBFolderInfoAndDB(getter_AddRefs(folderInfo), getter_AddRefs(db));
  }

  if (db)
  {
    uint32_t size = m_hits.Length();
    for (uint32_t i = 0; i < size; ++i)
    {
      nsCOMPtr <nsIMsgDBHdr> header;

      db->GetMsgHdrForKey(m_hits.ElementAt(i), getter_AddRefs(header));
      if (header)
        ReportHit(header, scopeFolder);
    }
  }
}

// ### this should take an nsIMsgFolder instead of a string location.
void nsMsgSearchNews::ReportHit (nsIMsgDBHdr *pHeaders, nsIMsgFolder *folder)
{
    // this is totally filched from msg_SearchOfflineMail until I decide whether the
    // right thing is to get them from the db or from NNTP
    nsCOMPtr<nsIMsgSearchSession> session;
    nsCOMPtr<nsIMsgFolder> scopeFolder;
    m_scope->GetFolder(getter_AddRefs(scopeFolder));
    m_scope->GetSearchSession(getter_AddRefs(session));
    if (session)
      session->AddSearchHit (pHeaders, scopeFolder);
}

nsresult nsMsgSearchValidityManager::InitNewsTable()
{
  NS_ASSERTION (nullptr == m_newsTable,"don't call this twice!");
  nsresult rv = NewTable (getter_AddRefs(m_newsTable));

  if (NS_SUCCEEDED(rv))
  {
    m_newsTable->SetAvailable (nsMsgSearchAttrib::Sender, nsMsgSearchOp::Contains, 1);
    m_newsTable->SetEnabled   (nsMsgSearchAttrib::Sender, nsMsgSearchOp::Contains, 1);
    m_newsTable->SetAvailable (nsMsgSearchAttrib::Sender, nsMsgSearchOp::Is, 1);
    m_newsTable->SetEnabled   (nsMsgSearchAttrib::Sender, nsMsgSearchOp::Is, 1);
    m_newsTable->SetAvailable (nsMsgSearchAttrib::Sender, nsMsgSearchOp::BeginsWith, 1);
    m_newsTable->SetEnabled   (nsMsgSearchAttrib::Sender, nsMsgSearchOp::BeginsWith, 1);
    m_newsTable->SetAvailable (nsMsgSearchAttrib::Sender, nsMsgSearchOp::EndsWith, 1);
    m_newsTable->SetEnabled   (nsMsgSearchAttrib::Sender, nsMsgSearchOp::EndsWith, 1);

    m_newsTable->SetAvailable (nsMsgSearchAttrib::Subject, nsMsgSearchOp::Contains, 1);
    m_newsTable->SetEnabled   (nsMsgSearchAttrib::Subject, nsMsgSearchOp::Contains, 1);
    m_newsTable->SetAvailable (nsMsgSearchAttrib::Subject, nsMsgSearchOp::Is, 1);
    m_newsTable->SetEnabled   (nsMsgSearchAttrib::Subject, nsMsgSearchOp::Is, 1);
    m_newsTable->SetAvailable (nsMsgSearchAttrib::Subject, nsMsgSearchOp::BeginsWith, 1);
    m_newsTable->SetEnabled   (nsMsgSearchAttrib::Subject, nsMsgSearchOp::BeginsWith, 1);
    m_newsTable->SetAvailable (nsMsgSearchAttrib::Subject, nsMsgSearchOp::EndsWith, 1);
    m_newsTable->SetEnabled   (nsMsgSearchAttrib::Subject, nsMsgSearchOp::EndsWith, 1);

#if 0
    // Size should be handled after the fact...
    m_newsTable->SetAvailable (nsMsgSearchAttrib::Size, nsMsgSearchOp::IsGreaterThan, 1);
    m_newsTable->SetEnabled   (nsMsgSearchAttrib::Size, nsMsgSearchOp::IsGreaterThan, 1);
    m_newsTable->SetAvailable (nsMsgSearchAttrib::Size, nsMsgSearchOp::IsLessThan, 1);
    m_newsTable->SetEnabled   (nsMsgSearchAttrib::Size, nsMsgSearchOp::IsLessThan, 1);
#endif
    
    m_newsTable->SetAvailable (nsMsgSearchAttrib::OtherHeader, nsMsgSearchOp::Contains, 1);
    m_newsTable->SetEnabled   (nsMsgSearchAttrib::OtherHeader, nsMsgSearchOp::Contains, 1);
    m_newsTable->SetAvailable (nsMsgSearchAttrib::OtherHeader, nsMsgSearchOp::Is, 1);
    m_newsTable->SetEnabled   (nsMsgSearchAttrib::OtherHeader, nsMsgSearchOp::Is, 1);
    m_newsTable->SetAvailable (nsMsgSearchAttrib::OtherHeader, nsMsgSearchOp::BeginsWith, 1);
    m_newsTable->SetEnabled   (nsMsgSearchAttrib::OtherHeader, nsMsgSearchOp::BeginsWith, 1);
    m_newsTable->SetAvailable (nsMsgSearchAttrib::OtherHeader, nsMsgSearchOp::EndsWith, 1);
    m_newsTable->SetEnabled   (nsMsgSearchAttrib::OtherHeader, nsMsgSearchOp::EndsWith, 1);
  }

  return rv;
}

nsresult nsMsgSearchValidityManager::InitNewsFilterTable()
{
  NS_ASSERTION (nullptr == m_newsFilterTable, "news filter table already initted");
  nsresult rv = NewTable (getter_AddRefs(m_newsFilterTable));

  if (NS_SUCCEEDED(rv))
  {
    m_newsFilterTable->SetAvailable (nsMsgSearchAttrib::Sender, nsMsgSearchOp::Contains, 1);
    m_newsFilterTable->SetEnabled   (nsMsgSearchAttrib::Sender, nsMsgSearchOp::Contains, 1);
    m_newsFilterTable->SetAvailable (nsMsgSearchAttrib::Sender, nsMsgSearchOp::DoesntContain, 1);
    m_newsFilterTable->SetEnabled   (nsMsgSearchAttrib::Sender, nsMsgSearchOp::DoesntContain, 1);
    m_newsFilterTable->SetAvailable (nsMsgSearchAttrib::Sender, nsMsgSearchOp::Is, 1);
    m_newsFilterTable->SetEnabled   (nsMsgSearchAttrib::Sender, nsMsgSearchOp::Is, 1);
    m_newsFilterTable->SetAvailable (nsMsgSearchAttrib::Sender, nsMsgSearchOp::Isnt, 1);
    m_newsFilterTable->SetEnabled   (nsMsgSearchAttrib::Sender, nsMsgSearchOp::Isnt, 1);
    m_newsFilterTable->SetAvailable (nsMsgSearchAttrib::Sender, nsMsgSearchOp::BeginsWith, 1);
    m_newsFilterTable->SetEnabled   (nsMsgSearchAttrib::Sender, nsMsgSearchOp::BeginsWith, 1);
    m_newsFilterTable->SetAvailable (nsMsgSearchAttrib::Sender, nsMsgSearchOp::EndsWith, 1);
    m_newsFilterTable->SetEnabled   (nsMsgSearchAttrib::Sender, nsMsgSearchOp::EndsWith, 1);

    m_newsFilterTable->SetAvailable (nsMsgSearchAttrib::Sender, nsMsgSearchOp::IsInAB, 1);
    m_newsFilterTable->SetEnabled   (nsMsgSearchAttrib::Sender, nsMsgSearchOp::IsInAB, 1);
    m_newsFilterTable->SetAvailable (nsMsgSearchAttrib::Sender, nsMsgSearchOp::IsntInAB, 1);
    m_newsFilterTable->SetEnabled   (nsMsgSearchAttrib::Sender, nsMsgSearchOp::IsntInAB, 1);

    m_newsFilterTable->SetAvailable (nsMsgSearchAttrib::Subject, nsMsgSearchOp::Contains, 1);
    m_newsFilterTable->SetEnabled   (nsMsgSearchAttrib::Subject, nsMsgSearchOp::Contains, 1);
    m_newsFilterTable->SetAvailable (nsMsgSearchAttrib::Subject, nsMsgSearchOp::DoesntContain, 1);
    m_newsFilterTable->SetEnabled   (nsMsgSearchAttrib::Subject, nsMsgSearchOp::DoesntContain, 1);
    m_newsFilterTable->SetAvailable (nsMsgSearchAttrib::Subject, nsMsgSearchOp::Is, 1);
    m_newsFilterTable->SetEnabled   (nsMsgSearchAttrib::Subject, nsMsgSearchOp::Is, 1);
    m_newsFilterTable->SetAvailable (nsMsgSearchAttrib::Subject, nsMsgSearchOp::Isnt, 1);
    m_newsFilterTable->SetEnabled   (nsMsgSearchAttrib::Subject, nsMsgSearchOp::Isnt, 1);
    m_newsFilterTable->SetAvailable (nsMsgSearchAttrib::Subject, nsMsgSearchOp::BeginsWith, 1);
    m_newsFilterTable->SetEnabled   (nsMsgSearchAttrib::Subject, nsMsgSearchOp::BeginsWith, 1);
    m_newsFilterTable->SetAvailable (nsMsgSearchAttrib::Subject, nsMsgSearchOp::EndsWith, 1);
    m_newsFilterTable->SetEnabled   (nsMsgSearchAttrib::Subject, nsMsgSearchOp::EndsWith, 1);

    m_newsFilterTable->SetAvailable (nsMsgSearchAttrib::Date, nsMsgSearchOp::IsBefore, 1);
    m_newsFilterTable->SetEnabled   (nsMsgSearchAttrib::Date, nsMsgSearchOp::IsBefore, 1);
    m_newsFilterTable->SetAvailable (nsMsgSearchAttrib::Date, nsMsgSearchOp::IsAfter, 1);
    m_newsFilterTable->SetEnabled   (nsMsgSearchAttrib::Date, nsMsgSearchOp::IsAfter, 1);
    m_newsFilterTable->SetAvailable (nsMsgSearchAttrib::Date, nsMsgSearchOp::Is, 1);
    m_newsFilterTable->SetEnabled   (nsMsgSearchAttrib::Date, nsMsgSearchOp::Is, 1);
    m_newsFilterTable->SetAvailable (nsMsgSearchAttrib::Date, nsMsgSearchOp::Isnt, 1);
    m_newsFilterTable->SetEnabled   (nsMsgSearchAttrib::Date, nsMsgSearchOp::Isnt, 1);

    m_newsFilterTable->SetAvailable (nsMsgSearchAttrib::Size, nsMsgSearchOp::IsGreaterThan, 1);
    m_newsFilterTable->SetEnabled   (nsMsgSearchAttrib::Size, nsMsgSearchOp::IsGreaterThan, 1);
    m_newsFilterTable->SetAvailable (nsMsgSearchAttrib::Size, nsMsgSearchOp::IsLessThan, 1);
    m_newsFilterTable->SetEnabled   (nsMsgSearchAttrib::Size, nsMsgSearchOp::IsLessThan, 1);

    m_newsFilterTable->SetAvailable (nsMsgSearchAttrib::OtherHeader, nsMsgSearchOp::Contains, 1);
    m_newsFilterTable->SetEnabled   (nsMsgSearchAttrib::OtherHeader, nsMsgSearchOp::Contains, 1);
    m_newsFilterTable->SetAvailable (nsMsgSearchAttrib::OtherHeader, nsMsgSearchOp::DoesntContain, 1);
    m_newsFilterTable->SetEnabled   (nsMsgSearchAttrib::OtherHeader, nsMsgSearchOp::DoesntContain, 1);
    m_newsFilterTable->SetAvailable (nsMsgSearchAttrib::OtherHeader, nsMsgSearchOp::Is, 1);
    m_newsFilterTable->SetEnabled   (nsMsgSearchAttrib::OtherHeader, nsMsgSearchOp::Is, 1);
    m_newsFilterTable->SetAvailable (nsMsgSearchAttrib::OtherHeader, nsMsgSearchOp::Isnt, 1);
    m_newsFilterTable->SetEnabled   (nsMsgSearchAttrib::OtherHeader, nsMsgSearchOp::Isnt, 1);
    m_newsFilterTable->SetAvailable (nsMsgSearchAttrib::OtherHeader, nsMsgSearchOp::BeginsWith, 1);
    m_newsFilterTable->SetEnabled   (nsMsgSearchAttrib::OtherHeader, nsMsgSearchOp::BeginsWith, 1);
    m_newsFilterTable->SetAvailable (nsMsgSearchAttrib::OtherHeader, nsMsgSearchOp::EndsWith, 1);
    m_newsFilterTable->SetEnabled   (nsMsgSearchAttrib::OtherHeader, nsMsgSearchOp::EndsWith, 1);
  }

  return rv;
}