mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-01 06:35:42 +00:00
make a whole bunch of search/filter stuff scriptable.
this included adding a new nsIMsgSearchValue interface, and renaming some of the IDL typedefs to be consistent with each other.
This commit is contained in:
parent
1d29b85f66
commit
42e1c6e1f3
@ -43,6 +43,7 @@ XPIDLSRCS = \
|
||||
nsIMsgFilterHitNotify.idl \
|
||||
nsIMsgFilterList.idl \
|
||||
nsIMsgFilterService.idl \
|
||||
nsIMsgSearchValue.idl \
|
||||
nsIMsgSearchAdapter.idl \
|
||||
nsIMsgSearchSession.idl \
|
||||
nsIMsgSearchScopeTerm.idl \
|
||||
|
@ -26,6 +26,7 @@ XPIDLSRCS = \
|
||||
.\nsIMsgFilterService.idl \
|
||||
.\nsIMsgFilterHitNotify.idl \
|
||||
.\nsIMsgFilterList.idl \
|
||||
.\nsIMsgSearchValue.idl \
|
||||
.\nsIMsgSearchSession.idl \
|
||||
.\nsIMsgSearchAdapter.idl \
|
||||
.\nsIMsgSearchScopeTerm.idl \
|
||||
|
@ -23,12 +23,8 @@
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsMsgFilterCore.idl"
|
||||
|
||||
%{C++
|
||||
#include "nsMsgSearchScopeTerm.h"
|
||||
%}
|
||||
|
||||
[ptr] native nsMsgSearchScopeTerm(nsMsgSearchScopeTerm);
|
||||
#include "nsIMsgSearchScopeTerm.idl"
|
||||
#include "nsIMsgSearchValue.idl"
|
||||
|
||||
interface nsOutputStream;
|
||||
|
||||
@ -38,21 +34,21 @@ interface nsIMsgFilter : nsISupports {
|
||||
attribute boolean enabled;
|
||||
attribute string filterName;
|
||||
attribute string filterDesc;
|
||||
[noscript] void AddTerm(in nsMsgSearchAttribute attrib,
|
||||
in nsMsgSearchOperator op,
|
||||
in nsMsgSearchValue value,
|
||||
in boolean BooleanAND,
|
||||
in string arbitraryHeader);
|
||||
void AddTerm(in nsMsgSearchAttribValue attrib,
|
||||
in nsMsgSearchOpValue op,
|
||||
in nsIMsgSearchValue value,
|
||||
in boolean BooleanAND,
|
||||
in string arbitraryHeader);
|
||||
|
||||
readonly attribute long numTerms;
|
||||
[noscript] void GetTerm(in long termIndex,
|
||||
out nsMsgSearchAttribute attrib,
|
||||
out nsMsgSearchOperator op,
|
||||
in nsMsgSearchValue value, // bad! using shared structure
|
||||
out boolean BooleanAND,
|
||||
out string arbitraryHeader);
|
||||
void GetTerm(in long termIndex,
|
||||
out nsMsgSearchAttribValue attrib,
|
||||
out nsMsgSearchOpValue op,
|
||||
out nsIMsgSearchValue value, // bad! using shared structure
|
||||
out boolean BooleanAND,
|
||||
out string arbitraryHeader);
|
||||
|
||||
[noscript] attribute nsMsgSearchScopeTerm scope;
|
||||
attribute nsIMsgSearchScopeTerm scope;
|
||||
|
||||
[noscript] void SetAction(in nsMsgRuleActionType type, in voidStar value);
|
||||
[noscript] void GetAction(out nsMsgRuleActionType type, out voidStar value);
|
||||
|
@ -23,14 +23,13 @@
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsMsgSearchCore.idl"
|
||||
#include "nsIMsgSearchScopeTerm.idl"
|
||||
|
||||
[ptr] native nsMsgSearchTermArray(nsMsgResultElement);
|
||||
[ptr] native nsMsgResultElement(nsMsgResultElement);
|
||||
[ptr] native nsMsgSearchScopeTerm(nsMsgSearchScopeTerm);
|
||||
|
||||
%{C++
|
||||
class nsMsgResultElement;
|
||||
class nsMsgSearchScopeTerm;
|
||||
%}
|
||||
|
||||
[scriptable, uuid(66f4b80c-0fb5-11d3-a515-0060b0fc04b7)]
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include "nsIFileSpec.idl"
|
||||
#include "nsIInputStream.idl"
|
||||
#include "nsIMsgSearchSession.idl"
|
||||
|
||||
interface nsIMsgFolder;
|
||||
|
||||
@ -31,5 +32,6 @@ interface nsIMsgSearchScopeTerm : nsISupports {
|
||||
attribute nsIInputStream fileStream;
|
||||
readonly attribute nsIFileSpec mailPath;
|
||||
readonly attribute nsIMsgFolder folder;
|
||||
readonly attribute nsIMsgSearchSession searchSession;
|
||||
};
|
||||
|
||||
|
@ -35,8 +35,8 @@ interface nsMsgResultElement;
|
||||
interface nsIMsgSearchSession : nsISupports {
|
||||
|
||||
[noscript]
|
||||
void AddSearchTerm(in nsMsgSearchAttribute attrib, /* attribute for this term */
|
||||
in nsMsgSearchOperator op,/* operator e.g. opContains */
|
||||
void AddSearchTerm(in nsMsgSearchAttribValue attrib, /* attribute for this term */
|
||||
in nsMsgSearchOpValue op,/* operator e.g. opContains */
|
||||
in nsMsgSearchValue value, /* value e.g. "Dogbert" */
|
||||
in boolean BooleanAND, /* set to true if associated boolean operator is AND */
|
||||
in string arbitraryHeader); /* user defined arbitrary header. ignored unless attrib = attribOtherHeader */
|
||||
@ -45,16 +45,16 @@ interface nsIMsgSearchSession : nsISupports {
|
||||
|
||||
[noscript]
|
||||
void GetNthSearchTerm(in long whichTerm,
|
||||
in nsMsgSearchAttribute attrib,
|
||||
in nsMsgSearchOperator op,
|
||||
in nsMsgSearchAttribValue attrib,
|
||||
in nsMsgSearchOpValue op,
|
||||
in nsMsgSearchValue value); // wrong, should be out
|
||||
|
||||
long CountSearchScopes();
|
||||
|
||||
void GetNthSearchScope(in long which,out nsMsgSearchScopeAttribute scopeId, out nsIMsgFolder folder);
|
||||
void GetNthSearchScope(in long which,out nsMsgSearchScopeValue scopeId, out nsIMsgFolder folder);
|
||||
|
||||
/* add a scope (e.g. a mail folder) to the search */
|
||||
void AddScopeTerm(in nsMsgSearchScopeAttribute attrib,
|
||||
void AddScopeTerm(in nsMsgSearchScopeValue attrib,
|
||||
in nsIMsgFolder folder);
|
||||
|
||||
/* special cases for LDAP since LDAP isn't really a folderInfo */
|
||||
@ -64,16 +64,16 @@ interface nsIMsgSearchSession : nsISupports {
|
||||
/* Call this function everytime the scope changes! It informs the FE if
|
||||
the current scope support custom header use. FEs should not display the
|
||||
custom header dialog if custom headers are not supported */
|
||||
[noscript] boolean ScopeUsesCustomHeaders(in nsMsgSearchScopeAttribute scope,
|
||||
[noscript] boolean ScopeUsesCustomHeaders(in nsMsgSearchScopeValue scope,
|
||||
/* could be a folder or server based on scope */
|
||||
in voidStar selection,
|
||||
in boolean forFilters);
|
||||
|
||||
/* use this to determine if your attribute is a string attrib */
|
||||
boolean IsStringAttribute(in nsMsgSearchAttribute attrib);
|
||||
boolean IsStringAttribute(in nsMsgSearchAttribValue attrib);
|
||||
|
||||
/* add all scopes of a given type to the search */
|
||||
void AddAllScopes(in nsMsgSearchScopeAttribute attrib);
|
||||
void AddAllScopes(in nsMsgSearchScopeValue attrib);
|
||||
|
||||
void Search(in nsIMsgWindow aWindow);
|
||||
void InterruptSearch();
|
||||
|
@ -2,7 +2,7 @@
|
||||
#ifndef __nsMsgBodyHandler_h
|
||||
#define __nsMsgBodyHandler_h
|
||||
|
||||
#include "nsMsgSearchScopeTerm.h"
|
||||
#include "nsIMsgSearchScopeTerm.h"
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// MSG_BodyHandler: used to retrive lines from POP and IMAP offline messages.
|
||||
@ -11,7 +11,7 @@
|
||||
class nsMsgBodyHandler
|
||||
{
|
||||
public:
|
||||
nsMsgBodyHandler (nsMsgSearchScopeTerm *,
|
||||
nsMsgBodyHandler (nsIMsgSearchScopeTerm *,
|
||||
PRUint32 offset,
|
||||
PRUint32 length,
|
||||
nsIMsgDBHdr * msg,
|
||||
@ -21,7 +21,7 @@ public:
|
||||
// filtering...we need the list of headers and the header size as well
|
||||
// if we are doing filtering...if ForFilters is false, headers and
|
||||
// headersSize is ignored!!!
|
||||
nsMsgBodyHandler (nsMsgSearchScopeTerm *, PRUint32 offset, PRUint32 length, nsIMsgDBHdr * msg, nsIMsgDatabase * db,
|
||||
nsMsgBodyHandler (nsIMsgSearchScopeTerm *, PRUint32 offset, PRUint32 length, nsIMsgDBHdr * msg, nsIMsgDatabase * db,
|
||||
const char * headers /* NULL terminated list of headers */, PRUint32 headersSize, PRBool ForFilters);
|
||||
|
||||
virtual ~nsMsgBodyHandler();
|
||||
@ -51,7 +51,7 @@ protected:
|
||||
// goes through the mail folder
|
||||
PRInt32 GetNextLocalLine(char * buf, int bufSize);
|
||||
|
||||
nsMsgSearchScopeTerm *m_scope;
|
||||
nsIMsgSearchScopeTerm *m_scope;
|
||||
|
||||
// local file state
|
||||
// XP_File *m_localFile;
|
||||
|
@ -57,6 +57,3 @@ interface nsMsgFilterAction {
|
||||
const long WatchThread=6;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -24,6 +24,8 @@
|
||||
#define __nsMsgResultElement_h
|
||||
|
||||
#include "nsMsgSearchCore.h"
|
||||
#include "nsIMsgSearchAdapter.h"
|
||||
#include "nsMsgSearchArray.h"
|
||||
|
||||
// nsMsgResultElement specifies a single search hit.
|
||||
|
||||
@ -39,13 +41,13 @@ public:
|
||||
virtual ~nsMsgResultElement ();
|
||||
|
||||
static nsresult AssignValues (nsMsgSearchValue *src, nsMsgSearchValue *dst);
|
||||
nsresult GetValue (nsMsgSearchAttribute, nsMsgSearchValue **) const;
|
||||
nsresult GetValue (nsMsgSearchAttribValue, nsMsgSearchValue **) const;
|
||||
nsresult AddValue (nsMsgSearchValue*);
|
||||
|
||||
nsresult GetPrettyName (nsMsgSearchValue**);
|
||||
|
||||
|
||||
const nsMsgSearchValue *GetValueRef (nsMsgSearchAttribute) const;
|
||||
const nsMsgSearchValue *GetValueRef (nsMsgSearchAttribValue) const;
|
||||
nsresult Open (void *window);
|
||||
|
||||
// added as part of the search as view capabilities...
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "nsIMsgSearchAdapter.h"
|
||||
#include "nsMsgSearchArray.h"
|
||||
|
||||
class nsIMsgSearchScopeTerm;
|
||||
class nsINNTPHost;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -38,7 +39,7 @@ class nsINNTPHost;
|
||||
// the special smarts for that protocol.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
inline PRBool IsStringAttribute (nsMsgSearchAttribute a)
|
||||
inline PRBool IsStringAttribute (nsMsgSearchAttribValue a)
|
||||
{
|
||||
return ! (a == nsMsgSearchAttrib::Priority || a == nsMsgSearchAttrib::Date ||
|
||||
a == nsMsgSearchAttrib::MsgStatus || a == nsMsgSearchAttrib::MessageKey ||
|
||||
@ -49,7 +50,7 @@ inline PRBool IsStringAttribute (nsMsgSearchAttribute a)
|
||||
class nsMsgSearchAdapter : public nsIMsgSearchAdapter
|
||||
{
|
||||
public:
|
||||
nsMsgSearchAdapter (nsMsgSearchScopeTerm*, nsMsgSearchTermArray&);
|
||||
nsMsgSearchAdapter (nsIMsgSearchScopeTerm*, nsMsgSearchTermArray&);
|
||||
virtual ~nsMsgSearchAdapter ();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
@ -64,7 +65,7 @@ public:
|
||||
// NS_IMETHOD FindTargetFolder (const nsMsgResultElement*, nsIMsgFolder **aFolder);
|
||||
// NS_IMETHOD Abort ();
|
||||
|
||||
nsMsgSearchScopeTerm *m_scope;
|
||||
nsIMsgSearchScopeTerm *m_scope;
|
||||
nsMsgSearchTermArray &m_searchTerms;
|
||||
|
||||
PRBool m_abortCalled;
|
||||
@ -214,7 +215,7 @@ protected:
|
||||
nsresult InitLocalNewsTable();
|
||||
nsresult InitNewsExTable (nsINNTPHost *host = nsnull);
|
||||
|
||||
void EnableLdapAttribute (nsMsgSearchAttribute, PRBool enabled = TRUE);
|
||||
void EnableLdapAttribute (nsMsgSearchAttribValue, PRBool enabled = PR_TRUE);
|
||||
};
|
||||
|
||||
extern nsMsgSearchValidityManager gValidityMgr;
|
||||
|
@ -32,7 +32,7 @@ interface nsIMsgHeaderParser;
|
||||
interface nsIMsgDatabase;
|
||||
interface nsIMsgDBHdr;
|
||||
|
||||
typedef long nsMsgSearchScopeAttribute;
|
||||
typedef long nsMsgSearchScopeValue;
|
||||
|
||||
[scriptable, uuid(5fe70a74-304e-11d3-9be1-00a0c900d445)]
|
||||
interface nsMsgSearchScope {
|
||||
@ -43,7 +43,7 @@ interface nsMsgSearchScope {
|
||||
const long AllSearchableGroups = 4;
|
||||
};
|
||||
|
||||
typedef long nsMsgSearchAttribute;
|
||||
typedef long nsMsgSearchAttribValue;
|
||||
|
||||
[scriptable, uuid(68c8710a-304e-11d3-97bf-00a0c900d445)]
|
||||
interface nsMsgSearchAttrib {
|
||||
@ -116,7 +116,7 @@ interface nsMsgSearchAttrib {
|
||||
* RULES.DAT stores enum values persistently
|
||||
*/
|
||||
|
||||
typedef long nsMsgSearchOperator;
|
||||
typedef long nsMsgSearchOpValue;
|
||||
|
||||
[scriptable, uuid(82cc4518-304e-11d3-831d-00a0c900d445)]
|
||||
interface nsMsgSearchOp {
|
||||
@ -146,7 +146,7 @@ interface nsMsgSearchOp {
|
||||
const long kNumMsgSearchOperators = 16; /* must be last operator */
|
||||
};
|
||||
|
||||
typedef long nsMsgSearchValueWidget;
|
||||
typedef long nsMsgSearchWidgetValue;
|
||||
|
||||
/* FEs use this to help build the search dialog box */
|
||||
[scriptable,uuid(903dd2e8-304e-11d3-92e6-00a0c900d445)]
|
||||
@ -158,7 +158,7 @@ interface nsMsgSearchWidget {
|
||||
const long None = 4;
|
||||
};
|
||||
|
||||
typedef long nsMsgSearchTypeVal;
|
||||
typedef long nsMsgSearchTypeValue;
|
||||
|
||||
|
||||
/* Used to specify type of search to be performed */
|
||||
@ -186,7 +186,7 @@ interface nsMsgSearchBooleanOp {
|
||||
%{C++
|
||||
typedef struct nsMsgSearchValue
|
||||
{
|
||||
nsMsgSearchAttribute attribute;
|
||||
nsMsgSearchAttribValue attribute;
|
||||
union
|
||||
{
|
||||
char *string;
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
#include "nsMsgSearchCore.h"
|
||||
#include "nsMsgSearchArray.h"
|
||||
#include "nsMsgSearchScopeTerm.h"
|
||||
#include "nsIMsgSearchAdapter.h"
|
||||
#include "nsIMsgFolder.h"
|
||||
#include "nsIMsgSearchAdapter.h"
|
||||
@ -32,24 +33,26 @@
|
||||
#include "nsIMsgSearchSession.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsMsgSearchScopeTerm
|
||||
class nsMsgSearchScopeTerm : public nsIMsgSearchScopeTerm
|
||||
{
|
||||
public:
|
||||
nsMsgSearchScopeTerm (nsIMsgSearchSession *, nsMsgSearchScopeAttribute, nsIMsgFolder *);
|
||||
nsMsgSearchScopeTerm (nsIMsgSearchSession *, nsMsgSearchScopeValue, nsIMsgFolder *);
|
||||
nsMsgSearchScopeTerm ();
|
||||
virtual ~nsMsgSearchScopeTerm ();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIMSGSEARCHSCOPETERM
|
||||
|
||||
PRBool IsOfflineNews();
|
||||
PRBool IsOfflineMail ();
|
||||
PRBool IsOfflineIMAPMail(); // added by mscott
|
||||
nsresult GetMailPath(nsIFileSpec **aFileSpec);
|
||||
nsresult TimeSlice (PRBool *aDone);
|
||||
|
||||
nsresult InitializeAdapter (nsMsgSearchTermArray &termList);
|
||||
|
||||
char *GetStatusBarName ();
|
||||
|
||||
nsMsgSearchScopeAttribute m_attribute;
|
||||
nsMsgSearchScopeValue m_attribute;
|
||||
char *m_name;
|
||||
nsCOMPtr <nsIMsgFolder> m_folder;
|
||||
nsInputFileStream *m_fileStream;
|
||||
|
@ -30,7 +30,7 @@
|
||||
// perhaps this should go in its own header file, if this class gets
|
||||
// its own cpp file, nsMsgSearchTerm.cpp
|
||||
#include "nsIMsgSearchSession.h"
|
||||
#include "nsMsgSearchScopeTerm.h"
|
||||
#include "nsIMsgSearchScopeTerm.h"
|
||||
|
||||
#define EMPTY_MESSAGE_LINE(buf) (buf[0] == CR || buf[0] == LF || buf[0] == '\0')
|
||||
|
||||
@ -41,7 +41,7 @@ public:
|
||||
#if 0
|
||||
nsMsgSearchTerm (nsMsgSearchAttribute, nsMsgSearchOperator, nsMsgSearchValue *, PRBool, char * arbitraryHeader); // the bool is true if AND, PR_FALSE if OR
|
||||
#endif
|
||||
nsMsgSearchTerm (nsMsgSearchAttribute, nsMsgSearchOperator, nsMsgSearchValue *, nsMsgSearchBooleanOperator, const char * arbitraryHeader);
|
||||
nsMsgSearchTerm (nsMsgSearchAttribValue, nsMsgSearchOpValue, nsMsgSearchValue *, nsMsgSearchBooleanOperator, const char * arbitraryHeader);
|
||||
|
||||
virtual ~nsMsgSearchTerm ();
|
||||
|
||||
@ -49,9 +49,9 @@ public:
|
||||
PRInt32 GetNextIMAPOfflineMsgLine (char * buf, int bufferSize, int msgOffset, nsIMessage * msg, nsIMsgDatabase * db);
|
||||
|
||||
|
||||
nsresult MatchBody (nsMsgSearchScopeTerm*, PRUint32 offset, PRUint32 length, const char *charset,
|
||||
nsresult MatchBody (nsIMsgSearchScopeTerm*, PRUint32 offset, PRUint32 length, const char *charset,
|
||||
nsIMsgDBHdr * msg, nsIMsgDatabase * db, PRBool *pResult);
|
||||
nsresult MatchArbitraryHeader (nsMsgSearchScopeTerm *,
|
||||
nsresult MatchArbitraryHeader (nsIMsgSearchScopeTerm *,
|
||||
PRUint32 offset,
|
||||
PRUint32 length,
|
||||
const char *charset,
|
||||
@ -85,16 +85,16 @@ public:
|
||||
|
||||
nsCOMPtr<nsIMsgHeaderParser> m_headerAddressParser;
|
||||
|
||||
nsMsgSearchAttribute m_attribute;
|
||||
nsMsgSearchOperator m_operator;
|
||||
nsMsgSearchAttribValue m_attribute;
|
||||
nsMsgSearchOpValue m_operator;
|
||||
nsMsgSearchValue m_value;
|
||||
nsMsgSearchBooleanOperator m_booleanOp; // boolean operator to be applied to this search term and the search term which precedes it.
|
||||
nsCString m_arbitraryHeader; // user specified string for the name of the arbitrary header to be used in the search
|
||||
// only has a value when m_attribute = attribOtherHeader!!!!
|
||||
protected:
|
||||
nsresult OutputValue(nsCString &outputStr);
|
||||
nsMsgSearchAttribute ParseAttribute(char *inStream);
|
||||
nsMsgSearchOperator ParseOperator(char *inStream);
|
||||
nsMsgSearchAttribValue ParseAttribute(char *inStream);
|
||||
nsMsgSearchOpValue ParseOperator(char *inStream);
|
||||
nsresult ParseValue(char *inStream);
|
||||
nsresult InitHeaderAddressParser();
|
||||
|
||||
|
@ -36,6 +36,7 @@ CPPSRCS = \
|
||||
nsMsgSearchTerm.cpp \
|
||||
nsMsgBodyHandler.cpp \
|
||||
nsMsgLocalSearch.cpp \
|
||||
nsMsgSearchValue.cpp \
|
||||
nsMsgSearchAdapter.cpp \
|
||||
nsMsgSearchSession.cpp \
|
||||
nsMsgImapSearch.cpp \
|
||||
|
@ -37,6 +37,7 @@ CPPSRCS= nsMsgFilterService.cpp\
|
||||
nsMsgLocalSearch.cpp\
|
||||
nsMsgSearchAdapter.cpp\
|
||||
nsMsgSearchSession.cpp\
|
||||
nsMsgSearchValue.cpp \
|
||||
nsMsgImapSearch.cpp\
|
||||
nsMsgSearchNews.cpp \
|
||||
nsMsgFilterDataSource.cpp \
|
||||
|
@ -25,8 +25,10 @@
|
||||
#include "nsMsgUtils.h"
|
||||
#include "nsMsgBodyHandler.h"
|
||||
#include "nsMsgSearchTerm.h"
|
||||
#include "nsFileStream.h"
|
||||
#include "nsIFileStream.h"
|
||||
|
||||
nsMsgBodyHandler::nsMsgBodyHandler (nsMsgSearchScopeTerm * scope, PRUint32 offset, PRUint32 numLines, nsIMsgDBHdr* msg, nsIMsgDatabase * db)
|
||||
nsMsgBodyHandler::nsMsgBodyHandler (nsIMsgSearchScopeTerm * scope, PRUint32 offset, PRUint32 numLines, nsIMsgDBHdr* msg, nsIMsgDatabase * db)
|
||||
{
|
||||
m_scope = scope;
|
||||
m_localFileOffset = offset;
|
||||
@ -44,7 +46,7 @@ nsMsgBodyHandler::nsMsgBodyHandler (nsMsgSearchScopeTerm * scope, PRUint32 offse
|
||||
OpenLocalFolder();
|
||||
}
|
||||
|
||||
nsMsgBodyHandler::nsMsgBodyHandler(nsMsgSearchScopeTerm * scope,
|
||||
nsMsgBodyHandler::nsMsgBodyHandler(nsIMsgSearchScopeTerm * scope,
|
||||
PRUint32 offset, PRUint32 numLines,
|
||||
nsIMsgDBHdr* msg, nsIMsgDatabase* db,
|
||||
const char * headers, PRUint32 headersSize,
|
||||
@ -84,11 +86,7 @@ void nsMsgBodyHandler::Initialize()
|
||||
|
||||
nsMsgBodyHandler::~nsMsgBodyHandler()
|
||||
{
|
||||
if (m_scope->m_fileStream)
|
||||
{
|
||||
delete m_scope->m_fileStream;
|
||||
m_scope->m_fileStream = NULL;
|
||||
}
|
||||
m_scope->SetFileStream(nsnull);
|
||||
}
|
||||
|
||||
|
||||
@ -120,7 +118,12 @@ PRInt32 nsMsgBodyHandler::GetNextLine (char * buf, int bufSize)
|
||||
}
|
||||
void nsMsgBodyHandler::OpenLocalFolder()
|
||||
{
|
||||
if (!m_scope->m_fileStream)
|
||||
nsInputFileStream *stream=nsnull;
|
||||
|
||||
nsCOMPtr<nsIInputStream> scopeFileStream;
|
||||
nsresult rv = m_scope->GetFileStream(getter_AddRefs(scopeFileStream));
|
||||
|
||||
if (NS_FAILED(rv) || !scopeFileStream)
|
||||
{
|
||||
nsCOMPtr <nsIFileSpec> fileSpec;
|
||||
nsresult rv = m_scope->GetMailPath(getter_AddRefs(fileSpec));
|
||||
@ -128,11 +131,17 @@ void nsMsgBodyHandler::OpenLocalFolder()
|
||||
{
|
||||
nsFileSpec path;
|
||||
fileSpec->GetFileSpec(&path);
|
||||
m_scope->m_fileStream = new nsInputFileStream(path);
|
||||
stream = new nsInputFileStream(path);
|
||||
scopeFileStream = stream->GetIStream();
|
||||
m_scope->SetFileStream(scopeFileStream);
|
||||
}
|
||||
}
|
||||
if (m_scope->m_fileStream)
|
||||
m_scope->m_fileStream->seek(m_localFileOffset);
|
||||
} else {
|
||||
stream = new nsInputFileStream(scopeFileStream);
|
||||
}
|
||||
if (stream) {
|
||||
stream->seek(m_localFileOffset);
|
||||
delete stream;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -181,10 +190,14 @@ PRInt32 nsMsgBodyHandler::GetNextLocalLine(char * buf, int bufSize)
|
||||
if (m_passedHeaders)
|
||||
m_numLocalLines--; // the line count is only for body lines
|
||||
// do we need to check the return value here?
|
||||
if (m_scope->m_fileStream->eof())
|
||||
nsCOMPtr<nsIInputStream> inputStream;
|
||||
m_scope->GetFileStream(getter_AddRefs(inputStream));
|
||||
|
||||
nsInputFileStream fileStream(inputStream);
|
||||
if (fileStream.eof())
|
||||
return -1;
|
||||
|
||||
if (m_scope->m_fileStream->readline(buf, bufSize))
|
||||
if (fileStream.readline(buf, bufSize))
|
||||
return nsCRT::strlen(buf);
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,9 @@
|
||||
#include "nsMsgLocalSearch.h"
|
||||
#include "nsMsgSearchTerm.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsMsgSearchScopeTerm.h"
|
||||
#include "nsIMsgAccountManager.h"
|
||||
#include "nsMsgSearchValue.h"
|
||||
|
||||
static const char *kImapPrefix = "//imap:";
|
||||
|
||||
@ -127,11 +129,13 @@ NS_IMETHODIMP nsMsgFilter::SetFilterDesc(const char *description)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFilter::AddTerm(
|
||||
nsMsgSearchAttribute attrib, /* attribute for this term */
|
||||
nsMsgSearchOperator op, /* operator e.g. opContains */
|
||||
nsMsgSearchValue *value, /* value e.g. "Dogbert" */
|
||||
PRBool BooleanAND, /* PR_TRUE if AND is the boolean operator. PR_FALSE if OR is the boolean operators */
|
||||
const char * arbitraryHeader) /* arbitrary header specified by user. ignored unless attrib = attribOtherHeader */
|
||||
nsMsgSearchAttribValue attrib, /* attribute for this term */
|
||||
nsMsgSearchOpValue op, /* operator e.g. opContains */
|
||||
nsIMsgSearchValue *value, /* value e.g. "Dogbert" */
|
||||
PRBool BooleanAND, /* PR_TRUE if AND is the boolean operator.
|
||||
PR_FALSE if OR is the boolean operators */
|
||||
const char * arbitraryHeader) /* arbitrary header specified by user.
|
||||
ignored unless attrib = attribOtherHeader */
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
@ -147,11 +151,13 @@ NS_IMETHODIMP nsMsgFilter::GetNumTerms(PRInt32 *aResult)
|
||||
|
||||
|
||||
NS_IMETHODIMP nsMsgFilter::GetTerm(PRInt32 termIndex,
|
||||
nsMsgSearchAttribute *attrib, /* attribute for this term */
|
||||
nsMsgSearchOperator *op, /* operator e.g. opContains */
|
||||
nsMsgSearchValue *value, /* value e.g. "Dogbert" */
|
||||
PRBool *booleanAnd, /* PR_TRUE if AND is the boolean operator. PR_FALSE if OR is the boolean operator */
|
||||
char ** arbitraryHeader) /* arbitrary header specified by user. ignore unless attrib = attribOtherHeader */
|
||||
nsMsgSearchAttribValue *attrib, /* attribute for this term */
|
||||
nsMsgSearchOpValue *op, /* operator e.g. opContains */
|
||||
nsIMsgSearchValue **value, /* value e.g. "Dogbert" */
|
||||
PRBool *booleanAnd, /* PR_TRUE if AND is the boolean operator.
|
||||
PR_FALSE if OR is the boolean operator */
|
||||
char ** arbitraryHeader) /* arbitrary header specified by user.
|
||||
ignore unless attrib = attribOtherHeader */
|
||||
{
|
||||
if (!attrib || !op || !value || !booleanAnd || !arbitraryHeader)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
@ -161,7 +167,13 @@ NS_IMETHODIMP nsMsgFilter::GetTerm(PRInt32 termIndex,
|
||||
{
|
||||
*attrib = term->m_attribute;
|
||||
*op = term->m_operator;
|
||||
*value = term->m_value;
|
||||
|
||||
// create the search value object
|
||||
nsMsgSearchValueImpl *searchValue =
|
||||
new nsMsgSearchValueImpl(&term->m_value);
|
||||
*value = NS_STATIC_CAST(nsIMsgSearchValue*,searchValue);
|
||||
NS_ADDREF(*value);
|
||||
|
||||
*booleanAnd = term->m_booleanOp;
|
||||
if (term->m_attribute == nsMsgSearchAttrib::OtherHeader)
|
||||
*arbitraryHeader = PL_strdup(term->m_arbitraryHeader.GetBuffer());
|
||||
@ -169,13 +181,13 @@ NS_IMETHODIMP nsMsgFilter::GetTerm(PRInt32 termIndex,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFilter::SetScope(nsMsgSearchScopeTerm *aResult)
|
||||
NS_IMETHODIMP nsMsgFilter::SetScope(nsIMsgSearchScopeTerm *aResult)
|
||||
{
|
||||
m_scope = aResult;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFilter::GetScope(nsMsgSearchScopeTerm **aResult)
|
||||
NS_IMETHODIMP nsMsgFilter::GetScope(nsIMsgSearchScopeTerm **aResult)
|
||||
{
|
||||
if (aResult == NULL)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
@ -284,9 +296,11 @@ NS_IMETHODIMP nsMsgFilter::MatchHdr(nsIMsgDBHdr *msgHdr, nsIMsgFolder *folder, n
|
||||
const char *headers, PRUint32 headersSize, PRBool *pResult)
|
||||
{
|
||||
|
||||
nsMsgSearchScopeTerm scope (nsnull, nsMsgSearchScope::MailFolder, folder);
|
||||
nsMsgSearchScopeTerm* scope = new nsMsgSearchScopeTerm(nsnull, nsMsgSearchScope::MailFolder, folder);
|
||||
nsCOMPtr<nsIMsgSearchScopeTerm> scopeInterface = scope;
|
||||
|
||||
return nsMsgSearchOfflineMail::MatchTermsForFilter(msgHdr, m_termList,
|
||||
&scope,
|
||||
scope,
|
||||
db,
|
||||
headers,
|
||||
headersSize,
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "nsISupports.h"
|
||||
#include "nsIMsgFilter.h"
|
||||
#include "nsMsgSearchArray.h"
|
||||
#include "nsIMsgSearchScopeTerm.h"
|
||||
|
||||
class nsMsgRuleAction
|
||||
{
|
||||
@ -91,7 +92,7 @@ protected:
|
||||
|
||||
nsMsgFilterList *m_filterList; /* owning filter list */
|
||||
nsMsgSearchTermArray m_termList; /* linked list of criteria terms */
|
||||
nsMsgSearchScopeTerm *m_scope; /* default for mail rules is inbox, but news rules could
|
||||
nsIMsgSearchScopeTerm *m_scope; /* default for mail rules is inbox, but news rules could
|
||||
have a newsgroup - LDAP would be invalid */
|
||||
|
||||
};
|
||||
|
@ -131,7 +131,10 @@ nsresult nsMsgSearchOnlineMail::AddResultElement (nsIMsgDBHdr *pHeaders)
|
||||
{
|
||||
nsXPIDLString folderName;
|
||||
pValue->attribute = nsMsgSearchAttrib::Location;
|
||||
m_scope->m_folder->GetName(getter_Copies(folderName));
|
||||
nsCOMPtr<nsIMsgFolder> folder;
|
||||
err = m_scope->GetFolder(getter_AddRefs(folder));
|
||||
if (NS_SUCCEEDED(err) && folder)
|
||||
folder->GetName(getter_Copies(folderName));
|
||||
// pValue->u.wString = nsCRT::strdup((const PRUnichar *) folderName);
|
||||
newResult->AddValue (pValue);
|
||||
}
|
||||
@ -151,7 +154,11 @@ nsresult nsMsgSearchOnlineMail::AddResultElement (nsIMsgDBHdr *pHeaders)
|
||||
}
|
||||
if (!pValue)
|
||||
err = NS_ERROR_OUT_OF_MEMORY;
|
||||
m_scope->m_searchSession->AddResultElement (newResult);
|
||||
nsCOMPtr<nsIMsgSearchSession> searchSession;
|
||||
m_scope->GetSearchSession(getter_AddRefs(searchSession));
|
||||
if (searchSession)
|
||||
searchSession->AddResultElement(newResult);
|
||||
//XXXX alecf do not checkin without fixing! m_scope->m_searchSession->AddResultElement (newResult);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
@ -225,7 +225,7 @@ PRInt32 nsMsgSearchBoolExpression::GenerateEncodeStr(nsCString * buffer)
|
||||
|
||||
//---------------- Adapter class for searching offline IMAP folders -----------
|
||||
//-----------------------------------------------------------------------------
|
||||
nsMsgSearchIMAPOfflineMail::nsMsgSearchIMAPOfflineMail (nsMsgSearchScopeTerm *scope, nsMsgSearchTermArray &termList) : nsMsgSearchOfflineMail(scope, termList)
|
||||
nsMsgSearchIMAPOfflineMail::nsMsgSearchIMAPOfflineMail (nsIMsgSearchScopeTerm *scope, nsMsgSearchTermArray &termList) : nsMsgSearchOfflineMail(scope, termList)
|
||||
{
|
||||
|
||||
}
|
||||
@ -274,7 +274,7 @@ nsresult nsMsgSearchIMAPOfflineMail::ValidateTerms ()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
nsMsgSearchOfflineMail::nsMsgSearchOfflineMail (nsMsgSearchScopeTerm *scope, nsMsgSearchTermArray &termList) : nsMsgSearchAdapter (scope, termList)
|
||||
nsMsgSearchOfflineMail::nsMsgSearchOfflineMail (nsIMsgSearchScopeTerm *scope, nsMsgSearchTermArray &termList) : nsMsgSearchAdapter (scope, termList)
|
||||
{
|
||||
m_db = nsnull;
|
||||
m_listContext = nsnull;
|
||||
@ -453,7 +453,7 @@ nsresult nsMsgSearchOfflineMail::SummaryFileError ()
|
||||
|
||||
nsresult nsMsgSearchOfflineMail::MatchTermsForFilter(nsIMsgDBHdr *msgToMatch,
|
||||
nsMsgSearchTermArray & termList,
|
||||
nsMsgSearchScopeTerm * scope,
|
||||
nsIMsgSearchScopeTerm * scope,
|
||||
nsIMsgDatabase * db,
|
||||
const char * headers,
|
||||
PRUint32 headerSize,
|
||||
@ -465,7 +465,7 @@ nsresult nsMsgSearchOfflineMail::MatchTermsForFilter(nsIMsgDBHdr *msgToMatch,
|
||||
// static method which matches a header against a list of search terms.
|
||||
nsresult nsMsgSearchOfflineMail::MatchTermsForSearch(nsIMsgDBHdr *msgToMatch,
|
||||
nsMsgSearchTermArray &termList,
|
||||
nsMsgSearchScopeTerm *scope,
|
||||
nsIMsgSearchScopeTerm *scope,
|
||||
nsIMsgDatabase *db,
|
||||
PRBool *pResult)
|
||||
{
|
||||
@ -474,7 +474,7 @@ nsresult nsMsgSearchOfflineMail::MatchTermsForSearch(nsIMsgDBHdr *msgToMatch,
|
||||
|
||||
nsresult nsMsgSearchOfflineMail::MatchTerms(nsIMsgDBHdr *msgToMatch,
|
||||
nsMsgSearchTermArray & termList,
|
||||
nsMsgSearchScopeTerm * scope,
|
||||
nsIMsgSearchScopeTerm * scope,
|
||||
nsIMsgDatabase * db,
|
||||
const char * headers,
|
||||
PRUint32 headerSize,
|
||||
|
@ -28,13 +28,15 @@
|
||||
|
||||
// inherit base implementation
|
||||
#include "nsMsgSearchAdapter.h"
|
||||
|
||||
class nsIMsgDBHdr;
|
||||
class nsMsgMailboxParser;
|
||||
class nsIMsgSearchScopeTerm;
|
||||
|
||||
class nsMsgSearchOfflineMail : public nsMsgSearchAdapter
|
||||
{
|
||||
public:
|
||||
nsMsgSearchOfflineMail (nsMsgSearchScopeTerm*, nsMsgSearchTermArray&);
|
||||
nsMsgSearchOfflineMail (nsIMsgSearchScopeTerm*, nsMsgSearchTermArray&);
|
||||
virtual ~nsMsgSearchOfflineMail ();
|
||||
|
||||
NS_IMETHOD ValidateTerms ();
|
||||
@ -42,13 +44,13 @@ public:
|
||||
NS_IMETHOD Abort ();
|
||||
static nsresult MatchTermsForFilter(nsIMsgDBHdr * msgToMatch,
|
||||
nsMsgSearchTermArray &termList,
|
||||
nsMsgSearchScopeTerm *scope,
|
||||
nsIMsgSearchScopeTerm *scope,
|
||||
nsIMsgDatabase * db,
|
||||
const char * headers,
|
||||
PRUint32 headerSize,
|
||||
PRBool *pResult);
|
||||
|
||||
static nsresult MatchTermsForSearch(nsIMsgDBHdr * msgTomatch, nsMsgSearchTermArray & termList, nsMsgSearchScopeTerm *scope,
|
||||
static nsresult MatchTermsForSearch(nsIMsgDBHdr * msgTomatch, nsMsgSearchTermArray & termList, nsIMsgSearchScopeTerm *scope,
|
||||
nsIMsgDatabase *db, PRBool *pResult);
|
||||
|
||||
virtual nsresult BuildSummaryFile ();
|
||||
@ -61,7 +63,7 @@ public:
|
||||
protected:
|
||||
static nsresult MatchTerms(nsIMsgDBHdr *msgToMatch,
|
||||
nsMsgSearchTermArray &termList,
|
||||
nsMsgSearchScopeTerm *scope,
|
||||
nsIMsgSearchScopeTerm *scope,
|
||||
nsIMsgDatabase * db,
|
||||
const char * headers,
|
||||
PRUint32 headerSize,
|
||||
@ -86,7 +88,7 @@ protected:
|
||||
class nsMsgSearchIMAPOfflineMail : public nsMsgSearchOfflineMail
|
||||
{
|
||||
public:
|
||||
nsMsgSearchIMAPOfflineMail (nsMsgSearchScopeTerm*, nsMsgSearchTermArray&);
|
||||
nsMsgSearchIMAPOfflineMail (nsIMsgSearchScopeTerm*, nsMsgSearchTermArray&);
|
||||
virtual ~nsMsgSearchIMAPOfflineMail ();
|
||||
|
||||
NS_IMETHOD ValidateTerms ();
|
||||
@ -97,7 +99,7 @@ public:
|
||||
class nsMsgSearchOfflineNews : public nsMsgSearchOfflineMail
|
||||
{
|
||||
public:
|
||||
nsMsgSearchOfflineNews (nsMsgSearchScopeTerm*, nsMsgSearchTermArray&);
|
||||
nsMsgSearchOfflineNews (nsIMsgSearchScopeTerm*, nsMsgSearchTermArray&);
|
||||
virtual ~nsMsgSearchOfflineNews ();
|
||||
NS_IMETHOD ValidateTerms ();
|
||||
|
||||
|
@ -77,7 +77,7 @@ NS_IMETHODIMP nsMsgSearchAdapter::OpenResultElement(nsMsgResultElement *)
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsMsgSearchAdapter, nsIMsgSearchAdapter)
|
||||
|
||||
nsMsgSearchAdapter::nsMsgSearchAdapter(nsMsgSearchScopeTerm *scope, nsMsgSearchTermArray &searchTerms)
|
||||
nsMsgSearchAdapter::nsMsgSearchAdapter(nsIMsgSearchScopeTerm *scope, nsMsgSearchTermArray &searchTerms)
|
||||
: m_searchTerms(searchTerms)
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
@ -305,6 +305,7 @@ char *nsMsgSearchAdapter::UnEscapeSearchUrl (const char *commandSpecificData)
|
||||
void
|
||||
nsMsgSearchAdapter::GetSearchCharsets(nsString &srcCharset, nsString& dstCharset)
|
||||
{
|
||||
nsresult rv;
|
||||
// char *defaultCharset = nsMsgI18NGetDefaultMailCharset();
|
||||
nsAutoString defaultCharset = nsMsgI18NGetDefaultMailCharset();
|
||||
srcCharset = defaultCharset;
|
||||
@ -314,13 +315,16 @@ nsMsgSearchAdapter::GetSearchCharsets(nsString &srcCharset, nsString& dstCharset
|
||||
{
|
||||
// ### DMB is there a way to get the charset for the "window"?
|
||||
|
||||
nsCOMPtr<nsIMsgFolder> folder;
|
||||
rv = m_scope->GetFolder(getter_AddRefs(folder));
|
||||
|
||||
// Ask the newsgroup/folder for its csid.
|
||||
if (m_scope->m_folder)
|
||||
{
|
||||
nsXPIDLString folderCharset;
|
||||
m_scope->m_folder->GetCharset(getter_Copies(folderCharset));
|
||||
dstCharset = folderCharset;
|
||||
}
|
||||
if (NS_SUCCEEDED(rv) && folder)
|
||||
{
|
||||
nsXPIDLString folderCharset;
|
||||
folder->GetCharset(getter_Copies(folderCharset));
|
||||
dstCharset = folderCharset;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -333,7 +337,6 @@ nsMsgSearchAdapter::GetSearchCharsets(nsString &srcCharset, nsString& dstCharset
|
||||
dstCharset = srcCharset;
|
||||
|
||||
PRBool forceAscii = PR_FALSE;
|
||||
nsresult rv;
|
||||
|
||||
NS_WITH_SERVICE(nsIPref, prefs, kPrefServiceCID, &rv);
|
||||
|
||||
|
@ -483,7 +483,9 @@ void nsMsgSearchNews::ReportHit (nsIMsgDBHdr *pHeaders, const char *location)
|
||||
}
|
||||
if (!pValue)
|
||||
err = NS_ERROR_OUT_OF_MEMORY;
|
||||
m_scope->m_searchSession->AddResultElement (newResult);
|
||||
nsCOMPtr<nsIMsgSearchSession> session;
|
||||
m_scope->GetSearchSession(getter_AddRefs(session));
|
||||
session->AddResultElement (newResult);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "nsMsgSearchSession.h"
|
||||
#include "nsMsgResultElement.h"
|
||||
#include "nsMsgSearchTerm.h"
|
||||
#include "nsMsgSearchScopeTerm.h"
|
||||
#include "nsIMsgMessageService.h"
|
||||
#include "nsMsgUtils.h"
|
||||
#include "nsXPIDLString.h"
|
||||
@ -55,7 +56,12 @@ nsMsgSearchSession::~nsMsgSearchSession()
|
||||
}
|
||||
|
||||
/* [noscript] void AddSearchTerm (in nsMsgSearchAttribute attrib, in nsMsgSearchOperator op, in nsMsgSearchValue value, in boolean BooleanAND, in string arbitraryHeader); */
|
||||
NS_IMETHODIMP nsMsgSearchSession::AddSearchTerm(nsMsgSearchAttribute attrib, nsMsgSearchOperator op, nsMsgSearchValue * value, PRBool BooleanAND, const char *arbitraryHeader)
|
||||
NS_IMETHODIMP
|
||||
nsMsgSearchSession::AddSearchTerm(nsMsgSearchAttribValue attrib,
|
||||
nsMsgSearchOpValue op,
|
||||
nsMsgSearchValue * value,
|
||||
PRBool BooleanAND,
|
||||
const char *arbitraryHeader)
|
||||
{
|
||||
nsMsgSearchTerm *pTerm = new nsMsgSearchTerm (attrib, op, value, nsMsgSearchBooleanOp::BooleanAND, arbitraryHeader);
|
||||
if (nsnull == pTerm)
|
||||
@ -73,7 +79,11 @@ NS_IMETHODIMP nsMsgSearchSession::GetNumSearchTerms(PRInt32 *aNumSearchTerms)
|
||||
}
|
||||
|
||||
/* [noscript] void GetNthSearchTerm (in long whichTerm, in nsMsgSearchAttribute attrib, in nsMsgSearchOperator op, in nsMsgSearchValue value); */
|
||||
NS_IMETHODIMP nsMsgSearchSession::GetNthSearchTerm(PRInt32 whichTerm, nsMsgSearchAttribute attrib, nsMsgSearchOperator op, nsMsgSearchValue * value)
|
||||
NS_IMETHODIMP
|
||||
nsMsgSearchSession::GetNthSearchTerm(PRInt32 whichTerm,
|
||||
nsMsgSearchAttribValue attrib,
|
||||
nsMsgSearchOpValue op,
|
||||
nsMsgSearchValue * value)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
@ -86,7 +96,10 @@ NS_IMETHODIMP nsMsgSearchSession::CountSearchScopes(PRInt32 *_retval)
|
||||
}
|
||||
|
||||
/* void GetNthSearchScope (in long which, out nsMsgSearchScope scopeId, out nsIMsgFolder folder); */
|
||||
NS_IMETHODIMP nsMsgSearchSession::GetNthSearchScope(PRInt32 which, nsMsgSearchScopeAttribute *scopeId, nsIMsgFolder **folder)
|
||||
NS_IMETHODIMP
|
||||
nsMsgSearchSession::GetNthSearchScope(PRInt32 which,
|
||||
nsMsgSearchScopeValue *scopeId,
|
||||
nsIMsgFolder **folder)
|
||||
{
|
||||
// argh, does this do an addref?
|
||||
nsMsgSearchScopeTerm *scopeTerm = m_scopeList.ElementAt(which);
|
||||
@ -97,7 +110,9 @@ NS_IMETHODIMP nsMsgSearchSession::GetNthSearchScope(PRInt32 which, nsMsgSearchSc
|
||||
}
|
||||
|
||||
/* void AddScopeTerm (in nsMsgSearchScope attrib, in nsIMsgFolder folder); */
|
||||
NS_IMETHODIMP nsMsgSearchSession::AddScopeTerm(nsMsgSearchScopeAttribute attrib, nsIMsgFolder *folder)
|
||||
NS_IMETHODIMP
|
||||
nsMsgSearchSession::AddScopeTerm(nsMsgSearchScopeValue attrib,
|
||||
nsIMsgFolder *folder)
|
||||
{
|
||||
if (attrib != nsMsgSearchScope::AllSearchableGroups)
|
||||
{
|
||||
@ -196,20 +211,27 @@ NS_IMETHODIMP nsMsgSearchSession::AddLdapScope(nsMsgDIRServer * server)
|
||||
}
|
||||
|
||||
/* [noscript] boolean ScopeUsesCustomHeaders (in nsMsgSearchScope scope, in voidStar selection, in boolean forFilters); */
|
||||
NS_IMETHODIMP nsMsgSearchSession::ScopeUsesCustomHeaders(nsMsgSearchScopeAttribute scope, void * selection, PRBool forFilters, PRBool *_retval)
|
||||
NS_IMETHODIMP
|
||||
nsMsgSearchSession::ScopeUsesCustomHeaders(nsMsgSearchScopeValue scope,
|
||||
void * selection,
|
||||
PRBool forFilters,
|
||||
PRBool *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* boolean IsStringAttribute (in nsMsgSearchAttribute attrib); */
|
||||
NS_IMETHODIMP nsMsgSearchSession::IsStringAttribute(nsMsgSearchAttribute attrib, PRBool *_retval)
|
||||
NS_IMETHODIMP
|
||||
nsMsgSearchSession::IsStringAttribute(nsMsgSearchAttribValue attrib,
|
||||
PRBool *_retval)
|
||||
{
|
||||
NS_ENSURE_ARG(_retval);
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void AddAllScopes (in nsMsgSearchScope attrib); */
|
||||
NS_IMETHODIMP nsMsgSearchSession::AddAllScopes(nsMsgSearchScopeAttribute attrib)
|
||||
NS_IMETHODIMP
|
||||
nsMsgSearchSession::AddAllScopes(nsMsgSearchScopeValue attrib)
|
||||
{
|
||||
// don't think this is needed.
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
@ -70,7 +70,7 @@ protected:
|
||||
nsresult TimeSliceSerial (PRBool *aDone);
|
||||
nsresult TimeSliceParallel ();
|
||||
|
||||
nsMsgSearchAttribute m_sortAttribute;
|
||||
nsMsgSearchAttribValue m_sortAttribute;
|
||||
PRBool m_descending;
|
||||
// support for searching multiple scopes in parallel
|
||||
PRBool m_parallel;
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "nsMsgUtils.h"
|
||||
#include "nsIMsgDatabase.h"
|
||||
#include "nsMsgSearchTerm.h"
|
||||
#include "nsMsgSearchScopeTerm.h"
|
||||
#include "nsMsgBodyHandler.h"
|
||||
#include "nsMsgResultElement.h"
|
||||
#include "nsIMsgImapMailFolder.h"
|
||||
@ -43,7 +44,7 @@
|
||||
|
||||
typedef struct
|
||||
{
|
||||
nsMsgSearchAttribute attrib;
|
||||
nsMsgSearchAttribValue attrib;
|
||||
const char *attribName;
|
||||
} nsMsgSearchAttribEntry;
|
||||
|
||||
@ -106,7 +107,7 @@ nsresult NS_MsgGetStringForAttribute(PRInt16 attrib, const char **string)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
nsMsgSearchOperator op;
|
||||
nsMsgSearchOpValue op;
|
||||
const char *opName;
|
||||
} nsMsgSearchOperatorEntry;
|
||||
|
||||
@ -252,8 +253,8 @@ nsMsgSearchTerm::nsMsgSearchTerm (
|
||||
#endif
|
||||
|
||||
nsMsgSearchTerm::nsMsgSearchTerm (
|
||||
nsMsgSearchAttribute attrib,
|
||||
nsMsgSearchOperator op,
|
||||
nsMsgSearchAttribValue attrib,
|
||||
nsMsgSearchOpValue op,
|
||||
nsMsgSearchValue *val,
|
||||
nsMsgSearchBooleanOperator boolOp,
|
||||
const char * arbitraryHeader)
|
||||
@ -444,7 +445,8 @@ nsresult nsMsgSearchTerm::ParseValue(char *inStream)
|
||||
}
|
||||
|
||||
// find the operator code for this operator string.
|
||||
nsMsgSearchOperator nsMsgSearchTerm::ParseOperator(char *inStream)
|
||||
nsMsgSearchOpValue
|
||||
nsMsgSearchTerm::ParseOperator(char *inStream)
|
||||
{
|
||||
PRInt16 operatorVal;
|
||||
nsresult err;
|
||||
@ -458,11 +460,12 @@ nsMsgSearchOperator nsMsgSearchTerm::ParseOperator(char *inStream)
|
||||
*commaSep = '\0';
|
||||
|
||||
err = NS_MsgGetOperatorFromString(inStream, &operatorVal);
|
||||
return (nsMsgSearchOperator) operatorVal;
|
||||
return (nsMsgSearchOpValue) operatorVal;
|
||||
}
|
||||
|
||||
// find the attribute code for this comma-delimited attribute.
|
||||
nsMsgSearchAttribute nsMsgSearchTerm::ParseAttribute(char *inStream)
|
||||
nsMsgSearchAttribValue
|
||||
nsMsgSearchTerm::ParseAttribute(char *inStream)
|
||||
{
|
||||
nsCAutoString attributeStr;
|
||||
PRInt16 attributeVal;
|
||||
@ -489,7 +492,7 @@ nsMsgSearchAttribute nsMsgSearchTerm::ParseAttribute(char *inStream)
|
||||
*separator = '\0';
|
||||
|
||||
err = NS_MsgGetAttributeFromString(inStream, &attributeVal);
|
||||
nsMsgSearchAttribute attrib = (nsMsgSearchAttribute) attributeVal;
|
||||
nsMsgSearchAttribValue attrib = (nsMsgSearchAttribValue) attributeVal;
|
||||
|
||||
if (attrib == nsMsgSearchAttrib::OtherHeader) // if we are dealing with an arbitrary header....
|
||||
m_arbitraryHeader = inStream;
|
||||
@ -576,7 +579,7 @@ void nsMsgSearchTerm::StripQuotedPrintable (unsigned char *src)
|
||||
|
||||
// Looks in the MessageDB for the user specified arbitrary header, if it finds the header, it then looks for a match against
|
||||
// the value for the header.
|
||||
nsresult nsMsgSearchTerm::MatchArbitraryHeader (nsMsgSearchScopeTerm *scope, PRUint32 offset, PRUint32 length /* in lines*/, const char *charset,
|
||||
nsresult nsMsgSearchTerm::MatchArbitraryHeader (nsIMsgSearchScopeTerm *scope, PRUint32 offset, PRUint32 length /* in lines*/, const char *charset,
|
||||
nsIMsgDBHdr *msg, nsIMsgDatabase* db, const char * headers,
|
||||
PRUint32 headersSize, PRBool ForFiltering, PRBool *pResult)
|
||||
{
|
||||
@ -653,7 +656,7 @@ nsresult nsMsgSearchTerm::MatchArbitraryHeader (nsMsgSearchScopeTerm *scope, PRU
|
||||
}
|
||||
}
|
||||
|
||||
nsresult nsMsgSearchTerm::MatchBody (nsMsgSearchScopeTerm *scope, PRUint32 offset, PRUint32 length /*in lines*/, const char *folderCharset,
|
||||
nsresult nsMsgSearchTerm::MatchBody (nsIMsgSearchScopeTerm *scope, PRUint32 offset, PRUint32 length /*in lines*/, const char *folderCharset,
|
||||
nsIMsgDBHdr *msg, nsIMsgDatabase* db, PRBool *pResult)
|
||||
{
|
||||
if (!pResult)
|
||||
@ -1128,7 +1131,9 @@ nsresult nsMsgSearchTerm::InitHeaderAddressParser()
|
||||
//-----------------------------------------------------------------------------
|
||||
// nsMsgSearchScopeTerm implementation
|
||||
//-----------------------------------------------------------------------------
|
||||
nsMsgSearchScopeTerm::nsMsgSearchScopeTerm (nsIMsgSearchSession *session, nsMsgSearchScopeAttribute attribute, nsIMsgFolder *folder)
|
||||
nsMsgSearchScopeTerm::nsMsgSearchScopeTerm (nsIMsgSearchSession *session,
|
||||
nsMsgSearchScopeValue attribute,
|
||||
nsIMsgFolder *folder)
|
||||
{
|
||||
m_attribute = attribute;
|
||||
m_folder = folder;
|
||||
@ -1147,6 +1152,44 @@ nsMsgSearchScopeTerm::~nsMsgSearchScopeTerm ()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsMsgSearchScopeTerm, nsIMsgSearchScopeTerm)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgSearchScopeTerm::GetFileStream(nsIInputStream** aResult)
|
||||
{
|
||||
*aResult = m_fileStream->GetIStream();
|
||||
NS_IF_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgSearchScopeTerm::SetFileStream(nsIInputStream *aStream)
|
||||
{
|
||||
if (m_fileStream)
|
||||
delete m_fileStream;
|
||||
m_fileStream = new nsInputFileStream(aStream);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgSearchScopeTerm::GetFolder(nsIMsgFolder **aResult)
|
||||
{
|
||||
*aResult = m_folder;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgSearchScopeTerm::GetSearchSession(nsIMsgSearchSession** aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
*aResult = m_searchSession;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// ### purely temporary
|
||||
static PRBool NET_IsOffline()
|
||||
{
|
||||
@ -1344,7 +1387,8 @@ nsresult nsMsgResultElement::AssignValues (nsMsgSearchValue *src, nsMsgSearchVal
|
||||
}
|
||||
|
||||
|
||||
nsresult nsMsgResultElement::GetValue (nsMsgSearchAttribute attrib, nsMsgSearchValue **outValue) const
|
||||
nsresult nsMsgResultElement::GetValue (nsMsgSearchAttribValue attrib,
|
||||
nsMsgSearchValue **outValue) const
|
||||
{
|
||||
nsresult err = NS_OK;
|
||||
nsMsgSearchValue *value = NULL;
|
||||
@ -1387,7 +1431,8 @@ nsresult nsMsgResultElement::GetValue (nsMsgSearchAttribute attrib, nsMsgSearchV
|
||||
}
|
||||
|
||||
|
||||
const nsMsgSearchValue *nsMsgResultElement::GetValueRef (nsMsgSearchAttribute attrib) const
|
||||
const nsMsgSearchValue *
|
||||
nsMsgResultElement::GetValueRef (nsMsgSearchAttribValue attrib) const
|
||||
{
|
||||
nsMsgSearchValue *value = NULL;
|
||||
for (int i = 0; i < m_valueList.Count(); i++)
|
||||
|
@ -86,56 +86,86 @@ nsMsgSearchValueImpl::SetStatus(PRUint32 aValue)
|
||||
NS_IMETHODIMP
|
||||
nsMsgSearchValueImpl::GetSize(PRUint32 *aResult)
|
||||
{
|
||||
|
||||
*aResult = mValue.u.size;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgSearchValueImpl::SetSize(PRUint32 aValue)
|
||||
{
|
||||
|
||||
mValue.u.size = aValue;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgSearchValueImpl::GetMsgKey(nsMsgKey *aResult)
|
||||
{
|
||||
|
||||
*aResult = mValue.u.key;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgSearchValueImpl::SetMsgKey(nsMsgKey aValue)
|
||||
{
|
||||
|
||||
mValue.u.key = aValue;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgSearchValueImpl::GetAge(PRUint32 *aResult)
|
||||
{
|
||||
|
||||
*aResult = mValue.u.age;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP
|
||||
nsMsgSearchValueImpl::SetAge(PRUint32 aValue)
|
||||
{
|
||||
|
||||
mValue.u.age = aValue;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgSearchValueImpl::GetFolder(nsIMsgFolder* *aResult)
|
||||
{
|
||||
|
||||
*aResult = mValue.u.folder;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP
|
||||
nsMsgSearchValueImpl::SetFolder(nsIMsgFolder* aValue)
|
||||
{
|
||||
|
||||
mValue.u.folder = aValue;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgSearchValueImpl::GetDate(PRTime *aResult)
|
||||
{
|
||||
|
||||
*aResult = mValue.u.date;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP
|
||||
nsMsgSearchValueImpl::SetDate(PRTime aValue)
|
||||
{
|
||||
|
||||
mValue.u.date = aValue;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgSearchValueImpl::GetAttrib(nsMsgSearchAttribValue *aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
*aResult = mValue.attribute;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgSearchValueImpl::SetAttrib(nsMsgSearchAttribValue aValue)
|
||||
{
|
||||
mValue.attribute = aValue;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user