This commit is contained in:
jefft%netscape.com 1999-04-21 05:20:11 +00:00
Родитель abeb4be98b
Коммит 064782a44f
2 изменённых файлов: 818 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,661 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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, 1999 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "msgCore.h"
#include "nsImapMailFolder.h"
#include "nsIEnumerator.h"
#include "nsIFolderListener.h"
#include "nsCOMPtr.h"
#include "nsIRDFService.h"
#include "nsIRDFDataSource.h"
#include "nsRDFCID.h"
#include "nsFileStream.h"
#include "nsMsgDBCID.h"
#include "nsMsgFolderFlags.h"
// we need this because of an egcs 1.0 (and possibly gcc) compiler bug
// that doesn't allow you to call ::nsISupports::GetIID() inside of a class
// that multiply inherits from nsISupports
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
static NS_DEFINE_CID(kCMailDB, NS_MAILDB_CID);
////////////////////////////////////////////////////////////////////////////////
nsImapMailFolder::nsImapMailFolder() :
nsMsgFolder(), mPathName(""), mMailDatabase(nsnull),
mInitialized(PR_FALSE), mHaveReadNameFromDB(PR_FALSE)
{
//XXXX This is a hack for the moment. I'm assuming the only listener is our rdf:mailnews datasource.
//In reality anyone should be able to listen to folder changes.
nsIRDFService* rdfService = nsnull;
nsIRDFDataSource* datasource = nsnull;
nsresult rv = nsServiceManager::GetService(kRDFServiceCID,
nsIRDFService::GetIID(),
(nsISupports**) &rdfService);
if(NS_SUCCEEDED(rv))
{
if(NS_SUCCEEDED(rv = rdfService->GetDataSource("rdf:mailnewsfolders", &datasource)))
{
nsIFolderListener *folderListener;
if(NS_SUCCEEDED(datasource->QueryInterface(nsIFolderListener::GetIID(), (void**)&folderListener)))
{
AddFolderListener(folderListener);
NS_RELEASE(folderListener);
}
NS_RELEASE(datasource);
}
nsServiceManager::ReleaseService(kRDFServiceCID, rdfService);
}
// NS_INIT_REFCNT(); done by superclass
}
nsImapMailFolder::~nsImapMailFolder()
{
if (mMailDatabase)
mMailDatabase->Close(PR_TRUE);
}
NS_IMPL_ADDREF_INHERITED(nsImapMailFolder, nsMsgFolder)
NS_IMPL_RELEASE_INHERITED(nsImapMailFolder, nsMsgFolder)
NS_IMETHODIMP nsImapMailFolder::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (!aInstancePtr) return NS_ERROR_NULL_POINTER;
*aInstancePtr = nsnull;
if (aIID.Equals(nsIMsgImapMailFolder::GetIID()))
{
*aInstancePtr = NS_STATIC_CAST(nsIMsgImapMailFolder*, this);
}
else if (aIID.Equals(nsIDBChangeListener::GetIID()))
{
*aInstancePtr = NS_STATIC_CAST(nsIDBChangeListener*, this);
}
else if(aIID.Equals(nsICopyMessageListener::GetIID()))
{
*aInstancePtr = NS_STATIC_CAST(nsICopyMessageListener*, this);
}
else if (aIID.Equals(nsIImapMailFolderSink::GetIID()))
{
*aInstancePtr = NS_STATIC_CAST(nsIImapMailFolderSink*, this);
}
if(*aInstancePtr)
{
AddRef();
return NS_OK;
}
return nsMsgFolder::QueryInterface(aIID, aInstancePtr);
}
NS_IMETHODIMP nsImapMailFolder::GetPathName(nsNativeFileSpec& aPathName)
{
nsFileSpec nopath("");
if (mPathName == nopath)
{
nsresult rv = nsURI2Path(kMailboxRootURI, mURI, mPathName);
if (NS_FAILED(rv)) return rv;
}
aPathName = mPathName;
return NS_OK;
}
NS_IMETHODIMP nsImapMailFolder::Enumerate(nsIEnumerator* *result)
{
nsresult rv = NS_OK;
nsIEnumerator* folders;
nsIEnumerator* messages;
rv = GetSubFolders(&folders);
if (NS_FAILED(rv)) return rv;
rv = GetMessages(&messages);
if (NS_FAILED(rv)) return rv;
return NS_NewConjoiningEnumerator(folders, messages,
(nsIBidirectionalEnumerator**)result);
}
nsresult nsImapMailFolder::AddDirectorySeparator(nsFileSpec &path)
{
nsresult rv = NS_OK;
if (nsCRT::strcmp(mURI, kImapRootURI) == 0) {
// don't concat the full separator with .sbd
}
else {
nsAutoString sep;
rv = nsGetMailFolderSeparator(sep);
if (NS_FAILED(rv)) return rv;
// see if there's a dir with the same name ending with .sbd
// unfortunately we can't just say:
// path += sep;
// here because of the way nsFileSpec concatenates
nsAutoString str((nsFilePath)path);
str += sep;
path = nsFilePath(str);
}
return rv;
}
static PRBool
nsShouldIgnoreFile(nsString& name)
{
PRInt32 len = name.Length();
if (len > 4 && name.RFind(".msf", PR_TRUE) == len -4)
{
name.SetLength(len-4); // truncate the string
return PR_FALSE;
}
return PR_TRUE;
}
nsresult nsImapMailFolder::AddSubfolder(nsAutoString name,
nsIMsgFolder **child)
{
if(!child)
return NS_ERROR_NULL_POINTER;
nsresult rv = NS_OK;
nsIRDFService* rdf;
rv = nsServiceManager::GetService(kRDFServiceCID,
nsIRDFService::GetIID(),
(nsISupports**)&rdf);
if(NS_FAILED(rv))
return rv;
nsAutoString uri;
uri.Append(mURI);
uri.Append('/');
uri.Append(name);
char* uriStr = uri.ToNewCString();
if (uriStr == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
nsIRDFResource* res;
rv = rdf->GetResource(uriStr, &res);
if (NS_FAILED(rv))
return rv;
nsCOMPtr<nsIMsgFolder> folder(do_QueryInterface(res, &rv));
if (NS_FAILED(rv))
return rv;
delete[] uriStr;
folder->SetFlag(MSG_FOLDER_FLAG_MAIL);
if(name == "Inbox")
folder->SetFlag(MSG_FOLDER_FLAG_INBOX);
else if(name == "Trash")
folder->SetFlag(MSG_FOLDER_FLAG_TRASH);
mSubFolders->AppendElement(folder);
*child = folder;
NS_ADDREF(*child);
(void)nsServiceManager::ReleaseService(kRDFServiceCID, rdf);
return rv;
}
nsresult nsImapMailFolder::CreateSubFolders(nsFileSpec &path)
{
nsresult rv = NS_OK;
nsAutoString currentFolderNameStr;
nsIMsgFolder *child;
char *folderName;
for (nsDirectoryIterator dir(path); dir.Exists(); dir++) {
nsFileSpec currentFolderPath = (nsFileSpec&)dir;
folderName = currentFolderPath.GetLeafName();
currentFolderNameStr = folderName;
if (nsShouldIgnoreFile(currentFolderNameStr))
{
PL_strfree(folderName);
continue;
}
AddSubfolder(currentFolderNameStr, &child);
NS_IF_RELEASE(child);
PL_strfree(folderName);
}
return rv;
}
NS_IMETHODIMP nsImapMailFolder::GetSubFolders(nsIEnumerator* *result)
{
if (!mInitialized)
{
nsresult rv = NS_OK;
nsFileSpec path;
rv = GetPathName(path);
if (NS_FAILED(rv)) return rv;
rv = AddDirectorySeparator(path);
if(NS_FAILED(rv)) return rv;
// we have to treat the root folder specially, because it's name
// doesn't end with .sbd
PRInt32 newFlags = MSG_FOLDER_FLAG_MAIL;
if (path.IsDirectory()) {
newFlags |= (MSG_FOLDER_FLAG_DIRECTORY | MSG_FOLDER_FLAG_ELIDED);
SetFlag(newFlags);
rv = CreateSubFolders(path);
if (mSubFolders->Count() == 0)
{
nsAutoString inboxString = "Inbox";
nsIMsgFolder *child = nsnull;
AddSubfolder(inboxString, &child);
NS_IF_RELEASE (child);
}
}
else
{
UpdateSummaryTotals();
// Look for a directory for this mail folder, and recurse into it.
// e.g. if the folder is "inbox", look for "inbox.sbd".
#if 0
char *folderName = path->GetLeafName();
char *newLeafName = (char*)malloc(PL_strlen(folderName) +
PL_strlen(kDirExt) + 2);
PL_strcpy(newLeafName, folderName);
PL_strcat(newLeafName, kDirExt);
path->SetLeafName(newLeafName);
if(folderName)
delete[] folderName;
if(newLeafName)
delete[] newLeafName;
#endif
}
if (NS_FAILED(rv)) return rv;
mInitialized = PR_TRUE; // XXX do this on failure too?
}
return mSubFolders->Enumerate(result);
}
NS_IMETHODIMP nsImapMailFolder::AddUnique(nsISupports* element)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::ReplaceElement(nsISupports* element,
nsISupports* newElement)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::GetMessages(nsIEnumerator* *result)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::GetThreads(nsIEnumerator** threadEnumerator)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::GetThreadForMessage(nsIMessage *message,
nsIMsgThread **thread)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::CreateSubfolder(const char *folderName)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::RemoveSubFolder (nsIMsgFolder *which)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::Delete ()
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::Rename (const char *newName)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::GetChildNamed(nsString& name, nsISupports **
aChild)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::GetName(char ** name)
{
if(!name)
return NS_ERROR_NULL_POINTER;
if (!mHaveReadNameFromDB)
{
if (mDepth == 1)
{
SetName("Imap Host Name");
mHaveReadNameFromDB = TRUE;
*name = mName.ToNewCString();
return NS_OK;
}
else
{
//Need to read the name from the database
}
}
nsAutoString folderName;
nsURI2Name(kMailboxRootURI, mURI, folderName);
*name = folderName.ToNewCString();
return NS_OK;
}
NS_IMETHODIMP nsImapMailFolder::GetPrettyName(nsString& prettyName)
{
if (mDepth == 1) {
// Depth == 1 means we are on the mail server level
// override the name here to say "Imap Host Name"
prettyName = PL_strdup("Imap Host Name");
}
else {
nsresult rv = NS_ERROR_NULL_POINTER;
char *pName = prettyName.ToNewCString();
if (pName)
rv = nsMsgFolder::GetPrettyName(&pName);
delete[] pName;
return rv;
}
return NS_OK;
}
NS_IMETHODIMP nsImapMailFolder::BuildFolderURL(char **url)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::UpdateSummaryTotals()
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::GetExpungedBytesCount(PRUint32 *count)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::GetDeletable (PRBool *deletable)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::GetCanCreateChildren (PRBool
*canCreateChildren)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::GetCanBeRenamed (PRBool *canBeRenamed)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::GetRequiresCleanup(PRBool *requiresCleanup)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::GetSizeOnDisk(PRUint32 size)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::GetUsersName(char** userName)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::GetHostName(char** hostName)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::UserNeedsToAuthenticateForFolder(PRBool
displayOnly,
PRBool
*authenticate)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::RememberPassword(char *password)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::GetRememberedPassword(char ** password)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::Adopt(nsIMsgFolder *srcFolder,
PRUint32 *outPos)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
nsresult nsImapMailFolder::GetDBFolderInfoAndDB(
nsIDBFolderInfo **folderInfo, nsIMsgDatabase **db)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::DeleteMessage(nsIMessage* message)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::PossibleImapMailbox(
nsIImapProtocol* aProtocol, mailbox_spec* aSpec)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::MailboxDiscoveryDone(
nsIImapProtocol* aProtocol)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::UpdateImapMailboxInfo(
nsIImapProtocol* aProtocol, mailbox_spec* aSpec)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::UpdateImapMailboxStatus(
nsIImapProtocol* aProtocol, mailbox_spec* aSpec)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::ChildDiscoverySucceeded(
nsIImapProtocol* aProtocol)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::OnlineFolderDelete(
nsIImapProtocol* aProtocol, const char* folderName)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::OnlineFolderCreateFailed(
nsIImapProtocol* aProtocol, const char* folderName)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::OnlineFolderRename(
nsIImapProtocol* aProtocol, folder_rename_struct* aStruct)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::SubscribeUpgradeFinished(
nsIImapProtocol* aProtocol, EIMAPSubscriptionUpgradeState* aState)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::PromptUserForSubscribeUpdatePath(
nsIImapProtocol* aProtocol, PRBool* aBool)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::FolderIsNoSelect(nsIImapProtocol* aProtocol,
FolderQueryInfo* aInfo)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::SetupHeaderParseStream(
nsIImapProtocol* aProtocol, StreamInfo* aStreamInfo)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::ParseAdoptedHeaderLine(
nsIImapProtocol* aProtocol, msg_line_info* aMsgLineInfo)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::NormalEndHeaderParseStream(nsIImapProtocol*
aProtocol)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::AbortHeaderParseStream(nsIImapProtocol*
aProtocol)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::OnKeyChange(nsMsgKey aKeyChanged,
int32 aFlags,
nsIDBChangeListener * aInstigator)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::OnKeyDeleted(nsMsgKey aKeyChanged,
int32 aFlags,
nsIDBChangeListener * aInstigator)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::OnKeyAdded(nsMsgKey aKeyChanged,
int32 aFlags,
nsIDBChangeListener * aInstigator)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::OnAnnouncerGoingAway(nsIDBChangeAnnouncer *
instigator)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::BeginCopy(nsIMessage *message)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::CopyData(nsIInputStream *aIStream,
PRInt32 aLength)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}
NS_IMETHODIMP nsImapMailFolder::EndCopy(PRBool copySucceeded)
{
nsresult rv = NS_ERROR_FAILURE;
return rv;
}

Просмотреть файл

@ -0,0 +1,157 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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, 1999 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsImapMailFolder_h__
#define nsImapMailFolder_h__
#include "nsImapCore.h"
#include "nsMsgFolder.h"
#include "nsIImapMailfolderSink.h"
#include "nsIDBChangeListener.h"
#include "nsICopyMessageListener.h"
/* fa32d000-f6a0-11d2-af8d-001083002da8 */
#define NS_IMAPRESOURCE_CID \
{ 0xfa32d000, 0xf6a0, 0x11d2, \
{ 0xaf, 0x8d, 0x00, 0x10, 0x83, 0x00, 0x2d, 0xa8 } }
class nsImapMailFolder : public nsMsgFolder,
public nsIMsgImapMailFolder,
public nsIImapMailFolderSink,
public nsIDBChangeListener,
public nsICopyMessageListener
{
public:
nsImapMailFolder();
virtual ~nsImapMailFolder();
NS_DECL_ISUPPORTS_INHERITED
// nsIMsgImapMailFolder methods
NS_IMETHOD GetPathName(nsNativeFileSpec& aPathName);
// 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);
NS_IMETHOD GetThreads(nsIEnumerator** threadEnumerator);
NS_IMETHOD GetThreadForMessage(nsIMessage *message, nsIMsgThread **thread);
NS_IMETHOD CreateSubfolder(const char *folderName);
NS_IMETHOD RemoveSubFolder (nsIMsgFolder *which);
NS_IMETHOD Delete ();
NS_IMETHOD Rename (const char *newName);
NS_IMETHOD Adopt(nsIMsgFolder *srcFolder, PRUint32 *outPos);
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(nsString& prettyName); // Override of the base, for top-level mail folder
NS_IMETHOD BuildFolderURL(char **url);
NS_IMETHOD UpdateSummaryTotals() ;
NS_IMETHOD GetExpungedBytesCount(PRUint32 *count);
NS_IMETHOD GetDeletable (PRBool *deletable);
NS_IMETHOD GetCanCreateChildren (PRBool *canCreateChildren) ;
NS_IMETHOD GetCanBeRenamed (PRBool *canBeRenamed);
NS_IMETHOD GetRequiresCleanup(PRBool *requiresCleanup);
NS_IMETHOD GetSizeOnDisk(PRUint32 size);
NS_IMETHOD GetUsersName(char** userName);
NS_IMETHOD GetHostName(char** hostName);
NS_IMETHOD UserNeedsToAuthenticateForFolder(PRBool displayOnly, PRBool *authenticate);
NS_IMETHOD RememberPassword(char *password);
NS_IMETHOD GetRememberedPassword(char ** password);
virtual nsresult GetDBFolderInfoAndDB(nsIDBFolderInfo **folderInfo,
nsIMsgDatabase **db);
NS_IMETHOD DeleteMessage(nsIMessage *message);
// nsIImapMailFolderSink methods
// Tell mail master about a discovered imap mailbox
NS_IMETHOD PossibleImapMailbox(nsIImapProtocol* aProtocol,
mailbox_spec* aSpec);
NS_IMETHOD MailboxDiscoveryDone(nsIImapProtocol* aProtocol);
// Tell mail master about the newly selected mailbox
NS_IMETHOD UpdateImapMailboxInfo(nsIImapProtocol* aProtocol,
mailbox_spec* aSpec);
NS_IMETHOD UpdateImapMailboxStatus(nsIImapProtocol* aProtocol,
mailbox_spec* aSpec);
NS_IMETHOD ChildDiscoverySucceeded(nsIImapProtocol* aProtocol);
NS_IMETHOD OnlineFolderDelete(nsIImapProtocol* aProtocol,
const char* folderName);
NS_IMETHOD OnlineFolderCreateFailed(nsIImapProtocol* aProtocol,
const char* folderName);
NS_IMETHOD OnlineFolderRename(nsIImapProtocol* aProtocol,
folder_rename_struct* aStruct);
NS_IMETHOD SubscribeUpgradeFinished(nsIImapProtocol* aProtocol,
EIMAPSubscriptionUpgradeState* aState);
NS_IMETHOD PromptUserForSubscribeUpdatePath(nsIImapProtocol* aProtocol,
PRBool* aBool);
NS_IMETHOD FolderIsNoSelect(nsIImapProtocol* aProtocol,
FolderQueryInfo* aInfo);
NS_IMETHOD SetupHeaderParseStream(nsIImapProtocol* aProtocol,
StreamInfo* aStreamInfo);
NS_IMETHOD ParseAdoptedHeaderLine(nsIImapProtocol* aProtocol,
msg_line_info* aMsgLineInfo);
NS_IMETHOD NormalEndHeaderParseStream(nsIImapProtocol* aProtocol);
NS_IMETHOD AbortHeaderParseStream(nsIImapProtocol* aProtocol);
//nsIDBChangeListener
NS_IMETHOD OnKeyChange(nsMsgKey aKeyChanged, int32 aFlags,
nsIDBChangeListener * aInstigator);
NS_IMETHOD OnKeyDeleted(nsMsgKey aKeyChanged, int32 aFlags,
nsIDBChangeListener * aInstigator);
NS_IMETHOD OnKeyAdded(nsMsgKey aKeyChanged, int32 aFlags,
nsIDBChangeListener * aInstigator);
NS_IMETHOD OnAnnouncerGoingAway(nsIDBChangeAnnouncer * instigator);
//nsICopyMessageListener
NS_IMETHOD BeginCopy(nsIMessage *message);
NS_IMETHOD CopyData(nsIInputStream *aIStream, PRInt32 aLength);
NS_IMETHOD EndCopy(PRBool copySucceeded);
protected:
// Helper methods
nsresult AddDirectorySeparator(nsFileSpec &path);
nsresult CreateSubFolders(nsFileSpec &path);
//Creates a subfolder with the name 'name' and adds it to the list of
//children. Returns the child as well.
nsresult AddSubfolder(nsAutoString name, nsIMsgFolder **child);
nsNativeFileSpec mPathName;
nsIMsgDatabase* mMailDatabase;
PRBool mInitialized;
PRBool mHaveReadNameFromDB;
};
#endif