get parser to compile

This commit is contained in:
bienvenu%netscape.com 1999-03-31 04:42:08 +00:00
parent 0a7c4eba32
commit e9371ee3b9
13 changed files with 294 additions and 182 deletions

View File

@ -31,6 +31,8 @@
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
static NS_DEFINE_CID(kCImapUrl, NS_IMAPURL_CID);
static NS_DEFINE_CID(kCImapProtocol, NS_IMAPPROTOCOL_CID);
static NS_DEFINE_CID(kCImapHostSessionList, NS_IMAPPROTOCOL_CID);
////////////////////////////////////////////////////////////
//

View File

@ -36,59 +36,60 @@ class nsIImapHostSessionList : public nsISupports
public:
// Host List
NS_IMETHOD AddHostToList(const char *hostName) = 0;
NS_IMETHOD AddHostToList(const char *hostname, const char *userName) = 0;
NS_IMETHOD ResetAll() = 0;
// Capabilities
NS_IMETHOD GetCapabilityForHost(const char *hostName, PRUint32 &result) = 0;
NS_IMETHOD SetCapabilityForHost(const char *hostName, PRUint32 capability) = 0;
NS_IMETHOD GetHostHasAdminURL(const char *hostName, PRBool &result) = 0;
NS_IMETHOD SetHostHasAdminURL(const char *hostName, PRBool hasAdminUrl) = 0;
NS_IMETHOD GetCapabilityForHost(const char *hostName, const char *userName, PRUint32 &result) = 0;
NS_IMETHOD SetCapabilityForHost(const char *hostname, const char *userName, PRUint32 capability) = 0;
NS_IMETHOD GetHostHasAdminURL(const char *hostname, const char *userName, PRBool &result) = 0;
NS_IMETHOD SetHostHasAdminURL(const char *hostname, const char *userName, PRBool hasAdminUrl) = 0;
// Subscription
NS_IMETHOD GetHostIsUsingSubscription(const char *hostName, PRBool &result) = 0;
NS_IMETHOD SetHostIsUsingSubscription(const char *hostName, PRBool usingSubscription) = 0;
NS_IMETHOD GetHostIsUsingSubscription(const char *hostname, const char *userName, PRBool &result) = 0;
NS_IMETHOD SetHostIsUsingSubscription(const char *hostname, const char *userName, PRBool usingSubscription) = 0;
// Passwords
NS_IMETHOD GetPasswordForHost(const char *hostName, nsString &result) = 0;
NS_IMETHOD SetPasswordForHost(const char *hostName, const char *password) = 0;
NS_IMETHOD GetPasswordVerifiedOnline(const char *hostName, PRBool &result) = 0;
NS_IMETHOD SetPasswordVerifiedOnline(const char *hostName) = 0;
NS_IMETHOD GetPasswordForHost(const char *hostname, const char *userName, nsString &result) = 0;
NS_IMETHOD SetPasswordForHost(const char *hostname, const char *userName, const char *password) = 0;
NS_IMETHOD GetPasswordVerifiedOnline(const char *hostname, const char *userName, PRBool &result) = 0;
NS_IMETHOD SetPasswordVerifiedOnline(const char *hostName, const char *userName) = 0;
// Folders
NS_IMETHOD SetHaveWeEverDiscoveredFoldersForHost(const char *hostName, PRBool discovered) = 0;
NS_IMETHOD GetHaveWeEverDiscoveredFoldersForHost(const char *hostName, PRBool &result) = 0;
NS_IMETHOD SetHaveWeEverDiscoveredFoldersForHost(const char *hostname, const char *userName, PRBool discovered) = 0;
NS_IMETHOD GetHaveWeEverDiscoveredFoldersForHost(const char *hostname, const char *userName, PRBool &result) = 0;
// Trash Folder
NS_IMETHOD SetOnlineTrashFolderExistsForHost(const char *hostName, PRBool exists) = 0;
NS_IMETHOD GetOnlineTrashFolderExistsForHost(const char *hostName, PRBool &result) = 0;
NS_IMETHOD SetOnlineTrashFolderExistsForHost(const char *hostname, const char *userName, PRBool exists) = 0;
NS_IMETHOD GetOnlineTrashFolderExistsForHost(const char *hostname, const char *userName, PRBool &result) = 0;
// INBOX
NS_IMETHOD GetOnlineInboxPathForHost(const char *hostName, nsString &result) = 0;
NS_IMETHOD GetShouldAlwaysListInboxForHost(const char *hostName, PRBool &result) = 0;
NS_IMETHOD SetShouldAlwaysListInboxForHost(const char *hostName, PRBool shouldList) = 0;
NS_IMETHOD GetOnlineInboxPathForHost(const char *hostname, const char *userName, nsString &result) = 0;
NS_IMETHOD GetShouldAlwaysListInboxForHost(const char *hostname, const char *userName, PRBool &result) = 0;
NS_IMETHOD SetShouldAlwaysListInboxForHost(const char *hostname, const char *userName, PRBool shouldList) = 0;
// Namespaces
NS_IMETHOD GetNamespaceForMailboxForHost(const char *hostName, const char *mailbox_name, nsIMAPNamespace &result) = 0;
NS_IMETHOD AddNewNamespaceForHost(const char *hostName, nsIMAPNamespace *ns) = 0;
NS_IMETHOD ClearServerAdvertisedNamespacesForHost(const char *hostName) = 0;
NS_IMETHOD ClearPrefsNamespacesForHost(const char *hostName) = 0;
NS_IMETHOD GetDefaultNamespaceOfTypeForHost(const char *hostName, EIMAPNamespaceType type, nsIMAPNamespace &result) = 0;
NS_IMETHOD SetNamespacesOverridableForHost(const char *hostName, PRBool overridable) = 0;
NS_IMETHOD GetNamespacesOverridableForHost(const char *hostName,PRBool &result) = 0;
NS_IMETHOD GetNumberOfNamespacesForHost(const char *hostName, PRUint32 &result) = 0;
NS_IMETHOD GetNamespaceNumberForHost(const char *hostName, PRInt32 n, nsIMAPNamespace &result) = 0;
NS_IMETHOD GetNamespaceForMailboxForHost(const char *hostname, const char *userName, const char *mailbox_name, nsIMAPNamespace * & result) = 0;
NS_IMETHOD AddNewNamespaceForHost(const char *hostname, const char *userName, nsIMAPNamespace *ns) = 0;
NS_IMETHOD ClearServerAdvertisedNamespacesForHost(const char *hostName, const char *userName) = 0;
NS_IMETHOD ClearPrefsNamespacesForHost(const char *hostName, const char *userName) = 0;
NS_IMETHOD GetDefaultNamespaceOfTypeForHost(const char *hostname, const char *userName, EIMAPNamespaceType type, nsIMAPNamespace * & result) = 0;
NS_IMETHOD SetNamespacesOverridableForHost(const char *hostname, const char *userName, PRBool overridable) = 0;
NS_IMETHOD GetNamespacesOverridableForHost(const char *hostname, const char *userName,PRBool &result) = 0;
NS_IMETHOD GetNumberOfNamespacesForHost(const char *hostname, const char *userName, PRUint32 &result) = 0;
NS_IMETHOD GetNamespaceNumberForHost(const char *hostname, const char *userName, PRInt32 n, nsIMAPNamespace * &result) = 0;
// ### dmb hoo boy, how are we going to do this?
// NS_IMETHOD CommitNamespacesForHost(const char *hostName, MSG_Master *master) = 0;
NS_IMETHOD CommitNamespacesForHost(const char *hostname, const char *userName) = 0;
NS_IMETHOD FlushUncommittedNamespacesForHost(const char *hostName, const char *userName, PRBool &result) = 0;
// Hierarchy Delimiters
NS_IMETHOD AddHierarchyDelimiter(const char *hostName, char delimiter) = 0;
NS_IMETHOD GetHierarchyDelimiterStringForHost(const char *hostName, nsString &result) = 0;
NS_IMETHOD SetNamespaceHierarchyDelimiterFromMailboxForHost(const char *hostName, const char *boxName, char delimiter) = 0;
NS_IMETHOD AddHierarchyDelimiter(const char *hostname, const char *userName, char delimiter) = 0;
NS_IMETHOD GetHierarchyDelimiterStringForHost(const char *hostname, const char *userName, nsString &result) = 0;
NS_IMETHOD SetNamespaceHierarchyDelimiterFromMailboxForHost(const char *hostname, const char *userName, const char *boxName, char delimiter) = 0;
// Message Body Shells
NS_IMETHOD AddShellToCacheForHost(const char *hostName, nsIMAPBodyShell *shell) = 0;
NS_IMETHOD FindShellInCacheForHost(const char *hostName, const char *mailboxName, const char *UID, nsIMAPBodyShell &result) = 0;
NS_IMETHOD AddShellToCacheForHost(const char *hostname, const char *userName, nsIMAPBodyShell *shell) = 0;
NS_IMETHOD FindShellInCacheForHost(const char *hostname, const char *userName, const char *mailboxName, const char *UID, nsIMAPBodyShell &result) = 0;
};

View File

@ -108,6 +108,9 @@ public:
NS_IMETHOD GetImapAction(nsImapAction * aImapAction) = 0;
NS_IMETHOD SetImapAction(nsImapAction aImapAction) = 0;
NS_IMETHOD GetImapPartToFetch(const char **resultPart) const = 0;
NS_IMETHOD AllocateCannonicalPath(const char *serverPath, char onlineDelimiter, char **allocatedPath ) const = 0;
};
#endif /* nsIImapUrl_h___ */

View File

@ -43,9 +43,9 @@ CPP_OBJS= .\$(OBJDIR)\nsImapUrl.obj \
.\$(OBJDIR)\nsIMAPBodyShell.obj \
.\$(OBJDIR)\nsIMAPGenericParser.obj \
.\$(OBJDIR)\nsIMAPNamespace.obj \
# .\$(OBJDIR)\nsImapSearchResults.obj \
# .\$(OBJDIR)\nsImapFlagAndUidState.obj \
# .\$(OBJDIR)\nsImapServerResponseParser.obj \
.\$(OBJDIR)\nsImapSearchResults.obj \
.\$(OBJDIR)\nsImapFlagAndUidState.obj \
.\$(OBJDIR)\nsImapServerResponseParser.obj \
$(NULL)

View File

@ -27,9 +27,10 @@
#include "nsISupportsUtils.h"
nsIMAPHostInfo::nsIMAPHostInfo(const char *hostName)
nsIMAPHostInfo::nsIMAPHostInfo(const char *hostName, const char *userName)
{
fHostName = nsCRT::strdup(hostName);
fUserName = nsCRT::strdup(userName);
fNextHost = NULL;
fCachedPassword = NULL;
fCapabilityFlags = kCapabilityUndefined;
@ -47,6 +48,7 @@ nsIMAPHostInfo::nsIMAPHostInfo(const char *hostName)
nsIMAPHostInfo::~nsIMAPHostInfo()
{
PR_FREEIF(fHostName);
PR_FREEIF(fUserName);
PR_FREEIF(fCachedPassword);
PR_FREEIF(fHierarchyDelimiters);
delete fNamespaceList;
@ -99,10 +101,11 @@ nsIMAPHostSessionList::~nsIMAPHostSessionList()
PR_DestroyMonitor(gCachedHostInfoMonitor);
}
nsIMAPHostInfo *nsIMAPHostSessionList::FindHost(const char *hostName)
nsIMAPHostInfo *nsIMAPHostSessionList::FindHost(const char *hostName, const char *userName)
{
nsIMAPHostInfo *host;
// ### should also check userName here, if NON NULL
for (host = fHostInfoList; host; host = host->fNextHost)
{
if (!PL_strcasecmp(hostName, host->fHostName))
@ -126,14 +129,14 @@ NS_IMETHODIMP nsIMAPHostSessionList::ResetAll()
return NS_OK;
}
NS_IMETHODIMP nsIMAPHostSessionList::AddHostToList(const char *hostName)
NS_IMETHODIMP nsIMAPHostSessionList::AddHostToList(const char *hostName, const char *userName)
{
nsIMAPHostInfo *newHost=NULL;
PR_EnterMonitor(gCachedHostInfoMonitor);
if (!FindHost(hostName))
if (!FindHost(hostName, userName))
{
// stick it on the front
newHost = new nsIMAPHostInfo(hostName);
newHost = new nsIMAPHostInfo(hostName, userName);
if (newHost)
{
newHost->fNextHost = fHostInfoList;
@ -144,40 +147,40 @@ NS_IMETHODIMP nsIMAPHostSessionList::AddHostToList(const char *hostName)
return (newHost == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
NS_IMETHODIMP nsIMAPHostSessionList::GetCapabilityForHost(const char *hostName, PRUint32 &result)
NS_IMETHODIMP nsIMAPHostSessionList::GetCapabilityForHost(const char *hostName, const char *userName, PRUint32 &result)
{
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(hostName);
nsIMAPHostInfo *host = FindHost(hostName, userName);
result = (host) ? host->fCapabilityFlags : 0;
PR_ExitMonitor(gCachedHostInfoMonitor);
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
NS_IMETHODIMP nsIMAPHostSessionList::SetCapabilityForHost(const char *hostName, PRUint32 capability)
NS_IMETHODIMP nsIMAPHostSessionList::SetCapabilityForHost(const char *hostName, const char *userName, PRUint32 capability)
{
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(hostName);
nsIMAPHostInfo *host = FindHost(hostName, userName);
if (host)
host->fCapabilityFlags = capability;
PR_ExitMonitor(gCachedHostInfoMonitor);
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
NS_IMETHODIMP nsIMAPHostSessionList::GetPasswordForHost(const char *hostName, nsString &result)
NS_IMETHODIMP nsIMAPHostSessionList::GetPasswordForHost(const char *hostName, const char *userName, nsString &result)
{
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(hostName);
nsIMAPHostInfo *host = FindHost(hostName, userName);
if (host)
result = host->fCachedPassword;
PR_ExitMonitor(gCachedHostInfoMonitor);
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
NS_IMETHODIMP nsIMAPHostSessionList::SetPasswordForHost(const char *hostName, const char *password)
NS_IMETHODIMP nsIMAPHostSessionList::SetPasswordForHost(const char *hostName, const char *userName, const char *password)
{
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(hostName);
nsIMAPHostInfo *host = FindHost(hostName, userName);
if (host)
{
PR_FREEIF(host->fCachedPassword);
@ -188,41 +191,41 @@ NS_IMETHODIMP nsIMAPHostSessionList::SetPasswordForHost(const char *hostName, co
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
NS_IMETHODIMP nsIMAPHostSessionList::SetPasswordVerifiedOnline(const char *hostName)
NS_IMETHODIMP nsIMAPHostSessionList::SetPasswordVerifiedOnline(const char *hostName, const char *userName)
{
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(hostName);
nsIMAPHostInfo *host = FindHost(hostName, userName);
if (host)
host->fPasswordVerifiedOnline = TRUE;
PR_ExitMonitor(gCachedHostInfoMonitor);
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
NS_IMETHODIMP nsIMAPHostSessionList::GetPasswordVerifiedOnline(const char *hostName, PRBool &result)
NS_IMETHODIMP nsIMAPHostSessionList::GetPasswordVerifiedOnline(const char *hostName, const char *userName, PRBool &result)
{
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(hostName);
nsIMAPHostInfo *host = FindHost(hostName, userName);
if (host)
result = host->fPasswordVerifiedOnline;
PR_ExitMonitor(gCachedHostInfoMonitor);
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
NS_IMETHODIMP nsIMAPHostSessionList::GetHierarchyDelimiterStringForHost(const char *hostName, nsString &result)
NS_IMETHODIMP nsIMAPHostSessionList::GetHierarchyDelimiterStringForHost(const char *hostName, const char *userName, nsString &result)
{
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(hostName);
nsIMAPHostInfo *host = FindHost(hostName, userName);
if (host)
result = host->fHierarchyDelimiters;
PR_ExitMonitor(gCachedHostInfoMonitor);
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
NS_IMETHODIMP nsIMAPHostSessionList::AddHierarchyDelimiter(const char *hostName, char delimiter)
NS_IMETHODIMP nsIMAPHostSessionList::AddHierarchyDelimiter(const char *hostName, const char *userName, char delimiter)
{
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(hostName);
nsIMAPHostInfo *host = FindHost(hostName, userName);
if (host)
{
if (!host->fHierarchyDelimiters)
@ -240,40 +243,40 @@ NS_IMETHODIMP nsIMAPHostSessionList::AddHierarchyDelimiter(const char *hostName,
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
NS_IMETHODIMP nsIMAPHostSessionList::GetHostIsUsingSubscription(const char *hostName, PRBool &result)
NS_IMETHODIMP nsIMAPHostSessionList::GetHostIsUsingSubscription(const char *hostName, const char *userName, PRBool &result)
{
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(hostName);
nsIMAPHostInfo *host = FindHost(hostName, userName);
if (host)
result = host->fUsingSubscription;
PR_ExitMonitor(gCachedHostInfoMonitor);
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
NS_IMETHODIMP nsIMAPHostSessionList::SetHostIsUsingSubscription(const char *hostName, PRBool usingSubscription)
NS_IMETHODIMP nsIMAPHostSessionList::SetHostIsUsingSubscription(const char *hostName, const char *userName, PRBool usingSubscription)
{
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(hostName);
nsIMAPHostInfo *host = FindHost(hostName, userName);
if (host)
host->fUsingSubscription = usingSubscription;
PR_ExitMonitor(gCachedHostInfoMonitor);
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
NS_IMETHODIMP nsIMAPHostSessionList::GetHostHasAdminURL(const char *hostName, PRBool &result)
NS_IMETHODIMP nsIMAPHostSessionList::GetHostHasAdminURL(const char *hostName, const char *userName, PRBool &result)
{
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(hostName);
nsIMAPHostInfo *host = FindHost(hostName, userName);
if (host)
result = host->fHaveAdminURL;
PR_ExitMonitor(gCachedHostInfoMonitor);
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
NS_IMETHODIMP nsIMAPHostSessionList::SetHostHasAdminURL(const char *hostName, PRBool haveAdminURL)
NS_IMETHODIMP nsIMAPHostSessionList::SetHostHasAdminURL(const char *hostName, const char *userName, PRBool haveAdminURL)
{
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(hostName);
nsIMAPHostInfo *host = FindHost(hostName, userName);
if (host)
host->fHaveAdminURL = haveAdminURL;
PR_ExitMonitor(gCachedHostInfoMonitor);
@ -281,51 +284,51 @@ NS_IMETHODIMP nsIMAPHostSessionList::SetHostHasAdminURL(const char *hostName, PR
}
NS_IMETHODIMP nsIMAPHostSessionList::GetHaveWeEverDiscoveredFoldersForHost(const char *hostName, PRBool &result)
NS_IMETHODIMP nsIMAPHostSessionList::GetHaveWeEverDiscoveredFoldersForHost(const char *hostName, const char *userName, PRBool &result)
{
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(hostName);
nsIMAPHostInfo *host = FindHost(hostName, userName);
if (host)
result = host->fHaveWeEverDiscoveredFolders;
PR_ExitMonitor(gCachedHostInfoMonitor);
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
NS_IMETHODIMP nsIMAPHostSessionList::SetHaveWeEverDiscoveredFoldersForHost(const char *hostName, PRBool discovered)
NS_IMETHODIMP nsIMAPHostSessionList::SetHaveWeEverDiscoveredFoldersForHost(const char *hostName, const char *userName, PRBool discovered)
{
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(hostName);
nsIMAPHostInfo *host = FindHost(hostName, userName);
if (host)
host->fHaveWeEverDiscoveredFolders = discovered;
PR_ExitMonitor(gCachedHostInfoMonitor);
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
NS_IMETHODIMP nsIMAPHostSessionList::SetOnlineTrashFolderExistsForHost(const char *hostName, PRBool exists)
NS_IMETHODIMP nsIMAPHostSessionList::SetOnlineTrashFolderExistsForHost(const char *hostName, const char *userName, PRBool exists)
{
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(hostName);
nsIMAPHostInfo *host = FindHost(hostName, userName);
if (host)
host->fOnlineTrashFolderExists = exists;
PR_ExitMonitor(gCachedHostInfoMonitor);
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
NS_IMETHODIMP nsIMAPHostSessionList::GetOnlineTrashFolderExistsForHost(const char *hostName, PRBool &result)
NS_IMETHODIMP nsIMAPHostSessionList::GetOnlineTrashFolderExistsForHost(const char *hostName, const char *userName, PRBool &result)
{
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(hostName);
nsIMAPHostInfo *host = FindHost(hostName, userName);
if (host)
result = host->fOnlineTrashFolderExists;
PR_ExitMonitor(gCachedHostInfoMonitor);
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
NS_IMETHODIMP nsIMAPHostSessionList::AddNewNamespaceForHost(const char *hostName, nsIMAPNamespace *ns)
NS_IMETHODIMP nsIMAPHostSessionList::AddNewNamespaceForHost(const char *hostName, const char *userName, nsIMAPNamespace *ns)
{
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(hostName);
nsIMAPHostInfo *host = FindHost(hostName, userName);
if (host)
{
host->fNamespaceList->AddNewNamespace(ns);
@ -335,84 +338,84 @@ NS_IMETHODIMP nsIMAPHostSessionList::AddNewNamespaceForHost(const char *hostName
}
NS_IMETHODIMP nsIMAPHostSessionList::GetNamespaceForMailboxForHost(const char *hostName, const char *mailbox_name, nsIMAPNamespace &result)
NS_IMETHODIMP nsIMAPHostSessionList::GetNamespaceForMailboxForHost(const char *hostName, const char *userName, const char *mailbox_name, nsIMAPNamespace * &result)
{
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(hostName);
nsIMAPHostInfo *host = FindHost(hostName, userName);
if (host)
{
result = *host->fNamespaceList->GetNamespaceForMailbox(mailbox_name);
result = host->fNamespaceList->GetNamespaceForMailbox(mailbox_name);
}
PR_ExitMonitor(gCachedHostInfoMonitor);
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
NS_IMETHODIMP nsIMAPHostSessionList::ClearPrefsNamespacesForHost(const char *hostName)
NS_IMETHODIMP nsIMAPHostSessionList::ClearPrefsNamespacesForHost(const char *hostName, const char *userName)
{
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(hostName);
nsIMAPHostInfo *host = FindHost(hostName, userName);
if (host)
{
host->fNamespaceList->ClearNamespaces(TRUE, FALSE);
host->fNamespaceList->ClearNamespaces(TRUE, FALSE, TRUE);
}
PR_ExitMonitor(gCachedHostInfoMonitor);
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
NS_IMETHODIMP nsIMAPHostSessionList::ClearServerAdvertisedNamespacesForHost(const char *hostName)
NS_IMETHODIMP nsIMAPHostSessionList::ClearServerAdvertisedNamespacesForHost(const char *hostName, const char *userName)
{
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(hostName);
nsIMAPHostInfo *host = FindHost(hostName, userName);
if (host)
{
host->fNamespaceList->ClearNamespaces(FALSE, TRUE);
host->fNamespaceList->ClearNamespaces(FALSE, TRUE, TRUE);
}
PR_ExitMonitor(gCachedHostInfoMonitor);
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
NS_IMETHODIMP nsIMAPHostSessionList::GetDefaultNamespaceOfTypeForHost(const char *hostName, EIMAPNamespaceType type, nsIMAPNamespace &result)
NS_IMETHODIMP nsIMAPHostSessionList::GetDefaultNamespaceOfTypeForHost(const char *hostName, const char *userName, EIMAPNamespaceType type, nsIMAPNamespace * &result)
{
nsIMAPNamespace *ret = NULL;
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(hostName);
nsIMAPHostInfo *host = FindHost(hostName, userName);
if (host)
{
result = *host->fNamespaceList->GetDefaultNamespaceOfType(type);
result = host->fNamespaceList->GetDefaultNamespaceOfType(type);
}
PR_ExitMonitor(gCachedHostInfoMonitor);
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
NS_IMETHODIMP nsIMAPHostSessionList::GetNamespacesOverridableForHost(const char *hostName, PRBool &result)
NS_IMETHODIMP nsIMAPHostSessionList::GetNamespacesOverridableForHost(const char *hostName, const char *userName, PRBool &result)
{
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(hostName);
nsIMAPHostInfo *host = FindHost(hostName, userName);
if (host)
result = host->fNamespacesOverridable;
PR_ExitMonitor(gCachedHostInfoMonitor);
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
NS_IMETHODIMP nsIMAPHostSessionList::SetNamespacesOverridableForHost(const char *hostName, PRBool overridable)
NS_IMETHODIMP nsIMAPHostSessionList::SetNamespacesOverridableForHost(const char *hostName, const char *userName, PRBool overridable)
{
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(hostName);
nsIMAPHostInfo *host = FindHost(hostName, userName);
if (host)
host->fNamespacesOverridable = overridable;
PR_ExitMonitor(gCachedHostInfoMonitor);
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
NS_IMETHODIMP nsIMAPHostSessionList::GetNumberOfNamespacesForHost(const char *hostName, PRUint32 &result)
NS_IMETHODIMP nsIMAPHostSessionList::GetNumberOfNamespacesForHost(const char *hostName, const char *userName, PRUint32 &result)
{
PRInt32 intResult;
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(hostName);
nsIMAPHostInfo *host = FindHost(hostName, userName);
if (host)
{
intResult = host->fNamespaceList->GetNumberOfNamespaces();
@ -423,24 +426,25 @@ NS_IMETHODIMP nsIMAPHostSessionList::GetNumberOfNamespacesForHost(const char *ho
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
NS_IMETHODIMP nsIMAPHostSessionList::GetNamespaceNumberForHost(const char *hostName, PRInt32 n, nsIMAPNamespace &result)
NS_IMETHODIMP nsIMAPHostSessionList::GetNamespaceNumberForHost(const char *hostName, const char *userName, PRInt32 n, nsIMAPNamespace * &result)
{
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(hostName);
nsIMAPHostInfo *host = FindHost(hostName, userName);
if (host)
{
result = *host->fNamespaceList->GetNamespaceNumber(n);
result = host->fNamespaceList->GetNamespaceNumber(n);
}
PR_ExitMonitor(gCachedHostInfoMonitor);
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
#if 0 // do we need this? What should we do about the master thing?
// do we need this? What should we do about the master thing?
// Make sure this is running in the Mozilla thread when called
NS_IMETHODIMP nsIMAPHostSessionList::CommitNamespacesForHost(const char *hostName, MSG_Master *master)
NS_IMETHODIMP nsIMAPHostSessionList::CommitNamespacesForHost(const char *hostName, const char *userName)
{
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(hostName);
nsIMAPHostInfo *host = FindHost(hostName, userName);
#if 0
if (host)
{
EIMAPNamespaceType type = kPersonalNamespace;
@ -494,17 +498,36 @@ NS_IMETHODIMP nsIMAPHostSessionList::CommitNamespacesForHost(const char *hostNam
}
}
}
// clear, but don't delete the entries in, the temp namespace list
host->fTempNamespaceList->ClearNamespaces(TRUE, TRUE, FALSE);
// Now reset all of libmsg's namespace references.
// Did I mention this needs to be running in the mozilla thread?
MSG_ResetNamespaceReferences(master, host->fHostName);
}
#endif // ### DMB must figure out what to do about this.
PR_ExitMonitor(gCachedHostInfoMonitor);
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
NS_IMETHODIMP nsIMAPHostSessionList::FlushUncommittedNamespacesForHost(const char *hostName, const char *userName, PRBool &result)
{
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(hostName, userName);
if (host)
{
host->fTempNamespaceList->ClearNamespaces(TRUE, TRUE, TRUE);
}
PR_ExitMonitor(gCachedHostInfoMonitor);
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
#endif // ### DMB must figure out what to do about this.
// Returns NULL if there is no personal namespace on the given host
NS_IMETHODIMP nsIMAPHostSessionList::GetOnlineInboxPathForHost(const char *hostName, nsString &result)
NS_IMETHODIMP nsIMAPHostSessionList::GetOnlineInboxPathForHost(const char *hostName, const char *userName, nsString &result)
{
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(hostName);
nsIMAPHostInfo *host = FindHost(hostName, userName);
if (host)
{
nsIMAPNamespace *ns = NULL;
@ -522,13 +545,13 @@ NS_IMETHODIMP nsIMAPHostSessionList::GetOnlineInboxPathForHost(const char *hostN
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
NS_IMETHODIMP nsIMAPHostSessionList::GetShouldAlwaysListInboxForHost(const char* /*hostName*/, PRBool &result)
NS_IMETHODIMP nsIMAPHostSessionList::GetShouldAlwaysListInboxForHost(const char* /*hostName */, const char * /*userName*/, PRBool &result)
{
result = TRUE;
/*
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(hostName);
nsIMAPHostInfo *host = FindHost(hostName, userName);
if (host)
ret = host->fShouldAlwaysListInbox;
PR_ExitMonitor(gCachedHostInfoMonitor);
@ -536,20 +559,20 @@ NS_IMETHODIMP nsIMAPHostSessionList::GetShouldAlwaysListInboxForHost(const char*
return NS_OK;
}
NS_IMETHODIMP nsIMAPHostSessionList::SetShouldAlwaysListInboxForHost(const char *hostName, PRBool shouldList)
NS_IMETHODIMP nsIMAPHostSessionList::SetShouldAlwaysListInboxForHost(const char *hostName, const char *userName, PRBool shouldList)
{
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(hostName);
nsIMAPHostInfo *host = FindHost(hostName, userName);
if (host)
host->fShouldAlwaysListInbox = shouldList;
PR_ExitMonitor(gCachedHostInfoMonitor);
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
NS_IMETHODIMP nsIMAPHostSessionList::SetNamespaceHierarchyDelimiterFromMailboxForHost(const char *hostName, const char *boxName, char delimiter)
NS_IMETHODIMP nsIMAPHostSessionList::SetNamespaceHierarchyDelimiterFromMailboxForHost(const char *hostName, const char *userName, const char *boxName, char delimiter)
{
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(hostName);
nsIMAPHostInfo *host = FindHost(hostName, userName);
if (host)
{
nsIMAPNamespace *ns = host->fNamespaceList->GetNamespaceForMailbox(boxName);
@ -562,10 +585,10 @@ NS_IMETHODIMP nsIMAPHostSessionList::SetNamespaceHierarchyDelimiterFromMailboxFo
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
NS_IMETHODIMP nsIMAPHostSessionList::AddShellToCacheForHost(const char *hostName, nsIMAPBodyShell *shell)
NS_IMETHODIMP nsIMAPHostSessionList::AddShellToCacheForHost(const char *hostName, const char *userName, nsIMAPBodyShell *shell)
{
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(hostName);
nsIMAPHostInfo *host = FindHost(hostName, userName);
if (host)
{
if (host->fShellCache)
@ -584,10 +607,10 @@ NS_IMETHODIMP nsIMAPHostSessionList::AddShellToCacheForHost(const char *hostName
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
NS_IMETHODIMP nsIMAPHostSessionList::FindShellInCacheForHost(const char *hostName, const char *mailboxName, const char *UID, nsIMAPBodyShell &shell)
NS_IMETHODIMP nsIMAPHostSessionList::FindShellInCacheForHost(const char *hostName, const char *userName, const char *mailboxName, const char *UID, nsIMAPBodyShell &shell)
{
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(hostName);
nsIMAPHostInfo *host = FindHost(hostName, userName);
if (host)
{
if (host->fShellCache)

View File

@ -30,17 +30,18 @@ class nsIMAPHostInfo
public:
friend class nsIMAPHostSessionList;
nsIMAPHostInfo(const char *hostName);
nsIMAPHostInfo(const char *hostName, const char *userName);
~nsIMAPHostInfo();
protected:
char *fHostName;
char *fUserName;
char *fCachedPassword;
nsIMAPHostInfo *fNextHost;
PRUint32 fCapabilityFlags;
char *fHierarchyDelimiters; // string of top-level hierarchy delimiters
PRBool fHaveWeEverDiscoveredFolders;
char *fCanonicalOnlineSubDir;
nsIMAPNamespaceList *fNamespaceList;
nsIMAPNamespaceList *fNamespaceList, *fTempNamespaceList;
PRBool fNamespacesOverridable;
PRBool fUsingSubscription;
PRBool fOnlineTrashFolderExists;
@ -60,64 +61,64 @@ public:
nsIMAPHostSessionList();
virtual ~nsIMAPHostSessionList();
// Host List
NS_IMETHOD AddHostToList(const char *hostName);
NS_IMETHOD AddHostToList(const char *hostName, const char *userName);
NS_IMETHOD ResetAll();
// Capabilities
NS_IMETHOD GetCapabilityForHost(const char *hostName, PRUint32 &result);
NS_IMETHOD SetCapabilityForHost(const char *hostName, PRUint32 capability);
NS_IMETHOD GetHostHasAdminURL(const char *hostName, PRBool &result);
NS_IMETHOD SetHostHasAdminURL(const char *hostName, PRBool hasAdminUrl);
NS_IMETHOD GetCapabilityForHost(const char *hostName, const char *userName, PRUint32 &result);
NS_IMETHOD SetCapabilityForHost(const char *hostName, const char *userName, PRUint32 capability);
NS_IMETHOD GetHostHasAdminURL(const char *hostName, const char *userName, PRBool &result);
NS_IMETHOD SetHostHasAdminURL(const char *hostName, const char *userName, PRBool hasAdminUrl);
// Subscription
NS_IMETHOD GetHostIsUsingSubscription(const char *hostName, PRBool &result);
NS_IMETHOD SetHostIsUsingSubscription(const char *hostName, PRBool usingSubscription);
NS_IMETHOD GetHostIsUsingSubscription(const char *hostName, const char *userName, PRBool &result);
NS_IMETHOD SetHostIsUsingSubscription(const char *hostName, const char *userName, PRBool usingSubscription);
// Passwords
NS_IMETHOD GetPasswordForHost(const char *hostName, nsString &result);
NS_IMETHOD SetPasswordForHost(const char *hostName, const char *password);
NS_IMETHOD GetPasswordVerifiedOnline(const char *hostName, PRBool &result);
NS_IMETHOD SetPasswordVerifiedOnline(const char *hostName);
NS_IMETHOD GetPasswordForHost(const char *hostName, const char *userName, nsString &result);
NS_IMETHOD SetPasswordForHost(const char *hostName, const char *userName, const char *password);
NS_IMETHOD GetPasswordVerifiedOnline(const char *hostName, const char *userName, PRBool &result);
NS_IMETHOD SetPasswordVerifiedOnline(const char *hostName, const char *userName);
// Folders
NS_IMETHOD SetHaveWeEverDiscoveredFoldersForHost(const char *hostName, PRBool discovered);
NS_IMETHOD GetHaveWeEverDiscoveredFoldersForHost(const char *hostName, PRBool &result);
NS_IMETHOD SetHaveWeEverDiscoveredFoldersForHost(const char *hostName, const char *userName, PRBool discovered);
NS_IMETHOD GetHaveWeEverDiscoveredFoldersForHost(const char *hostName, const char *userName, PRBool &result);
// Trash Folder
NS_IMETHOD SetOnlineTrashFolderExistsForHost(const char *hostName, PRBool exists);
NS_IMETHOD GetOnlineTrashFolderExistsForHost(const char *hostName, PRBool &result);
NS_IMETHOD SetOnlineTrashFolderExistsForHost(const char *hostName, const char *userName, PRBool exists);
NS_IMETHOD GetOnlineTrashFolderExistsForHost(const char *hostName, const char *userName, PRBool &result);
// INBOX
NS_IMETHOD GetOnlineInboxPathForHost(const char *hostName, nsString &result);
NS_IMETHOD GetShouldAlwaysListInboxForHost(const char *hostName, PRBool &result);
NS_IMETHOD SetShouldAlwaysListInboxForHost(const char *hostName, PRBool shouldList);
NS_IMETHOD GetOnlineInboxPathForHost(const char *hostName, const char *userName, nsString &result);
NS_IMETHOD GetShouldAlwaysListInboxForHost(const char *hostName, const char *userName, PRBool &result);
NS_IMETHOD SetShouldAlwaysListInboxForHost(const char *hostName, const char *userName, PRBool shouldList);
// Namespaces
NS_IMETHOD GetNamespaceForMailboxForHost(const char *hostName, const char *mailbox_name, nsIMAPNamespace &result);
NS_IMETHOD AddNewNamespaceForHost(const char *hostName, nsIMAPNamespace *ns);
NS_IMETHOD ClearServerAdvertisedNamespacesForHost(const char *hostName);
NS_IMETHOD ClearPrefsNamespacesForHost(const char *hostName);
NS_IMETHOD GetDefaultNamespaceOfTypeForHost(const char *hostName, EIMAPNamespaceType type, nsIMAPNamespace &result);
NS_IMETHOD SetNamespacesOverridableForHost(const char *hostName, PRBool overridable);
NS_IMETHOD GetNamespacesOverridableForHost(const char *hostName,PRBool &result);
NS_IMETHOD GetNumberOfNamespacesForHost(const char *hostName, PRUint32 &result);
NS_IMETHOD GetNamespaceNumberForHost(const char *hostName, PRInt32 n, nsIMAPNamespace &result);
NS_IMETHOD GetNamespaceForMailboxForHost(const char *hostName, const char *userName, const char *mailbox_name, nsIMAPNamespace *&result);
NS_IMETHOD AddNewNamespaceForHost(const char *hostName, const char *userName, nsIMAPNamespace *ns);
NS_IMETHOD ClearServerAdvertisedNamespacesForHost(const char *hostName, const char *userName);
NS_IMETHOD ClearPrefsNamespacesForHost(const char *hostName, const char *userName);
NS_IMETHOD GetDefaultNamespaceOfTypeForHost(const char *hostName, const char *userName, EIMAPNamespaceType type, nsIMAPNamespace *&result);
NS_IMETHOD SetNamespacesOverridableForHost(const char *hostName, const char *userName, PRBool overridable);
NS_IMETHOD GetNamespacesOverridableForHost(const char *hostName, const char *userName,PRBool &result);
NS_IMETHOD GetNumberOfNamespacesForHost(const char *hostName, const char *userName, PRUint32 &result);
NS_IMETHOD GetNamespaceNumberForHost(const char *hostName, const char *userName, PRInt32 n, nsIMAPNamespace * &result);
// ### dmb hoo boy, how are we going to do this?
// NS_IMETHOD CommitNamespacesForHost(const char *hostName, MSG_Master *master);
NS_IMETHOD CommitNamespacesForHost(const char *hostName, const char *userName);
NS_IMETHOD FlushUncommittedNamespacesForHost(const char *hostName, const char *userName, PRBool &result);
// Hierarchy Delimiters
NS_IMETHOD AddHierarchyDelimiter(const char *hostName, char delimiter);
NS_IMETHOD GetHierarchyDelimiterStringForHost(const char *hostName, nsString &result);
NS_IMETHOD SetNamespaceHierarchyDelimiterFromMailboxForHost(const char *hostName, const char *boxName, char delimiter);
NS_IMETHOD AddHierarchyDelimiter(const char *hostName, const char *userName, char delimiter);
NS_IMETHOD GetHierarchyDelimiterStringForHost(const char *hostName, const char *userName, nsString &result);
NS_IMETHOD SetNamespaceHierarchyDelimiterFromMailboxForHost(const char *hostName, const char *userName, const char *boxName, char delimiter);
// Message Body Shells
NS_IMETHOD AddShellToCacheForHost(const char *hostName, nsIMAPBodyShell *shell);
NS_IMETHOD FindShellInCacheForHost(const char *hostName, const char *mailboxName, const char *UID, nsIMAPBodyShell &result);
NS_IMETHOD AddShellToCacheForHost(const char *hostName, const char *userName, nsIMAPBodyShell *shell);
NS_IMETHOD FindShellInCacheForHost(const char *hostName, const char *userName, const char *mailboxName, const char *UID, nsIMAPBodyShell &result);
PRMonitor *gCachedHostInfoMonitor;
nsIMAPHostInfo *fHostInfoList;
protected:
nsIMAPHostInfo *FindHost(const char *hostName);
nsIMAPHostInfo *FindHost(const char *hostName, const char *userName);
};
#endif

View File

@ -151,11 +151,11 @@ nsIMAPNamespace *nsIMAPNamespaceList::GetDefaultNamespaceOfType(EIMAPNamespaceTy
nsIMAPNamespaceList::~nsIMAPNamespaceList()
{
ClearNamespaces(TRUE, TRUE);
ClearNamespaces(TRUE, TRUE, TRUE);
}
// ClearNamespaces removes and deletes the namespaces specified, and if there are no namespaces left,
void nsIMAPNamespaceList::ClearNamespaces(XP_Bool deleteFromPrefsNamespaces, XP_Bool deleteServerAdvertisedNamespaces)
void nsIMAPNamespaceList::ClearNamespaces(PRBool deleteFromPrefsNamespaces, PRBool deleteServerAdvertisedNamespaces, PRBool reallyDelete)
{
int nodeIndex = 0;
@ -167,13 +167,15 @@ void nsIMAPNamespaceList::ClearNamespaces(XP_Bool deleteFromPrefsNamespaces, XP_
if (deleteFromPrefsNamespaces)
{
m_NamespaceList.RemoveElement(ns);
delete ns;
if (reallyDelete)
delete ns;
}
}
else if (deleteServerAdvertisedNamespaces)
{
m_NamespaceList.RemoveElement(ns);
delete ns;
if (reallyDelete)
delete ns;
}
}
}

View File

@ -56,7 +56,7 @@ public:
static nsIMAPNamespaceList *CreatensIMAPNamespaceList();
void ClearNamespaces(PRBool deleteFromPrefsNamespaces, PRBool deleteServerAdvertisedNamespaces);
void ClearNamespaces(PRBool deleteFromPrefsNamespaces, PRBool deleteServerAdvertisedNamespaces, PRBool reallyDelete);
int GetNumberOfNamespaces();
int GetNumberOfNamespaces(EIMAPNamespaceType);
nsIMAPNamespace *GetNamespaceNumber(int nodeIndex);

View File

@ -139,6 +139,7 @@ public:
void ShowProgress() {}
void ProgressEventFunctionUsingId(PRUint32 aMsgId) {}
void ProgressEventFunctionUsingIdWithString(PRUint32 aMsgId, const char * aExtraInfo) {}
void PercentProgressUpdateEvent(char *message, PRInt32 percent);
// utility function calls made by the server
char * CreateUtf7ConvertedString(const char * aSourceString, PRBool aConvertToUtf7Imap) { return nsnull;}

View File

@ -17,6 +17,7 @@
*/
#include "msgCore.h" // for pre-compiled headers
#include "net.h" /* should be defined into msgCore.h? - need MESSAGE_RFC822 */
#include "nsImapCore.h"
#include "nsImapProtocol.h"
@ -42,7 +43,6 @@ nsImapServerResponseParser::nsImapServerResponseParser(nsImapProtocol &imapProto
fSelectedMailboxName(nil),
fFlagState(nil),
fCurrentLineContainedFlagInfo(PR_FALSE),
fZeroLengthMessageUidString(nil),
fReportingErrors(PR_TRUE),
fLastChunk(PR_FALSE),
fServerIsNetscape3xServer(PR_FALSE),
@ -66,7 +66,6 @@ nsImapServerResponseParser::~nsImapServerResponseParser()
PR_FREEIF( fCurrentCommandTag );
//delete fFlagState; // not our object
delete fSearchResults;
PR_FREEIF( fZeroLengthMessageUidString );
PR_FREEIF( fMailAccountUrl );
PR_FREEIF( fFolderAdminUrl );
PR_FREEIF( fNetscapeServerVersionString );
@ -243,7 +242,7 @@ void nsImapServerResponseParser::HandleMemoryFailure()
#ifdef DEBUG_chrisf
XP_ASSERT(PR_FALSE);
#endif
fServerConnection.AlertUserEvent(XP_GetString(kImapOutOfMemory));
fServerConnection.AlertUserEventUsingId(kImapOutOfMemory);
nsIMAPGenericParser::HandleMemoryFailure();
}
@ -368,15 +367,14 @@ void nsImapServerResponseParser::ProcessOkCommand(const char *commandToken)
}
else if (!PL_strcasecmp(commandToken, "FETCH"))
{
if (fZeroLengthMessageUidString)
if (fZeroLengthMessageUidString.Length())
{
// "Deleting zero length message");
fServerConnection.Store(fZeroLengthMessageUidString, "+Flags (\\Deleted)", PR_TRUE);
fServerConnection.Store(fZeroLengthMessageUidString.GetBuffer(), "+Flags (\\Deleted)", PR_TRUE);
if (LastCommandSuccessful())
fServerConnection.Expunge();
PR_FREEIF( fZeroLengthMessageUidString );
fZeroLengthMessageUidString = nil;
fZeroLengthMessageUidString.Truncate();
}
}
if (GetFillingInShell())
@ -386,9 +384,12 @@ void nsImapServerResponseParser::ProcessOkCommand(const char *commandToken)
if (!m_shell->IsBeingGenerated())
{
nsImapProtocol *navCon = &fServerConnection;
NS_ASSERTION(navCon, "no connection for imap parser"); // we should always have this
m_shell->Generate(navCon ? navCon->GetCurrentUrl()->GetImapPartToFetch() : (char *)nsnull);
char *imapPart = nsnull;
fServerConnection.GetCurrentUrl()->GetImapPartToFetch(&imapPart);
m_shell->Generate(imapPart);
PR_FREEIF(imapPart);
if ((navCon && navCon->GetPseudoInterrupted())
|| fServerConnection.DeathSignalReceived())
@ -408,7 +409,7 @@ void nsImapServerResponseParser::ProcessOkCommand(const char *commandToken)
if (!m_shell->IsShellCached()) // cache is responsible for destroying it
{
PR_LOG(IMAP, PR_LOG_ALWAYS, ("BODYSHELL: Adding shell to cache."));
GetHostSessionList()->AddShellToCacheForHost(fServerConnection.GetHostName(), m_shell);
GetHostSessionList()->AddShellToCacheForHost(fServerConnection.GetHostName(), nsnull /* userName */, m_shell);
}
}
else
@ -798,10 +799,11 @@ void nsImapServerResponseParser::mailbox(mailbox_spec *boxSpec)
if (boxname)
{
// should the namespace check go before or after the Utf7 conversion?
GetHostSessionList()->SetNamespaceHierarchyDelimiterFromMailboxForHost(fServerConnection.GetHostName(), boxname, boxSpec->hierarchySeparator);
GetHostSessionList()->SetNamespaceHierarchyDelimiterFromMailboxForHost(fServerConnection.GetHostName(), nsnull /* userName */, boxname, boxSpec->hierarchySeparator);
nsIMAPNamespace *ns = GetHostSessionList()->GetNamespaceForMailboxForHost(fServerConnection.GetHostName(),boxname);
nsIMAPNamespace *ns = nsnull;
GetHostSessionList()->GetNamespaceForMailboxForHost(fServerConnection.GetHostName(), nsnull /* userName */,boxname, ns);
if (ns)
{
switch (ns->GetType())
@ -837,7 +839,7 @@ void nsImapServerResponseParser::mailbox(mailbox_spec *boxSpec)
NS_ASSERTION(boxSpec->connection->GetCurrentUrl(), "box spec has connection with null url");
//boxSpec->hostName = nsnull;
//if (boxSpec->connection && boxSpec->connection->GetCurrentUrl())
boxSpec->allocatedPathName = boxSpec->connection->GetCurrentUrl()->AllocateCanonicalPath(boxname, boxSpec->hierarchySeparator);
boxSpec->connection->GetCurrentUrl()->AllocateCannonicalPath(boxname, boxSpec->hierarchySeparator, &boxSpec->allocatedPathName);
boxSpec->connection->GetCurrentUrl()->GetHost(&boxSpec->hostName);
PR_FREEIF( boxname);
// storage for the boxSpec is now owned by server connection
@ -1069,12 +1071,12 @@ void nsImapServerResponseParser::msg_fetch()
char uidString[100];
sprintf(uidString, "%ld", (long)CurrentResponseUID());
if (!fZeroLengthMessageUidString)
fZeroLengthMessageUidString = PL_strdup(uidString);
if (!fZeroLengthMessageUidString.Length())
fZeroLengthMessageUidString = uidString;
else
{
StrAllocCat(fZeroLengthMessageUidString, ",");
StrAllocCat(fZeroLengthMessageUidString, uidString);
fZeroLengthMessageUidString += ",";
fZeroLengthMessageUidString += uidString;
}
}
@ -1629,7 +1631,7 @@ void nsImapServerResponseParser::capability_data()
!at_end_of_line() &&
ContinueParse());
GetHostSessionList()->SetCapabilityForHost(fServerConnection.GetHostName(), fCapabilityFlag);
GetHostSessionList()->SetCapabilityForHost(fServerConnection.GetHostName(), nsnull /* userName */, fCapabilityFlag);
nsImapProtocol *navCon = &fServerConnection;
NS_ASSERTION(navCon, "null imap protocol connection while parsing capability response"); // we should always have this
if (navCon)
@ -1747,7 +1749,7 @@ void nsImapServerResponseParser::namespace_data()
nsIMAPNamespace *newNamespace = new nsIMAPNamespace(namespaceType, namespacePrefix, namespaceDelimiter, PR_FALSE);
// add it to a temporary list in the host
if (newNamespace)
GetHostSessionList()->AddNewUncommittedNamespaceForHost(fServerConnection.GetHostName(), newNamespace);
GetHostSessionList()->AddNewNamespaceForHost(fServerConnection.GetHostName(), nsnull /* userName */, newNamespace);
skip_to_close_paren(); // Ignore any extension data
@ -1791,7 +1793,10 @@ void nsImapServerResponseParser::namespace_data()
skip_to_CRLF();
if (!namespacesCommitted)
GetHostSessionList()->FlushUncommittedNamespacesForHost(fServerConnection.GetHostName());
{
PRBool success;
GetHostSessionList()->FlushUncommittedNamespacesForHost(fServerConnection.GetHostName(), nsnull /* userName */, success);
}
}
@ -2011,7 +2016,7 @@ void nsImapServerResponseParser::UseCachedShell(nsIMAPBodyShell *cachedShell)
void nsImapServerResponseParser::ResetCapabilityFlag()
{
nsGetHostSessionList()->SetCapabilityForHost(fServerConnection.GetHostName(), kCapabilityUndefined);
GetHostSessionList()->SetCapabilityForHost(fServerConnection.GetHostName(), nsnull /* userName */, kCapabilityUndefined);
}
/*
@ -2051,8 +2056,7 @@ PRBool nsImapServerResponseParser::msg_fetch_literal(PRBool chunk, PRInt32 origi
{
if (lastCRLFwasCRCRLF && (*fCurrentLine == CR))
{
char *usableCurrentLine = 0;
StrAllocCopy(usableCurrentLine, fCurrentLine + 1);
char *usableCurrentLine = PL_strdup(fCurrentLine + 1);
PR_FREEIF(fCurrentLine);
if (usableCurrentLine)
fCurrentLine = usableCurrentLine;
@ -2166,14 +2170,22 @@ PRBool nsImapServerResponseParser::IsNumericString(const char *string)
struct mailbox_spec *nsImapServerResponseParser::CreateCurrentMailboxSpec(const char *mailboxName /* = nsnull */)
{
mailbox_spec *returnSpec = (mailbox_spec *) XP_CALLOC(1, sizeof(mailbox_spec) );
mailbox_spec *returnSpec = (mailbox_spec *) PR_Calloc(1, sizeof(mailbox_spec) );
if (returnSpec)
{
char *convertedMailboxName = nsnull;
const char *mailboxNameToConvert = (mailboxName) ? mailboxName : fSelectedMailboxName;
if (mailboxNameToConvert)
{
nsIMAPNamespace *ns = GetHostSessionList()->GetNamespaceForMailboxForHost(fServerConnection.GetCurrentUrl()->GetUrlHost(), mailboxNameToConvert); // for delimiter
const char *host = nsnull;
fServerConnection.GetCurrentUrl()->GetHost(&host);
nsIMAPNamespace *ns = nsnull;
if (host != nsnull)
{
GetHostSessionList()->GetNamespaceForMailboxForHost(host, nsnull /* userName */, mailboxNameToConvert, ns); // for delimiter
}
if (ns)
returnSpec->hierarchySeparator = ns->GetDelimiter();
else
@ -2182,7 +2194,7 @@ struct mailbox_spec *nsImapServerResponseParser::CreateCurrentMailboxSpec(const
char *convertedName = fServerConnection.CreateUtf7ConvertedString(mailboxNameToConvert, PR_FALSE);
if (convertedName)
{
convertedMailboxName = fServerConnection.GetCurrentUrl()->AllocateCanonicalPath(convertedName, returnSpec->hierarchySeparator);
fServerConnection.GetCurrentUrl()->AllocateCannonicalPath(convertedName, returnSpec->hierarchySeparator, &convertedMailboxName);
PR_Free(convertedName);
}
}
@ -2196,7 +2208,7 @@ struct mailbox_spec *nsImapServerResponseParser::CreateCurrentMailboxSpec(const
returnSpec->box_flags = kNoFlags; // stub
returnSpec->onlineVerified = PR_FALSE; // we're fabricating this. The flags aren't verified.
returnSpec->allocatedPathName = convertedMailboxName;
returnSpec->connection = fServerConnection;
returnSpec->connection = &fServerConnection;
if (returnSpec->connection)
returnSpec->connection->GetCurrentUrl()->GetHost(&returnSpec->hostName);
else

View File

@ -22,12 +22,14 @@
#include "nsImapCore.h"
#include "nsIMAPHostSessionList.h"
#include "nsImapSearchResults.h"
#include "nsString2.h"
class nsIMAPNamespace;
class nsIMAPNamespaceList;
class nsIMAPBodyShell;
class nsImapSearchResultIterator;
class nsImapFlagAndUidState;
class nsString2;
#include "nsIMAPGenericParser.h"
@ -199,7 +201,7 @@ private:
char *fCurrentCommandTag;
char *fZeroLengthMessageUidString;
nsString2 fZeroLengthMessageUidString;
char *fSelectedMailboxName;

View File

@ -671,6 +671,70 @@ NS_IMETHODIMP nsImapUrl::GetImapPartToFetch(const char **result) const
}
NS_IMETHODIMP nsImapUrl::AllocateCannonicalPath(const char *serverPath, char onlineDelimiter, char **allocatedPath ) const
{
NS_LOCK_INSTANCE();
#if 0 // here's the old code.
char delimiterToUse = onlineDelimiter;
if (onlineDelimiter == kOnlineHierarchySeparatorUnknown ||
onlineDelimiter == 0)
delimiterToUse = GetOnlineSubDirSeparator();
XP_ASSERT(serverPath);
if (!serverPath)
return NULL;
// First we have to check to see if we should strip off an online server subdirectory
// If this host has an online server directory configured
char *currentPath = (char *) serverPath;
char *onlineDir = TIMAPHostInfo::GetOnlineDirForHost(GetUrlHost());
if (currentPath && onlineDir)
{
#ifdef DEBUG
// This invariant should be maintained by libmsg when reading/writing the prefs.
// We are only supporting online directories whose online delimiter is /
// Therefore, the online directory must end in a slash.
XP_ASSERT(onlineDir[XP_STRLEN(onlineDir) - 1] == '/');
#endif
// By definition, the online dir must be at the root.
int len = XP_STRLEN(onlineDir);
if (!XP_STRNCMP(onlineDir, currentPath, len))
{
// This online path begins with the server sub directory
currentPath += len;
// This might occur, but it's most likely something not good.
// Basically, it means we're doing something on the online sub directory itself.
XP_ASSERT(*currentPath);
// Also make sure that the first character in the mailbox name is not '/'.
XP_ASSERT(*currentPath != '/');
}
}
if (!currentPath)
return NULL;
// Now, start the conversion to canonical form.
char *canonicalPath = ReplaceCharsInCopiedString(currentPath, delimiterToUse , '/');
// eat any escape characters for escaped dir separators
if (canonicalPath)
{
char *currentEscapeSequence = XP_STRSTR(canonicalPath, "\\/");
while (currentEscapeSequence)
{
XP_STRCPY(currentEscapeSequence, currentEscapeSequence+1);
currentEscapeSequence = XP_STRSTR(currentEscapeSequence+1, "\\/");
}
}
return canonicalPath;
#endif // 0
NS_UNLOCK_INSTANCE();
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////////
// End of functions which should be made obsolete after modifying nsIURL
////////////////////////////////////////////////////////////////////////////////////

View File

@ -83,6 +83,7 @@ public:
NS_IMETHOD ToString(PRUnichar* *aString) const;
NS_IMETHOD GetImapPartToFetch(const char **result) const;
NS_IMETHOD AllocateCannonicalPath(const char *serverPath, char onlineDelimiter, char **allocatedPath ) const;
// nsImapUrl
nsImapUrl();
virtual ~nsImapUrl();