Bug 857230 - Convert nsIMsgFilter::searchTerms from nsISupportsArray to nsIMutableArray. r=aceman,jorgk,mkmelin,Ratty a=Ratty
--HG-- extra : amend_source : bbc18e1edd58590834f958ea01f3ce84e0ca6717
This commit is contained in:
Родитель
9fa2e528f1
Коммит
41f9037a09
|
@ -3,6 +3,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
Components.utils.import("resource:///modules/ABQueryUtils.jsm");
|
Components.utils.import("resource:///modules/ABQueryUtils.jsm");
|
||||||
|
Components.utils.import("resource:///modules/iteratorUtils.js");
|
||||||
Components.utils.import("resource:///modules/mailServices.js");
|
Components.utils.import("resource:///modules/mailServices.js");
|
||||||
Components.utils.import("resource://gre/modules/PluralForm.jsm");
|
Components.utils.import("resource://gre/modules/PluralForm.jsm");
|
||||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||||
|
@ -178,11 +179,7 @@ function onSearch()
|
||||||
|
|
||||||
var searchUri = currentAbURI + "?(";
|
var searchUri = currentAbURI + "?(";
|
||||||
|
|
||||||
var count = gSearchSession.searchTerms.Count();
|
for (let searchTerm of fixIterator(gSearchSession.searchTerms, nsIMsgSearchTerm)) {
|
||||||
|
|
||||||
for (var i=0; i<count; i++) {
|
|
||||||
var searchTerm = gSearchSession.searchTerms.GetElementAt(i).QueryInterface(nsIMsgSearchTerm);
|
|
||||||
|
|
||||||
// get the "and" / "or" value from the first term
|
// get the "and" / "or" value from the first term
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
if (searchTerm.booleanAnd)
|
if (searchTerm.booleanAnd)
|
||||||
|
|
|
@ -361,7 +361,7 @@ SearchSpec.prototype = {
|
||||||
let session = this.session;
|
let session = this.session;
|
||||||
|
|
||||||
// clear out our current terms and scope
|
// clear out our current terms and scope
|
||||||
session.searchTerms.QueryInterface(Ci.nsISupportsArray).Clear();
|
session.searchTerms.clear();
|
||||||
session.clearScopes();
|
session.clearScopes();
|
||||||
|
|
||||||
// the scope logic needs to know if any terms look at the body attribute.
|
// the scope logic needs to know if any terms look at the body attribute.
|
||||||
|
|
|
@ -137,9 +137,9 @@ function filterEditorOnLoad()
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy the search terms
|
// copy the search terms
|
||||||
for (let i = 0; i < copiedFilter.searchTerms.Count(); i++)
|
for (let i = 0; i < copiedFilter.searchTerms.length; i++)
|
||||||
{
|
{
|
||||||
var searchTerm = copiedFilter.searchTerms.QueryElementAt(i,
|
let searchTerm = copiedFilter.searchTerms.queryElementAt(i,
|
||||||
Components.interfaces.nsIMsgSearchTerm);
|
Components.interfaces.nsIMsgSearchTerm);
|
||||||
|
|
||||||
var newTerm = newFilter.createTerm();
|
var newTerm = newFilter.createTerm();
|
||||||
|
|
|
@ -173,8 +173,8 @@ function initializeBooleanWidgets()
|
||||||
|
|
||||||
function initializeSearchRows(scope, searchTerms)
|
function initializeSearchRows(scope, searchTerms)
|
||||||
{
|
{
|
||||||
for (var i = 0; i < searchTerms.Count(); i++) {
|
for (let i = 0; i < searchTerms.length; i++) {
|
||||||
var searchTerm = searchTerms.QueryElementAt(i, nsIMsgSearchTerm);
|
let searchTerm = searchTerms.queryElementAt(i, nsIMsgSearchTerm);
|
||||||
createSearchRow(i, scope, searchTerm, false);
|
createSearchRow(i, scope, searchTerm, false);
|
||||||
gTotalSearchTerms++;
|
gTotalSearchTerms++;
|
||||||
}
|
}
|
||||||
|
@ -470,7 +470,7 @@ function removeSearchRow(index)
|
||||||
|
|
||||||
|
|
||||||
if (searchTermObj.searchTerm) {
|
if (searchTermObj.searchTerm) {
|
||||||
gSearchRemovedTerms[gSearchRemovedTerms.length] = searchTermObj.searchTerm;
|
gSearchRemovedTerms.push(searchTermObj.searchTerm);
|
||||||
} else {
|
} else {
|
||||||
//dump("That wasn't real. ignoring \n");
|
//dump("That wasn't real. ignoring \n");
|
||||||
}
|
}
|
||||||
|
@ -482,7 +482,7 @@ function removeSearchRow(index)
|
||||||
}
|
}
|
||||||
|
|
||||||
// save the search terms from the UI back to the actual search terms
|
// save the search terms from the UI back to the actual search terms
|
||||||
// searchTerms: nsISupportsArray of terms
|
// searchTerms: nsIMutableArray of terms
|
||||||
// termOwner: object which can contain and create the terms
|
// termOwner: object which can contain and create the terms
|
||||||
// (will be unnecessary if we just make terms creatable
|
// (will be unnecessary if we just make terms creatable
|
||||||
// via XPCOM)
|
// via XPCOM)
|
||||||
|
@ -491,7 +491,7 @@ function saveSearchTerms(searchTerms, termOwner)
|
||||||
var matchAll = gSearchBooleanRadiogroup.value == 'matchAll';
|
var matchAll = gSearchBooleanRadiogroup.value == 'matchAll';
|
||||||
var i;
|
var i;
|
||||||
for (i = 0; i < gSearchRemovedTerms.length; i++)
|
for (i = 0; i < gSearchRemovedTerms.length; i++)
|
||||||
searchTerms.RemoveElement(gSearchRemovedTerms[i]);
|
searchTerms.removeElementAt(searchTerms.indexOf(0, gSearchRemovedTerms[i]));
|
||||||
|
|
||||||
for (i = 0; i<gSearchTerms.length; i++) {
|
for (i = 0; i<gSearchTerms.length; i++) {
|
||||||
try {
|
try {
|
||||||
|
@ -510,7 +510,7 @@ function saveSearchTerms(searchTerms, termOwner)
|
||||||
// but we need to make the array longer anyway
|
// but we need to make the array longer anyway
|
||||||
termOwner.appendTerm(searchTerm);
|
termOwner.appendTerm(searchTerm);
|
||||||
}
|
}
|
||||||
searchTerms.SetElementAt(i, searchTerm);
|
searchTerms.replaceElementAt(searchTerm, i, /* weak */ false);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
dump("** Error saving element " + i + ": " + ex + "\n");
|
dump("** Error saving element " + i + ": " + ex + "\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,18 +6,9 @@
|
||||||
|
|
||||||
#include "nsISupports.idl"
|
#include "nsISupports.idl"
|
||||||
#include "nsMsgFilterCore.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 nsIArray;
|
||||||
|
interface nsIMutableArray;
|
||||||
interface nsIOutputStream;
|
interface nsIOutputStream;
|
||||||
interface nsIMsgFilterCustomAction;
|
interface nsIMsgFilterCustomAction;
|
||||||
interface nsIMsgFilterList;
|
interface nsIMsgFilterList;
|
||||||
|
@ -87,7 +78,7 @@ interface nsIMsgFilter : nsISupports {
|
||||||
|
|
||||||
nsIMsgSearchTerm createTerm();
|
nsIMsgSearchTerm createTerm();
|
||||||
|
|
||||||
attribute nsISupportsArray searchTerms;
|
attribute nsIMutableArray searchTerms;
|
||||||
|
|
||||||
attribute nsIMsgSearchScopeTerm scope;
|
attribute nsIMsgSearchScopeTerm scope;
|
||||||
|
|
||||||
|
|
|
@ -6,21 +6,12 @@
|
||||||
#include "nsISupports.idl"
|
#include "nsISupports.idl"
|
||||||
#include "nsIMsgSearchValue.idl"
|
#include "nsIMsgSearchValue.idl"
|
||||||
|
|
||||||
|
interface nsIMutableArray;
|
||||||
interface nsIMsgSearchAdapter;
|
interface nsIMsgSearchAdapter;
|
||||||
interface nsIMsgSearchTerm;
|
interface nsIMsgSearchTerm;
|
||||||
interface nsIMsgSearchNotify;
|
interface nsIMsgSearchNotify;
|
||||||
interface nsIMsgHdr;
|
interface nsIMsgHdr;
|
||||||
interface nsIMsgDatabase;
|
interface nsIMsgDatabase;
|
||||||
// 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 nsIMsgWindow;
|
interface nsIMsgWindow;
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -50,7 +41,7 @@ interface nsIMsgSearchSession : nsISupports {
|
||||||
in boolean BooleanAND,
|
in boolean BooleanAND,
|
||||||
in string customString);
|
in string customString);
|
||||||
|
|
||||||
readonly attribute nsISupportsArray searchTerms;
|
attribute nsIMutableArray searchTerms;
|
||||||
|
|
||||||
nsIMsgSearchTerm createTerm();
|
nsIMsgSearchTerm createTerm();
|
||||||
void appendTerm(in nsIMsgSearchTerm term);
|
void appendTerm(in nsIMsgSearchTerm term);
|
||||||
|
|
|
@ -5,16 +5,7 @@
|
||||||
|
|
||||||
#include "nsISupports.idl"
|
#include "nsISupports.idl"
|
||||||
#include "nsMsgSearchCore.idl"
|
#include "nsMsgSearchCore.idl"
|
||||||
// Disable deprecation warnings generated by nsISupportsArray and associated
|
interface nsIArray;
|
||||||
// classes.
|
|
||||||
%{C++
|
|
||||||
#if defined(__GNUC__)
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
#pragma warning (disable : 4996)
|
|
||||||
#endif
|
|
||||||
%}
|
|
||||||
interface nsISupportsArray;
|
|
||||||
|
|
||||||
[scriptable, uuid(b07f1cb6-fae9-4d92-9edb-03f9ad249c66)]
|
[scriptable, uuid(b07f1cb6-fae9-4d92-9edb-03f9ad249c66)]
|
||||||
interface nsIMsgSearchValidityTable : nsISupports {
|
interface nsIMsgSearchValidityTable : nsISupports {
|
||||||
|
@ -33,7 +24,7 @@ interface nsIMsgSearchValidityTable : nsISupports {
|
||||||
boolean getValidButNotShown(in nsMsgSearchAttribValue attrib,
|
boolean getValidButNotShown(in nsMsgSearchAttribValue attrib,
|
||||||
in nsMsgSearchOpValue op);
|
in nsMsgSearchOpValue op);
|
||||||
|
|
||||||
[noscript] void validateTerms(in nsISupportsArray terms);
|
[noscript] void validateTerms(in nsIArray terms);
|
||||||
|
|
||||||
readonly attribute long numAvailAttribs;
|
readonly attribute long numAvailAttribs;
|
||||||
|
|
||||||
|
|
|
@ -29,20 +29,20 @@ class nsIMsgSearchScopeTerm;
|
||||||
class nsMsgSearchAdapter : public nsIMsgSearchAdapter
|
class nsMsgSearchAdapter : public nsIMsgSearchAdapter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsMsgSearchAdapter (nsIMsgSearchScopeTerm*, nsISupportsArray *);
|
nsMsgSearchAdapter (nsIMsgSearchScopeTerm*, nsIArray*);
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
NS_DECL_NSIMSGSEARCHADAPTER
|
NS_DECL_NSIMSGSEARCHADAPTER
|
||||||
|
|
||||||
nsIMsgSearchScopeTerm *m_scope;
|
nsIMsgSearchScopeTerm *m_scope;
|
||||||
nsCOMPtr<nsISupportsArray> m_searchTerms; /* linked list of criteria terms */
|
nsCOMPtr<nsIArray> m_searchTerms; /* linked list of criteria terms */
|
||||||
|
|
||||||
bool m_abortCalled;
|
bool m_abortCalled;
|
||||||
nsString m_defaultCharset;
|
nsString m_defaultCharset;
|
||||||
bool m_forceAsciiSearch;
|
bool m_forceAsciiSearch;
|
||||||
|
|
||||||
static nsresult EncodeImap (char **ppEncoding,
|
static nsresult EncodeImap (char **ppEncoding,
|
||||||
nsISupportsArray *searchTerms,
|
nsIArray *searchTerms,
|
||||||
const char16_t *srcCharset,
|
const char16_t *srcCharset,
|
||||||
const char16_t *destCharset,
|
const char16_t *destCharset,
|
||||||
bool reallyDredd = false);
|
bool reallyDredd = false);
|
||||||
|
|
|
@ -26,7 +26,7 @@ public:
|
||||||
NS_DECL_NSIMSGSEARCHSCOPETERM
|
NS_DECL_NSIMSGSEARCHSCOPETERM
|
||||||
|
|
||||||
nsresult TimeSlice (bool *aDone);
|
nsresult TimeSlice (bool *aDone);
|
||||||
nsresult InitializeAdapter (nsISupportsArray *termList);
|
nsresult InitializeAdapter (nsIArray *termList);
|
||||||
|
|
||||||
char *GetStatusBarName ();
|
char *GetStatusBarName ();
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
// this file implements the nsMsgFilter interface
|
// this file implements the nsMsgFilter interface
|
||||||
|
|
||||||
#include "msgCore.h"
|
#include "msgCore.h"
|
||||||
|
#include "nsArray.h"
|
||||||
#include "nsMsgBaseCID.h"
|
#include "nsMsgBaseCID.h"
|
||||||
#include "nsIMsgHdr.h"
|
#include "nsIMsgHdr.h"
|
||||||
#include "nsMsgFilterList.h" // for kFileVersion
|
#include "nsMsgFilterList.h" // for kFileVersion
|
||||||
|
@ -17,13 +18,13 @@
|
||||||
#include "nsIMsgIncomingServer.h"
|
#include "nsIMsgIncomingServer.h"
|
||||||
#include "nsMsgSearchValue.h"
|
#include "nsMsgSearchValue.h"
|
||||||
#include "nsMsgI18N.h"
|
#include "nsMsgI18N.h"
|
||||||
|
#include "nsIMutableArray.h"
|
||||||
#include "nsIOutputStream.h"
|
#include "nsIOutputStream.h"
|
||||||
#include "nsIStringBundle.h"
|
#include "nsIStringBundle.h"
|
||||||
#include "nsDateTimeFormatCID.h"
|
#include "nsDateTimeFormatCID.h"
|
||||||
#include "nsComponentManagerUtils.h"
|
#include "nsComponentManagerUtils.h"
|
||||||
#include "nsServiceManagerUtils.h"
|
#include "nsServiceManagerUtils.h"
|
||||||
#include "nsIMsgFilterService.h"
|
#include "nsIMsgFilterService.h"
|
||||||
#include "nsIMutableArray.h"
|
|
||||||
#include "prmem.h"
|
#include "prmem.h"
|
||||||
#include "mozilla/ArrayUtils.h"
|
#include "mozilla/ArrayUtils.h"
|
||||||
#include "mozilla/Services.h"
|
#include "mozilla/Services.h"
|
||||||
|
@ -172,9 +173,8 @@ nsMsgFilter::nsMsgFilter():
|
||||||
m_filterList(nullptr),
|
m_filterList(nullptr),
|
||||||
m_expressionTree(nullptr)
|
m_expressionTree(nullptr)
|
||||||
{
|
{
|
||||||
nsresult rv = NS_NewISupportsArray(getter_AddRefs(m_termList));
|
m_termList = nsArray::Create();
|
||||||
if (NS_FAILED(rv))
|
NS_ASSERTION(m_termList, "Failed to allocate a nsIMutableArray for m_termList");
|
||||||
NS_ASSERTION(false, "Failed to allocate a nsISupportsArray for nsMsgFilter");
|
|
||||||
|
|
||||||
m_type = nsMsgFilterType::InboxRule | nsMsgFilterType::Manual;
|
m_type = nsMsgFilterType::InboxRule | nsMsgFilterType::Manual;
|
||||||
}
|
}
|
||||||
|
@ -245,7 +245,7 @@ NS_IMETHODIMP nsMsgFilter::AppendTerm(nsIMsgSearchTerm * aTerm)
|
||||||
// invalidate expression tree if we're changing the terms
|
// invalidate expression tree if we're changing the terms
|
||||||
delete m_expressionTree;
|
delete m_expressionTree;
|
||||||
m_expressionTree = nullptr;
|
m_expressionTree = nullptr;
|
||||||
return m_termList->AppendElement(static_cast<nsISupports*>(aTerm));
|
return m_termList->AppendElement(aTerm, /* weak = */ false);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
@ -442,7 +442,7 @@ NS_IMETHODIMP nsMsgFilter::GetTerm(int32_t termIndex,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsMsgFilter::GetSearchTerms(nsISupportsArray **aResult)
|
NS_IMETHODIMP nsMsgFilter::GetSearchTerms(nsIMutableArray **aResult)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aResult);
|
NS_ENSURE_ARG_POINTER(aResult);
|
||||||
// caller can change m_termList, which can invalidate m_expressionTree.
|
// caller can change m_termList, which can invalidate m_expressionTree.
|
||||||
|
@ -452,7 +452,7 @@ NS_IMETHODIMP nsMsgFilter::GetSearchTerms(nsISupportsArray **aResult)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsMsgFilter::SetSearchTerms(nsISupportsArray *aSearchList)
|
NS_IMETHODIMP nsMsgFilter::SetSearchTerms(nsIMutableArray *aSearchList)
|
||||||
{
|
{
|
||||||
delete m_expressionTree;
|
delete m_expressionTree;
|
||||||
m_expressionTree = nullptr;
|
m_expressionTree = nullptr;
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "nsIMsgFilter.h"
|
#include "nsIMsgFilter.h"
|
||||||
#include "nsIMsgSearchScopeTerm.h"
|
#include "nsIMsgSearchScopeTerm.h"
|
||||||
#include "nsMsgSearchBoolExpression.h"
|
#include "nsMsgSearchBoolExpression.h"
|
||||||
|
#include "nsIMutableArray.h"
|
||||||
#include "nsIDateTimeFormat.h"
|
#include "nsIDateTimeFormat.h"
|
||||||
#include "nsIMsgFilterCustomAction.h"
|
#include "nsIMsgFilterCustomAction.h"
|
||||||
|
|
||||||
|
@ -92,7 +93,7 @@ protected:
|
||||||
bool m_temporary;
|
bool m_temporary;
|
||||||
bool m_unparseable;
|
bool m_unparseable;
|
||||||
nsIMsgFilterList *m_filterList; /* owning filter list */
|
nsIMsgFilterList *m_filterList; /* owning filter list */
|
||||||
nsCOMPtr<nsISupportsArray> m_termList; /* linked list of criteria terms */
|
nsCOMPtr<nsIMutableArray> m_termList; /* linked list of criteria terms */
|
||||||
nsCOMPtr<nsIMsgSearchScopeTerm> m_scope; /* default for mail rules is inbox, but news rules could
|
nsCOMPtr<nsIMsgSearchScopeTerm> m_scope; /* default for mail rules is inbox, but news rules could
|
||||||
have a newsgroup - LDAP would be invalid */
|
have a newsgroup - LDAP would be invalid */
|
||||||
nsTArray<nsCOMPtr<nsIMsgRuleAction> > m_actionList;
|
nsTArray<nsCOMPtr<nsIMsgRuleAction> > m_actionList;
|
||||||
|
|
|
@ -1146,11 +1146,11 @@ nsresult nsMsgFilterList::ComputeArbitraryHeaders()
|
||||||
rv = GetFilterAt(index, getter_AddRefs(filter));
|
rv = GetFilterAt(index, getter_AddRefs(filter));
|
||||||
if (!(NS_SUCCEEDED(rv) && filter)) continue;
|
if (!(NS_SUCCEEDED(rv) && filter)) continue;
|
||||||
|
|
||||||
nsCOMPtr <nsISupportsArray> searchTerms;
|
nsCOMPtr<nsIMutableArray> searchTerms;
|
||||||
uint32_t numSearchTerms = 0;
|
uint32_t numSearchTerms = 0;
|
||||||
filter->GetSearchTerms(getter_AddRefs(searchTerms));
|
filter->GetSearchTerms(getter_AddRefs(searchTerms));
|
||||||
if (searchTerms)
|
if (searchTerms)
|
||||||
searchTerms->Count(&numSearchTerms);
|
searchTerms->GetLength(&numSearchTerms);
|
||||||
for (uint32_t i = 0; i < numSearchTerms; i++)
|
for (uint32_t i = 0; i < numSearchTerms; i++)
|
||||||
{
|
{
|
||||||
filter->GetTerm(i, &attrib, nullptr, nullptr, nullptr, arbitraryHeader);
|
filter->GetTerm(i, &attrib, nullptr, nullptr, nullptr, arbitraryHeader);
|
||||||
|
|
|
@ -383,7 +383,7 @@ nsresult nsMsgFilterAfterTheFact::RunNextFilter()
|
||||||
rv = m_filters->GetFilterAt(m_curFilterIndex++, getter_AddRefs(m_curFilter));
|
rv = m_filters->GetFilterAt(m_curFilterIndex++, getter_AddRefs(m_curFilter));
|
||||||
CONTINUE_IF_FAILURE(rv, "Could not get filter at index");
|
CONTINUE_IF_FAILURE(rv, "Could not get filter at index");
|
||||||
|
|
||||||
nsCOMPtr <nsISupportsArray> searchTerms;
|
nsCOMPtr<nsIMutableArray> searchTerms;
|
||||||
rv = m_curFilter->GetSearchTerms(getter_AddRefs(searchTerms));
|
rv = m_curFilter->GetSearchTerms(getter_AddRefs(searchTerms));
|
||||||
CONTINUE_IF_FAILURE(rv, "Could not get searchTerms");
|
CONTINUE_IF_FAILURE(rv, "Could not get searchTerms");
|
||||||
|
|
||||||
|
@ -393,8 +393,8 @@ nsresult nsMsgFilterAfterTheFact::RunNextFilter()
|
||||||
BREAK_IF_FAILURE(rv, "Failed to get search session");
|
BREAK_IF_FAILURE(rv, "Failed to get search session");
|
||||||
|
|
||||||
nsMsgSearchScopeValue searchScope = nsMsgSearchScope::offlineMail;
|
nsMsgSearchScopeValue searchScope = nsMsgSearchScope::offlineMail;
|
||||||
uint32_t termCount;
|
uint32_t termCount = 0;
|
||||||
searchTerms->Count(&termCount);
|
searchTerms->GetLength(&termCount);
|
||||||
for (uint32_t termIndex = 0; termIndex < termCount; termIndex++)
|
for (uint32_t termIndex = 0; termIndex < termCount; termIndex++)
|
||||||
{
|
{
|
||||||
nsCOMPtr <nsIMsgSearchTerm> term;
|
nsCOMPtr <nsIMsgSearchTerm> term;
|
||||||
|
|
|
@ -10,18 +10,11 @@
|
||||||
#include "nsIMsgHdr.h"
|
#include "nsIMsgHdr.h"
|
||||||
#include "nsMsgSearchImap.h"
|
#include "nsMsgSearchImap.h"
|
||||||
#include "prmem.h"
|
#include "prmem.h"
|
||||||
// Disable deprecation warnings generated by nsISupportsArray and associated
|
#include "nsIArray.h"
|
||||||
// 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 IMAP mail folders
|
||||||
|
|
||||||
|
|
||||||
nsMsgSearchOnlineMail::nsMsgSearchOnlineMail (nsMsgSearchScopeTerm *scope, nsISupportsArray *termList) : nsMsgSearchAdapter (scope, termList)
|
nsMsgSearchOnlineMail::nsMsgSearchOnlineMail (nsMsgSearchScopeTerm *scope, nsIArray *termList) : nsMsgSearchAdapter (scope, termList)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +76,7 @@ nsresult nsMsgSearchOnlineMail::Search (bool *aDone)
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsMsgSearchOnlineMail::Encode (nsCString& pEncoding,
|
nsresult nsMsgSearchOnlineMail::Encode (nsCString& pEncoding,
|
||||||
nsISupportsArray *searchTerms,
|
nsIArray *searchTerms,
|
||||||
const char16_t *destCharset)
|
const char16_t *destCharset)
|
||||||
{
|
{
|
||||||
nsCString imapTerms;
|
nsCString imapTerms;
|
||||||
|
@ -95,7 +88,7 @@ nsresult nsMsgSearchOnlineMail::Encode (nsCString& pEncoding,
|
||||||
if (true) // !(srcCharset & CODESET_MASK == STATEFUL || srcCharset & CODESET_MASK == WIDECHAR) ) //assume all single/multiple bytes charset has ascii as subset
|
if (true) // !(srcCharset & CODESET_MASK == STATEFUL || srcCharset & CODESET_MASK == WIDECHAR) ) //assume all single/multiple bytes charset has ascii as subset
|
||||||
{
|
{
|
||||||
uint32_t termCount;
|
uint32_t termCount;
|
||||||
searchTerms->Count(&termCount);
|
searchTerms->GetLength(&termCount);
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
|
|
||||||
for (i = 0; i < termCount && asciiOnly; i++)
|
for (i = 0; i < termCount && asciiOnly; i++)
|
||||||
|
|
|
@ -14,14 +14,7 @@
|
||||||
#include "nsMsgSearchTerm.h"
|
#include "nsMsgSearchTerm.h"
|
||||||
#include "nsMsgResultElement.h"
|
#include "nsMsgResultElement.h"
|
||||||
#include "nsIDBFolderInfo.h"
|
#include "nsIDBFolderInfo.h"
|
||||||
// Disable deprecation warnings generated by nsISupportsArray and associated
|
#include "nsIArray.h"
|
||||||
// classes.
|
|
||||||
#if defined(__GNUC__)
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
#pragma warning (disable : 4996)
|
|
||||||
#endif
|
|
||||||
#include "nsISupportsArray.h"
|
|
||||||
#include "nsMsgBaseCID.h"
|
#include "nsMsgBaseCID.h"
|
||||||
#include "nsMsgSearchValue.h"
|
#include "nsMsgSearchValue.h"
|
||||||
#include "nsIMsgLocalMailFolder.h"
|
#include "nsIMsgLocalMailFolder.h"
|
||||||
|
@ -237,7 +230,7 @@ void nsMsgSearchBoolExpression::GenerateEncodeStr(nsCString * buffer)
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS_INHERITED(nsMsgSearchOfflineMail, nsMsgSearchAdapter, nsIUrlListener)
|
NS_IMPL_ISUPPORTS_INHERITED(nsMsgSearchOfflineMail, nsMsgSearchAdapter, nsIUrlListener)
|
||||||
|
|
||||||
nsMsgSearchOfflineMail::nsMsgSearchOfflineMail (nsIMsgSearchScopeTerm *scope, nsISupportsArray *termList) : nsMsgSearchAdapter (scope, termList)
|
nsMsgSearchOfflineMail::nsMsgSearchOfflineMail (nsIMsgSearchScopeTerm *scope, nsIArray *termList) : nsMsgSearchAdapter (scope, termList)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,7 +303,7 @@ nsresult nsMsgSearchOfflineMail::OpenSummaryFile ()
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsMsgSearchOfflineMail::MatchTermsForFilter(nsIMsgDBHdr *msgToMatch,
|
nsMsgSearchOfflineMail::MatchTermsForFilter(nsIMsgDBHdr *msgToMatch,
|
||||||
nsISupportsArray *termList,
|
nsIArray *termList,
|
||||||
const char *defaultCharset,
|
const char *defaultCharset,
|
||||||
nsIMsgSearchScopeTerm * scope,
|
nsIMsgSearchScopeTerm * scope,
|
||||||
nsIMsgDatabase * db,
|
nsIMsgDatabase * db,
|
||||||
|
@ -325,7 +318,7 @@ nsMsgSearchOfflineMail::MatchTermsForFilter(nsIMsgDBHdr *msgToMatch,
|
||||||
// static method which matches a header against a list of search terms.
|
// static method which matches a header against a list of search terms.
|
||||||
nsresult
|
nsresult
|
||||||
nsMsgSearchOfflineMail::MatchTermsForSearch(nsIMsgDBHdr *msgToMatch,
|
nsMsgSearchOfflineMail::MatchTermsForSearch(nsIMsgDBHdr *msgToMatch,
|
||||||
nsISupportsArray* termList,
|
nsIArray* termList,
|
||||||
const char *defaultCharset,
|
const char *defaultCharset,
|
||||||
nsIMsgSearchScopeTerm *scope,
|
nsIMsgSearchScopeTerm *scope,
|
||||||
nsIMsgDatabase *db,
|
nsIMsgDatabase *db,
|
||||||
|
@ -336,7 +329,7 @@ nsMsgSearchOfflineMail::MatchTermsForSearch(nsIMsgDBHdr *msgToMatch,
|
||||||
return MatchTerms(msgToMatch, termList, defaultCharset, scope, db, nullptr, 0, false, aExpressionTree, pResult);
|
return MatchTerms(msgToMatch, termList, defaultCharset, scope, db, nullptr, 0, false, aExpressionTree, pResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsMsgSearchOfflineMail::ConstructExpressionTree(nsISupportsArray * termList,
|
nsresult nsMsgSearchOfflineMail::ConstructExpressionTree(nsIArray *termList,
|
||||||
uint32_t termCount,
|
uint32_t termCount,
|
||||||
uint32_t &aStartPosInList,
|
uint32_t &aStartPosInList,
|
||||||
nsMsgSearchBoolExpression ** aExpressionTree)
|
nsMsgSearchBoolExpression ** aExpressionTree)
|
||||||
|
@ -664,7 +657,7 @@ nsresult nsMsgSearchOfflineMail::ProcessSearchTerm(nsIMsgDBHdr *msgToMatch,
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsMsgSearchOfflineMail::MatchTerms(nsIMsgDBHdr *msgToMatch,
|
nsresult nsMsgSearchOfflineMail::MatchTerms(nsIMsgDBHdr *msgToMatch,
|
||||||
nsISupportsArray * termList,
|
nsIArray *termList,
|
||||||
const char *defaultCharset,
|
const char *defaultCharset,
|
||||||
nsIMsgSearchScopeTerm * scope,
|
nsIMsgSearchScopeTerm * scope,
|
||||||
nsIMsgDatabase * db,
|
nsIMsgDatabase * db,
|
||||||
|
@ -681,7 +674,7 @@ nsresult nsMsgSearchOfflineMail::MatchTerms(nsIMsgDBHdr *msgToMatch,
|
||||||
{
|
{
|
||||||
uint32_t initialPos = 0;
|
uint32_t initialPos = 0;
|
||||||
uint32_t count;
|
uint32_t count;
|
||||||
termList->Count(&count);
|
termList->GetLength(&count);
|
||||||
err = ConstructExpressionTree(termList, count, initialPos, aExpressionTree);
|
err = ConstructExpressionTree(termList, count, initialPos, aExpressionTree);
|
||||||
if (NS_FAILED(err))
|
if (NS_FAILED(err))
|
||||||
return err;
|
return err;
|
||||||
|
@ -824,7 +817,7 @@ NS_IMETHODIMP nsMsgSearchOfflineMail::OnStopRunningUrl(nsIURI *url, nsresult aEx
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsMsgSearchOfflineNews::nsMsgSearchOfflineNews (nsIMsgSearchScopeTerm *scope, nsISupportsArray *termList) : nsMsgSearchOfflineMail (scope, termList)
|
nsMsgSearchOfflineNews::nsMsgSearchOfflineNews (nsIMsgSearchScopeTerm *scope, nsIArray *termList) : nsMsgSearchOfflineMail (scope, termList)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ class nsMsgSearchBoolExpression;
|
||||||
class nsMsgSearchOfflineMail : public nsMsgSearchAdapter, public nsIUrlListener
|
class nsMsgSearchOfflineMail : public nsMsgSearchAdapter, public nsIUrlListener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsMsgSearchOfflineMail (nsIMsgSearchScopeTerm*, nsISupportsArray *);
|
nsMsgSearchOfflineMail (nsIMsgSearchScopeTerm*, nsIArray *);
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ public:
|
||||||
NS_IMETHOD AddResultElement (nsIMsgDBHdr *) override;
|
NS_IMETHOD AddResultElement (nsIMsgDBHdr *) override;
|
||||||
|
|
||||||
static nsresult MatchTermsForFilter(nsIMsgDBHdr * msgToMatch,
|
static nsresult MatchTermsForFilter(nsIMsgDBHdr * msgToMatch,
|
||||||
nsISupportsArray *termList,
|
nsIArray *termList,
|
||||||
const char *defaultCharset,
|
const char *defaultCharset,
|
||||||
nsIMsgSearchScopeTerm *scope,
|
nsIMsgSearchScopeTerm *scope,
|
||||||
nsIMsgDatabase * db,
|
nsIMsgDatabase * db,
|
||||||
|
@ -46,7 +46,7 @@ public:
|
||||||
bool *pResult);
|
bool *pResult);
|
||||||
|
|
||||||
static nsresult MatchTermsForSearch(nsIMsgDBHdr * msgTomatch,
|
static nsresult MatchTermsForSearch(nsIMsgDBHdr * msgTomatch,
|
||||||
nsISupportsArray * termList,
|
nsIArray *termList,
|
||||||
const char *defaultCharset,
|
const char *defaultCharset,
|
||||||
nsIMsgSearchScopeTerm *scope,
|
nsIMsgSearchScopeTerm *scope,
|
||||||
nsIMsgDatabase *db,
|
nsIMsgDatabase *db,
|
||||||
|
@ -67,7 +67,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
virtual ~nsMsgSearchOfflineMail();
|
virtual ~nsMsgSearchOfflineMail();
|
||||||
static nsresult MatchTerms(nsIMsgDBHdr *msgToMatch,
|
static nsresult MatchTerms(nsIMsgDBHdr *msgToMatch,
|
||||||
nsISupportsArray *termList,
|
nsIArray *termList,
|
||||||
const char *defaultCharset,
|
const char *defaultCharset,
|
||||||
nsIMsgSearchScopeTerm *scope,
|
nsIMsgSearchScopeTerm *scope,
|
||||||
nsIMsgDatabase * db,
|
nsIMsgDatabase * db,
|
||||||
|
@ -77,7 +77,7 @@ protected:
|
||||||
nsMsgSearchBoolExpression ** aExpressionTree,
|
nsMsgSearchBoolExpression ** aExpressionTree,
|
||||||
bool *pResult);
|
bool *pResult);
|
||||||
|
|
||||||
static nsresult ConstructExpressionTree(nsISupportsArray * termList,
|
static nsresult ConstructExpressionTree(nsIArray *termList,
|
||||||
uint32_t termCount,
|
uint32_t termCount,
|
||||||
uint32_t &aStartPosInList,
|
uint32_t &aStartPosInList,
|
||||||
nsMsgSearchBoolExpression ** aExpressionTree);
|
nsMsgSearchBoolExpression ** aExpressionTree);
|
||||||
|
@ -91,7 +91,7 @@ protected:
|
||||||
class nsMsgSearchOfflineNews : public nsMsgSearchOfflineMail
|
class nsMsgSearchOfflineNews : public nsMsgSearchOfflineMail
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsMsgSearchOfflineNews (nsIMsgSearchScopeTerm*, nsISupportsArray *);
|
nsMsgSearchOfflineNews (nsIMsgSearchScopeTerm*, nsIArray*);
|
||||||
virtual ~nsMsgSearchOfflineNews ();
|
virtual ~nsMsgSearchOfflineNews ();
|
||||||
NS_IMETHOD ValidateTerms () override;
|
NS_IMETHOD ValidateTerms () override;
|
||||||
|
|
||||||
|
|
|
@ -24,14 +24,7 @@
|
||||||
#include "nsServiceManagerUtils.h"
|
#include "nsServiceManagerUtils.h"
|
||||||
#include "nsMemory.h"
|
#include "nsMemory.h"
|
||||||
#include "nsMsgMessageFlags.h"
|
#include "nsMsgMessageFlags.h"
|
||||||
// Disable deprecation warnings generated by nsISupportsArray and associated
|
#include "nsIArray.h"
|
||||||
// classes.
|
|
||||||
#if defined(__GNUC__)
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
#pragma warning (disable : 4996)
|
|
||||||
#endif
|
|
||||||
#include "nsISupportsArray.h"
|
|
||||||
#include "nsAlgorithm.h"
|
#include "nsAlgorithm.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
|
@ -89,7 +82,7 @@ NS_IMETHODIMP nsMsgSearchAdapter::OpenResultElement(nsMsgResultElement *)
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS(nsMsgSearchAdapter, nsIMsgSearchAdapter)
|
NS_IMPL_ISUPPORTS(nsMsgSearchAdapter, nsIMsgSearchAdapter)
|
||||||
|
|
||||||
nsMsgSearchAdapter::nsMsgSearchAdapter(nsIMsgSearchScopeTerm *scope, nsISupportsArray *searchTerms)
|
nsMsgSearchAdapter::nsMsgSearchAdapter(nsIMsgSearchScopeTerm *scope, nsIArray *searchTerms)
|
||||||
: m_searchTerms(searchTerms)
|
: m_searchTerms(searchTerms)
|
||||||
{
|
{
|
||||||
m_scope = scope;
|
m_scope = scope;
|
||||||
|
@ -667,7 +660,7 @@ nsresult nsMsgSearchAdapter::EncodeImapValue(char *encoding, const char *value,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
nsresult nsMsgSearchAdapter::EncodeImap (char **ppOutEncoding, nsISupportsArray *searchTerms, const char16_t *srcCharset, const char16_t *destCharset, bool reallyDredd)
|
nsresult nsMsgSearchAdapter::EncodeImap (char **ppOutEncoding, nsIArray *searchTerms, const char16_t *srcCharset, const char16_t *destCharset, bool reallyDredd)
|
||||||
{
|
{
|
||||||
// i've left the old code (before using CBoolExpression for debugging purposes to make sure that
|
// i've left the old code (before using CBoolExpression for debugging purposes to make sure that
|
||||||
// the new code generates the same encoding string as the old code.....
|
// the new code generates the same encoding string as the old code.....
|
||||||
|
@ -676,7 +669,7 @@ nsresult nsMsgSearchAdapter::EncodeImap (char **ppOutEncoding, nsISupportsArray
|
||||||
*ppOutEncoding = nullptr;
|
*ppOutEncoding = nullptr;
|
||||||
|
|
||||||
uint32_t termCount;
|
uint32_t termCount;
|
||||||
searchTerms->Count(&termCount);
|
searchTerms->GetLength(&termCount);
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
|
|
||||||
// create our expression
|
// create our expression
|
||||||
|
@ -823,14 +816,14 @@ nsMsgSearchValidityTable::GetNumAvailAttribs(int32_t *aResult)
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsMsgSearchValidityTable::ValidateTerms (nsISupportsArray *searchTerms)
|
nsMsgSearchValidityTable::ValidateTerms (nsIArray *searchTerms)
|
||||||
{
|
{
|
||||||
nsresult err = NS_OK;
|
nsresult err = NS_OK;
|
||||||
uint32_t count;
|
uint32_t count;
|
||||||
|
|
||||||
NS_ENSURE_ARG(searchTerms);
|
NS_ENSURE_ARG(searchTerms);
|
||||||
|
|
||||||
searchTerms->Count(&count);
|
searchTerms->GetLength(&count);
|
||||||
for (uint32_t i = 0; i < count; i++)
|
for (uint32_t i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIMsgSearchTerm> pTerm;
|
nsCOMPtr<nsIMsgSearchTerm> pTerm;
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
class nsMsgSearchOnlineMail : public nsMsgSearchAdapter
|
class nsMsgSearchOnlineMail : public nsMsgSearchAdapter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsMsgSearchOnlineMail (nsMsgSearchScopeTerm *scope, nsISupportsArray *termList);
|
nsMsgSearchOnlineMail (nsMsgSearchScopeTerm *scope, nsIArray *termList);
|
||||||
virtual ~nsMsgSearchOnlineMail ();
|
virtual ~nsMsgSearchOnlineMail ();
|
||||||
|
|
||||||
NS_IMETHOD ValidateTerms () override;
|
NS_IMETHOD ValidateTerms () override;
|
||||||
|
@ -23,7 +23,7 @@ public:
|
||||||
NS_IMETHOD AddResultElement (nsIMsgDBHdr *) override;
|
NS_IMETHOD AddResultElement (nsIMsgDBHdr *) override;
|
||||||
|
|
||||||
static nsresult Encode (nsCString& ppEncoding,
|
static nsresult Encode (nsCString& ppEncoding,
|
||||||
nsISupportsArray *searchTerms,
|
nsIArray *searchTerms,
|
||||||
const char16_t *destCharset);
|
const char16_t *destCharset);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,14 +15,7 @@
|
||||||
#include "nsIMsgDatabase.h"
|
#include "nsIMsgDatabase.h"
|
||||||
#include "nsMemory.h"
|
#include "nsMemory.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
// Disable deprecation warnings generated by nsISupportsArray and associated
|
#include "nsIArray.h"
|
||||||
// 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 IMAP mail folders
|
||||||
|
|
||||||
|
@ -40,7 +33,7 @@ const char *nsMsgSearchNews::m_kNntpSubject = "SUBJECT ";
|
||||||
const char *nsMsgSearchNews::m_kTermSeparator = "/";
|
const char *nsMsgSearchNews::m_kTermSeparator = "/";
|
||||||
|
|
||||||
|
|
||||||
nsMsgSearchNews::nsMsgSearchNews (nsMsgSearchScopeTerm *scope, nsISupportsArray *termList) : nsMsgSearchAdapter (scope, termList)
|
nsMsgSearchNews::nsMsgSearchNews (nsMsgSearchScopeTerm *scope, nsIArray *termList) : nsMsgSearchAdapter (scope, termList)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,7 +216,7 @@ nsresult nsMsgSearchNews::Encode (nsCString *outEncoding)
|
||||||
|
|
||||||
uint32_t numTerms;
|
uint32_t numTerms;
|
||||||
|
|
||||||
m_searchTerms->Count(&numTerms);
|
m_searchTerms->GetLength(&numTerms);
|
||||||
char **intermediateEncodings = new char * [numTerms];
|
char **intermediateEncodings = new char * [numTerms];
|
||||||
if (intermediateEncodings)
|
if (intermediateEncodings)
|
||||||
{
|
{
|
||||||
|
@ -252,7 +245,7 @@ nsresult nsMsgSearchNews::Encode (nsCString *outEncoding)
|
||||||
{
|
{
|
||||||
PL_strcpy (encoding, "?search");
|
PL_strcpy (encoding, "?search");
|
||||||
|
|
||||||
m_searchTerms->Count(&numTerms);
|
m_searchTerms->GetLength(&numTerms);
|
||||||
|
|
||||||
for (i = 0; i < numTerms; i++)
|
for (i = 0; i < numTerms; i++)
|
||||||
{
|
{
|
||||||
|
@ -335,7 +328,7 @@ void nsMsgSearchNews::CollateHits()
|
||||||
// in the results of each XPAT command. So if we fire 3 XPAT commands (one
|
// 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
|
// 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.
|
// fewer than 3 times, it matched some search terms, but not all.
|
||||||
m_searchTerms->Count(&termCount);
|
m_searchTerms->GetLength(&termCount);
|
||||||
}
|
}
|
||||||
uint32_t candidateCount = 0;
|
uint32_t candidateCount = 0;
|
||||||
uint32_t candidate = m_candidateHits[0];
|
uint32_t candidate = m_candidateHits[0];
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
class nsMsgSearchNews : public nsMsgSearchAdapter
|
class nsMsgSearchNews : public nsMsgSearchAdapter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsMsgSearchNews (nsMsgSearchScopeTerm *scope, nsISupportsArray *termList);
|
nsMsgSearchNews (nsMsgSearchScopeTerm *scope, nsIArray *termList);
|
||||||
virtual ~nsMsgSearchNews ();
|
virtual ~nsMsgSearchNews ();
|
||||||
|
|
||||||
NS_IMETHOD ValidateTerms () override;
|
NS_IMETHOD ValidateTerms () override;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "msgCore.h"
|
#include "msgCore.h"
|
||||||
|
#include "nsArray.h"
|
||||||
#include "nsMsgSearchCore.h"
|
#include "nsMsgSearchCore.h"
|
||||||
#include "nsMsgSearchAdapter.h"
|
#include "nsMsgSearchAdapter.h"
|
||||||
#include "nsMsgSearchBoolExpression.h"
|
#include "nsMsgSearchBoolExpression.h"
|
||||||
|
@ -32,9 +33,8 @@ nsMsgSearchSession::nsMsgSearchSession()
|
||||||
m_handlingError = false;
|
m_handlingError = false;
|
||||||
m_expressionTree = nullptr;
|
m_expressionTree = nullptr;
|
||||||
m_searchPaused = false;
|
m_searchPaused = false;
|
||||||
nsresult rv = NS_NewISupportsArray(getter_AddRefs(m_termList));
|
m_termList = nsArray::Create();
|
||||||
if (NS_FAILED(rv))
|
NS_ASSERTION(m_termList, "Failed to allocate a nsIMutableArray for m_termList");
|
||||||
NS_ASSERTION(false, "Failed to allocate a nsISupportsArray for nsMsgFilter");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsMsgSearchSession::~nsMsgSearchSession()
|
nsMsgSearchSession::~nsMsgSearchSession()
|
||||||
|
@ -62,7 +62,7 @@ nsMsgSearchSession::AddSearchTerm(nsMsgSearchAttribValue attrib,
|
||||||
boolOp, customString);
|
boolOp, customString);
|
||||||
NS_ENSURE_TRUE(pTerm, NS_ERROR_OUT_OF_MEMORY);
|
NS_ENSURE_TRUE(pTerm, NS_ERROR_OUT_OF_MEMORY);
|
||||||
|
|
||||||
m_termList->AppendElement(pTerm);
|
m_termList->AppendElement(pTerm, /* weak = */ false);
|
||||||
// force the expression tree to rebuild whenever we change the terms
|
// force the expression tree to rebuild whenever we change the terms
|
||||||
delete m_expressionTree;
|
delete m_expressionTree;
|
||||||
m_expressionTree = nullptr;
|
m_expressionTree = nullptr;
|
||||||
|
@ -76,11 +76,11 @@ nsMsgSearchSession::AppendTerm(nsIMsgSearchTerm *aTerm)
|
||||||
NS_ENSURE_TRUE(m_termList, NS_ERROR_NOT_INITIALIZED);
|
NS_ENSURE_TRUE(m_termList, NS_ERROR_NOT_INITIALIZED);
|
||||||
delete m_expressionTree;
|
delete m_expressionTree;
|
||||||
m_expressionTree = nullptr;
|
m_expressionTree = nullptr;
|
||||||
return m_termList->AppendElement(aTerm);
|
return m_termList->AppendElement(aTerm, /* weak = */ false);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsMsgSearchSession::GetSearchTerms(nsISupportsArray **aResult)
|
nsMsgSearchSession::GetSearchTerms(nsIMutableArray **aResult)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aResult);
|
NS_ENSURE_ARG_POINTER(aResult);
|
||||||
*aResult = m_termList;
|
*aResult = m_termList;
|
||||||
|
@ -88,6 +88,13 @@ nsMsgSearchSession::GetSearchTerms(nsISupportsArray **aResult)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsMsgSearchSession::SetSearchTerms(nsIMutableArray *aSearchTerms)
|
||||||
|
{
|
||||||
|
m_termList = aSearchTerms;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsMsgSearchSession::CreateTerm(nsIMsgSearchTerm **aResult)
|
nsMsgSearchSession::CreateTerm(nsIMsgSearchTerm **aResult)
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,14 +12,7 @@
|
||||||
#include "nsIUrlListener.h"
|
#include "nsIUrlListener.h"
|
||||||
#include "nsIMsgWindow.h"
|
#include "nsIMsgWindow.h"
|
||||||
#include "nsITimer.h"
|
#include "nsITimer.h"
|
||||||
// Disable deprecation warnings generated by nsISupportsArray and associated
|
#include "nsIMutableArray.h"
|
||||||
// classes.
|
|
||||||
#if defined(__GNUC__)
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
#pragma warning (disable : 4996)
|
|
||||||
#endif
|
|
||||||
#include "nsISupportsArray.h"
|
|
||||||
#include "nsCOMArray.h"
|
#include "nsCOMArray.h"
|
||||||
#include "nsWeakReference.h"
|
#include "nsWeakReference.h"
|
||||||
#include "nsTObserverArray.h"
|
#include "nsTObserverArray.h"
|
||||||
|
@ -55,7 +48,7 @@ protected:
|
||||||
void ReleaseFolderDBRef();
|
void ReleaseFolderDBRef();
|
||||||
|
|
||||||
nsTArray<RefPtr<nsMsgSearchScopeTerm>> m_scopeList;
|
nsTArray<RefPtr<nsMsgSearchScopeTerm>> m_scopeList;
|
||||||
nsCOMPtr <nsISupportsArray> m_termList;
|
nsCOMPtr<nsIMutableArray> m_termList;
|
||||||
|
|
||||||
nsTArray<nsCOMPtr<nsIMsgSearchNotify> > m_listenerList;
|
nsTArray<nsCOMPtr<nsIMsgSearchNotify> > m_listenerList;
|
||||||
nsTArray<int32_t> m_listenerFlagList;
|
nsTArray<int32_t> m_listenerFlagList;
|
||||||
|
|
|
@ -1906,7 +1906,7 @@ nsresult nsMsgSearchScopeTerm::TimeSlice (bool *aDone)
|
||||||
return m_adapter->Search(aDone);
|
return m_adapter->Search(aDone);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsMsgSearchScopeTerm::InitializeAdapter (nsISupportsArray *termList)
|
nsresult nsMsgSearchScopeTerm::InitializeAdapter (nsIArray *termList)
|
||||||
{
|
{
|
||||||
if (m_adapter)
|
if (m_adapter)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
|
@ -9,14 +9,7 @@
|
||||||
|
|
||||||
#include "nsIComponentManager.h"
|
#include "nsIComponentManager.h"
|
||||||
#include "nsIServiceManager.h"
|
#include "nsIServiceManager.h"
|
||||||
// Disable deprecation warnings generated by nsISupportsArray and associated
|
#include "nsIMutableArray.h"
|
||||||
// classes.
|
|
||||||
#if defined(__GNUC__)
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
#pragma warning (disable : 4996)
|
|
||||||
#endif
|
|
||||||
#include "nsISupportsArray.h"
|
|
||||||
#include "nsIArray.h"
|
#include "nsIArray.h"
|
||||||
#include "nsArrayUtils.h"
|
#include "nsArrayUtils.h"
|
||||||
#include "nsMsgAccountManager.h"
|
#include "nsMsgAccountManager.h"
|
||||||
|
@ -2559,7 +2552,7 @@ nsresult VirtualFolderChangeListener::Init()
|
||||||
m_searchSession = do_CreateInstance(NS_MSGSEARCHSESSION_CONTRACTID, &rv);
|
m_searchSession = do_CreateInstance(NS_MSGSEARCHSESSION_CONTRACTID, &rv);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
nsCOMPtr<nsISupportsArray> searchTerms;
|
nsCOMPtr<nsIMutableArray> searchTerms;
|
||||||
rv = tempFilter->GetSearchTerms(getter_AddRefs(searchTerms));
|
rv = tempFilter->GetSearchTerms(getter_AddRefs(searchTerms));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
|
|
@ -3593,7 +3593,7 @@ nsMsgDBView::PerformActionsOnJunkMsgs(bool msgsAreJunk)
|
||||||
// a delete toggle. So what we have to do is to assemble a new delete
|
// a delete toggle. So what we have to do is to assemble a new delete
|
||||||
// array, keeping only those that are not deleted.
|
// array, keeping only those that are not deleted.
|
||||||
//
|
//
|
||||||
nsCOMPtr<nsIMutableArray> hdrsToDelete = do_CreateInstance("@mozilla.org/array;1", &rv);
|
nsCOMPtr<nsIMutableArray> hdrsToDelete = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
uint32_t cnt;
|
uint32_t cnt;
|
||||||
rv = mJunkHdrs->GetLength(&cnt);
|
rv = mJunkHdrs->GetLength(&cnt);
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "nsMsgDBCID.h"
|
#include "nsMsgDBCID.h"
|
||||||
#include "nsMsgMessageFlags.h"
|
#include "nsMsgMessageFlags.h"
|
||||||
#include "nsServiceManagerUtils.h"
|
#include "nsServiceManagerUtils.h"
|
||||||
|
#include "nsIMutableArray.h"
|
||||||
|
|
||||||
nsMsgXFVirtualFolderDBView::nsMsgXFVirtualFolderDBView()
|
nsMsgXFVirtualFolderDBView::nsMsgXFVirtualFolderDBView()
|
||||||
{
|
{
|
||||||
|
@ -383,7 +384,7 @@ nsMsgXFVirtualFolderDBView::OnNewSearch()
|
||||||
|
|
||||||
nsCString terms;
|
nsCString terms;
|
||||||
dbFolderInfo->GetCharProperty("searchStr", terms);
|
dbFolderInfo->GetCharProperty("searchStr", terms);
|
||||||
nsCOMPtr<nsISupportsArray> searchTerms;
|
nsCOMPtr<nsIMutableArray> searchTerms;
|
||||||
rv = searchSession->GetSearchTerms(getter_AddRefs(searchTerms));
|
rv = searchSession->GetSearchTerms(getter_AddRefs(searchTerms));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
nsCString curSearchAsString;
|
nsCString curSearchAsString;
|
||||||
|
|
|
@ -30,8 +30,7 @@ var VirtualFolderHelper = {
|
||||||
* sources for the virtual folder OR a string that is the already '|'
|
* sources for the virtual folder OR a string that is the already '|'
|
||||||
* delimited list of folder URIs to use.
|
* delimited list of folder URIs to use.
|
||||||
* @param aSearchTerms The search terms to use for the virtual folder. This
|
* @param aSearchTerms The search terms to use for the virtual folder. This
|
||||||
* should be a JS list/nsIMutableArray/nsISupportsArray of
|
* should be a JS list/nsIMutableArray of nsIMsgSearchTerms.
|
||||||
* nsIMsgSearchTermbs.
|
|
||||||
* @param aOnlineSearch Should the search attempt to use the server's search
|
* @param aOnlineSearch Should the search attempt to use the server's search
|
||||||
* capabilities when possible and appropriate?
|
* capabilities when possible and appropriate?
|
||||||
*
|
*
|
||||||
|
@ -133,8 +132,7 @@ VirtualFolderWrapper.prototype = {
|
||||||
* Set the search folders that back this virtual folder.
|
* Set the search folders that back this virtual folder.
|
||||||
*
|
*
|
||||||
* @param aFolders Either a "|"-delimited string of folder URIs or a list of
|
* @param aFolders Either a "|"-delimited string of folder URIs or a list of
|
||||||
* nsIMsgFolders that fixIterator can traverse (JS array/nsIMutableArray/
|
* nsIMsgFolders that fixIterator can traverse (JS array/nsIMutableArray).
|
||||||
* nsISupportsArray).
|
|
||||||
*/
|
*/
|
||||||
set searchFolders(aFolders) {
|
set searchFolders(aFolders) {
|
||||||
if (typeof(aFolders) == "string") {
|
if (typeof(aFolders) == "string") {
|
||||||
|
@ -183,7 +181,7 @@ VirtualFolderWrapper.prototype = {
|
||||||
* directly.
|
* directly.
|
||||||
*
|
*
|
||||||
* @param aTerms Some collection that fixIterator can traverse. A JS list or
|
* @param aTerms Some collection that fixIterator can traverse. A JS list or
|
||||||
* XPCOM array (nsIMutableArray or nsISupportsArray) should work.
|
* XPCOM array (nsIMutableArray) should work.
|
||||||
*/
|
*/
|
||||||
set searchTerms(aTerms) {
|
set searchTerms(aTerms) {
|
||||||
let condition = "";
|
let condition = "";
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "nsIMsgWindow.h"
|
#include "nsIMsgWindow.h"
|
||||||
#include "nsIMsgFilterService.h"
|
#include "nsIMsgFilterService.h"
|
||||||
#include "nsIMsgProtocolInfo.h"
|
#include "nsIMsgProtocolInfo.h"
|
||||||
|
#include "nsIMutableArray.h"
|
||||||
#include "nsIPrefService.h"
|
#include "nsIPrefService.h"
|
||||||
#include "nsIRelativeFilePref.h"
|
#include "nsIRelativeFilePref.h"
|
||||||
#include "nsIDocShell.h"
|
#include "nsIDocShell.h"
|
||||||
|
@ -1875,7 +1876,7 @@ nsMsgIncomingServer::ConfigureTemporaryServerSpamFilters(nsIMsgFilterList *filte
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// get the list of search terms from the filter
|
// get the list of search terms from the filter
|
||||||
nsCOMPtr<nsISupportsArray> searchTerms;
|
nsCOMPtr<nsIMutableArray> searchTerms;
|
||||||
rv = newFilter->GetSearchTerms(getter_AddRefs(searchTerms));
|
rv = newFilter->GetSearchTerms(getter_AddRefs(searchTerms));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
|
@ -1911,7 +1912,7 @@ nsMsgIncomingServer::ConfigureTemporaryServerSpamFilters(nsIMsgFilterList *filte
|
||||||
searchValue->SetStr(NS_LITERAL_STRING("user"));
|
searchValue->SetStr(NS_LITERAL_STRING("user"));
|
||||||
searchTerm->SetValue(searchValue);
|
searchTerm->SetValue(searchValue);
|
||||||
|
|
||||||
searchTerms->InsertElementAt(searchTerm, count);
|
searchTerms->InsertElementAt(searchTerm, count, /* weak = */ false);
|
||||||
|
|
||||||
bool moveOnSpam, markAsReadOnSpam;
|
bool moveOnSpam, markAsReadOnSpam;
|
||||||
spamSettings->GetMoveOnSpam(&moveOnSpam);
|
spamSettings->GetMoveOnSpam(&moveOnSpam);
|
||||||
|
|
|
@ -58,14 +58,7 @@
|
||||||
#include "nsIMsgWindow.h"
|
#include "nsIMsgWindow.h"
|
||||||
#include "nsIWindowWatcher.h"
|
#include "nsIWindowWatcher.h"
|
||||||
#include "nsIPrompt.h"
|
#include "nsIPrompt.h"
|
||||||
// Disable deprecation warnings generated by nsISupportsArray and associated
|
#include "nsIArray.h"
|
||||||
// classes.
|
|
||||||
#if defined(__GNUC__)
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
#pragma warning (disable : 4996)
|
|
||||||
#endif
|
|
||||||
#include "nsISupportsArray.h"
|
|
||||||
#include "nsIMsgSearchTerm.h"
|
#include "nsIMsgSearchTerm.h"
|
||||||
#include "nsTextFormatter.h"
|
#include "nsTextFormatter.h"
|
||||||
#include "nsIAtomService.h"
|
#include "nsIAtomService.h"
|
||||||
|
@ -2237,10 +2230,10 @@ NS_MSG_BASE PRTime MsgConvertAgeInDaysToCutoffDate(int32_t ageInDays)
|
||||||
return now - PR_USEC_PER_DAY * ageInDays;
|
return now - PR_USEC_PER_DAY * ageInDays;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_MSG_BASE nsresult MsgTermListToString(nsISupportsArray *aTermList, nsCString &aOutString)
|
NS_MSG_BASE nsresult MsgTermListToString(nsIArray *aTermList, nsCString &aOutString)
|
||||||
{
|
{
|
||||||
uint32_t count;
|
uint32_t count;
|
||||||
aTermList->Count(&count);
|
aTermList->GetLength(&count);
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
for (uint32_t searchIndex = 0; searchIndex < count;
|
for (uint32_t searchIndex = 0; searchIndex < count;
|
||||||
|
|
|
@ -14,14 +14,7 @@
|
||||||
#include "nsTArray.h"
|
#include "nsTArray.h"
|
||||||
#include "nsInterfaceRequestorAgg.h"
|
#include "nsInterfaceRequestorAgg.h"
|
||||||
#include "nsILoadGroup.h"
|
#include "nsILoadGroup.h"
|
||||||
// Disable deprecation warnings generated by nsISupportsArray and associated
|
#include "nsIArray.h"
|
||||||
// classes.
|
|
||||||
#if defined(__GNUC__)
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
#pragma warning (disable : 4996)
|
|
||||||
#endif
|
|
||||||
#include "nsISupportsArray.h"
|
|
||||||
#include "nsIAtom.h"
|
#include "nsIAtom.h"
|
||||||
#include "nsINetUtil.h"
|
#include "nsINetUtil.h"
|
||||||
#include "nsIRequest.h"
|
#include "nsIRequest.h"
|
||||||
|
@ -42,7 +35,6 @@ class nsIMsgDatabase;
|
||||||
class nsIMutableArray;
|
class nsIMutableArray;
|
||||||
class nsIProxyInfo;
|
class nsIProxyInfo;
|
||||||
class nsIMsgWindow;
|
class nsIMsgWindow;
|
||||||
class nsISupportsArray;
|
|
||||||
class nsIStreamListener;
|
class nsIStreamListener;
|
||||||
|
|
||||||
#define FILE_IO_BUFFER_SIZE (16*1024)
|
#define FILE_IO_BUFFER_SIZE (16*1024)
|
||||||
|
@ -287,7 +279,7 @@ NS_MSG_BASE PRTime MsgConvertAgeInDaysToCutoffDate(int32_t ageInDays);
|
||||||
* @param[out] aOutString result representation of search terms.
|
* @param[out] aOutString result representation of search terms.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
NS_MSG_BASE nsresult MsgTermListToString(nsISupportsArray *aTermList, nsCString &aOutString);
|
NS_MSG_BASE nsresult MsgTermListToString(nsIArray *aTermList, nsCString &aOutString);
|
||||||
|
|
||||||
NS_MSG_BASE nsresult
|
NS_MSG_BASE nsresult
|
||||||
MsgStreamMsgHeaders(nsIInputStream *aInputStream, nsIStreamListener *aConsumer);
|
MsgStreamMsgHeaders(nsIInputStream *aInputStream, nsIStreamListener *aConsumer);
|
||||||
|
@ -404,8 +396,7 @@ ConvertBufToPlainText(nsString &aConBuf, bool formatFlowed, bool delsp,
|
||||||
EndReading()[-1]
|
EndReading()[-1]
|
||||||
#define SetCharAt(ch, index) \
|
#define SetCharAt(ch, index) \
|
||||||
Replace(index, 1, ch)
|
Replace(index, 1, ch)
|
||||||
#define NS_NewISupportsArray(result) \
|
|
||||||
CallCreateInstance(NS_SUPPORTSARRAY_CONTRACTID, static_cast<nsISupportsArray**>(result))
|
|
||||||
/**
|
/**
|
||||||
* The internal and external methods expect the parameters in a different order.
|
* The internal and external methods expect the parameters in a different order.
|
||||||
* The internal API also always expects a flag rather than a comparator.
|
* The internal API also always expects a flag rather than a comparator.
|
||||||
|
|
|
@ -5,17 +5,8 @@
|
||||||
|
|
||||||
|
|
||||||
#include "nsISupports.idl"
|
#include "nsISupports.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 nsIMutableArray;
|
||||||
interface nsIMsgSearchTerm;
|
interface nsIMsgSearchTerm;
|
||||||
|
|
||||||
[scriptable, uuid(28AC84DF-CBE5-430d-A5C0-4FA63B5424DF)]
|
[scriptable, uuid(28AC84DF-CBE5-430d-A5C0-4FA63B5424DF)]
|
||||||
|
@ -24,12 +15,11 @@ interface nsIMsgMailView : nsISupports {
|
||||||
readonly attribute wstring prettyName; // localized pretty name
|
readonly attribute wstring prettyName; // localized pretty name
|
||||||
|
|
||||||
// the array of search terms
|
// the array of search terms
|
||||||
attribute nsISupportsArray searchTerms;
|
attribute nsIMutableArray searchTerms;
|
||||||
|
|
||||||
// these two helper methods are required to allow searchTermsOverlay.js to
|
// these two helper methods are required to allow searchTermsOverlay.js to
|
||||||
// manipulate a mail view without knowing it is dealing with a mail view. nsIMsgFilter
|
// manipulate a mail view without knowing it is dealing with a mail view. nsIMsgFilter
|
||||||
// and nsIMsgSearchSession have the same two methods....we should probably make an interface around them.
|
// and nsIMsgSearchSession have the same two methods....we should probably make an interface around them.
|
||||||
void appendTerm(in nsIMsgSearchTerm term);
|
void appendTerm(in nsIMsgSearchTerm term);
|
||||||
nsIMsgSearchTerm createTerm();
|
nsIMsgSearchTerm createTerm();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,14 +4,8 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "nsMsgMailViewList.h"
|
#include "nsMsgMailViewList.h"
|
||||||
// Disable deprecation warnings generated by nsISupportsArray and associated
|
#include "nsArray.h"
|
||||||
// classes.
|
#include "nsIMutableArray.h"
|
||||||
#if defined(__GNUC__)
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
#pragma warning (disable : 4996)
|
|
||||||
#endif
|
|
||||||
#include "nsISupportsArray.h"
|
|
||||||
#include "nsIFileChannel.h"
|
#include "nsIFileChannel.h"
|
||||||
#include "nsIMsgFilterService.h"
|
#include "nsIMsgFilterService.h"
|
||||||
#include "nsIMsgMailSession.h"
|
#include "nsIMsgMailSession.h"
|
||||||
|
@ -23,6 +17,7 @@
|
||||||
#include "nsComponentManagerUtils.h"
|
#include "nsComponentManagerUtils.h"
|
||||||
#include "mozilla/Services.h"
|
#include "mozilla/Services.h"
|
||||||
#include "nsIMsgFilter.h"
|
#include "nsIMsgFilter.h"
|
||||||
|
#include "nsArrayUtils.h"
|
||||||
|
|
||||||
#define kDefaultViewPeopleIKnow "People I Know"
|
#define kDefaultViewPeopleIKnow "People I Know"
|
||||||
#define kDefaultViewRecent "Recent Mail"
|
#define kDefaultViewRecent "Recent Mail"
|
||||||
|
@ -32,7 +27,8 @@
|
||||||
|
|
||||||
nsMsgMailView::nsMsgMailView()
|
nsMsgMailView::nsMsgMailView()
|
||||||
{
|
{
|
||||||
mViewSearchTerms = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID);
|
mViewSearchTerms = nsArray::Create();
|
||||||
|
NS_ASSERTION(mViewSearchTerms, "Failed to allocate a nsIMutableArray for mViewSearchTerms");
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMPL_ADDREF(nsMsgMailView)
|
NS_IMPL_ADDREF(nsMsgMailView)
|
||||||
|
@ -93,14 +89,14 @@ NS_IMETHODIMP nsMsgMailView::GetPrettyName(char16_t ** aMailViewName)
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsMsgMailView::GetSearchTerms(nsISupportsArray ** aSearchTerms)
|
NS_IMETHODIMP nsMsgMailView::GetSearchTerms(nsIMutableArray **aSearchTerms)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aSearchTerms);
|
NS_ENSURE_ARG_POINTER(aSearchTerms);
|
||||||
NS_IF_ADDREF(*aSearchTerms = mViewSearchTerms);
|
NS_IF_ADDREF(*aSearchTerms = mViewSearchTerms);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsMsgMailView::SetSearchTerms(nsISupportsArray * aSearchTerms)
|
NS_IMETHODIMP nsMsgMailView::SetSearchTerms(nsIMutableArray *aSearchTerms)
|
||||||
{
|
{
|
||||||
mViewSearchTerms = aSearchTerms;
|
mViewSearchTerms = aSearchTerms;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -110,7 +106,7 @@ NS_IMETHODIMP nsMsgMailView::AppendTerm(nsIMsgSearchTerm * aTerm)
|
||||||
{
|
{
|
||||||
NS_ENSURE_TRUE(aTerm, NS_ERROR_NULL_POINTER);
|
NS_ENSURE_TRUE(aTerm, NS_ERROR_NULL_POINTER);
|
||||||
|
|
||||||
return mViewSearchTerms->AppendElement(static_cast<nsISupports*>(aTerm));
|
return mViewSearchTerms->AppendElement(aTerm, /* weak */ false);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsMsgMailView::CreateTerm(nsIMsgSearchTerm **aResult)
|
NS_IMETHODIMP nsMsgMailView::CreateTerm(nsIMsgSearchTerm **aResult)
|
||||||
|
@ -222,7 +218,7 @@ nsresult nsMsgMailViewList::ConvertMailViewListToFilterList()
|
||||||
if (!newMailFilter)
|
if (!newMailFilter)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
nsCOMPtr<nsISupportsArray> searchTerms;
|
nsCOMPtr<nsIMutableArray> searchTerms;
|
||||||
mailView->GetSearchTerms(getter_AddRefs(searchTerms));
|
mailView->GetSearchTerms(getter_AddRefs(searchTerms));
|
||||||
newMailFilter->SetSearchTerms(searchTerms);
|
newMailFilter->SetSearchTerms(searchTerms);
|
||||||
mFilterList->InsertFilterAt(index, newMailFilter);
|
mFilterList->InsertFilterAt(index, newMailFilter);
|
||||||
|
@ -298,7 +294,7 @@ nsresult nsMsgMailViewList::ConvertFilterListToMailViews()
|
||||||
msgFilter->GetFilterName(filterName);
|
msgFilter->GetFilterName(filterName);
|
||||||
newMailView->SetMailViewName(filterName.get());
|
newMailView->SetMailViewName(filterName.get());
|
||||||
|
|
||||||
nsCOMPtr<nsISupportsArray> filterSearchTerms;
|
nsCOMPtr<nsIMutableArray> filterSearchTerms;
|
||||||
rv = msgFilter->GetSearchTerms(getter_AddRefs(filterSearchTerms));
|
rv = msgFilter->GetSearchTerms(getter_AddRefs(filterSearchTerms));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = newMailView->SetSearchTerms(filterSearchTerms);
|
rv = newMailView->SetSearchTerms(filterSearchTerms);
|
||||||
|
|
|
@ -11,14 +11,7 @@
|
||||||
#include "nsIMsgMailViewList.h"
|
#include "nsIMsgMailViewList.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsCOMArray.h"
|
#include "nsCOMArray.h"
|
||||||
// Disable deprecation warnings generated by nsISupportsArray and associated
|
#include "nsIMutableArray.h"
|
||||||
// classes.
|
|
||||||
#if defined(__GNUC__)
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
#pragma warning (disable : 4996)
|
|
||||||
#endif
|
|
||||||
#include "nsISupportsArray.h"
|
|
||||||
#include "nsIStringBundle.h"
|
#include "nsIStringBundle.h"
|
||||||
#include "nsStringGlue.h"
|
#include "nsStringGlue.h"
|
||||||
#include "nsIMsgFilterList.h"
|
#include "nsIMsgFilterList.h"
|
||||||
|
@ -36,7 +29,7 @@ protected:
|
||||||
virtual ~nsMsgMailView();
|
virtual ~nsMsgMailView();
|
||||||
nsString mName;
|
nsString mName;
|
||||||
nsCOMPtr<nsIStringBundle> mBundle;
|
nsCOMPtr<nsIStringBundle> mBundle;
|
||||||
nsCOMPtr<nsISupportsArray> mViewSearchTerms;
|
nsCOMPtr<nsIMutableArray> mViewSearchTerms;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -691,7 +691,7 @@ NS_IMETHODIMP nsImapMailFolder::UpdateFolderWithListener(nsIMsgWindow *aMsgWindo
|
||||||
filter->GetEnabled(&enabled);
|
filter->GetEnabled(&enabled);
|
||||||
if (!enabled)
|
if (!enabled)
|
||||||
continue;
|
continue;
|
||||||
nsCOMPtr<nsISupportsArray> searchTerms;
|
nsCOMPtr<nsIMutableArray> searchTerms;
|
||||||
uint32_t numSearchTerms = 0;
|
uint32_t numSearchTerms = 0;
|
||||||
filter->GetSearchTerms(getter_AddRefs(searchTerms));
|
filter->GetSearchTerms(getter_AddRefs(searchTerms));
|
||||||
if (searchTerms)
|
if (searchTerms)
|
||||||
|
|
|
@ -880,7 +880,7 @@ function getSearchTermString(searchTerms)
|
||||||
var count = searchTerms.Count();
|
var count = searchTerms.Count();
|
||||||
for (searchIndex = 0; searchIndex < count; )
|
for (searchIndex = 0; searchIndex < count; )
|
||||||
{
|
{
|
||||||
var term = searchTerms.QueryElementAt(searchIndex++, Components.interfaces.nsIMsgSearchTerm);
|
var term = searchTerms.queryElementAt(searchIndex++, Components.interfaces.nsIMsgSearchTerm);
|
||||||
|
|
||||||
if (condition.length > 1)
|
if (condition.length > 1)
|
||||||
condition += ' ';
|
condition += ' ';
|
||||||
|
@ -978,26 +978,33 @@ function setupXFVirtualFolderSearch(folderUrisToSearch, searchTerms, searchOnlin
|
||||||
gSearchSession.addScopeTerm(!searchOnline ? nsMsgSearchScope.offlineMail : GetScopeForFolder(realFolder), realFolder);
|
gSearchSession.addScopeTerm(!searchOnline ? nsMsgSearchScope.offlineMail : GetScopeForFolder(realFolder), realFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
var termsArray = searchTerms.QueryInterface(Components.interfaces.nsISupportsArray);
|
|
||||||
const nsIMsgSearchTerm = Components.interfaces.nsIMsgSearchTerm;
|
const nsIMsgSearchTerm = Components.interfaces.nsIMsgSearchTerm;
|
||||||
for (let term in fixIterator(termsArray, nsIMsgSearchTerm)) {
|
for (let term of fixIterator(searchTerms, nsIMsgSearchTerm)) {
|
||||||
gSearchSession.appendTerm(term);
|
gSearchSession.appendTerm(term);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses an array of search terms to produce a new list usable from quick search.
|
||||||
|
*
|
||||||
|
* @param searchTermsArray A nsIArray of terms to copy.
|
||||||
|
*
|
||||||
|
* @return nsIMutableArray of search terms
|
||||||
|
*/
|
||||||
function CreateGroupedSearchTerms(searchTermsArray)
|
function CreateGroupedSearchTerms(searchTermsArray)
|
||||||
{
|
{
|
||||||
|
|
||||||
var searchSession = gSearchSession ||
|
var searchSession = gSearchSession ||
|
||||||
Components.classes[searchSessionContractID].createInstance(Components.interfaces.nsIMsgSearchSession);
|
Components.classes[searchSessionContractID].createInstance(Components.interfaces.nsIMsgSearchSession);
|
||||||
|
|
||||||
// create a temporary isupports array to store our search terms
|
// Create a temporary nsIMutableArray to store our search terms
|
||||||
// since we will be modifying the terms so they work with quick search
|
// since we will be modifying the terms so they work with quick search.
|
||||||
var searchTermsArrayForQS = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);
|
var searchTermsArrayForQS = Components.classes["@mozilla.org/array;1"]
|
||||||
|
.createInstance(Components.interfaces.nsIMutableArray);
|
||||||
|
|
||||||
var numEntries = searchTermsArray.Count();
|
var numEntries = searchTermsArray.length;
|
||||||
for (var i = 0; i < numEntries; i++) {
|
for (let i = 0; i < numEntries; i++) {
|
||||||
var searchTerm = searchTermsArray.GetElementAt(i).QueryInterface(Components.interfaces.nsIMsgSearchTerm);
|
let searchTerm = searchTermsArray.queryElementAt(i, Components.interfaces.nsIMsgSearchTerm);
|
||||||
|
|
||||||
// clone the term, since we might be modifying it
|
// clone the term, since we might be modifying it
|
||||||
var searchTermForQS = searchSession.createTerm();
|
var searchTermForQS = searchSession.createTerm();
|
||||||
|
@ -1017,7 +1024,7 @@ function CreateGroupedSearchTerms(searchTermsArray)
|
||||||
// turn the first term to true to work with quick search...
|
// turn the first term to true to work with quick search...
|
||||||
searchTermForQS.booleanAnd = i ? searchTerm.booleanAnd : true;
|
searchTermForQS.booleanAnd = i ? searchTerm.booleanAnd : true;
|
||||||
|
|
||||||
searchTermsArrayForQS.AppendElement(searchTermForQS);
|
searchTermsArrayForQS.appendElement(searchTermForQS, /* weak = */ false);
|
||||||
}
|
}
|
||||||
return searchTermsArrayForQS;
|
return searchTermsArrayForQS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -210,8 +210,8 @@ function ViewTagKeyword(keyword)
|
||||||
PrepareForViewChange();
|
PrepareForViewChange();
|
||||||
|
|
||||||
// create an i supports array to store our search terms
|
// create an i supports array to store our search terms
|
||||||
var searchTermsArray = Components.classes["@mozilla.org/supports-array;1"]
|
var searchTermsArray = Components.classes["@mozilla.org/array;1"]
|
||||||
.createInstance(Components.interfaces.nsISupportsArray);
|
.createInstance(Components.interfaces.nsIMutableArray);
|
||||||
var term = gSearchSession.createTerm();
|
var term = gSearchSession.createTerm();
|
||||||
var value = term.value;
|
var value = term.value;
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ function ViewTagKeyword(keyword)
|
||||||
term.op = nsMsgSearchOp.Contains;
|
term.op = nsMsgSearchOp.Contains;
|
||||||
term.booleanAnd = true;
|
term.booleanAnd = true;
|
||||||
|
|
||||||
searchTermsArray.AppendElement(term);
|
searchTermsArray.appendElement(term, /* weak = */ false);
|
||||||
AddVirtualFolderTerms(searchTermsArray);
|
AddVirtualFolderTerms(searchTermsArray);
|
||||||
createSearchTermsWithList(searchTermsArray);
|
createSearchTermsWithList(searchTermsArray);
|
||||||
gDefaultSearchViewTerms = searchTermsArray;
|
gDefaultSearchViewTerms = searchTermsArray;
|
||||||
|
@ -234,8 +234,8 @@ function ViewNewMail()
|
||||||
PrepareForViewChange();
|
PrepareForViewChange();
|
||||||
|
|
||||||
// create an i supports array to store our search terms
|
// create an i supports array to store our search terms
|
||||||
var searchTermsArray = Components.classes["@mozilla.org/supports-array;1"]
|
var searchTermsArray = Components.classes["@mozilla.org/array;1"]
|
||||||
.createInstance(Components.interfaces.nsISupportsArray);
|
.createInstance(Components.interfaces.nsIMutableArray);
|
||||||
var term = gSearchSession.createTerm();
|
var term = gSearchSession.createTerm();
|
||||||
var value = term.value;
|
var value = term.value;
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ function ViewNewMail()
|
||||||
term.attrib = nsMsgSearchAttrib.MsgStatus;
|
term.attrib = nsMsgSearchAttrib.MsgStatus;
|
||||||
term.op = nsMsgSearchOp.Isnt;
|
term.op = nsMsgSearchOp.Isnt;
|
||||||
term.booleanAnd = true;
|
term.booleanAnd = true;
|
||||||
searchTermsArray.AppendElement(term);
|
searchTermsArray.appendElement(term, /* weak = */ false);
|
||||||
|
|
||||||
AddVirtualFolderTerms(searchTermsArray);
|
AddVirtualFolderTerms(searchTermsArray);
|
||||||
|
|
||||||
|
@ -260,8 +260,8 @@ function ViewNotDeletedMail()
|
||||||
PrepareForViewChange();
|
PrepareForViewChange();
|
||||||
|
|
||||||
// create an i supports array to store our search terms
|
// create an i supports array to store our search terms
|
||||||
var searchTermsArray = Components.classes["@mozilla.org/supports-array;1"]
|
var searchTermsArray = Components.classes["@mozilla.org/array;1"]
|
||||||
.createInstance(Components.interfaces.nsISupportsArray);
|
.createInstance(Components.interfaces.nsIMutableArray);
|
||||||
var term = gSearchSession.createTerm();
|
var term = gSearchSession.createTerm();
|
||||||
var value = term.value;
|
var value = term.value;
|
||||||
|
|
||||||
|
@ -271,7 +271,7 @@ function ViewNotDeletedMail()
|
||||||
term.attrib = nsMsgSearchAttrib.MsgStatus;
|
term.attrib = nsMsgSearchAttrib.MsgStatus;
|
||||||
term.op = nsMsgSearchOp.Isnt;
|
term.op = nsMsgSearchOp.Isnt;
|
||||||
term.booleanAnd = true;
|
term.booleanAnd = true;
|
||||||
searchTermsArray.AppendElement(term);
|
searchTermsArray.appendElement(term, /* weak = */ false);
|
||||||
|
|
||||||
AddVirtualFolderTerms(searchTermsArray);
|
AddVirtualFolderTerms(searchTermsArray);
|
||||||
|
|
||||||
|
@ -287,14 +287,10 @@ function AddVirtualFolderTerms(searchTermsArray)
|
||||||
var virtualFolderSearchTerms = (gVirtualFolderTerms || gXFVirtualFolderTerms);
|
var virtualFolderSearchTerms = (gVirtualFolderTerms || gXFVirtualFolderTerms);
|
||||||
if (virtualFolderSearchTerms)
|
if (virtualFolderSearchTerms)
|
||||||
{
|
{
|
||||||
var isupports = null;
|
for (let i = 0; i < termsArray.length; i++)
|
||||||
var searchTerm;
|
|
||||||
var termsArray = virtualFolderSearchTerms.QueryInterface(Components.interfaces.nsISupportsArray);
|
|
||||||
for (var i = 0; i < termsArray.Count(); i++)
|
|
||||||
{
|
{
|
||||||
isupports = termsArray.GetElementAt(i);
|
let searchTerm = virtualFolderSearchTerms.queryElementAt(i, Components.interfaces.nsIMsgSearchTerm);
|
||||||
searchTerm = isupports.QueryInterface(Components.interfaces.nsIMsgSearchTerm);
|
searchTermsArray.appendElement(searchTerm, /* weak = */ false);
|
||||||
searchTermsArray.AppendElement(searchTerm);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
Components.utils.import("resource:///modules/ABQueryUtils.jsm");
|
Components.utils.import("resource:///modules/ABQueryUtils.jsm");
|
||||||
|
Components.utils.import("resource:///modules/iteratorUtils.js");
|
||||||
Components.utils.import("resource:///modules/mailServices.js");
|
Components.utils.import("resource:///modules/mailServices.js");
|
||||||
Components.utils.import("resource://gre/modules/PluralForm.jsm");
|
Components.utils.import("resource://gre/modules/PluralForm.jsm");
|
||||||
|
|
||||||
|
@ -165,11 +166,7 @@ function onSearch()
|
||||||
|
|
||||||
var searchUri = currentAbURI + "?(";
|
var searchUri = currentAbURI + "?(";
|
||||||
|
|
||||||
var count = gSearchSession.searchTerms.Count();
|
for (let searchTerm of fixIterator(gSearchSession.searchTerms, nsIMsgSearchTerm)) {
|
||||||
|
|
||||||
for (var i=0; i<count; i++) {
|
|
||||||
var searchTerm = gSearchSession.searchTerms.GetElementAt(i).QueryInterface(nsIMsgSearchTerm);
|
|
||||||
|
|
||||||
// get the "and" / "or" value from the first term
|
// get the "and" / "or" value from the first term
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
if (searchTerm.booleanAnd)
|
if (searchTerm.booleanAnd)
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
Components.utils.import("resource://gre/modules/PluralForm.jsm");
|
Components.utils.import("resource://gre/modules/PluralForm.jsm");
|
||||||
|
Components.utils.import("resource:///modules/iteratorUtils.jsm");
|
||||||
|
|
||||||
var gSearchSession = null;
|
var gSearchSession = null;
|
||||||
var gPreQuickSearchView = null;
|
var gPreQuickSearchView = null;
|
||||||
|
@ -172,7 +173,7 @@ function onEnterInSearchBar()
|
||||||
var addTerms = gDefaultSearchViewTerms || gVirtualFolderTerms || gXFVirtualFolderTerms;
|
var addTerms = gDefaultSearchViewTerms || gVirtualFolderTerms || gXFVirtualFolderTerms;
|
||||||
if (addTerms)
|
if (addTerms)
|
||||||
{
|
{
|
||||||
viewDebug ("addTerms = " + addTerms + " count = " + addTerms.Count() + "\n");
|
viewDebug ("addTerms = " + addTerms + " count = " + addTerms.length + "\n");
|
||||||
initializeSearchBar();
|
initializeSearchBar();
|
||||||
onSearch(addTerms);
|
onSearch(addTerms);
|
||||||
}
|
}
|
||||||
|
@ -291,10 +292,8 @@ function createSearchTermsWithList(aTermsArray)
|
||||||
var nsMsgSearchAttrib = Components.interfaces.nsMsgSearchAttrib;
|
var nsMsgSearchAttrib = Components.interfaces.nsMsgSearchAttrib;
|
||||||
var nsMsgSearchOp = Components.interfaces.nsMsgSearchOp;
|
var nsMsgSearchOp = Components.interfaces.nsMsgSearchOp;
|
||||||
|
|
||||||
|
gSearchSession.clear();
|
||||||
gSearchSession.clearScopes();
|
gSearchSession.clearScopes();
|
||||||
var searchTerms = gSearchSession.searchTerms;
|
|
||||||
var searchTermsArray = searchTerms.QueryInterface(Components.interfaces.nsISupportsArray);
|
|
||||||
searchTermsArray.Clear();
|
|
||||||
|
|
||||||
var i;
|
var i;
|
||||||
var selectedFolder = GetThreadPaneFolder();
|
var selectedFolder = GetThreadPaneFolder();
|
||||||
|
@ -320,11 +319,11 @@ function createSearchTermsWithList(aTermsArray)
|
||||||
viewDebug ("in createSearchTermsWithList, adding scope term for selected folder\n");
|
viewDebug ("in createSearchTermsWithList, adding scope term for selected folder\n");
|
||||||
gSearchSession.addScopeTerm(nsMsgSearchScope.offlineMail, selectedFolder);
|
gSearchSession.addScopeTerm(nsMsgSearchScope.offlineMail, selectedFolder);
|
||||||
}
|
}
|
||||||
// add each item in termsArray to the search session
|
|
||||||
|
|
||||||
var termsArray = aTermsArray.QueryInterface(Components.interfaces.nsISupportsArray);
|
// Add each item in aTermsArray to the search session.
|
||||||
for (i = 0; i < termsArray.Count(); ++i)
|
for (let term of fixIterator(aTermsArray, Components.interfaces.nsIMsgSearchTerm)) {
|
||||||
gSearchSession.appendTerm(termsArray.GetElementAt(i).QueryInterface(Components.interfaces.nsIMsgSearchTerm));
|
gSearchSession.appendTerm(term);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function createSearchTerms()
|
function createSearchTerms()
|
||||||
|
@ -333,8 +332,9 @@ function createSearchTerms()
|
||||||
var nsMsgSearchAttrib = Components.interfaces.nsMsgSearchAttrib;
|
var nsMsgSearchAttrib = Components.interfaces.nsMsgSearchAttrib;
|
||||||
var nsMsgSearchOp = Components.interfaces.nsMsgSearchOp;
|
var nsMsgSearchOp = Components.interfaces.nsMsgSearchOp;
|
||||||
|
|
||||||
// create an nsISupportsArray to store our search terms
|
// create an nsIMutableArray to store our search terms
|
||||||
var searchTermsArray = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);
|
var searchTermsArray = Components.classes["@mozilla.org/array;1"]
|
||||||
|
.createInstance(Components.interfaces.nsIMutableArray);
|
||||||
var selectedFolder = GetThreadPaneFolder();
|
var selectedFolder = GetThreadPaneFolder();
|
||||||
|
|
||||||
// implement | for QS
|
// implement | for QS
|
||||||
|
@ -356,7 +356,7 @@ function createSearchTerms()
|
||||||
term.attrib = nsMsgSearchAttrib.Subject;
|
term.attrib = nsMsgSearchAttrib.Subject;
|
||||||
term.op = nsMsgSearchOp.Contains;
|
term.op = nsMsgSearchOp.Contains;
|
||||||
term.booleanAnd = false;
|
term.booleanAnd = false;
|
||||||
searchTermsArray.AppendElement(term);
|
searchTermsArray.appendElement(term, /* weak = */ false);
|
||||||
|
|
||||||
// create, fill, and append the AllAddresses term
|
// create, fill, and append the AllAddresses term
|
||||||
term = gSearchSession.createTerm();
|
term = gSearchSession.createTerm();
|
||||||
|
@ -366,7 +366,7 @@ function createSearchTerms()
|
||||||
term.attrib = nsMsgSearchAttrib.AllAddresses;
|
term.attrib = nsMsgSearchAttrib.AllAddresses;
|
||||||
term.op = nsMsgSearchOp.Contains;
|
term.op = nsMsgSearchOp.Contains;
|
||||||
term.booleanAnd = false;
|
term.booleanAnd = false;
|
||||||
searchTermsArray.AppendElement(term);
|
searchTermsArray.appendElement(term, /* weak = */ false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// now append the default view or virtual folder criteria to the quick search
|
// now append the default view or virtual folder criteria to the quick search
|
||||||
|
@ -376,14 +376,9 @@ function createSearchTerms()
|
||||||
var defaultSearchTerms = (gDefaultSearchViewTerms || gVirtualFolderTerms || gXFVirtualFolderTerms);
|
var defaultSearchTerms = (gDefaultSearchViewTerms || gVirtualFolderTerms || gXFVirtualFolderTerms);
|
||||||
if (defaultSearchTerms)
|
if (defaultSearchTerms)
|
||||||
{
|
{
|
||||||
var isupports = null;
|
for (let searchTerm of fixIterator(defaultSearchTerms, Components.interfaces.nsIMsgSearchTerm))
|
||||||
var searchTerm;
|
|
||||||
var termsArray = defaultSearchTerms.QueryInterface(Components.interfaces.nsISupportsArray);
|
|
||||||
for (i = 0; i < termsArray.Count(); i++)
|
|
||||||
{
|
{
|
||||||
isupports = termsArray.GetElementAt(i);
|
searchTermsArray.appendElement(searchTerm, /* weak = */ false);
|
||||||
searchTerm = isupports.QueryInterface(Components.interfaces.nsIMsgSearchTerm);
|
|
||||||
searchTermsArray.AppendElement(searchTerm);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче