Reorganization. Changes for collections, enumerations, generic folders, file paths, etc.
This commit is contained in:
Родитель
581d345aec
Коммит
7f928e4843
|
@ -172,7 +172,7 @@ NSRegisterSelf(const char* path)
|
|||
nsresult ret;
|
||||
|
||||
ret = nsRepository::RegisterFactory(kCMsgFolderEventCID, path, PR_TRUE,
|
||||
PR_TRUE);
|
||||
PR_TRUE);
|
||||
if (NS_FAILED(ret)) {
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ EXPORTS = \
|
|||
nsIMsgRFC822Parser.h \
|
||||
nsIMsgHost.h \
|
||||
nsIMsgGroupRecord.h \
|
||||
nsIFolder.h \
|
||||
nsIMsgFolder.h \
|
||||
nsIMsgRDFFolder.h \
|
||||
nsIMsgMailNewsUrl.h \
|
||||
|
|
|
@ -34,6 +34,7 @@ EXPORTS = \
|
|||
nsMsgMessageFlags.h \
|
||||
nsIMsgHost.h \
|
||||
nsIMsgGroupRecord.h \
|
||||
nsIFolder.h \
|
||||
nsIMsgFolder.h \
|
||||
nsIMsgRDFFolder.h \
|
||||
nsIMsgMailNewsUrl.h \
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsIFolder_h__
|
||||
#define nsIFolder_h__
|
||||
|
||||
#include "nsICollection.h"
|
||||
#include "nsString.h"
|
||||
|
||||
// XXX regenerate this iid -- I was on a machine w/o an network card
|
||||
#define NS_IFOLDER_IID \
|
||||
{ /* fc232e90-c1f5-11d2-8612-000000000000 */ \
|
||||
0xfc232e90, \
|
||||
0xc1f5, \
|
||||
0x11d2, \
|
||||
{0x86, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} \
|
||||
}
|
||||
|
||||
/**
|
||||
* nsIFolder: Call Enumerate to get the sub-folders and folder items (the children).
|
||||
*/
|
||||
class nsIFolder : public nsICollection {
|
||||
public:
|
||||
|
||||
static const nsIID& IID(void) { static nsIID iid = NS_IFOLDER_IID; return iid; }
|
||||
|
||||
// unique identifier for folder:
|
||||
NS_IMETHOD GetURI(const char* *name) = 0;
|
||||
|
||||
NS_IMETHOD GetName(nsString& name) = 0;
|
||||
NS_IMETHOD SetName(const nsString& name) = 0;
|
||||
|
||||
NS_IMETHOD GetChildNamed(const nsString& name, nsISupports* *result) = 0;
|
||||
|
||||
// XXX does this make sense for virtual folders?
|
||||
NS_IMETHOD GetParent(nsIFolder* *parent) = 0;
|
||||
|
||||
// subset of Enumerate such that each element is an nsIFolder
|
||||
NS_IMETHOD GetSubFolders(nsIEnumerator* *result) = 0;
|
||||
};
|
||||
|
||||
#endif // nsIFolder_h__
|
|
@ -0,0 +1,30 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsICollection.idl"
|
||||
|
||||
[uuid(361c89b0-c481-11d2-8614-000000000001)] /* XXX regenerate */
|
||||
interface nsIFolder : nsICollection {
|
||||
|
||||
readonly attribute string URI;
|
||||
attribute string name;
|
||||
|
||||
nsISupports GetChildNamed(in string name);
|
||||
nsIFolder GetParent();
|
||||
};
|
||||
|
|
@ -5,9 +5,11 @@
|
|||
#ifndef __gen_nsIMsgFolder_h__
|
||||
#define __gen_nsIMsgFolder_h__
|
||||
|
||||
#include "nsISupportsArray.h" /* interface nsISupportsArray */
|
||||
#include "nsIFolder.h"
|
||||
|
||||
class nsISupportsArray;
|
||||
class nsIMessage;
|
||||
class nsNativeFileSpec;
|
||||
|
||||
/* starting interface nsIMsgFolder */
|
||||
|
||||
|
@ -17,73 +19,31 @@ class nsIMessage;
|
|||
{0x85e39ff0, 0xb248, 0x11d2, \
|
||||
{ 0xb7, 0xef, 0x00, 0x80, 0x5f, 0x05, 0xff, 0xa5 }}
|
||||
|
||||
class nsIMsgFolder : public nsISupports {
|
||||
class nsIMsgFolder : public nsIFolder {
|
||||
public:
|
||||
static const nsIID& IID() {
|
||||
static nsIID iid = NS_IMSGFOLDER_IID;
|
||||
static nsIID iid = NS_IMSGFOLDER_IID;
|
||||
return iid;
|
||||
}
|
||||
|
||||
/* <IDL> */
|
||||
NS_IMETHOD GetPrettyName(char * *aPrettyName) = 0;
|
||||
// XXX should these 2 go on nsIFolder or nsICollection?
|
||||
NS_IMETHOD AddUnique(nsISupports* element) = 0;
|
||||
NS_IMETHOD ReplaceElement(nsISupports* element, nsISupports* newElement) = 0;
|
||||
|
||||
NS_IMETHOD GetVisibleSubFolders(nsIEnumerator* *result) = 0;
|
||||
|
||||
// subset of GetElements such that each element is an nsIMessage
|
||||
NS_IMETHOD GetMessages(nsIEnumerator* *result) = 0;
|
||||
|
||||
NS_IMETHOD GetPrettyName(nsString& name) = 0;
|
||||
NS_IMETHOD SetPrettyName(const nsString& name) = 0;
|
||||
|
||||
/* <IDL> */
|
||||
NS_IMETHOD GetName(char * *aName) = 0;
|
||||
|
||||
/* <IDL> */
|
||||
NS_IMETHOD SetName(const char *name) = 0;
|
||||
|
||||
/* <IDL> */
|
||||
NS_IMETHOD GetPrettiestName(char * *aPrettiestName) = 0;
|
||||
NS_IMETHOD GetPrettiestName(nsString& aPrettiestName) = 0;
|
||||
|
||||
/* <IDL> */
|
||||
NS_IMETHOD BuildFolderURL(char **_retval) = 0;
|
||||
|
||||
/* <IDL> */
|
||||
NS_IMETHOD GetNameFromPathName(const char *pathName, char **_retval) = 0;
|
||||
|
||||
/* <IDL> */
|
||||
NS_IMETHOD HasSubFolders(PRBool *_retval) = 0;
|
||||
|
||||
/* <IDL> */
|
||||
NS_IMETHOD GetNumSubFolders(PRUint32 *_retval) = 0;
|
||||
|
||||
/* <IDL> */
|
||||
NS_IMETHOD GetNumSubFoldersToDisplay(PRUint32 *_retval) = 0;
|
||||
|
||||
/* <IDL> */
|
||||
NS_IMETHOD GetSubFolder(PRUint32 which, nsIMsgFolder **_retval) = 0;
|
||||
|
||||
/* <IDL> */
|
||||
NS_IMETHOD GetSubFolders(nsISupportsArray **_retval) = 0;
|
||||
|
||||
/* <IDL> */
|
||||
NS_IMETHOD AddSubFolder(const nsIMsgFolder *folder) = 0;
|
||||
|
||||
/* <IDL> */
|
||||
NS_IMETHOD RemoveSubFolder(const nsIMsgFolder *folder) = 0;
|
||||
|
||||
/* <IDL> */
|
||||
NS_IMETHOD HasMessages(PRBool *_retval) = 0;
|
||||
|
||||
/* <IDL> */
|
||||
NS_IMETHOD GetNumMessages(PRUint32 *_retval) = 0;
|
||||
|
||||
/* <IDL> */
|
||||
NS_IMETHOD GetNumMessagesToDisplay(PRUint32 *_retval) = 0;
|
||||
|
||||
/* <IDL> */
|
||||
NS_IMETHOD GetMessage(PRUint32 which, nsIMessage **_retval) = 0;
|
||||
|
||||
/* <IDL> */
|
||||
NS_IMETHOD GetMessages(nsISupportsArray **_retval) = 0;
|
||||
|
||||
/* <IDL> */
|
||||
NS_IMETHOD AddMessage(const nsIMessage *msg) = 0;
|
||||
|
||||
/* <IDL> */
|
||||
NS_IMETHOD RemoveMessage(const nsIMessage *msg) = 0;
|
||||
|
||||
/* <IDL> */
|
||||
NS_IMETHOD GetDeleteIsMoveToTrash(PRBool *aDeleteIsMoveToTrash) = 0;
|
||||
|
||||
|
@ -114,9 +74,6 @@ class nsIMsgFolder : public nsISupports {
|
|||
/* <IDL> */
|
||||
NS_IMETHOD ContainsChildNamed(const char *name, PRBool *_retval) = 0;
|
||||
|
||||
/* <IDL> */
|
||||
NS_IMETHOD FindChildNamed(const char *name, nsIMsgFolder **_retval) = 0;
|
||||
|
||||
/* <IDL> */
|
||||
NS_IMETHOD FindParentOf(const nsIMsgFolder *childFolder, nsIMsgFolder **_retval) = 0;
|
||||
|
||||
|
@ -190,12 +147,6 @@ class nsIMsgFolder : public nsISupports {
|
|||
/* <IDL> */
|
||||
NS_IMETHOD GetHostName(char **_retval) = 0;
|
||||
|
||||
/* <IDL> */
|
||||
NS_IMETHOD AddSubfolderIfUnique(const nsIMsgFolder *newSubfolder) = 0;
|
||||
|
||||
/* <IDL> */
|
||||
NS_IMETHOD ReplaceSubfolder(const nsIMsgFolder *oldFolder, const nsIMsgFolder *newFolder) = 0;
|
||||
|
||||
/* <IDL> */
|
||||
NS_IMETHOD SetFlag(PRUint32 flag) = 0;
|
||||
|
||||
|
@ -238,8 +189,7 @@ class nsIMsgLocalMailFolder : public nsISupports {
|
|||
}
|
||||
|
||||
/* <IDL> */
|
||||
NS_IMETHOD GetPathName(char * *aPathName) = 0;
|
||||
NS_IMETHOD SetPathName(char * aPathName) = 0;
|
||||
NS_IMETHOD GetPath(nsNativeFileSpec& aPathName) = 0;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -262,9 +212,9 @@ class nsIMsgImapMailFolder : public nsISupports {
|
|||
}
|
||||
|
||||
/* <IDL> */
|
||||
NS_IMETHOD GetPathName(char * *aPathName) = 0;
|
||||
NS_IMETHOD SetPathName(char * aPathName) = 0;
|
||||
NS_IMETHOD GetPathName(nsNativeFileSpec& aPathName) = 0;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* __gen_nsIMsgFolder_h__ */
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
XXX fix this to match the .h file
|
||||
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
|
@ -20,7 +22,6 @@
|
|||
#include "nsISupports.idl"
|
||||
#include "nsIMsg.idl"
|
||||
|
||||
|
||||
[uuid(85e39ff0-b248-11d2-b7ef-00805f05ffa5)]
|
||||
interface nsIMsgFolder : nsISupports {
|
||||
|
||||
|
@ -31,7 +32,9 @@ interface nsIMsgFolder : nsISupports {
|
|||
|
||||
string BuildFolderURL();
|
||||
|
||||
string GetNameFromPathName(in string pathName);
|
||||
// XXX should these 2 go on nsIFolder or nsICollection?
|
||||
void AddUnique(in nsISupports element);
|
||||
void ReplaceElement(in nsISupports element, in nsISupports newElement);
|
||||
|
||||
boolean HasSubFolders();
|
||||
unsigned long GetNumSubFolders() ;
|
||||
|
@ -121,7 +124,7 @@ interface nsIMsgFolder : nsISupports {
|
|||
[uuid(27D2DE40-BAF1-11d2-9578-00805F8AC615)]
|
||||
interface nsIMsgLocalMailFolder : nsISupports {
|
||||
|
||||
attribute string pathName;
|
||||
readonly attribute nsNativeFileSpec pathName;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -36,12 +36,11 @@
|
|||
* nsIMsgRFCParser Interface declaration
|
||||
*/
|
||||
|
||||
class nsIMsgRFC822Parser: public nsISupports {
|
||||
public:
|
||||
static const nsIID& IID() {
|
||||
static nsIID iid = NS_IMSGRFC822PARSER_IID;
|
||||
return iid;
|
||||
}
|
||||
class nsIMsgRFC822Parser: public nsISupports {
|
||||
public:
|
||||
|
||||
static const nsIID& IID(void) { static nsIID iid = NS_IMSGRFC822PARSER_IID; return iid; }
|
||||
|
||||
/* Given a string which contains a list of RFC822 addresses, parses it into
|
||||
their component names and mailboxes.
|
||||
|
||||
|
@ -126,7 +125,7 @@
|
|||
NS_IMETHOD UnquotePhraseOrAddr (const char *line, char** lineout) = 0;
|
||||
NS_IMETHOD UnquotePhraseOrAddr_Intl (PRInt16 csid, const char *line, char** lineout) = 0;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
#endif /* nsIMSGRFC822PARSER_h__ */
|
||||
|
||||
|
|
|
@ -61,7 +61,14 @@ EXPORTS= \
|
|||
nsMsgFolder.h \
|
||||
$(NULL)
|
||||
|
||||
LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\mailnews -I$(PUBLIC)\raptor -I$(PUBLIC)\rdf
|
||||
LINCS= \
|
||||
-I$(PUBLIC)\xpcom \
|
||||
-I$(PUBLIC)\mailnews \
|
||||
-I$(PUBLIC)\raptor \
|
||||
-I$(PUBLIC)\rdf \
|
||||
-I$(PUBLIC)\rdfutil \
|
||||
-I$(PUBLIC)\pref \
|
||||
-I$(PUBLIC)\js
|
||||
|
||||
LCFLAGS = \
|
||||
$(LCFLAGS) \
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "nsMsgFolderFlags.h"
|
||||
#include "prprf.h"
|
||||
#include "nsMsgKeyArray.h"
|
||||
#include "nsISupportsArray.h"
|
||||
|
||||
#ifdef HAVE_DB
|
||||
#include "nsMsgDatabase.h"
|
||||
|
@ -33,17 +34,12 @@
|
|||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
nsMsgFolder::nsMsgFolder(const char* uri)
|
||||
: nsRDFResource(PL_strdup(uri))
|
||||
: nsRDFResource(uri), mFlags(0), mDepth(0),
|
||||
mNumUnreadMessages(-1), mNumTotalMessages(0),
|
||||
mPrefFlags(0), mCsid(0)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
mFlags = 0;
|
||||
mName = nsnull;
|
||||
|
||||
mDepth = 0;
|
||||
mNumUnreadMessages = -1;
|
||||
mNumTotalMessages = 0;
|
||||
|
||||
#ifdef HAVE_MASTER
|
||||
mMaster = NULL;
|
||||
#endif
|
||||
|
@ -52,9 +48,6 @@ nsMsgFolder::nsMsgFolder(const char* uri)
|
|||
mSemaphoreHolder = NULL;
|
||||
#endif
|
||||
|
||||
mPrefFlags = 0;
|
||||
mCsid = 0;
|
||||
|
||||
#ifdef HAVE_DB
|
||||
mLastMessageLoaded = nsMsgKey_None;
|
||||
mNumPendingUnreadMessages = 0;
|
||||
|
@ -78,9 +71,6 @@ nsMsgFolder::~nsMsgFolder()
|
|||
|
||||
NS_RELEASE(mSubFolders);
|
||||
}
|
||||
|
||||
PR_FREEIF(mName);
|
||||
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsMsgFolder)
|
||||
|
@ -102,6 +92,64 @@ nsMsgFolder::QueryInterface(REFNSIID iid, void** result)
|
|||
return nsRDFResource::QueryInterface(iid, result);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef PRBool
|
||||
(*nsArrayFilter)(nsISupports* element, void* data);
|
||||
|
||||
static nsresult
|
||||
nsFilterBy(nsISupportsArray* array, nsArrayFilter filter, void* data,
|
||||
nsISupportsArray* *result)
|
||||
{
|
||||
nsISupportsArray* f;
|
||||
nsresult rv = NS_NewISupportsArray(&f);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
NS_ADDREF(f);
|
||||
for (PRUint32 i = 0; i < array->Count(); i++) {
|
||||
nsISupports* element = (*array)[i];
|
||||
if (filter(element, data)) {
|
||||
nsresult rv = f->AppendElement(element);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(f);
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
}
|
||||
*result = f;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgFolder::AddUnique(nsISupports* element)
|
||||
{
|
||||
// XXX fix this
|
||||
return mSubFolders->AppendElement(element);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgFolder::ReplaceElement(nsISupports* element, nsISupports* newElement)
|
||||
{
|
||||
PR_ASSERT(0);
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgFolder::GetSubFolders(nsIEnumerator* *result)
|
||||
{
|
||||
return mSubFolders->Enumerate(result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgFolder::GetMessages(nsIEnumerator* *result)
|
||||
{
|
||||
// XXX should this return an empty enumeration?
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::BuildFolderURL(char **url)
|
||||
{
|
||||
if(*url)
|
||||
|
@ -230,25 +278,24 @@ nsMsgFolder::StartAsyncCopyMessagesInto(MSG_FolderInfo *dstFolder,
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::BeginCopyingMessages (MSG_FolderInfo *dstFolder,
|
||||
nsMsgDatabase *sourceDB,
|
||||
nsMsgKeyArray *srcArray,
|
||||
MSG_UrlQueue *urlQueue,
|
||||
int32 srcCount,
|
||||
MessageCopyInfo *copyInfo)
|
||||
NS_IMETHODIMP nsMsgFolder::BeginCopyingMessages(MSG_FolderInfo *dstFolder,
|
||||
nsMsgDatabase *sourceDB,
|
||||
nsMsgKeyArray *srcArray,
|
||||
MSG_UrlQueue *urlQueue,
|
||||
int32 srcCount,
|
||||
MessageCopyInfo *copyInfo)
|
||||
{
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::FinishCopyingMessages (MWContext *context,
|
||||
MSG_FolderInfo * srcFolder,
|
||||
MSG_FolderInfo *dstFolder,
|
||||
nsMsgDatabase *sourceDB,
|
||||
nsMsgKeyArray **ppSrcArray,
|
||||
int32 srcCount,
|
||||
msg_move_state *state)
|
||||
NS_IMETHODIMP nsMsgFolder::FinishCopyingMessages(MWContext *context,
|
||||
MSG_FolderInfo * srcFolder,
|
||||
MSG_FolderInfo *dstFolder,
|
||||
nsMsgDatabase *sourceDB,
|
||||
nsMsgKeyArray **ppSrcArray,
|
||||
int32 srcCount,
|
||||
msg_move_state *state)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -306,219 +353,105 @@ NS_IMETHODIMP nsMsgFolder::CleanupCopyMessagesInto (MessageCopyInfo **info)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::SaveMessages(nsMsgKeyArray *, const char *fileName,
|
||||
MSG_Pane *pane, nsMsgDatabase *msgDB,
|
||||
int (*doneCB)(void *, int status) = NULL, void *state = NULL,
|
||||
PRBool addMozillaStatus = TRUE)
|
||||
MSG_Pane *pane, nsMsgDatabase *msgDB,
|
||||
int (*doneCB)(void *, int status) = NULL, void *state = NULL,
|
||||
PRBool addMozillaStatus = TRUE)
|
||||
{
|
||||
DownloadArticlesToFolder::SaveMessages(array, fileName, pane, this, msgDB, doneCB, state, addMozillaStatus);
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::GetPrettyName(char ** name)
|
||||
NS_IMETHODIMP nsMsgFolder::GetPrettyName(nsString& name)
|
||||
{
|
||||
if(name)
|
||||
{
|
||||
*name = mName;
|
||||
return NS_OK;
|
||||
}
|
||||
else
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
name = mName;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::GetName(char **name)
|
||||
NS_IMETHODIMP nsMsgFolder::SetPrettyName(const nsString& name)
|
||||
{
|
||||
if(name)
|
||||
{
|
||||
*name = mName;
|
||||
return NS_OK;
|
||||
}
|
||||
else
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
mName = name;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::SetName(const char *name)
|
||||
NS_IMETHODIMP_(PRUint32) nsMsgFolder::Count(void) const
|
||||
{
|
||||
PR_FREEIF(mName);
|
||||
mName = PL_strdup(name);
|
||||
return mSubFolders->Count();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::AppendElement(nsISupports *aElement)
|
||||
{
|
||||
return mSubFolders->AppendElement(aElement);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::RemoveElement(nsISupports *aElement)
|
||||
{
|
||||
return mSubFolders->RemoveElement(aElement);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::Enumerate(nsIEnumerator* *result)
|
||||
{
|
||||
// nsMsgFolders only have subfolders, no message elements
|
||||
return mSubFolders->Enumerate(result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::Clear(void)
|
||||
{
|
||||
return mSubFolders->Clear();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::GetName(nsString& name)
|
||||
{
|
||||
name = mName;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::SetName(const nsString& name)
|
||||
{
|
||||
mName = name;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::GetPrettiestName(char **name)
|
||||
NS_IMETHODIMP nsMsgFolder::GetChildNamed(const nsString& name, nsISupports* *result)
|
||||
{
|
||||
nsresult result;
|
||||
if(name)
|
||||
{
|
||||
if(NS_SUCCEEDED(result = GetPrettyName(name)))
|
||||
{
|
||||
if(*name)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
return GetName(name);
|
||||
}
|
||||
}
|
||||
else
|
||||
return result;
|
||||
}
|
||||
else return NS_ERROR_NULL_POINTER;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::GetNameFromPathName(const char *pathName, char **folderName)
|
||||
NS_IMETHODIMP nsMsgFolder::GetParent(nsIFolder* *parent)
|
||||
{
|
||||
if(!folderName)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
char* ptr = PL_strrchr(pathName, '/');
|
||||
if (ptr)
|
||||
*folderName = ptr + 1;
|
||||
else
|
||||
*folderName =(char*)pathName;
|
||||
|
||||
return NS_OK;
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::HasSubFolders(PRBool *hasSubFolders)
|
||||
NS_IMETHODIMP nsMsgFolder::GetPrettiestName(nsString& name)
|
||||
{
|
||||
if(hasSubFolders)
|
||||
{
|
||||
*hasSubFolders = mSubFolders->Count() > 0;
|
||||
return NS_OK;
|
||||
}
|
||||
else return NS_ERROR_NULL_POINTER;
|
||||
if (NS_SUCCEEDED(GetPrettyName(name)))
|
||||
return NS_OK;
|
||||
return GetName(name);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::GetNumSubFolders(PRUint32 *numSubFolders)
|
||||
static PRBool
|
||||
nsCanBeInFolderPane(nsISupports* element, void* data)
|
||||
{
|
||||
if(numSubFolders)
|
||||
{
|
||||
*numSubFolders = mSubFolders->Count();
|
||||
return NS_OK;
|
||||
}
|
||||
else
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::GetNumSubFoldersToDisplay(PRUint32 *numSubFolders)
|
||||
{
|
||||
if(numSubFolders)
|
||||
{
|
||||
return GetNumSubFolders(numSubFolders);
|
||||
}
|
||||
else
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::GetSubFolder(PRUint32 which, nsIMsgFolder **aFolder)
|
||||
{
|
||||
PR_ASSERT(which >= 0 && which < (PRUint32)mSubFolders->Count()); // XXX fix Count return type
|
||||
if(aFolder)
|
||||
{
|
||||
*aFolder = nsnull;
|
||||
nsISupports *folder = mSubFolders->ElementAt(which);
|
||||
if(folder)
|
||||
{
|
||||
folder->QueryInterface(nsIMsgFolder::IID(), (void**)aFolder);
|
||||
|
||||
NS_RELEASE(folder);
|
||||
}
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
else
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::GetSubFolders (nsISupportsArray ** subFolders)
|
||||
{
|
||||
if(subFolders)
|
||||
{
|
||||
NS_ADDREF(mSubFolders);
|
||||
*subFolders = mSubFolders;
|
||||
return NS_OK;
|
||||
}
|
||||
else
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::AddSubFolder(const nsIMsgFolder *folder)
|
||||
{
|
||||
nsISupports * supports;
|
||||
|
||||
if(NS_SUCCEEDED(((nsISupports*)folder)->QueryInterface(kISupportsIID,
|
||||
(void**)&supports)))
|
||||
{
|
||||
mSubFolders->AppendElement(supports);
|
||||
NS_RELEASE(supports);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::AddSubfolderIfUnique(const nsIMsgFolder *newSubfolder)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsMsgFolder::ReplaceSubfolder(const nsIMsgFolder *oldFolder, const nsIMsgFolder *newFolder)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::RemoveSubFolder (const nsIMsgFolder *which)
|
||||
{
|
||||
nsISupports * supports;
|
||||
|
||||
if(NS_SUCCEEDED(((nsISupports*)which)->QueryInterface(kISupportsIID,
|
||||
(void**)&supports)))
|
||||
{
|
||||
mSubFolders->RemoveElement(supports);
|
||||
//make sure it's really been removed and no others exist.
|
||||
PR_ASSERT(mSubFolders->IndexOf(supports, 0) == -1);
|
||||
NS_RELEASE(supports);
|
||||
}
|
||||
|
||||
|
||||
nsIMsgFolder* subFolder = NS_STATIC_CAST(nsIMsgFolder*, element);
|
||||
#ifdef HAVE_PANE
|
||||
if (m_subFolders->GetSize() == 0)
|
||||
{
|
||||
// Our last child was deleted, so reset our hierarchy bits and tell the panes that this
|
||||
// folderInfo changed, which eventually redraws the expand/collapse widget in the folder pane
|
||||
m_flags &= ~MSG_FOLDER_FLAG_DIRECTORY;
|
||||
m_flags &= ~MSG_FOLDER_FLAG_ELIDED;
|
||||
#ifdef HAVE_MASTER
|
||||
m_master->BroadcastFolderChanged (this);
|
||||
return subFolder->CanBeInFolderPane();
|
||||
#else
|
||||
return PR_TRUE;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef HAVE_PANE
|
||||
NS_IMETHODIMP nsMsgFolder::GetVisibleSubFolders (nsISupportsArray ** visibleSubFolders)
|
||||
NS_IMETHODIMP
|
||||
nsMsgFolder::GetVisibleSubFolders(nsIEnumerator* *result)
|
||||
{
|
||||
// The folder pane uses this routine to work around the fact
|
||||
// that unsubscribed newsgroups are children of the news host.
|
||||
// We can't count those when computing folder pane view indexes.
|
||||
|
||||
for (int i = 0; i < m_subFolders->GetSize(); i++)
|
||||
{
|
||||
MSG_FolderInfo *f = m_subFolders->GetAt(i);
|
||||
if (f && f->CanBeInFolderPane())
|
||||
subFolders.Add (f);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
nsresult rv;
|
||||
nsISupportsArray* vFolders;
|
||||
rv = nsFilterBy(mSubFolders, nsCanBeInFolderPane, nsnull, &vFolders);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = vFolders->Enumerate(result);
|
||||
NS_RELEASE(vFolders);
|
||||
return rv;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ADMINURL
|
||||
NS_IMETHODIMP nsMsgFolder::GetAdminUrl(MWContext *context, MSG_AdminURLType type)
|
||||
{
|
||||
|
@ -570,14 +503,14 @@ NS_IMETHODIMP nsMsgFolder::Delete ()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::PropagateDelete (nsIMsgFolder **folder, PRBool deleteStorage)
|
||||
NS_IMETHODIMP nsMsgFolder::PropagateDelete(nsIMsgFolder **folder, PRBool deleteStorage)
|
||||
{
|
||||
nsresult status = NS_OK;
|
||||
|
||||
nsIMsgFolder *child = nsnull;
|
||||
|
||||
// first, find the folder we're looking to delete
|
||||
for (int i = 0; i < mSubFolders->Count() && *folder; i++)
|
||||
for (PRUint32 i = 0; i < mSubFolders->Count() && *folder; i++)
|
||||
{
|
||||
nsISupports *supports = mSubFolders->ElementAt(i);
|
||||
if(supports)
|
||||
|
@ -597,7 +530,7 @@ NS_IMETHODIMP nsMsgFolder::PropagateDelete (nsIMsgFolder **folder, PRBool delete
|
|||
// Many important things happen on this broadcast.
|
||||
mMaster->BroadcastFolderDeleted (child);
|
||||
#endif
|
||||
RemoveSubFolder(child);
|
||||
mSubFolders->RemoveElement(child);
|
||||
NS_RELEASE(*folder); // stop looking since will set *folder to nsnull
|
||||
}
|
||||
}
|
||||
|
@ -621,7 +554,7 @@ NS_IMETHODIMP nsMsgFolder::PropagateDelete (nsIMsgFolder **folder, PRBool delete
|
|||
return status;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::RecursiveDelete (PRBool deleteStorage)
|
||||
NS_IMETHODIMP nsMsgFolder::RecursiveDelete(PRBool deleteStorage)
|
||||
{
|
||||
// If deleteStorage is TRUE, recursively deletes disk storage for this folder
|
||||
// and all its subfolders.
|
||||
|
@ -644,7 +577,7 @@ NS_IMETHODIMP nsMsgFolder::RecursiveDelete (PRBool deleteStorage)
|
|||
// Many important things happen on this broadcast.
|
||||
mMaster->BroadcastFolderDeleted (child);
|
||||
#endif
|
||||
RemoveSubFolder(child); // unlink it from this's child list
|
||||
mSubFolders->RemoveElement(child); // unlink it from this's child list
|
||||
NS_RELEASE(child);
|
||||
}
|
||||
NS_RELEASE(supports); // free memory
|
||||
|
@ -657,14 +590,14 @@ NS_IMETHODIMP nsMsgFolder::RecursiveDelete (PRBool deleteStorage)
|
|||
return status;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::CreateSubfolder (const char *, nsIMsgFolder**, PRUint32*)
|
||||
NS_IMETHODIMP nsMsgFolder::CreateSubfolder(const char *, nsIMsgFolder**, PRUint32*)
|
||||
{
|
||||
return NS_OK;
|
||||
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::Rename (const char *name)
|
||||
NS_IMETHODIMP nsMsgFolder::Rename(const char *name)
|
||||
{
|
||||
nsresult status = NS_OK;
|
||||
status = SetName(name);
|
||||
|
@ -678,20 +611,20 @@ NS_IMETHODIMP nsMsgFolder::Rename (const char *name)
|
|||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::Adopt (const nsIMsgFolder *srcFolder, PRUint32* outPos)
|
||||
NS_IMETHODIMP nsMsgFolder::Adopt(const nsIMsgFolder *srcFolder, PRUint32* outPos)
|
||||
{
|
||||
return NS_OK;
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::ContainsChildNamed (const char *name, PRBool* containsChild)
|
||||
NS_IMETHODIMP nsMsgFolder::ContainsChildNamed(const char *name, PRBool* containsChild)
|
||||
{
|
||||
nsIMsgFolder *child;
|
||||
|
||||
if(containsChild)
|
||||
{
|
||||
*containsChild = PR_FALSE;
|
||||
if(NS_SUCCEEDED(FindChildNamed(name, &child)))
|
||||
if(NS_SUCCEEDED(GetChildNamed(name, (nsISupports**)&child)))
|
||||
{
|
||||
*containsChild = child != nsnull;
|
||||
if(child)
|
||||
|
@ -703,7 +636,7 @@ NS_IMETHODIMP nsMsgFolder::ContainsChildNamed (const char *name, PRBool* contain
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::FindParentOf (const nsIMsgFolder * aFolder, nsIMsgFolder ** aParent)
|
||||
NS_IMETHODIMP nsMsgFolder::FindParentOf(const nsIMsgFolder * aFolder, nsIMsgFolder ** aParent)
|
||||
{
|
||||
if(!aParent)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
@ -747,7 +680,7 @@ NS_IMETHODIMP nsMsgFolder::FindParentOf (const nsIMsgFolder * aFolder, nsIMsgFol
|
|||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::IsParentOf (const nsIMsgFolder *child, PRBool deep, PRBool *isParent)
|
||||
NS_IMETHODIMP nsMsgFolder::IsParentOf(const nsIMsgFolder *child, PRBool deep, PRBool *isParent)
|
||||
{
|
||||
if(!isParent)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
@ -911,24 +844,24 @@ NS_IMETHODIMP nsMsgFolder::GetTotalMessages(PRBool deep, PRUint32 *totalMessages
|
|||
}
|
||||
|
||||
#ifdef HAVE_DB
|
||||
NS_IMETHOD GetTotalMessagesInDB(PRUint32 *totalMessages) const; // How many messages in database.
|
||||
NS_IMETHOD GetTotalMessagesInDB(PRUint32 *totalMessages) const; // How many messages in database.
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PANE
|
||||
virtual void MarkAllRead(MSG_Pane *pane, PRBool deep);
|
||||
virtual void MarkAllRead(MSG_Pane *pane, PRBool deep);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DB
|
||||
// These functions are used for tricking the front end into thinking that we have more
|
||||
// messages than are really in the DB. This is usually after and IMAP message copy where
|
||||
// we don't want to do an expensive select until the user actually opens that folder
|
||||
// These functions are called when MSG_Master::GetFolderLineById is populating a MSG_FolderLine
|
||||
// struct used by the FE
|
||||
int32 GetNumPendingUnread(PRBool deep = FALSE) const;
|
||||
int32 GetNumPendingTotalMessages(PRBool deep = FALSE) const;
|
||||
// These functions are used for tricking the front end into thinking that we have more
|
||||
// messages than are really in the DB. This is usually after and IMAP message copy where
|
||||
// we don't want to do an expensive select until the user actually opens that folder
|
||||
// These functions are called when MSG_Master::GetFolderLineById is populating a MSG_FolderLine
|
||||
// struct used by the FE
|
||||
int32 GetNumPendingUnread(PRBool deep = FALSE) const;
|
||||
int32 GetNumPendingTotalMessages(PRBool deep = FALSE) const;
|
||||
|
||||
void ChangeNumPendingUnread(int32 delta);
|
||||
void ChangeNumPendingTotalMessages(int32 delta);
|
||||
void ChangeNumPendingUnread(int32 delta);
|
||||
void ChangeNumPendingTotalMessages(int32 delta);
|
||||
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::SetFolderPrefFlags(PRUint32 flags)
|
||||
|
@ -1041,7 +974,7 @@ NS_IMETHODIMP nsMsgFolder::GetFoldersWithFlag(PRUint32 flags, nsIMsgFolder **res
|
|||
nsISupports *supports = mSubFolders->ElementAt(i);
|
||||
if(NS_SUCCEEDED(supports->QueryInterface(nsIMsgFolder::IID(), (void**)&folder)))
|
||||
{
|
||||
// CAREFUL! if NULL ise passed in for result then the caller
|
||||
// CAREFUL! if NULL is passed in for result then the caller
|
||||
// still wants the full count! Otherwise, the result should be at most the
|
||||
// number that the caller asked for.
|
||||
PRUint32 numSubFolders;
|
||||
|
@ -1076,7 +1009,7 @@ NS_IMETHODIMP nsMsgFolder::GetExpansionArray(const nsISupportsArray *expansionAr
|
|||
// the application of flags in GetExpansionArray is subtly different
|
||||
// than in GetFoldersWithFlag
|
||||
|
||||
for (int i = 0; i < mSubFolders->Count(); i++)
|
||||
for (PRUint32 i = 0; i < mSubFolders->Count(); i++)
|
||||
{
|
||||
nsISupports *supports = mSubFolders->ElementAt(i);
|
||||
nsIMsgFolder *folder = nsnull;
|
||||
|
@ -1118,7 +1051,7 @@ NS_IMETHODIMP nsMsgFolder::GetExpungedBytesCount(PRUint32 *count)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::GetDeletable (PRBool *deletable)
|
||||
NS_IMETHODIMP nsMsgFolder::GetDeletable(PRBool *deletable)
|
||||
{
|
||||
|
||||
if(!deletable)
|
||||
|
@ -1128,7 +1061,7 @@ NS_IMETHODIMP nsMsgFolder::GetDeletable (PRBool *deletable)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::GetCanCreateChildren (PRBool *canCreateChildren)
|
||||
NS_IMETHODIMP nsMsgFolder::GetCanCreateChildren(PRBool *canCreateChildren)
|
||||
{
|
||||
if(!canCreateChildren)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
@ -1137,7 +1070,7 @@ NS_IMETHODIMP nsMsgFolder::GetCanCreateChildren (PRBool *canCreateChildren)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::GetCanBeRenamed (PRBool *canBeRenamed)
|
||||
NS_IMETHODIMP nsMsgFolder::GetCanBeRenamed(PRBool *canBeRenamed)
|
||||
{
|
||||
if(!canBeRenamed)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
@ -1161,7 +1094,7 @@ NS_IMETHODIMP nsMsgFolder::ClearRequiresCleanup()
|
|||
}
|
||||
|
||||
#ifdef HAVE_PANE
|
||||
NS_IMETHODIMP nsMsgFolder::CanBeInFolderPane (PRBool *canBeInFolderPane)
|
||||
NS_IMETHODIMP nsMsgFolder::CanBeInFolderPane(PRBool *canBeInFolderPane)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -1222,22 +1155,22 @@ NS_IMETHODIMP nsMsgFolder::DisplayRecipients(PRBool *displayRecipients)
|
|||
}
|
||||
|
||||
#ifdef HAVE_SEMAPHORE
|
||||
NS_IMETHODIMP nsMsgFolder::AcquireSemaphore (void *semHolder)
|
||||
NS_IMETHODIMP nsMsgFolder::AcquireSemaphore(void *semHolder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::ReleaseSemaphore (void *semHolder)
|
||||
NS_IMETHODIMP nsMsgFolder::ReleaseSemaphore(void *semHolder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::TestSemaphore (void *semHolder, PRBool *result)
|
||||
NS_IMETHODIMP nsMsgFolder::TestSemaphore(void *semHolder, PRBool *result)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::IsLocked (PRBool *isLocked)
|
||||
NS_IMETHODIMP nsMsgFolder::IsLocked(PRBool *isLocked)
|
||||
{
|
||||
*isLocked = mSemaphoreHolder != NULL;
|
||||
}
|
||||
|
@ -1252,28 +1185,28 @@ NS_IMETHODIMP nsMsgFolder::IsLocked (PRBool *isLocked)
|
|||
#endif
|
||||
|
||||
#ifdef HAVE_CACHE
|
||||
NS_IMETHODIMP nsMsgFolder::WriteToCache (XP_File)
|
||||
NS_IMETHODIMP nsMsgFolder::WriteToCache(XP_File)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::ReadFromCache (char *)
|
||||
NS_IMETHODIMP nsMsgFolder::ReadFromCache(char *)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::IsCachable (PRBool *isCachable)
|
||||
NS_IMETHODIMP nsMsgFolder::IsCachable(PRBool *isCachable)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::SkipCacheTokens (char **ppBuf, int numTokens)
|
||||
NS_IMETHODIMP nsMsgFolder::SkipCacheTokens(char **ppBuf, int numTokens)
|
||||
{
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::GetRelativePathName (char **pathName)
|
||||
NS_IMETHODIMP nsMsgFolder::GetRelativePathName(char **pathName)
|
||||
{
|
||||
if(!pathName)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
@ -1302,7 +1235,10 @@ NS_IMETHODIMP nsMsgFolder::ShouldPerformOperationOffline(PRBool *performOffline)
|
|||
|
||||
|
||||
#ifdef DOES_FOLDEROPERATIONS
|
||||
NS_IMETHODIMP nsMsgFolder::DownloadToTempFileAndUpload(MessageCopyInfo *copyInfo, nsMsgKeyArray &keysToSave, MSG_FolderInfo *dstFolder, nsMsgDatabase *sourceDB)
|
||||
NS_IMETHODIMP nsMsgFolder::DownloadToTempFileAndUpload(MessageCopyInfo *copyInfo,
|
||||
nsMsgKeyArray &keysToSave,
|
||||
MSG_FolderInfo *dstFolder,
|
||||
nsMsgDatabase *sourceDB)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -1357,47 +1293,34 @@ NS_IMETHODIMP nsMsgFolder::GetHostName(char **hostName)
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Accessing Messages:
|
||||
#if 0
|
||||
#include "nsMsgLocalMailFolder.h"
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgFolder::HasMessages(PRBool *_retval)
|
||||
const char* kMsgRootFolderName = "Mail and News"; // XXX i18n
|
||||
|
||||
nsresult
|
||||
nsMsgFolder::GetRoot(nsIMsgFolder* *result)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult rv;
|
||||
nsMsgFolder* root = new nsMsgFolder("mailbox://");
|
||||
if (root == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(root);
|
||||
root->SetName(kMsgRootFolderName);
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgFolder::GetNumMessages(PRUint32 *_retval)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
nsIMsgFolder* localMail;
|
||||
rv = nsMsgLocalMailFolder::GetRoot(&localMail);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(root);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgFolder::GetNumMessagesToDisplay(PRUint32 *_retval)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
root->AppendElement(localMail);
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgFolder::GetMessage(PRUint32 which, nsIMessage **_retval)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
// Add news root, etc.
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgFolder::GetMessages(nsISupportsArray **_retval)
|
||||
{
|
||||
return NS_OK;
|
||||
*result = root;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgFolder::AddMessage(const nsIMessage *msg)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgFolder::RemoveMessage(const nsIMessage *msg)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -40,9 +40,33 @@ public:
|
|||
nsMsgFolder(const char* uri);
|
||||
virtual ~nsMsgFolder();
|
||||
|
||||
/* this macro defines QueryInterface, AddRef and Release for this class */
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsICollection methods:
|
||||
NS_IMETHOD_(PRUint32) Count(void) const;
|
||||
NS_IMETHOD AppendElement(nsISupports *aElement);
|
||||
NS_IMETHOD RemoveElement(nsISupports *aElement);
|
||||
NS_IMETHOD Enumerate(nsIEnumerator* *result);
|
||||
NS_IMETHOD Clear(void);
|
||||
|
||||
// nsIFolder methods:
|
||||
NS_IMETHOD GetURI(const char* *name) { return nsRDFResource::GetValue(name); }
|
||||
NS_IMETHOD GetName(nsString& name);
|
||||
NS_IMETHOD SetName(const nsString& name);
|
||||
NS_IMETHOD GetChildNamed(const nsString& name, nsISupports* *result);
|
||||
NS_IMETHOD GetParent(nsIFolder* *parent);
|
||||
NS_IMETHOD GetSubFolders(nsIEnumerator* *result);
|
||||
|
||||
// nsIMsgFolder methods:
|
||||
NS_IMETHOD AddUnique(nsISupports* element);
|
||||
NS_IMETHOD ReplaceElement(nsISupports* element, nsISupports* newElement);
|
||||
NS_IMETHOD GetVisibleSubFolders(nsIEnumerator* *result);
|
||||
NS_IMETHOD GetMessages(nsIEnumerator* *result);
|
||||
NS_IMETHOD GetPrettyName(nsString& name);
|
||||
NS_IMETHOD SetPrettyName(const nsString& name);
|
||||
#if 0
|
||||
static nsresult GetRoot(nsIMsgFolder* *result);
|
||||
#endif
|
||||
// Gets the URL that represents the given message. Returns a newly
|
||||
// created string that must be free'd using XP_FREE().
|
||||
// If the db is NULL, then returns a URL that represents the entire
|
||||
|
@ -92,36 +116,9 @@ public:
|
|||
PRBool addMozillaStatus = TRUE);
|
||||
#endif
|
||||
|
||||
NS_IMETHOD GetPrettyName(char * *aPrettyName);
|
||||
NS_IMETHOD GetName(char **name);
|
||||
NS_IMETHOD SetName(const char *name);
|
||||
NS_IMETHOD GetPrettiestName(char **name);
|
||||
|
||||
NS_IMETHOD BuildFolderURL(char ** url);
|
||||
|
||||
NS_IMETHOD GetNameFromPathName(const char *pathName, char ** name);
|
||||
|
||||
NS_IMETHOD HasSubFolders(PRBool *hasSubFolders);
|
||||
NS_IMETHOD GetNumSubFolders(PRUint32 *numSubFolders);
|
||||
NS_IMETHOD GetNumSubFoldersToDisplay(PRUint32 *numSubFolders);
|
||||
NS_IMETHOD GetSubFolder(PRUint32 which, nsIMsgFolder **aFolder);
|
||||
NS_IMETHOD GetSubFolders(nsISupportsArray ** subFolders);
|
||||
NS_IMETHOD AddSubFolder(const nsIMsgFolder *folder);
|
||||
NS_IMETHOD AddSubfolderIfUnique(const nsIMsgFolder *newSubfolder);
|
||||
NS_IMETHOD ReplaceSubfolder(const nsIMsgFolder *oldFolder, const nsIMsgFolder *newFolder);
|
||||
|
||||
NS_IMETHOD RemoveSubFolder(const nsIMsgFolder *which);
|
||||
#ifdef HAVE_PANE
|
||||
NS_IMETHOD GetVisibleSubFolders(nsISupportsArray ** visibleSubFolders);
|
||||
#endif
|
||||
|
||||
NS_IMETHOD HasMessages(PRBool *_retval);
|
||||
NS_IMETHOD GetNumMessages(PRUint32 *_retval);
|
||||
NS_IMETHOD GetNumMessagesToDisplay(PRUint32 *_retval);
|
||||
NS_IMETHOD GetMessage(PRUint32 which, nsIMessage **_retval);
|
||||
NS_IMETHOD GetMessages(nsISupportsArray **_retval);
|
||||
NS_IMETHOD AddMessage(const nsIMessage *msg);
|
||||
NS_IMETHOD RemoveMessage(const nsIMessage *msg);
|
||||
NS_IMETHOD GetPrettiestName(nsString& name);
|
||||
|
||||
#ifdef HAVE_ADMINURL
|
||||
NS_IMETHOD GetAdminUrl(MWContext *context, MSG_AdminURLType type);
|
||||
|
@ -143,15 +140,14 @@ public:
|
|||
NS_IMETHOD Adopt(const nsIMsgFolder *srcFolder, PRUint32*);
|
||||
|
||||
NS_IMETHOD ContainsChildNamed(const char *name, PRBool *containsChild);
|
||||
NS_IMETHOD FindChildNamed(const char *name, nsIMsgFolder ** aChild) = 0;
|
||||
NS_IMETHOD FindParentOf(const nsIMsgFolder * aFolder, nsIMsgFolder ** aParent);
|
||||
NS_IMETHOD IsParentOf(const nsIMsgFolder *, PRBool deep, PRBool *isParent);
|
||||
|
||||
NS_IMETHOD GenerateUniqueSubfolderName(const char *prefix, const nsIMsgFolder *otherFolder,
|
||||
char **name);
|
||||
|
||||
NS_IMETHOD GetDepth(PRUint32 *depth);
|
||||
NS_IMETHOD SetDepth(PRUint32 depth);
|
||||
NS_IMETHOD GetDepth(PRUint32 *depth);
|
||||
NS_IMETHOD SetDepth(PRUint32 depth);
|
||||
|
||||
// updates num messages and num unread - should be pure virtual
|
||||
// when I get around to implementing in all subclasses?
|
||||
|
@ -187,7 +183,7 @@ public:
|
|||
NS_IMETHOD GetFolderCSID(PRInt16 *csid);
|
||||
|
||||
|
||||
NS_IMETHOD SetLastMessageLoaded(nsMsgKey lastMessageLoaded);
|
||||
NS_IMETHOD SetLastMessageLoaded(nsMsgKey lastMessageLoaded);
|
||||
NS_IMETHOD GetLastMessageLoaded();
|
||||
#endif
|
||||
|
||||
|
@ -212,13 +208,13 @@ public:
|
|||
NS_IMETHOD EscapeMessageId(const char *messageId, const char **escapeMessageID);
|
||||
#endif
|
||||
|
||||
NS_IMETHOD GetExpungedBytesCount(PRUint32 *count);
|
||||
NS_IMETHOD GetExpungedBytesCount(PRUint32 *count);
|
||||
|
||||
NS_IMETHOD GetDeletable(PRBool *deletable);
|
||||
NS_IMETHOD GetCanCreateChildren(PRBool *canCreateChildren);
|
||||
NS_IMETHOD GetCanBeRenamed(PRBool *canBeRenamed);
|
||||
NS_IMETHOD GetRequiresCleanup(PRBool *requiredCleanup);
|
||||
NS_IMETHOD ClearRequiresCleanup() ;
|
||||
NS_IMETHOD ClearRequiresCleanup() ;
|
||||
#ifdef HAVE_PANE
|
||||
virtual PRBool CanBeInFolderPane();
|
||||
#endif
|
||||
|
@ -240,7 +236,7 @@ public:
|
|||
#endif
|
||||
|
||||
#ifdef HAVE_MASTER
|
||||
MSG_Master *GetMaster() {return m_master;}
|
||||
MSG_Master *GetMaster() {return m_master;}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CACHE
|
||||
|
@ -256,11 +252,11 @@ public:
|
|||
NS_IMETHOD GetSizeOnDisk(PRUint32 *size);
|
||||
|
||||
#ifdef HAVE_NET
|
||||
NS_IMETHOD ShouldPerformOperationOffline(PRBool *performOffline);
|
||||
NS_IMETHOD ShouldPerformOperationOffline(PRBool *performOffline);
|
||||
#endif
|
||||
|
||||
#ifdef DOES_FOLDEROPERATIONS
|
||||
int DownloadToTempFileAndUpload(MessageCopyInfo *copyInfo, nsMsgKeyArray &keysToSave, MSG_FolderInfo *dstFolder, nsMsgDatabase *sourceDB);
|
||||
int DownloadToTempFileAndUpload(MessageCopyInfo *copyInfo, nsMsgKeyArray &keysToSave, MSG_FolderInfo *dstFolder, nsMsgDatabase *sourceDB);
|
||||
void UpdateMoveCopyStatus(MWContext *context, PRBool isMove, int32 curMsgCount, int32 totMessages);
|
||||
#endif
|
||||
|
||||
|
@ -271,7 +267,7 @@ public:
|
|||
NS_IMETHOD GetHostName(char **hostName);
|
||||
|
||||
protected:
|
||||
char* mName;
|
||||
nsString mName;
|
||||
PRUint32 mFlags;
|
||||
PRUint32 mNumUnreadMessages; /* count of unread messages (-1 means
|
||||
unknown; -2 means unknown but we already
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include "nsMsgImapMailFolder.h"
|
||||
#include "nsMsgFolderFlags.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "prprf.h"
|
||||
|
||||
// we need this because of an egcs 1.0 (and possibly gcc) compiler bug
|
||||
|
@ -27,8 +28,8 @@
|
|||
// that multiply inherits from nsISupports
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
nsMsgImapMailFolder::nsMsgImapMailFolder(const char* uri)
|
||||
:nsMsgFolder(uri)
|
||||
nsMsgImapMailFolder::nsMsgImapMailFolder(const char* uri, nsString& name)
|
||||
: nsMsgFolder(uri, name)
|
||||
{
|
||||
mHaveReadNameFromDB = PR_FALSE;
|
||||
mPathName = nsnull;
|
||||
|
@ -116,19 +117,24 @@ nsMsgImapMailFolder::FindChildNamed(const char *name, nsIMsgFolder ** aChild)
|
|||
if (NS_SUCCEEDED(supports->QueryInterface(kISupportsIID,
|
||||
(void**)&folder)))
|
||||
{
|
||||
char *folderName;
|
||||
nsString folderName;
|
||||
|
||||
folder->GetName(&folderName);
|
||||
folder->GetName(folderName);
|
||||
// IMAP INBOX is case insensitive
|
||||
if (/* XXX type == FOLDER_IMAPSERVERCONTAINER && */
|
||||
!PL_strcasecmp(folderName, "INBOX"))
|
||||
!folderName.EqualsIgnoreCase("INBOX")
|
||||
// !PL_strcasecmp(folderName, "INBOX")
|
||||
)
|
||||
{
|
||||
NS_RELEASE(supports);
|
||||
continue;
|
||||
}
|
||||
|
||||
// For IMAP, folder names are case sensitive
|
||||
if (!PL_strcmp(folderName, name))
|
||||
if (
|
||||
!folderName.EqualsIgnoreCase(name)
|
||||
// !PL_strcmp(folderName, name)
|
||||
)
|
||||
{
|
||||
*aChild = folder;
|
||||
return NS_OK;
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
class nsMsgImapMailFolder : public nsMsgFolder, public nsIMsgImapMailFolder
|
||||
{
|
||||
public:
|
||||
nsMsgImapMailFolder(const char* uri);
|
||||
nsMsgImapMailFolder(const char* uri, nsString& name);
|
||||
~nsMsgImapMailFolder();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
|
|
@ -17,7 +17,7 @@ static NS_DEFINE_CID(kMsgRFC822ParserCID, NS_MSGRFC822PARSER_CID);
|
|||
nsIMsgRFC822Parser *sample;
|
||||
|
||||
// register our dll
|
||||
nsRepository::RegisterFactory(kMsgRFC822ParserCID, "msg.dll", PR_FALSE, PR_FALSE);
|
||||
nsRepository::RegisterFactory(kMsgRFC822ParserCID, "mailnews.dll", PR_FALSE, PR_FALSE);
|
||||
|
||||
nsresult res = nsRepository::CreateInstance(kMsgRFC822ParserCID,
|
||||
NULL,
|
||||
|
|
|
@ -12,17 +12,15 @@ class nsDBChangeAnnouncer;
|
|||
class nsIDBChangeListener : public nsISupports
|
||||
{
|
||||
public:
|
||||
static const nsIID& IID() {
|
||||
static nsIID iid = NS_IDBCHANGELISTENER_IID;
|
||||
return iid;
|
||||
}
|
||||
NS_IMETHOD OnKeyChange(nsMsgKey aKeyChanged, int32 aFlags,
|
||||
nsIDBChangeListener * aInstigator) = 0;
|
||||
NS_IMETHOD OnKeyDeleted(nsMsgKey aKeyChanged, int32 aFlags,
|
||||
nsIDBChangeListener * aInstigator) = 0;
|
||||
NS_IMETHOD OnKeyAdded(nsMsgKey aKeyChanged, int32 aFlags,
|
||||
nsIDBChangeListener * aInstigator) = 0;
|
||||
NS_IMETHOD OnAnnouncerGoingAway(nsDBChangeAnnouncer * instigator) ;
|
||||
static const nsIID& IID(void) { static nsIID iid = NS_IDBCHANGELISTENER_IID; return iid; }
|
||||
|
||||
NS_IMETHOD OnKeyChange(nsMsgKey aKeyChanged, int32 aFlags,
|
||||
nsIDBChangeListener * aInstigator) = 0;
|
||||
NS_IMETHOD OnKeyDeleted(nsMsgKey aKeyChanged, int32 aFlags,
|
||||
nsIDBChangeListener * aInstigator) = 0;
|
||||
NS_IMETHOD OnKeyAdded(nsMsgKey aKeyChanged, int32 aFlags,
|
||||
nsIDBChangeListener * aInstigator) = 0;
|
||||
NS_IMETHOD OnAnnouncerGoingAway(nsDBChangeAnnouncer * instigator) ;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -28,6 +28,7 @@ class nsMsgKeyArray;
|
|||
class MSG_Master;
|
||||
class MSG_FolderInfo;
|
||||
class nsIOFileStream;
|
||||
class nsFilePath;
|
||||
|
||||
// this is the version number for the mail db. If the file format changes, we
|
||||
// just reparse the mail folder.
|
||||
|
@ -36,7 +37,7 @@ const int kMailDBVersion = 1;
|
|||
class nsMailDatabase : public nsMsgDatabase
|
||||
{
|
||||
public:
|
||||
nsMailDatabase();
|
||||
nsMailDatabase(nsFilePath& folder);
|
||||
virtual ~nsMailDatabase();
|
||||
static nsresult Open(nsFilePath &dbName, PRBool create, nsMailDatabase** pMessageDB,
|
||||
PRBool upgrading = PR_FALSE);
|
||||
|
@ -79,10 +80,10 @@ protected:
|
|||
MsgFlags flag, nsIOFileStream **ppFileStream);
|
||||
virtual void SetReparse(PRBool reparse);
|
||||
|
||||
MSG_Master *m_master;
|
||||
PRBool m_reparse;
|
||||
nsFilePath m_folderName;
|
||||
nsIOFileStream *m_folderStream; /* this is a cache for loops which want file left open */
|
||||
MSG_Master *m_master;
|
||||
PRBool m_reparse;
|
||||
nsFilePath m_folderName;
|
||||
nsIOFileStream *m_folderStream; /* this is a cache for loops which want file left open */
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -45,7 +45,7 @@ EXPORTS= \
|
|||
$(NULL)
|
||||
|
||||
|
||||
LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\mailnews -I$(PUBLIC)\raptor -I$(PUBLIC)\rdf
|
||||
LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\mailnews -I$(PUBLIC)\raptor -I$(PUBLIC)\rdf -I$(PUBLIC)\rdfutil
|
||||
|
||||
LCFLAGS = \
|
||||
$(LCFLAGS) \
|
||||
|
|
|
@ -22,11 +22,11 @@
|
|||
#include "nsMsgLocalFolderHdrs.h"
|
||||
#include "nsFileStream.h"
|
||||
#include "nsLocalFolderSummarySpec.h"
|
||||
#include "nsFileSpec.h"
|
||||
|
||||
nsMailDatabase::nsMailDatabase()
|
||||
: m_folderName("")
|
||||
nsMailDatabase::nsMailDatabase(nsFilePath& folder)
|
||||
: m_master(nsnull), m_reparse(PR_FALSE), m_folderName(folder), m_folderStream(nsnull)
|
||||
{
|
||||
m_folderStream = NULL;
|
||||
}
|
||||
|
||||
nsMailDatabase::~nsMailDatabase()
|
||||
|
@ -34,8 +34,9 @@ nsMailDatabase::~nsMailDatabase()
|
|||
}
|
||||
|
||||
|
||||
|
||||
/* static */ nsresult nsMailDatabase::Open(nsFilePath &dbName, PRBool create, nsMailDatabase** pMessageDB,
|
||||
PRBool upgrading /*=PR_FALSE*/)
|
||||
PRBool upgrading /*=PR_FALSE*/)
|
||||
{
|
||||
nsMailDatabase *mailDB;
|
||||
int statResult;
|
||||
|
@ -45,10 +46,6 @@ nsMailDatabase::~nsMailDatabase()
|
|||
|
||||
nsDBFolderInfo *folderInfo = NULL;
|
||||
|
||||
// OK, dbName is probably folder name, since I can't figure out how nsFilePath interacts
|
||||
// with xpFileTypes and its related routines.
|
||||
char *folderName = dbName;
|
||||
|
||||
*pMessageDB = NULL;
|
||||
|
||||
mailDB = (nsMailDatabase *) FindInCache(dbName);
|
||||
|
@ -63,14 +60,11 @@ nsMailDatabase::~nsMailDatabase()
|
|||
if (stat ((const char *) summarySpec, &st) && create)
|
||||
newFile = PR_TRUE;
|
||||
|
||||
|
||||
mailDB = new nsMailDatabase;
|
||||
mailDB = new nsMailDatabase(dbName);
|
||||
|
||||
if (!mailDB)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
mailDB->m_folderName = PL_strdup(folderName);
|
||||
|
||||
// stat file before we open the db, because if we've latered
|
||||
// any messages, handling latered will change time stamp on
|
||||
// folder file.
|
||||
|
@ -416,7 +410,7 @@ nsresult nsMailDatabase::SetFolderInfoValid(nsFilePath &folderName, int num, int
|
|||
nsMailDatabase *pMessageDB = (nsMailDatabase *) nsMailDatabase::FindInCache(summaryPath);
|
||||
if (pMessageDB == NULL)
|
||||
{
|
||||
pMessageDB = new nsMailDatabase;
|
||||
pMessageDB = new nsMailDatabase(summaryPath);
|
||||
// ### this does later stuff (marks latered messages unread), which may be a problem
|
||||
err = pMessageDB->OpenMDB(summaryPath, FALSE);
|
||||
if (err != NS_OK)
|
||||
|
|
|
@ -223,13 +223,25 @@ void nsMsgDatabase::DumpCache()
|
|||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
nsMsgDatabase::nsMsgDatabase() : m_dbName("")
|
||||
nsMsgDatabase::nsMsgDatabase()
|
||||
: m_dbFolderInfo(nsnull), m_mdbEnv(nsnull), m_mdbStore(nsnull),
|
||||
m_mdbAllMsgHeadersTable(nsnull), m_dbName(""), m_newSet(nsnull),
|
||||
mRefCnt(0), m_mdbTokensInitialized(PR_FALSE),
|
||||
m_hdrRowScopeToken(0),
|
||||
m_hdrTableKindToken(0),
|
||||
m_subjectColumnToken(0),
|
||||
m_senderColumnToken(0),
|
||||
m_messageIdColumnToken(0),
|
||||
m_referencesColumnToken(0),
|
||||
m_recipientsColumnToken(0),
|
||||
m_dateColumnToken(0),
|
||||
m_messageSizeColumnToken(0),
|
||||
m_flagsColumnToken(0),
|
||||
m_priorityColumnToken(0),
|
||||
m_statusOffsetColumnToken(0),
|
||||
m_numLinesColumnToken(0),
|
||||
m_ccListColumnToken(0)
|
||||
{
|
||||
m_mdbEnv = NULL;
|
||||
m_mdbStore = NULL;
|
||||
m_mdbAllMsgHeadersTable = NULL;
|
||||
m_mdbTokensInitialized = FALSE;
|
||||
m_dbFolderInfo = NULL;
|
||||
}
|
||||
|
||||
nsMsgDatabase::~nsMsgDatabase()
|
||||
|
|
|
@ -72,6 +72,14 @@ nsMsgHdr::~nsMsgHdr()
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
NS_IMETHODIMP nsMsgHdr::GetMessageSize(PRUint32 *result)
|
||||
{
|
||||
*result = m_messageSize;
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP nsMsgHdr::GetMessageKey(nsMsgKey *result)
|
||||
{
|
||||
if (m_messageKey == nsMsgKey_None && m_mdbRow != NULL)
|
||||
|
|
|
@ -43,6 +43,8 @@ LLIBS=\
|
|||
$(LIBNSPR) \
|
||||
$(DIST)\lib\libplc21.lib \
|
||||
$(DIST)\lib\raptorbase.lib \
|
||||
$(DIST)\lib\rdfutil_s.lib \
|
||||
$(DIST)\lib\xpcom32.lib \
|
||||
$(NULL)
|
||||
|
||||
MISCDEP=$(LLIBS)
|
||||
|
|
|
@ -36,10 +36,8 @@
|
|||
class nsIPop3URL : public nsIURL
|
||||
{
|
||||
public:
|
||||
static const nsIID& IID() {
|
||||
static nsIID iid = NS_IPOP3URL_IID;
|
||||
return iid;
|
||||
}
|
||||
static const nsIID& IID() { static nsIID iid = NS_IPOP3URL_IID; return iid; }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Getters and Setters for the news specific event sinks to bind to to your url
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
class nsIRDFMSGFolderDataSource : public nsIRDFDataSource {
|
||||
public:
|
||||
static const nsIID& IID() { static nsIID iid = NS_IRDFMSGFOLDERDATASOURCE_IID; return iid; }
|
||||
};
|
||||
|
||||
extern NS_EXPORT nsresult NS_NewRDFMSGFolderDataSource(nsIRDFDataSource** result);
|
||||
|
|
|
@ -66,6 +66,9 @@ LINCS= -I$(PUBLIC)\xpcom \
|
|||
-I$(PUBLIC)\netlib \
|
||||
-I$(PUBLIC)\security \
|
||||
-I$(PUBLIC)\rdf \
|
||||
-I$(PUBLIC)\rdfutil \
|
||||
-I$(PUBLIC)\pref \
|
||||
-I$(PUBLIC)\js \
|
||||
$(NULL)
|
||||
|
||||
LCFLAGS = \
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -26,14 +26,28 @@
|
|||
#define nsMsgLocalMailFolder_h__
|
||||
|
||||
#include "nsMsgFolder.h" /* include the interface we are going to support */
|
||||
#include "nsFileSpec.h"
|
||||
|
||||
class nsMsgLocalMailFolder : public nsMsgFolder, public nsIMsgLocalMailFolder
|
||||
{
|
||||
public:
|
||||
nsMsgLocalMailFolder(const char* uri);
|
||||
~nsMsgLocalMailFolder();
|
||||
virtual ~nsMsgLocalMailFolder();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
#if 0
|
||||
static nsresult GetRoot(nsIMsgFolder* *result);
|
||||
#endif
|
||||
// nsICollection methods:
|
||||
NS_IMETHOD Enumerate(nsIEnumerator* *result);
|
||||
|
||||
// nsIFolder methods:
|
||||
NS_IMETHOD GetSubFolders(nsIEnumerator* *result);
|
||||
|
||||
// nsIMsgFolder methods:
|
||||
NS_IMETHOD AddUnique(nsISupports* element);
|
||||
NS_IMETHOD ReplaceElement(nsISupports* element, nsISupports* newElement);
|
||||
NS_IMETHOD GetMessages(nsIEnumerator* *result);
|
||||
|
||||
#ifdef HAVE_DB
|
||||
virtual nsresult BeginCopyingMessages(MSG_FolderInfo *dstFolder,
|
||||
|
@ -60,11 +74,11 @@ public:
|
|||
NS_IMETHOD Rename (const char *newName);
|
||||
NS_IMETHOD Adopt(const nsIMsgFolder *srcFolder, PRUint32 *outPos);
|
||||
|
||||
NS_IMETHOD FindChildNamed(const char *name, nsIMsgFolder ** aChild);
|
||||
NS_IMETHOD GetChildNamed(nsString& name, nsISupports ** aChild);
|
||||
|
||||
// this override pulls the value from the db
|
||||
NS_IMETHOD GetName(char** name); // Name of this folder (as presented to user).
|
||||
NS_IMETHOD GetPrettyName(char ** prettyName); // Override of the base, for top-level mail folder
|
||||
NS_IMETHOD GetName(nsString& name); // Name of this folder (as presented to user).
|
||||
NS_IMETHOD GetPrettyName(nsString& prettyName); // Override of the base, for top-level mail folder
|
||||
|
||||
NS_IMETHOD BuildFolderURL(char **url);
|
||||
|
||||
|
@ -76,10 +90,6 @@ public:
|
|||
NS_IMETHOD GetCanBeRenamed (PRBool *canBeRenamed);
|
||||
NS_IMETHOD GetRequiresCleanup(PRBool *requiresCleanup);
|
||||
|
||||
|
||||
NS_IMETHOD GetRelativePathName (char **pathName);
|
||||
|
||||
|
||||
NS_IMETHOD GetSizeOnDisk(PRUint32 size);
|
||||
|
||||
NS_IMETHOD GetUserName(char** userName);
|
||||
|
@ -89,14 +99,18 @@ public:
|
|||
NS_IMETHOD GetRememberedPassword(char ** password);
|
||||
|
||||
//nsIMsgMailFolder
|
||||
NS_IMETHOD GetPathName(char * *aPathName);
|
||||
NS_IMETHOD SetPathName(char * aPathName);
|
||||
NS_IMETHOD GetPath(nsNativeFileSpec& aPathName);
|
||||
|
||||
protected:
|
||||
char* mPathName;
|
||||
nsresult CreateSubFolders(void);
|
||||
nsresult Initialize(void);
|
||||
|
||||
protected:
|
||||
nsNativeFileSpec mPath;
|
||||
PRUint32 mExpungedBytes;
|
||||
PRBool mHaveReadNameFromDB;
|
||||
PRBool mGettingMail;
|
||||
PRBool mInitialized;
|
||||
};
|
||||
|
||||
#endif // nsMsgLocalMailFolder_h__
|
||||
|
|
|
@ -36,7 +36,9 @@
|
|||
#include "nsISupportsArray.h"
|
||||
#include "nsFileSpec.h"
|
||||
#include "nsMsgFolderFlags.h"
|
||||
#include "nsRDFCursorUtils.h"
|
||||
#include "nsIMessage.h"
|
||||
#include "nsMsgFolder.h"
|
||||
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
static NS_DEFINE_CID(kRDFInMemoryDataSourceCID, NS_RDFINMEMORYDATASOURCE_CID);
|
||||
|
@ -55,7 +57,7 @@ nsIRDFResource* nsMSGFolderDataSource::kNC_MSGFolderRoot;
|
|||
|
||||
nsIRDFResource* nsMSGFolderDataSource::kNC_Subject;
|
||||
|
||||
static const char kURINC_MSGFolderRoot[] = "mailbox:MSGFolderRoot";
|
||||
static const char kURINC_MSGFolderRoot[] = "mailbox:/";
|
||||
|
||||
#define NC_NAMESPACE_URI "http://home.netscape.com/NC-rdf#"
|
||||
DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, child);
|
||||
|
@ -91,15 +93,11 @@ peq(nsIRDFResource* r1, nsIRDFResource* r2)
|
|||
}
|
||||
}
|
||||
|
||||
static void createNode(const char *str, nsIRDFNode **node)
|
||||
static void createNode(nsString& str, nsIRDFNode **node)
|
||||
{
|
||||
nsIRDFLiteral * value;
|
||||
nsString nsStr(str);
|
||||
|
||||
*node = nsnull;
|
||||
|
||||
if(NS_SUCCEEDED(gRDFService->GetLiteral((const PRUnichar*)nsStr, &value)))
|
||||
{
|
||||
if(NS_SUCCEEDED(gRDFService->GetLiteral((const PRUnichar*)str, &value))) {
|
||||
*node = value;
|
||||
}
|
||||
}
|
||||
|
@ -136,6 +134,7 @@ static PRBool ShouldIgnoreFile (const char *name)
|
|||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsMSGFolderDataSource::nsMSGFolderDataSource()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
@ -192,8 +191,6 @@ NS_IMETHODIMP nsMSGFolderDataSource::Init(const char* uri)
|
|||
if ((mURI = PL_strdup(uri)) == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
if (! kNC_Child) {
|
||||
gRDFService->GetResource(kURINC_child, &kNC_Child);
|
||||
gRDFService->GetResource(kURINC_MessageChild, &kNC_MessageChild);
|
||||
|
@ -203,25 +200,32 @@ NS_IMETHODIMP nsMSGFolderDataSource::Init(const char* uri)
|
|||
|
||||
gRDFService->GetResource(kURINC_Subject, &kNC_Subject);
|
||||
}
|
||||
|
||||
#if 0
|
||||
//create the folder for the root folder
|
||||
nsresult rv;
|
||||
nsIMsgFolder *rootFolder;
|
||||
#if 0
|
||||
if(NS_SUCCEEDED(kNC_MSGFolderRoot->QueryInterface(nsIMsgFolder::IID(), (void**)&rootFolder)))
|
||||
{
|
||||
if(rootFolder)
|
||||
{
|
||||
rootFolder->SetName("Mail and News");
|
||||
rootFolder->SetDepth(0);
|
||||
nsNativeFileSpec startPath("d:\\users\\warren\\Mail", PR_FALSE);
|
||||
nsNativeFileSpec startPath("h:\\user\\warren\\Mail", PR_FALSE);
|
||||
if (NS_FAILED(rv = InitLocalFolders(rootFolder, startPath, 1)))
|
||||
return rv;
|
||||
|
||||
NS_RELEASE(rootFolder);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
if (NS_FAILED(rv = nsMsgFolder::GetRoot(&rootFolder)))
|
||||
return rv;
|
||||
#endif
|
||||
#endif
|
||||
mInitialized = PR_TRUE;
|
||||
return NS_OK;}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMSGFolderDataSource::GetURI(const char* *uri) const
|
||||
{
|
||||
|
@ -255,8 +259,8 @@ NS_IMETHODIMP nsMSGFolderDataSource::GetTarget(nsIRDFResource* source,
|
|||
nsresult rv;
|
||||
|
||||
if (peq(kNC_Name, property)) {
|
||||
char * name;
|
||||
rv = folder->GetName(&name);
|
||||
nsString name;
|
||||
rv = folder->GetName(name);
|
||||
createNode(name, target);
|
||||
}
|
||||
else {
|
||||
|
@ -275,9 +279,7 @@ NS_IMETHODIMP nsMSGFolderDataSource::GetTarget(nsIRDFResource* source,
|
|||
peq(kNC_Subject, property)) {
|
||||
nsAutoString subject;
|
||||
rv = message->GetProperty("subject", subject);
|
||||
char* str = subject.ToNewCString();
|
||||
createNode(str, target);
|
||||
delete[] str;
|
||||
createNode(subject, target);
|
||||
}
|
||||
else {
|
||||
rv = NS_ERROR_RDF_NO_VALUE;
|
||||
|
@ -315,29 +317,43 @@ NS_IMETHODIMP nsMSGFolderDataSource::GetTargets(nsIRDFResource* source,
|
|||
|
||||
if (peq(kNC_Child, property))
|
||||
{
|
||||
nsISupportsArray *subFolders;
|
||||
|
||||
folder->GetSubFolders (&subFolders);
|
||||
|
||||
*targets = new ArrayMsgFolderCursor(source, kNC_Child, subFolders);
|
||||
nsIEnumerator *subFolders;
|
||||
|
||||
folder->GetSubFolders(&subFolders);
|
||||
nsRDFEnumeratorAssertionCursor* cursor =
|
||||
new nsRDFEnumeratorAssertionCursor(gMsgFolderDataSource,
|
||||
source, kNC_Child, subFolders);
|
||||
NS_IF_RELEASE(subFolders);
|
||||
if (cursor == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(cursor);
|
||||
*targets = cursor;
|
||||
rv = NS_OK;
|
||||
}
|
||||
else if (peq(kNC_MessageChild, property))
|
||||
{
|
||||
nsISupportsArray *messages;
|
||||
nsIEnumerator *messages;
|
||||
|
||||
folder->GetMessages(&messages);
|
||||
|
||||
*targets = new ArrayMsgFolderCursor(source, kNC_MessageChild, messages);
|
||||
|
||||
nsRDFEnumeratorAssertionCursor* cursor =
|
||||
new nsRDFEnumeratorAssertionCursor(gMsgFolderDataSource,
|
||||
source, kNC_MessageChild, messages);
|
||||
NS_IF_RELEASE(messages);
|
||||
if (cursor == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(cursor);
|
||||
*targets = cursor;
|
||||
rv = NS_OK;
|
||||
}
|
||||
else if(peq(kNC_Name, property))
|
||||
{
|
||||
*targets = new SingletonMsgFolderCursor(source, property, PR_FALSE);
|
||||
nsRDFSingletonAssertionCursor* cursor =
|
||||
new nsRDFSingletonAssertionCursor(gMsgFolderDataSource,
|
||||
source, property);
|
||||
if (cursor == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(cursor);
|
||||
*targets = cursor;
|
||||
rv = NS_OK;
|
||||
}
|
||||
NS_IF_RELEASE(folder);
|
||||
|
@ -345,7 +361,13 @@ NS_IMETHODIMP nsMSGFolderDataSource::GetTargets(nsIRDFResource* source,
|
|||
else if (NS_SUCCEEDED(source->QueryInterface(nsIMessage::IID(), (void**)&message))) {
|
||||
if(peq(kNC_Name, property))
|
||||
{
|
||||
*targets = new SingletonMsgFolderCursor(source, property, PR_FALSE);
|
||||
nsRDFSingletonAssertionCursor* cursor =
|
||||
new nsRDFSingletonAssertionCursor(gMsgFolderDataSource,
|
||||
source, property, PR_FALSE);
|
||||
if (cursor == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(cursor);
|
||||
*targets = cursor;
|
||||
rv = NS_OK;
|
||||
}
|
||||
NS_IF_RELEASE(message);
|
||||
|
@ -406,15 +428,23 @@ NS_IMETHODIMP nsMSGFolderDataSource::ArcLabelsIn(nsIRDFNode* node,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP nsMSGFolderDataSource::ArcLabelsOut(nsIRDFResource* source,
|
||||
nsIRDFArcsOutCursor** labels)
|
||||
nsIRDFArcsOutCursor** labels)
|
||||
{
|
||||
nsISupportsArray *temp;
|
||||
NS_NewISupportsArray(&temp);
|
||||
nsISupportsArray *arcs;
|
||||
NS_NewISupportsArray(&arcs);
|
||||
if (arcs == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
temp->AppendElement(kNC_Child);
|
||||
temp->AppendElement(kNC_MessageChild);
|
||||
temp->AppendElement(kNC_Name);
|
||||
*labels = new MsgFolderArcsOutCursor(source, temp);
|
||||
arcs->AppendElement(kNC_Child);
|
||||
arcs->AppendElement(kNC_MessageChild);
|
||||
arcs->AppendElement(kNC_Name);
|
||||
nsRDFArrayArcsOutCursor* cursor =
|
||||
new nsRDFArrayArcsOutCursor(gMsgFolderDataSource, source, arcs);
|
||||
NS_RELEASE(arcs);
|
||||
if (cursor == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(cursor);
|
||||
*labels = cursor;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -432,8 +462,8 @@ NS_IMETHODIMP nsMSGFolderDataSource::Flush()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP nsMSGFolderDataSource::IsCommandEnabled(const char* aCommand,
|
||||
nsIRDFResource* aCommandTarget,
|
||||
PRBool* aResult)
|
||||
nsIRDFResource* aCommandTarget,
|
||||
PRBool* aResult)
|
||||
{
|
||||
PR_ASSERT(0);
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
@ -446,163 +476,6 @@ NS_IMETHODIMP nsMSGFolderDataSource::DoCommand(const char* aCommand,
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsresult nsMSGFolderDataSource::InitFoldersFromDirectory(nsIMsgFolder *folder, nsNativeFileSpec& aPath, PRInt32 depth)
|
||||
{
|
||||
|
||||
char *currentFolderName =nsnull;
|
||||
|
||||
for (nsDirectoryIterator dir(aPath); dir; dir++)
|
||||
{
|
||||
nsNativeFileSpec currentFolderPath = (nsNativeFileSpec&)dir;
|
||||
if(currentFolderName)
|
||||
delete[] currentFolderName;
|
||||
|
||||
currentFolderName = currentFolderPath.GetLeafName();
|
||||
if (ShouldIgnoreFile (currentFolderName))
|
||||
continue;
|
||||
|
||||
InitLocalFolders (folder, currentFolderPath, depth);
|
||||
}
|
||||
if(currentFolderName)
|
||||
delete[] currentFolderName;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMSGFolderDataSource::InitLocalFolders(nsIMsgFolder* aParentFolder, nsNativeFileSpec& aPath, PRInt32 depth)
|
||||
{
|
||||
const char *kDirExt = ".sbd";
|
||||
|
||||
nsFilePath aFilePath(aPath);
|
||||
char* pathStr = (char*)aFilePath;
|
||||
|
||||
PRInt32 newFlags = MSG_FOLDER_FLAG_MAIL;
|
||||
|
||||
PRBool addNewFolderToTree = PR_TRUE;
|
||||
nsIMsgFolder *folder = nsnull;
|
||||
|
||||
if(aPath.IsDirectory())
|
||||
{
|
||||
// pathStr specifies a filesystem directory
|
||||
char *lastFour = &pathStr[PL_strlen(pathStr) - PL_strlen(kDirExt)];
|
||||
if (PL_strcasecmp(lastFour, kDirExt))
|
||||
{
|
||||
newFlags |= (MSG_FOLDER_FLAG_DIRECTORY | MSG_FOLDER_FLAG_ELIDED);
|
||||
|
||||
// Create a new resource for this folder and set the child and name properties
|
||||
PRInt16 fileurlSize = PL_strlen("mailbox:") + PL_strlen(pathStr);
|
||||
char *fileurl = (char*)PR_Malloc( fileurlSize + 1);
|
||||
nsIRDFResource* resource;
|
||||
|
||||
PR_snprintf(fileurl, fileurlSize + 1, "mailbox:%s", pathStr);
|
||||
gRDFService->GetResource(fileurl, (nsIRDFResource**)&resource);
|
||||
|
||||
PR_Free(fileurl);
|
||||
|
||||
if(NS_SUCCEEDED(resource->QueryInterface(nsIMsgFolder::IID(), (void**)&folder)))
|
||||
{
|
||||
char * folderName;
|
||||
|
||||
folder->GetNameFromPathName(pathStr, &folderName);
|
||||
folder->SetName(folderName);
|
||||
|
||||
nsIMsgLocalMailFolder *mailFolder;
|
||||
if(NS_SUCCEEDED(folder->QueryInterface(nsIMsgLocalMailFolder::IID(), (void**)&mailFolder)))
|
||||
{
|
||||
mailFolder->SetPathName(pathStr);
|
||||
NS_IF_RELEASE(mailFolder);
|
||||
}
|
||||
|
||||
|
||||
folder->SetDepth(depth);
|
||||
folder->SetFlag(newFlags);
|
||||
aParentFolder->AddSubFolder(folder);
|
||||
}
|
||||
|
||||
InitFoldersFromDirectory(folder, aPath, depth + 1);
|
||||
|
||||
NS_IF_RELEASE(folder);
|
||||
NS_IF_RELEASE(resource);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// Create a new resource for this folder and set the child and name properties
|
||||
PRInt16 fileurlSize = PL_strlen("mailbox:") + PL_strlen(pathStr);
|
||||
char *fileurl = (char*)PR_Malloc( fileurlSize + 1);
|
||||
nsIRDFResource* resource;
|
||||
|
||||
PR_snprintf(fileurl, fileurlSize + 1, "mailbox:%s", pathStr);
|
||||
gRDFService->GetResource(fileurl, (nsIRDFResource**)&resource);
|
||||
|
||||
PR_Free(fileurl);
|
||||
|
||||
if(NS_SUCCEEDED(resource->QueryInterface(nsIMsgFolder::IID(), (void**)&folder)))
|
||||
{
|
||||
char * folderName;
|
||||
folder->GetNameFromPathName(pathStr, &folderName);
|
||||
folder->SetName(folderName);
|
||||
|
||||
nsIMsgLocalMailFolder *mailFolder;
|
||||
if(NS_SUCCEEDED(folder->QueryInterface(nsIMsgLocalMailFolder::IID(), (void**)&mailFolder)))
|
||||
{
|
||||
mailFolder->SetPathName(pathStr);
|
||||
NS_IF_RELEASE(mailFolder);
|
||||
}
|
||||
|
||||
folder->SetDepth(depth);
|
||||
if (addNewFolderToTree)
|
||||
{
|
||||
aParentFolder->AddSubFolder(folder);
|
||||
}
|
||||
|
||||
if (folder)
|
||||
{
|
||||
folder->UpdateSummaryTotals();
|
||||
// Look for a directory for this mail folder, and recurse into it.
|
||||
// e.g. if the folder is "inbox", look for "inbox.sbd".
|
||||
char *folderName = aPath.GetLeafName();
|
||||
char *newLeafName = (char*)malloc(PL_strlen(folderName) + PL_strlen(kDirExt) + 2);
|
||||
PL_strcpy(newLeafName, folderName);
|
||||
PL_strcat(newLeafName, kDirExt);
|
||||
aPath.SetLeafName(newLeafName);
|
||||
if(folderName)
|
||||
delete[] folderName;
|
||||
if(newLeafName)
|
||||
delete[] newLeafName;
|
||||
|
||||
if(aPath.IsDirectory())
|
||||
{
|
||||
// If we knew it was a directory before getting here, we must have
|
||||
// found that out from the folder cache. In that case, the elided bit
|
||||
// is already what it should be, and we shouldn't change it. Otherwise
|
||||
// the default setting is collapsed.
|
||||
// NOTE: these flags do not affect the sort order, so we don't have to call
|
||||
// QuickSort after changing them.
|
||||
|
||||
PRBool hasFlag;
|
||||
folder->GetFlag(MSG_FOLDER_FLAG_DIRECTORY, &hasFlag);
|
||||
if (!hasFlag)
|
||||
folder->SetFlag (MSG_FOLDER_FLAG_ELIDED);
|
||||
folder->SetFlag (MSG_FOLDER_FLAG_DIRECTORY);
|
||||
|
||||
InitFoldersFromDirectory(folder, aPath, depth + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
NS_IF_RELEASE(folder);
|
||||
NS_IF_RELEASE(resource);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
||||
}
|
||||
|
||||
|
||||
NS_EXPORT nsresult
|
||||
NS_NewRDFMSGFolderDataSource(nsIRDFDataSource** result)
|
||||
{
|
||||
|
@ -620,305 +493,3 @@ NS_NewRDFMSGFolderDataSource(nsIRDFDataSource** result)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
SingletonMsgFolderCursor::SingletonMsgFolderCursor(nsIRDFNode* u,
|
||||
nsIRDFResource* s,
|
||||
PRBool inversep)
|
||||
{
|
||||
if (!inversep) {
|
||||
mSource = (nsIRDFResource*)u;
|
||||
mTarget = nsnull;
|
||||
} else {
|
||||
mSource = nsnull;
|
||||
mTarget = u;
|
||||
}
|
||||
NS_ADDREF(u);
|
||||
mProperty = s;
|
||||
NS_ADDREF(mProperty);
|
||||
mValueReturnedp = PR_FALSE;
|
||||
mInversep = inversep;
|
||||
mValue = nsnull;
|
||||
}
|
||||
|
||||
|
||||
SingletonMsgFolderCursor::~SingletonMsgFolderCursor(void)
|
||||
{
|
||||
NS_IF_RELEASE(mSource);
|
||||
NS_IF_RELEASE(mValue);
|
||||
NS_IF_RELEASE(mProperty);
|
||||
NS_IF_RELEASE(mTarget);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// nsIRDFCursor interface
|
||||
NS_IMETHODIMP
|
||||
SingletonMsgFolderCursor::Advance(void)
|
||||
{
|
||||
nsresult rv = NS_ERROR_RDF_CURSOR_EMPTY;
|
||||
if (mValueReturnedp) {
|
||||
NS_IF_RELEASE(mValue);
|
||||
mValue = nsnull;
|
||||
return NS_ERROR_RDF_CURSOR_EMPTY;
|
||||
}
|
||||
mValueReturnedp = PR_TRUE;
|
||||
if (mInversep) {
|
||||
rv = gMsgFolderDataSource->GetSource(mProperty, mTarget, 1, (nsIRDFResource**)&mValue);
|
||||
mSource = (nsIRDFResource*)mValue;
|
||||
} else {
|
||||
rv = gMsgFolderDataSource->GetTarget(mSource, mProperty, 1, &mValue);
|
||||
mTarget = mValue;
|
||||
}
|
||||
if (mValue) {
|
||||
NS_ADDREF(mValue);
|
||||
NS_ADDREF(mValue);
|
||||
}
|
||||
// yes, its required twice, one for the value and one for the source/target
|
||||
if (rv == NS_ERROR_RDF_NO_VALUE) return NS_ERROR_RDF_CURSOR_EMPTY;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SingletonMsgFolderCursor::GetValue(nsIRDFNode** aValue)
|
||||
{
|
||||
NS_ADDREF(mValue);
|
||||
*aValue = mValue;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIRDFAssertionCursor interface
|
||||
NS_IMETHODIMP
|
||||
SingletonMsgFolderCursor::GetDataSource(nsIRDFDataSource** aDataSource)
|
||||
{
|
||||
NS_ADDREF(gMsgFolderDataSource);
|
||||
*aDataSource = gMsgFolderDataSource;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SingletonMsgFolderCursor::GetSubject(nsIRDFResource** aResource)
|
||||
{
|
||||
NS_ADDREF(mSource);
|
||||
*aResource = mSource;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SingletonMsgFolderCursor::GetPredicate(nsIRDFResource** aPredicate)
|
||||
{
|
||||
NS_ADDREF(mProperty);
|
||||
*aPredicate = mProperty;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SingletonMsgFolderCursor::GetObject(nsIRDFNode** aObject)
|
||||
{
|
||||
NS_ADDREF(mTarget);
|
||||
*aObject = mTarget;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SingletonMsgFolderCursor::GetTruthValue(PRBool* aTruthValue)
|
||||
{
|
||||
*aTruthValue = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMPL_ISUPPORTS(SingletonMsgFolderCursor, nsIRDFAssertionCursor::IID());
|
||||
|
||||
ArrayMsgFolderCursor::ArrayMsgFolderCursor(nsIRDFResource* u,
|
||||
nsIRDFResource* s,
|
||||
nsISupportsArray* array)
|
||||
{
|
||||
// getsources and gettargets will call this with the array
|
||||
mSource = u;
|
||||
mProperty = s;
|
||||
mArray = array;
|
||||
NS_ADDREF(mProperty);
|
||||
NS_ADDREF(u);
|
||||
NS_ADDREF(mArray);
|
||||
mCount = 0;
|
||||
mTarget = nsnull;
|
||||
mValue = nsnull;
|
||||
}
|
||||
|
||||
ArrayMsgFolderCursor::~ArrayMsgFolderCursor(void)
|
||||
{
|
||||
NS_IF_RELEASE(mSource);
|
||||
NS_IF_RELEASE(mValue);
|
||||
NS_IF_RELEASE(mProperty);
|
||||
NS_IF_RELEASE(mTarget);
|
||||
NS_IF_RELEASE(mArray);
|
||||
}
|
||||
|
||||
|
||||
// nsIRDFCursor interface
|
||||
NS_IMETHODIMP
|
||||
ArrayMsgFolderCursor::Advance(void)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
if (mArray->Count() <= mCount) return NS_ERROR_RDF_CURSOR_EMPTY;
|
||||
NS_IF_RELEASE(mValue);
|
||||
mTarget = mValue = (nsIRDFNode*) mArray->ElementAt(mCount++);
|
||||
NS_ADDREF(mValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ArrayMsgFolderCursor::GetValue(nsIRDFNode** aValue)
|
||||
{
|
||||
NS_ADDREF(mValue);
|
||||
*aValue = mValue;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIRDFAssertionCursor interface
|
||||
NS_IMETHODIMP
|
||||
ArrayMsgFolderCursor::GetDataSource(nsIRDFDataSource** aDataSource)
|
||||
{
|
||||
NS_ADDREF(gMsgFolderDataSource);
|
||||
*aDataSource = gMsgFolderDataSource;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ArrayMsgFolderCursor::GetSubject(nsIRDFResource** aResource)
|
||||
{
|
||||
NS_ADDREF(mSource);
|
||||
*aResource = mSource;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ArrayMsgFolderCursor::GetPredicate(nsIRDFResource** aPredicate)
|
||||
{
|
||||
NS_ADDREF(mProperty);
|
||||
*aPredicate = mProperty;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ArrayMsgFolderCursor::GetObject(nsIRDFNode** aObject)
|
||||
{
|
||||
NS_ADDREF(mTarget);
|
||||
*aObject = mTarget;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ArrayMsgFolderCursor::GetTruthValue(PRBool* aTruthValue)
|
||||
{
|
||||
*aTruthValue = 1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(ArrayMsgFolderCursor);
|
||||
NS_IMPL_RELEASE(ArrayMsgFolderCursor);
|
||||
|
||||
NS_IMETHODIMP
|
||||
ArrayMsgFolderCursor::QueryInterface(REFNSIID iid, void** result)
|
||||
{
|
||||
if (! result)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*result = nsnull;
|
||||
if (iid.Equals(nsIRDFAssertionCursor::IID()) ||
|
||||
iid.Equals(kIRDFCursorIID) ||
|
||||
iid.Equals(kISupportsIID)) {
|
||||
*result = NS_STATIC_CAST(nsIRDFAssertionCursor*, this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
|
||||
MsgFolderArcsOutCursor::MsgFolderArcsOutCursor(nsIRDFResource* source,
|
||||
nsISupportsArray* array)
|
||||
{
|
||||
// getsources and gettargets will call this with the array
|
||||
mSource = source;
|
||||
mProperty = nsnull;
|
||||
mArray = array;
|
||||
NS_ADDREF(source);
|
||||
NS_ADDREF(mArray);
|
||||
mCount = 0;
|
||||
}
|
||||
|
||||
MsgFolderArcsOutCursor::~MsgFolderArcsOutCursor(void)
|
||||
{
|
||||
NS_IF_RELEASE(mSource);
|
||||
NS_IF_RELEASE(mProperty);
|
||||
NS_IF_RELEASE(mArray);
|
||||
}
|
||||
|
||||
|
||||
// nsIRDFCursor interface
|
||||
NS_IMETHODIMP
|
||||
MsgFolderArcsOutCursor::Advance(void)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
if (mArray->Count() <= mCount) return NS_ERROR_RDF_CURSOR_EMPTY;
|
||||
NS_IF_RELEASE(mProperty);
|
||||
mProperty = (nsIRDFResource*)mArray->ElementAt(mCount++);
|
||||
NS_ADDREF(mProperty);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MsgFolderArcsOutCursor::GetValue(nsIRDFNode** aValue)
|
||||
{
|
||||
NS_ADDREF(mProperty);
|
||||
*aValue = mProperty;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIRDFAssertionCursor interface
|
||||
NS_IMETHODIMP
|
||||
MsgFolderArcsOutCursor::GetDataSource(nsIRDFDataSource** aDataSource)
|
||||
{
|
||||
NS_ADDREF(gMsgFolderDataSource);
|
||||
*aDataSource = gMsgFolderDataSource;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MsgFolderArcsOutCursor::GetSubject(nsIRDFResource** aResource)
|
||||
{
|
||||
NS_ADDREF(mSource);
|
||||
*aResource = mSource;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MsgFolderArcsOutCursor::GetPredicate(nsIRDFResource** aPredicate)
|
||||
{
|
||||
NS_ADDREF(mProperty);
|
||||
*aPredicate = mProperty;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMPL_ADDREF(MsgFolderArcsOutCursor);
|
||||
NS_IMPL_RELEASE(MsgFolderArcsOutCursor);
|
||||
|
||||
NS_IMETHODIMP
|
||||
MsgFolderArcsOutCursor::QueryInterface(REFNSIID iid, void** result)
|
||||
{
|
||||
if (! result)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*result = nsnull;
|
||||
if (iid.Equals(nsIRDFCursor::IID()) ||
|
||||
iid.Equals(nsIRDFArcsOutCursor::IID()) ||
|
||||
iid.Equals(::nsISupports::IID())) {
|
||||
*result = NS_STATIC_CAST(nsIRDFArcsOutCursor*, this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
|
|
@ -33,13 +33,6 @@ private:
|
|||
char* mURI;
|
||||
nsVoidArray* mObservers;
|
||||
PRBool mInitialized;
|
||||
// internal methods
|
||||
nsresult InitLocalFolders (nsIMsgFolder *aParentFolder, nsNativeFileSpec& path,
|
||||
PRInt32 depth);
|
||||
nsresult InitFoldersFromDirectory(nsIMsgFolder *folder,
|
||||
nsNativeFileSpec& aPath, PRInt32 depth);
|
||||
|
||||
nsresult AddColumns (void);
|
||||
|
||||
public:
|
||||
|
||||
|
@ -121,85 +114,3 @@ public:
|
|||
static nsIRDFResource* kNC_Subject;
|
||||
};
|
||||
|
||||
class SingletonMsgFolderCursor : public nsIRDFAssertionCursor
|
||||
{
|
||||
private:
|
||||
nsIRDFNode* mValue;
|
||||
nsIRDFResource* mSource;
|
||||
nsIRDFResource* mProperty;
|
||||
nsIRDFNode* mTarget;
|
||||
PRBool mValueReturnedp;
|
||||
PRBool mInversep;
|
||||
|
||||
public:
|
||||
SingletonMsgFolderCursor(nsIRDFNode* u,
|
||||
nsIRDFResource* s,
|
||||
PRBool inversep);
|
||||
virtual ~SingletonMsgFolderCursor(void);
|
||||
|
||||
// nsISupports interface
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIRDFCursor interface
|
||||
NS_IMETHOD Advance(void);
|
||||
NS_IMETHOD GetValue(nsIRDFNode** aValue);
|
||||
|
||||
// nsIRDFAssertionCursor interface
|
||||
NS_IMETHOD GetDataSource(nsIRDFDataSource** aDataSource);
|
||||
NS_IMETHOD GetSubject(nsIRDFResource** aResource);
|
||||
NS_IMETHOD GetPredicate(nsIRDFResource** aPredicate);
|
||||
NS_IMETHOD GetObject(nsIRDFNode** aObject);
|
||||
NS_IMETHOD GetTruthValue(PRBool* aTruthValue);
|
||||
};
|
||||
|
||||
class ArrayMsgFolderCursor : public nsIRDFAssertionCursor, public nsIRDFArcsOutCursor
|
||||
{
|
||||
private:
|
||||
nsIRDFNode* mValue;
|
||||
nsIRDFResource* mSource;
|
||||
nsIRDFResource* mProperty;
|
||||
nsIRDFNode* mTarget;
|
||||
int mCount;
|
||||
nsISupportsArray* mArray;
|
||||
|
||||
public:
|
||||
ArrayMsgFolderCursor(nsIRDFResource* u, nsIRDFResource* s, nsISupportsArray* array);
|
||||
virtual ~ArrayMsgFolderCursor(void);
|
||||
// nsISupports interface
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIRDFCursor interface
|
||||
NS_IMETHOD Advance(void);
|
||||
NS_IMETHOD GetValue(nsIRDFNode** aValue);
|
||||
// nsIRDFAssertionCursor interface
|
||||
NS_IMETHOD GetDataSource(nsIRDFDataSource** aDataSource);
|
||||
NS_IMETHOD GetSubject(nsIRDFResource** aResource);
|
||||
NS_IMETHOD GetPredicate(nsIRDFResource** aPredicate);
|
||||
NS_IMETHOD GetObject(nsIRDFNode** aObject);
|
||||
NS_IMETHOD GetTruthValue(PRBool* aTruthValue);
|
||||
};
|
||||
|
||||
class MsgFolderArcsOutCursor : public nsIRDFArcsOutCursor
|
||||
{
|
||||
private:
|
||||
nsIRDFResource* mSource;
|
||||
nsIRDFResource* mProperty;
|
||||
int mCount;
|
||||
nsISupportsArray* mArray;
|
||||
|
||||
public:
|
||||
MsgFolderArcsOutCursor(nsIRDFResource* source, nsISupportsArray* array);
|
||||
virtual ~MsgFolderArcsOutCursor(void);
|
||||
// nsISupports interface
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIRDFCursor interface
|
||||
NS_IMETHOD Advance(void);
|
||||
NS_IMETHOD GetValue(nsIRDFNode** aValue);
|
||||
// nsIRDFAssertionCursor interface
|
||||
NS_IMETHOD GetDataSource(nsIRDFDataSource** aDataSource);
|
||||
NS_IMETHOD GetSubject(nsIRDFResource** aResource);
|
||||
NS_IMETHOD GetPredicate(nsIRDFResource** aPredicate);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ NS_IMETHODIMP nsMsgMailboxParser::OnStartBinding(nsIURL* aURL, const char *aCont
|
|||
{
|
||||
nsFilePath dbName(fileName);
|
||||
|
||||
nsMailDatabase::Open(dbName, PR_TRUE, &m_mailDB, PR_FALSE);
|
||||
(void)nsMailDatabase::Open(dbName, PR_TRUE, &m_mailDB, PR_FALSE);
|
||||
printf("url file = %s\n", fileName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ nsresult NS_NewMailboxUrl(nsIMailboxUrl ** aResult, const nsString urlSpec)
|
|||
if (mailboxUrl)
|
||||
{
|
||||
mailboxUrl->ParseURL(urlSpec); // load the spec we were given...
|
||||
rv = mailboxUrl->QueryInterface(kIMailboxUrlIID, (void **) aResult);
|
||||
rv = mailboxUrl->QueryInterface(nsIMailboxUrl::IID(), (void **) aResult);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
|
|
@ -55,6 +55,8 @@ LIBS = \
|
|||
-lpref \
|
||||
-ljs \
|
||||
-lraptorbase \
|
||||
-lrdfbase_s \
|
||||
-lrdfutil_s \
|
||||
-lgmbase$(MOZ_TOOLKIT) \
|
||||
-lsecfree \
|
||||
-lz \
|
||||
|
|
|
@ -48,6 +48,7 @@ MYLIBS= \
|
|||
$(DIST)\lib\msgcore.lib \
|
||||
$(DIST)\lib\xplib.lib \
|
||||
$(DIST)\lib\mailnews.lib \
|
||||
$(DIST)\lib\rdfutil_s.lib \
|
||||
$(NULL)
|
||||
|
||||
LLIBS= $(MYLIBS) \
|
||||
|
|
|
@ -17,6 +17,6 @@
|
|||
|
||||
DEPTH=..
|
||||
|
||||
DIRS=public base db local news compose mime
|
||||
DIRS=public base db local news compose mime ui
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
|
||||
class nsIMimeObjectClassAccess : public nsISupports {
|
||||
public:
|
||||
static const nsIID& IID() { static nsIID iid = NS_IMIME_OBJECT_CLASS_ACCESS_IID; return iid; }
|
||||
|
||||
// These methods are all implemented by libmime to be used by
|
||||
// content type handler plugins for processing stream data.
|
||||
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
|
||||
class nsIStreamConverter : public nsIStreamListener {
|
||||
public:
|
||||
static const nsIID& IID() { static nsIID iid = NS_ISTREAM_CONVERTER_IID; return iid; }
|
||||
|
||||
//
|
||||
// This is the output stream where the stream converter will write processed data after
|
||||
// conversion.
|
||||
|
|
|
@ -82,6 +82,8 @@ typedef enum {
|
|||
|
||||
class nsINetFile: public nsISupports {
|
||||
public:
|
||||
static const nsIID& IID() { static nsIID iid = NS_INETFILE_IID; return iid; }
|
||||
|
||||
/*
|
||||
* File methods
|
||||
*/
|
||||
|
|
|
@ -41,10 +41,8 @@
|
|||
class nsINntpUrl : public nsIURL
|
||||
{
|
||||
public:
|
||||
static const nsIID& IID() {
|
||||
static nsIID iid = NS_INNTPURL_IID;
|
||||
return iid;
|
||||
}
|
||||
static const nsIID& IID() { static nsIID iid = NS_INNTPURL_IID; return iid; }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Getters and Setters for the news specific event sinks to bind to to your url
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
#include "nsNNTPNewsgroup.h"
|
||||
|
||||
#include "nsIMsgFolder.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsIEnumerator.h"
|
||||
|
||||
/* for XP_FilePerm */
|
||||
#include "xp_file.h"
|
||||
|
@ -284,7 +286,6 @@ private:
|
|||
char* GetPrettyName(const char* groupname);
|
||||
NS_IMETHOD SetPrettyName(const char* groupname, const char* prettyname);
|
||||
|
||||
|
||||
time_t GetAddTime(const char* groupname);
|
||||
|
||||
// Returns a unique integer associated with this newsgroup. This is
|
||||
|
@ -782,7 +783,8 @@ nsNNTPHost::ProcessLine(char* line, PRUint32 line_size)
|
|||
|
||||
nsIMsgFolder *folder = getFolderFor(info);
|
||||
if (folder) {
|
||||
m_hostinfo->AddSubFolder(folder);
|
||||
// m_hostinfo->AddSubFolder(folder);
|
||||
m_hostinfo->AppendElement(folder);
|
||||
NS_RELEASE(folder);
|
||||
}
|
||||
|
||||
|
@ -1704,7 +1706,8 @@ nsNNTPHost::AddGroup(const char *groupName,
|
|||
if (NS_SUCCEEDED(rv) && !subscribed) {
|
||||
newsInfo->SetSubscribed(PR_TRUE);
|
||||
nsIMsgFolder *newsFolder = getFolderFor(newsInfo);
|
||||
m_hostinfo->AddSubfolderIfUnique(newsFolder);
|
||||
// m_hostinfo->AddSubfolderIfUnique(newsFolder);
|
||||
m_hostinfo->AppendElement(newsFolder);
|
||||
/*
|
||||
nsISupportsArray* infolist;
|
||||
nsresult rv = m_hostinfo->GetSubFolders(&infolist);
|
||||
|
@ -1844,7 +1847,7 @@ nsNNTPHost::SwitchNewsToCategoryContainer(nsINNTPNewsgroup *newsInfo)
|
|||
if (newsFolder) {
|
||||
nsIMsgFolder *catContFolder = getFolderFor(newCatCont);
|
||||
if (catContFolder) {
|
||||
m_hostinfo->ReplaceSubfolder(newsFolder, catContFolder);
|
||||
m_hostinfo->ReplaceElement(newsFolder, catContFolder);
|
||||
NS_RELEASE(catContFolder);
|
||||
}
|
||||
NS_RELEASE(newsFolder);
|
||||
|
@ -1883,7 +1886,7 @@ nsNNTPHost::SwitchCategoryContainerToNews(nsINNTPCategoryContainer*
|
|||
if (catContFolder) {
|
||||
nsIMsgFolder *rootFolder = getFolderFor(rootCategory);
|
||||
if (rootFolder) {
|
||||
m_hostinfo->ReplaceSubfolder(catContFolder, rootFolder);
|
||||
m_hostinfo->ReplaceElement(catContFolder, rootFolder);
|
||||
NS_RELEASE(rootFolder);
|
||||
}
|
||||
NS_RELEASE(catContFolder);
|
||||
|
@ -1916,7 +1919,7 @@ nsNNTPHost::RemoveGroup (const nsINNTPNewsgroup *newsInfo)
|
|||
#endif
|
||||
nsIMsgFolder* newsFolder = getFolderFor((nsINNTPNewsgroup*)newsInfo);
|
||||
if (newsFolder) {
|
||||
m_hostinfo->RemoveSubFolder(newsFolder);
|
||||
m_hostinfo->RemoveElement(newsFolder);
|
||||
NS_RELEASE(newsFolder);
|
||||
}
|
||||
/*
|
||||
|
@ -2951,7 +2954,7 @@ nsNNTPHost::GroupNotFound(const char *groupName, PRBool opening)
|
|||
nsIMsgFolder* parentCategory;
|
||||
rv = catFolder->FindParentOf(newsFolder,&parentCategory);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
parentCategory->RemoveSubFolder(newsFolder);
|
||||
parentCategory->RemoveElement(newsFolder);
|
||||
NS_RELEASE(parentCategory);
|
||||
}
|
||||
NS_RELEASE(catFolder);
|
||||
|
@ -2967,7 +2970,7 @@ nsNNTPHost::GroupNotFound(const char *groupName, PRBool opening)
|
|||
|
||||
if (newsInfo)
|
||||
{
|
||||
m_hostinfo->RemoveSubFolder(newsFolder);
|
||||
m_hostinfo->RemoveElement(newsFolder);
|
||||
/*
|
||||
nsISupportsArray* infolist;
|
||||
nsresult rv = m_hostinfo->GetSubFolders(&infolist);
|
||||
|
@ -2983,13 +2986,13 @@ nsNNTPHost::GroupNotFound(const char *groupName, PRBool opening)
|
|||
}
|
||||
|
||||
|
||||
int nsNNTPHost::ReorderGroup (nsINNTPNewsgroup *groupToMove, nsINNTPNewsgroup *groupToMoveBefore, PRInt32 *newIdx)
|
||||
int nsNNTPHost::ReorderGroup(nsINNTPNewsgroup *groupToMove, nsINNTPNewsgroup *groupToMoveBefore, PRInt32 *newIdx)
|
||||
{
|
||||
// Do the list maintenance to reorder a newsgroup. The news host has a list, and
|
||||
// so does the FolderInfo which represents the host in the hierarchy tree
|
||||
|
||||
int err = MK_MSG_CANT_MOVE_FOLDER;
|
||||
nsISupportsArray *infoList=NULL;
|
||||
nsIEnumerator *infoList=NULL;
|
||||
nsresult rv = m_hostinfo->GetSubFolders(&infoList);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && groupToMove && groupToMoveBefore && infoList)
|
||||
|
@ -3002,18 +3005,24 @@ int nsNNTPHost::ReorderGroup (nsINNTPNewsgroup *groupToMove, nsINNTPNewsgroup *g
|
|||
// Unsubscribed groups are in the lists, but not in the view
|
||||
nsIMsgFolder *group = NULL;
|
||||
int idxInView, idxInData;
|
||||
int idxInHostInfo = 0;
|
||||
int idxInHostInfo = 0;
|
||||
infoList->First();
|
||||
PRBool foundIdxInHostInfo = PR_FALSE;
|
||||
|
||||
for (idxInData = 0, idxInView = -1; idxInData < m_groups->Count(); idxInData++)
|
||||
for (idxInData = 0, idxInView = -1; idxInData < (PRInt32)m_groups->Count(); idxInData++)
|
||||
{
|
||||
group = (nsIMsgFolder*)(*m_groups)[idxInData];
|
||||
nsISupports *hostInfoSupports =
|
||||
infoList->ElementAt(idxInHostInfo);
|
||||
|
||||
nsIMsgFolder *groupInHostInfo;
|
||||
(void)infoList->CurrentItem((nsISupports**)&groupInHostInfo);
|
||||
#if 0
|
||||
nsISupports *hostInfoSupports;
|
||||
(void)infoList->CurrentItem(&hostInfoSupports);
|
||||
|
||||
nsIMsgFolder *groupInHostInfo=NULL;
|
||||
rv = hostInfoSupports->QueryInterface(::nsISupports::IID(),
|
||||
(void **)&groupInHostInfo);
|
||||
#endif
|
||||
#ifdef HAVE_PANE
|
||||
if (group->CanBeInFolderPane())
|
||||
idxInView++;
|
||||
|
@ -3023,11 +3032,14 @@ int nsNNTPHost::ReorderGroup (nsINNTPNewsgroup *groupToMove, nsINNTPNewsgroup *g
|
|||
break;
|
||||
if (groupInHostInfo == folderToMoveBefore)
|
||||
foundIdxInHostInfo = PR_TRUE;
|
||||
else if (!foundIdxInHostInfo)
|
||||
else if (!foundIdxInHostInfo) {
|
||||
idxInHostInfo++;
|
||||
infoList->Next();
|
||||
}
|
||||
NS_RELEASE(groupInHostInfo);
|
||||
#if 0
|
||||
NS_RELEASE(hostInfoSupports);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
if (idxInView != -1)
|
||||
|
@ -3036,7 +3048,7 @@ int nsNNTPHost::ReorderGroup (nsINNTPNewsgroup *groupToMove, nsINNTPNewsgroup *g
|
|||
nsISupports* groupSupports;
|
||||
groupToMove->QueryInterface(::nsISupports::IID(),
|
||||
(void **)&groupSupports);
|
||||
infoList->InsertElementAt (groupSupports, idxInHostInfo);
|
||||
//XXX infoList->InsertElementAt(groupSupports, idxInHostInfo);
|
||||
NS_RELEASE(groupSupports);
|
||||
|
||||
MarkDirty (); // Make sure the newsrc gets written out in the new order
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "plstr.h"
|
||||
#include "prmem.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#include "nsINNTPNewsgroup.h"
|
||||
|
@ -608,7 +609,7 @@ nsresult nsNNTPHostStub::FindGroup(const char * name, nsINNTPNewsgroup ** retVal
|
|||
{
|
||||
PRBool found = PR_FALSE;
|
||||
*retVal = nsnull;
|
||||
for (PRInt32 count = 0; count < m_groups->Count() && !found; count++)
|
||||
for (PRUint32 count = 0; count < m_groups->Count() && !found; count++)
|
||||
{
|
||||
nsISupports * elem = m_groups->ElementAt(count);
|
||||
if (elem)
|
||||
|
|
|
@ -273,7 +273,7 @@ nsComposeAppCore::NewMessage()
|
|||
}
|
||||
|
||||
controllerCID = "6B75BB61-BD41-11d2-9D31-00805F8ADDDE";
|
||||
appShell->CreateTopLevelWindow(url, controllerCID, newWindow, nsnull);
|
||||
appShell->CreateTopLevelWindow(url, controllerCID, newWindow, nsnull, 100, 100);
|
||||
done:
|
||||
NS_RELEASE(url);
|
||||
if (nsnull != appShell) {
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="sidebar.css" type="text/css"?>
|
||||
|
||||
<xul:window
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns:rdf="http://www.w3.org/TR/WD-rdf-syntax#">
|
||||
|
||||
<xul:tree xul:datasources="rdf:mailnewsfolder">
|
||||
<xul:treecol rdf:resource="http://home.netscape.com/NC-rdf#Name"/>
|
||||
<xul:treehead>
|
||||
<xul:treeitem>
|
||||
<xul:treecell>Name</xul:treecell>
|
||||
<xul:treecell>Unread</xul:treecell>
|
||||
<xul:treecell>Total</xul:treecell>
|
||||
</xul:treeitem>
|
||||
</xul:treehead>
|
||||
|
||||
<xul:treebody>
|
||||
<xul:treeitem xul:id="mailbox:MSGFolderRoot">
|
||||
<xul:treecell><xul:treeindentation/><html:img html:hspace="2" html:style="vertical-align: bottom" html:src="http://rava/~hyatt/ClosedRead.gif"/>Local Mail</xul:treecell>
|
||||
<xul:treecell></xul:treecell>
|
||||
<xul:treecell></xul:treecell>
|
||||
</xul:treeitem>
|
||||
|
||||
</xul:treebody>
|
||||
</xul:tree>
|
||||
|
||||
</xul:window>
|
Загрузка…
Ссылка в новой задаче