зеркало из https://github.com/mozilla/gecko-dev.git
(not part of the build yet) more porting from 4.5 to 5.0; filling in more stub'd methods in nsImapProtocol; added missing host info methods
This commit is contained in:
Родитель
22acd0af11
Коммит
6d1b103319
|
@ -40,6 +40,7 @@ nsIMAPHostInfo::nsIMAPHostInfo(const char *hostName, const char *userName)
|
|||
{
|
||||
fHostName = nsCRT::strdup(hostName);
|
||||
fUserName = nsCRT::strdup(userName);
|
||||
fOnlineDir = NULL;
|
||||
fNextHost = NULL;
|
||||
fCachedPassword = NULL;
|
||||
fCapabilityFlags = kCapabilityUndefined;
|
||||
|
@ -52,6 +53,8 @@ nsIMAPHostInfo::nsIMAPHostInfo(const char *hostName, const char *userName)
|
|||
fShouldAlwaysListInbox = TRUE;
|
||||
fShellCache = nsIMAPBodyShellCache::Create();
|
||||
fPasswordVerifiedOnline = FALSE;
|
||||
fDeleteIsMoveToTrash = FALSE;
|
||||
fGotNamespaces = FALSE;
|
||||
}
|
||||
|
||||
nsIMAPHostInfo::~nsIMAPHostInfo()
|
||||
|
@ -60,6 +63,7 @@ nsIMAPHostInfo::~nsIMAPHostInfo()
|
|||
PR_FREEIF(fUserName);
|
||||
PR_FREEIF(fCachedPassword);
|
||||
PR_FREEIF(fHierarchyDelimiters);
|
||||
PR_FREEIF(fOnlineDir);
|
||||
delete fNamespaceList;
|
||||
delete fShellCache;
|
||||
}
|
||||
|
@ -222,6 +226,78 @@ NS_IMETHODIMP nsIMAPHostSessionList::GetPasswordVerifiedOnline(const char *hostN
|
|||
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIMAPHostSessionList::GetOnlineDirForHost(const char *hostName,
|
||||
const char *userName,
|
||||
nsString &result)
|
||||
{
|
||||
PR_EnterMonitor(gCachedHostInfoMonitor);
|
||||
nsIMAPHostInfo *host = FindHost(hostName, userName);
|
||||
if (host)
|
||||
result = host->fOnlineDir;
|
||||
PR_ExitMonitor(gCachedHostInfoMonitor);
|
||||
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIMAPHostSessionList::SetOnlineDirForHost(const char *hostName,
|
||||
const char *userName,
|
||||
const char *onlineDir)
|
||||
{
|
||||
PR_EnterMonitor(gCachedHostInfoMonitor);
|
||||
nsIMAPHostInfo *host = FindHost(hostName, userName);
|
||||
if (host)
|
||||
{
|
||||
PR_FREEIF(host->fOnlineDir);
|
||||
if (onlineDir)
|
||||
host->fOnlineDir = nsCRT::strdup(onlineDir);
|
||||
}
|
||||
PR_ExitMonitor(gCachedHostInfoMonitor);
|
||||
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIMAPHostSessionList::GetDeleteIsMoveToTrashForHost(
|
||||
const char *hostName, const char *userName, PRBool &result)
|
||||
{
|
||||
PR_EnterMonitor(gCachedHostInfoMonitor);
|
||||
nsIMAPHostInfo *host = FindHost(hostName, userName);
|
||||
if (host)
|
||||
result = host->fDeleteIsMoveToTrash;
|
||||
PR_ExitMonitor(gCachedHostInfoMonitor);
|
||||
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIMAPHostSessionList::SetDeleteIsMoveToTrashForHost(
|
||||
const char *hostName, const char *userName, PRBool isMoveToTrash)
|
||||
{
|
||||
PR_EnterMonitor(gCachedHostInfoMonitor);
|
||||
nsIMAPHostInfo *host = FindHost(hostName, userName);
|
||||
if (host)
|
||||
host->fDeleteIsMoveToTrash = isMoveToTrash;
|
||||
PR_ExitMonitor(gCachedHostInfoMonitor);
|
||||
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIMAPHostSessionList::GetGotNamespacesForHost(
|
||||
const char *hostName, const char *userName, PRBool &result)
|
||||
{
|
||||
PR_EnterMonitor(gCachedHostInfoMonitor);
|
||||
nsIMAPHostInfo *host = FindHost(hostName, userName);
|
||||
if (host)
|
||||
result = host->fGotNamespaces;
|
||||
PR_ExitMonitor(gCachedHostInfoMonitor);
|
||||
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIMAPHostSessionList::SetGotNamespacesForHost(
|
||||
const char *hostName, const char *userName, PRBool gotNamespaces)
|
||||
{
|
||||
PR_EnterMonitor(gCachedHostInfoMonitor);
|
||||
nsIMAPHostInfo *host = FindHost(hostName, userName);
|
||||
if (host)
|
||||
host->fGotNamespaces = gotNamespaces;
|
||||
PR_ExitMonitor(gCachedHostInfoMonitor);
|
||||
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIMAPHostSessionList::GetHierarchyDelimiterStringForHost(const char *hostName, const char *userName, nsString &result)
|
||||
{
|
||||
PR_EnterMonitor(gCachedHostInfoMonitor);
|
||||
|
|
|
@ -36,6 +36,7 @@ protected:
|
|||
char *fHostName;
|
||||
char *fUserName;
|
||||
char *fCachedPassword;
|
||||
char *fOnlineDir;
|
||||
nsIMAPHostInfo *fNextHost;
|
||||
PRUint32 fCapabilityFlags;
|
||||
char *fHierarchyDelimiters; // string of top-level hierarchy delimiters
|
||||
|
@ -48,6 +49,8 @@ protected:
|
|||
PRBool fShouldAlwaysListInbox;
|
||||
PRBool fHaveAdminURL;
|
||||
PRBool fPasswordVerifiedOnline;
|
||||
PRBool fDeleteIsMoveToTrash;
|
||||
PRBool fGotNamespaces;
|
||||
nsIMAPBodyShellCache *fShellCache;
|
||||
};
|
||||
|
||||
|
@ -79,6 +82,23 @@ public:
|
|||
NS_IMETHOD GetPasswordVerifiedOnline(const char *hostName, const char *userName, PRBool &result);
|
||||
NS_IMETHOD SetPasswordVerifiedOnline(const char *hostName, const char *userName);
|
||||
|
||||
// OnlineDir
|
||||
NS_IMETHOD GetOnlineDirForHost(const char *hostName, const char *userName,
|
||||
nsString &result);
|
||||
NS_IMETHOD SetOnlineDirForHost(const char *hostName, const char *userName,
|
||||
const char *onlineDir);
|
||||
|
||||
// Delete is move to trash folder
|
||||
NS_IMETHOD GetDeleteIsMoveToTrashForHost(const char *hostName, const char
|
||||
*userName, PRBool &result);
|
||||
NS_IMETHOD SetDeleteIsMoveToTrashForHost(const char *hostName, const char
|
||||
*userName, PRBool isMoveToTrash);
|
||||
|
||||
// Get namespaces
|
||||
NS_IMETHOD GetGotNamespacesForHost(const char *hostName, const char
|
||||
*userName, PRBool &result);
|
||||
NS_IMETHOD SetGotNamespacesForHost(const char *hostName, const char
|
||||
*userName, PRBool gotNamespaces);
|
||||
// Folders
|
||||
NS_IMETHOD SetHaveWeEverDiscoveredFoldersForHost(const char *hostName, const char *userName, PRBool discovered);
|
||||
NS_IMETHOD GetHaveWeEverDiscoveredFoldersForHost(const char *hostName, const char *userName, PRBool &result);
|
||||
|
|
|
@ -266,7 +266,7 @@ typedef struct _MessageSizeInfo
|
|||
|
||||
// This class is only used for passing data
|
||||
// between the IMAP and mozilla threadns
|
||||
class TIMAPACLRightsInfo
|
||||
class nsIMAPACLRightsInfo
|
||||
{
|
||||
public:
|
||||
char *hostName, *mailboxName, *userName, *rights;
|
||||
|
|
|
@ -193,7 +193,8 @@ nsImapProtocol::nsImapProtocol() :
|
|||
m_fetchByChunks = PR_FALSE;
|
||||
m_chunkSize = 0;
|
||||
m_chunkThreshold = 0;
|
||||
m_fromHeaderSeen = FALSE;
|
||||
m_fromHeaderSeen = PR_FALSE;
|
||||
m_closeNeededBeforeSelect = PR_FALSE;
|
||||
|
||||
// where should we do this? Perhaps in the factory object?
|
||||
if (!IMAP)
|
||||
|
@ -202,12 +203,15 @@ nsImapProtocol::nsImapProtocol() :
|
|||
|
||||
nsresult nsImapProtocol::Initialize(nsIImapHostSessionList * aHostSessionList, PLEventQueue * aSinkEventQueue)
|
||||
{
|
||||
NS_PRECONDITION(aSinkEventQueue,
|
||||
NS_PRECONDITION(aSinkEventQueue && aHostSessionList,
|
||||
"oops...trying to initalize with a null sink event queue!");
|
||||
if (!aSinkEventQueue)
|
||||
if (!aSinkEventQueue || !aHostSessionList)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
m_sinkEventQueue = aSinkEventQueue;
|
||||
m_hostSessionList = aHostSessionList;
|
||||
m_parser.SetHostSessionList(aHostSessionList);
|
||||
NS_ADDREF (m_hostSessionList);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1772,22 +1776,128 @@ PRBool nsImapProtocol::GetIOTunnellingEnabled()
|
|||
// if userName is NULL, it means "me," or MYRIGHTS.
|
||||
void nsImapProtocol::AddFolderRightsForUser(const char *mailboxName, const char *userName, const char *rights)
|
||||
{
|
||||
nsIMAPACLRightsInfo *aclRightsInfo = new nsIMAPACLRightsInfo();
|
||||
if (aclRightsInfo)
|
||||
{
|
||||
nsIMAPNamespace *namespaceForFolder = nsnull;
|
||||
NS_ASSERTION (m_hostSessionList, "fatal ... null host session list");
|
||||
if (m_hostSessionList)
|
||||
m_hostSessionList->GetNamespaceForMailboxForHost(
|
||||
GetImapHostName(), GetImapUserName(), mailboxName,
|
||||
namespaceForFolder);
|
||||
NS_ASSERTION (namespaceForFolder,
|
||||
"Oops ... null namespace for folder");
|
||||
aclRightsInfo->hostName = PL_strdup(GetImapHostName());
|
||||
|
||||
char *nonUTF7ConvertedName = CreateUtf7ConvertedString(mailboxName, FALSE);
|
||||
if (nonUTF7ConvertedName)
|
||||
mailboxName = nonUTF7ConvertedName;
|
||||
|
||||
if (namespaceForFolder)
|
||||
m_runningUrl->AllocateCanonicalPath(
|
||||
mailboxName,
|
||||
namespaceForFolder->GetDelimiter(),
|
||||
&aclRightsInfo->mailboxName);
|
||||
else
|
||||
m_runningUrl->AllocateCanonicalPath(mailboxName,
|
||||
kOnlineHierarchySeparatorUnknown,
|
||||
&aclRightsInfo->mailboxName);
|
||||
|
||||
PR_FREEIF(nonUTF7ConvertedName);
|
||||
if (userName)
|
||||
aclRightsInfo->userName = PL_strdup(userName);
|
||||
else
|
||||
aclRightsInfo->userName = NULL;
|
||||
aclRightsInfo->rights = PL_strdup(rights);
|
||||
|
||||
|
||||
if (aclRightsInfo->hostName &&
|
||||
aclRightsInfo->mailboxName && aclRightsInfo->rights &&
|
||||
userName ? (aclRightsInfo->userName != NULL) : TRUE)
|
||||
{
|
||||
if (m_imapExtension)
|
||||
{
|
||||
m_imapExtension->AddFolderRights(this, aclRightsInfo);
|
||||
WaitForFEEventCompletion();
|
||||
}
|
||||
}
|
||||
PR_FREEIF(aclRightsInfo->hostName);
|
||||
PR_FREEIF(aclRightsInfo->mailboxName);
|
||||
PR_FREEIF(aclRightsInfo->rights);
|
||||
PR_FREEIF(aclRightsInfo->userName);
|
||||
|
||||
delete aclRightsInfo;
|
||||
}
|
||||
else
|
||||
HandleMemoryFailure();
|
||||
}
|
||||
|
||||
|
||||
void nsImapProtocol::CommitNamespacesForHostEvent()
|
||||
{
|
||||
if (m_imapMiscellaneous)
|
||||
{
|
||||
m_imapMiscellaneous->CommitNamespaces(this, GetImapHostName());
|
||||
WaitForFEEventCompletion();
|
||||
}
|
||||
}
|
||||
|
||||
// notifies libmsg that we have new capability data for the current host
|
||||
void nsImapProtocol::CommitCapabilityForHostEvent()
|
||||
{
|
||||
if (m_imapMiscellaneous)
|
||||
{
|
||||
m_imapMiscellaneous->CommitCapabilityForHost(this, GetImapHostName());
|
||||
WaitForFEEventCompletion();
|
||||
}
|
||||
}
|
||||
|
||||
// rights is a single string of rights, as specified by RFC2086, the IMAP ACL extension.
|
||||
// Clears all rights for a given folder, for all users.
|
||||
void nsImapProtocol::ClearAllFolderRights(const char *mailboxName)
|
||||
void nsImapProtocol::ClearAllFolderRights(const char *mailboxName,
|
||||
nsIMAPNamespace *nsForMailbox)
|
||||
{
|
||||
NS_ASSERTION (nsForMailbox, "Oops ... null name space");
|
||||
nsIMAPACLRightsInfo *aclRightsInfo = new nsIMAPACLRightsInfo();
|
||||
if (aclRightsInfo)
|
||||
{
|
||||
char *nonUTF7ConvertedName = CreateUtf7ConvertedString(mailboxName, FALSE);
|
||||
if (nonUTF7ConvertedName)
|
||||
mailboxName = nonUTF7ConvertedName;
|
||||
|
||||
const char *hostName = "";
|
||||
m_runningUrl->GetHost(&hostName);
|
||||
|
||||
aclRightsInfo->hostName = PL_strdup(hostName);
|
||||
if (nsForMailbox)
|
||||
m_runningUrl->AllocateCanonicalPath(mailboxName,
|
||||
nsForMailbox->GetDelimiter(),
|
||||
&aclRightsInfo->mailboxName);
|
||||
else
|
||||
m_runningUrl->AllocateCanonicalPath(
|
||||
mailboxName, kOnlineHierarchySeparatorUnknown,
|
||||
&aclRightsInfo->mailboxName);
|
||||
|
||||
PR_FREEIF(nonUTF7ConvertedName);
|
||||
|
||||
aclRightsInfo->rights = NULL;
|
||||
aclRightsInfo->userName = NULL;
|
||||
|
||||
if (aclRightsInfo->hostName && aclRightsInfo->mailboxName)
|
||||
{
|
||||
if (m_imapExtension)
|
||||
{
|
||||
m_imapExtension->ClearFolderRights(this, aclRightsInfo);
|
||||
WaitForFEEventCompletion();
|
||||
}
|
||||
}
|
||||
PR_FREEIF(aclRightsInfo->hostName);
|
||||
PR_FREEIF(aclRightsInfo->mailboxName);
|
||||
|
||||
delete aclRightsInfo;
|
||||
}
|
||||
else
|
||||
HandleMemoryFailure();
|
||||
}
|
||||
|
||||
char*
|
||||
|
@ -1925,19 +2035,68 @@ char*
|
|||
nsImapProtocol::CreateUtf7ConvertedString(const char * aSourceString, PRBool
|
||||
aConvertToUtf7Imap)
|
||||
{
|
||||
return nsnull;
|
||||
// ***** temporary **** Fix me ****
|
||||
if (aSourceString)
|
||||
return PL_strdup(aSourceString);
|
||||
else
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
// imap commands issued by the parser
|
||||
void
|
||||
nsImapProtocol::Store(nsString2 &aMessageList, const char * aMessageData,
|
||||
PRBool aIdsAreUid)
|
||||
nsImapProtocol::Store(nsString2 &messageList, const char * messageData,
|
||||
PRBool idsAreUid)
|
||||
{
|
||||
IncrementCommandTagNumber();
|
||||
|
||||
char *formatString;
|
||||
if (idsAreUid)
|
||||
formatString = "%s uid store %s %s\015\012";
|
||||
else
|
||||
formatString = "%s store %s %s\015\012";
|
||||
|
||||
// we might need to close this mailbox after this
|
||||
m_closeNeededBeforeSelect = GetDeleteIsMoveToTrash() && (PL_strcasestr(messageData, "\\Deleted"));
|
||||
|
||||
const char *commandTag = GetServerCommandTag();
|
||||
int protocolStringSize = PL_strlen(formatString) + PL_strlen(messageList.GetBuffer()) + PL_strlen(messageData) + PL_strlen(commandTag) + 1;
|
||||
char *protocolString = (char *) PR_CALLOC( protocolStringSize );
|
||||
|
||||
if (protocolString)
|
||||
{
|
||||
PR_snprintf(protocolString, // string to create
|
||||
protocolStringSize, // max size
|
||||
formatString, // format string
|
||||
commandTag, // command tag
|
||||
messageList,
|
||||
messageData);
|
||||
|
||||
int ioStatus = SendData(protocolString);
|
||||
|
||||
ParseIMAPandCheckForNewMail(protocolString); // ??? do we really need this
|
||||
PR_Free(protocolString);
|
||||
}
|
||||
else
|
||||
HandleMemoryFailure();
|
||||
}
|
||||
|
||||
void
|
||||
nsImapProtocol::Expunge()
|
||||
{
|
||||
ProgressEventFunctionUsingId (/***** fix me **** MK_IMAP_STATUS_EXPUNGING_MAILBOX */ -1);
|
||||
IncrementCommandTagNumber();
|
||||
|
||||
char *tmpBuffer =
|
||||
PR_smprintf("%s expunge" CRLF, // format string
|
||||
GetServerCommandTag()); // command tag
|
||||
|
||||
if (tmpBuffer)
|
||||
{
|
||||
PRInt32 ioStatus = SendData(tmpBuffer);
|
||||
PR_Free(tmpBuffer);
|
||||
}
|
||||
|
||||
ParseIMAPandCheckForNewMail(); // ??? do we really need to do this
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1949,3 +2108,15 @@ nsImapProtocol::HandleMemoryFailure()
|
|||
// SetConnectionStatus(-1);
|
||||
PR_CExitMonitor(this);
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsImapProtocol::GetDeleteIsMoveToTrash()
|
||||
{
|
||||
PRBool rv = PR_FALSE;
|
||||
NS_ASSERTION (m_hostSessionList, "fatal... null host session list");
|
||||
if (m_hostSessionList)
|
||||
m_hostSessionList->GetDeleteIsMoveToTrashForHost(GetImapHostName(),
|
||||
GetImapUserName(),
|
||||
rv);
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "nsImapServerResponseParser.h"
|
||||
#include "nsImapProxyEvent.h"
|
||||
#include "nsImapFlagAndUidState.h"
|
||||
#include "nsIMAPNamespace.h"
|
||||
|
||||
class nsIMAPMessagePartIDArray;
|
||||
class nsIMsgIncomingServer;
|
||||
|
@ -184,7 +185,7 @@ public:
|
|||
// rights is a single string of rights, as specified by RFC2086, the IMAP ACL extension.
|
||||
void AddFolderRightsForUser(const char *mailboxName, const char *userName, const char *rights);
|
||||
// Clears all rights for a given folder, for all users.
|
||||
void ClearAllFolderRights(const char *mailboxName);
|
||||
void ClearAllFolderRights(const char *mailboxName, nsIMAPNamespace *nsForMailbox);
|
||||
|
||||
void WaitForFEEventCompletion();
|
||||
void HandleMemoryFailure();
|
||||
|
@ -209,6 +210,7 @@ private:
|
|||
nsIStreamListener * m_outputConsumer; // this will be obtained from the transport interface
|
||||
|
||||
// ******* Thread support *******
|
||||
nsIImapHostSessionList *m_hostSessionList;
|
||||
PLEventQueue *m_sinkEventQueue;
|
||||
PLEventQueue *m_eventQueue;
|
||||
PRThread *m_thread;
|
||||
|
@ -227,6 +229,7 @@ private:
|
|||
nsISupports* m_consumer;
|
||||
PRInt32 m_connectionStatus;
|
||||
nsIMsgIncomingServer * m_server;
|
||||
|
||||
nsImapLogProxy *m_imapLog;
|
||||
nsImapMailfolderProxy *m_imapMailfolder;
|
||||
nsImapMessageProxy *m_imapMessage;
|
||||
|
@ -234,9 +237,8 @@ private:
|
|||
nsImapMiscellaneousProxy *m_imapMiscellaneous;
|
||||
// helper function to setup imap sink interface proxies
|
||||
void SetupSinkProxy();
|
||||
PRBool GetDeleteIsMoveToTrash();
|
||||
|
||||
nsIOutputStream *m_messageDownloadOutputStream;
|
||||
|
||||
PRMonitor *GetDataMemberMonitor();
|
||||
nsString2 m_currentCommand;
|
||||
nsImapServerResponseParser m_parser;
|
||||
|
@ -295,6 +297,8 @@ private:
|
|||
PRInt32 m_chunkThreshold;
|
||||
TLineDownloadCache m_downloadLineCache;
|
||||
PRBool m_fromHeaderSeen;
|
||||
|
||||
PRBool m_closeNeededBeforeSelect;
|
||||
};
|
||||
|
||||
#endif // nsImapProtocol_h___
|
||||
|
|
|
@ -859,7 +859,7 @@ nsImapExtensionProxy::SetMailAccountUrl(nsIImapProtocol* aProtocol,
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsImapExtensionProxy::ClearFolderRights(nsIImapProtocol* aProtocol,
|
||||
TIMAPACLRightsInfo* aclRights)
|
||||
nsIMAPACLRightsInfo* aclRights)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
NS_PRECONDITION (aclRights, "Oops... null aclRights");
|
||||
|
@ -886,7 +886,7 @@ nsImapExtensionProxy::ClearFolderRights(nsIImapProtocol* aProtocol,
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsImapExtensionProxy::AddFolderRights(nsIImapProtocol* aProtocol,
|
||||
TIMAPACLRightsInfo* aclRights)
|
||||
nsIMAPACLRightsInfo* aclRights)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
NS_PRECONDITION (aclRights, "Oops... null aclRights");
|
||||
|
@ -913,7 +913,7 @@ nsImapExtensionProxy::AddFolderRights(nsIImapProtocol* aProtocol,
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsImapExtensionProxy::RefreshFolderRights(nsIImapProtocol* aProtocol,
|
||||
TIMAPACLRightsInfo* aclRights)
|
||||
nsIMAPACLRightsInfo* aclRights)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
NS_PRECONDITION (aclRights, "Oops... null aclRights");
|
||||
|
@ -940,7 +940,7 @@ nsImapExtensionProxy::RefreshFolderRights(nsIImapProtocol* aProtocol,
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsImapExtensionProxy::FolderNeedsACLInitialized(nsIImapProtocol* aProtocol,
|
||||
TIMAPACLRightsInfo* aclRights)
|
||||
nsIMAPACLRightsInfo* aclRights)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
NS_PRECONDITION (aclRights, "Oops... null aclRights");
|
||||
|
@ -2285,7 +2285,7 @@ SetMailAccountUrlProxyEvent::HandleEvent()
|
|||
}
|
||||
|
||||
ClearFolderRightsProxyEvent::ClearFolderRightsProxyEvent(
|
||||
nsImapExtensionProxy* aProxy, TIMAPACLRightsInfo* aclRights) :
|
||||
nsImapExtensionProxy* aProxy, nsIMAPACLRightsInfo* aclRights) :
|
||||
nsImapExtensionProxyEvent(aProxy)
|
||||
{
|
||||
NS_ASSERTION (aclRights, "Oops... a null acl rights info");
|
||||
|
@ -2327,7 +2327,7 @@ ClearFolderRightsProxyEvent::HandleEvent()
|
|||
}
|
||||
|
||||
AddFolderRightsProxyEvent::AddFolderRightsProxyEvent(
|
||||
nsImapExtensionProxy* aProxy, TIMAPACLRightsInfo* aclRights) :
|
||||
nsImapExtensionProxy* aProxy, nsIMAPACLRightsInfo* aclRights) :
|
||||
nsImapExtensionProxyEvent(aProxy)
|
||||
{
|
||||
NS_ASSERTION (aclRights, "Oops... a null acl rights info");
|
||||
|
@ -2369,7 +2369,7 @@ AddFolderRightsProxyEvent::HandleEvent()
|
|||
}
|
||||
|
||||
RefreshFolderRightsProxyEvent::RefreshFolderRightsProxyEvent(
|
||||
nsImapExtensionProxy* aProxy, TIMAPACLRightsInfo* aclRights) :
|
||||
nsImapExtensionProxy* aProxy, nsIMAPACLRightsInfo* aclRights) :
|
||||
nsImapExtensionProxyEvent(aProxy)
|
||||
{
|
||||
NS_ASSERTION (aclRights, "Oops... a null acl rights info");
|
||||
|
@ -2411,7 +2411,7 @@ RefreshFolderRightsProxyEvent::HandleEvent()
|
|||
}
|
||||
|
||||
FolderNeedsACLInitializedProxyEvent::FolderNeedsACLInitializedProxyEvent(
|
||||
nsImapExtensionProxy* aProxy, TIMAPACLRightsInfo* aclRights) :
|
||||
nsImapExtensionProxy* aProxy, nsIMAPACLRightsInfo* aclRights) :
|
||||
nsImapExtensionProxyEvent(aProxy)
|
||||
{
|
||||
NS_ASSERTION (aclRights, "Oops... a null acl rights info");
|
||||
|
|
|
@ -159,13 +159,13 @@ public:
|
|||
NS_IMETHOD SetMailAccountUrl(nsIImapProtocol* aProtocol,
|
||||
const char* hostName);
|
||||
NS_IMETHOD ClearFolderRights(nsIImapProtocol* aProtocol,
|
||||
TIMAPACLRightsInfo* aclRights);
|
||||
nsIMAPACLRightsInfo* aclRights);
|
||||
NS_IMETHOD AddFolderRights(nsIImapProtocol* aProtocol,
|
||||
TIMAPACLRightsInfo* aclRights);
|
||||
nsIMAPACLRightsInfo* aclRights);
|
||||
NS_IMETHOD RefreshFolderRights(nsIImapProtocol* aProtocol,
|
||||
TIMAPACLRightsInfo* aclRights);
|
||||
nsIMAPACLRightsInfo* aclRights);
|
||||
NS_IMETHOD FolderNeedsACLInitialized(nsIImapProtocol* aProtocol,
|
||||
TIMAPACLRightsInfo* aclRights);
|
||||
nsIMAPACLRightsInfo* aclRights);
|
||||
NS_IMETHOD SetFolderAdminURL(nsIImapProtocol* aProtocol,
|
||||
FolderQueryInfo* aInfo);
|
||||
|
||||
|
@ -481,37 +481,37 @@ struct SetMailAccountUrlProxyEvent : nsImapExtensionProxyEvent
|
|||
struct ClearFolderRightsProxyEvent : nsImapExtensionProxyEvent
|
||||
{
|
||||
ClearFolderRightsProxyEvent(nsImapExtensionProxy* aProxy,
|
||||
TIMAPACLRightsInfo* aclRights);
|
||||
nsIMAPACLRightsInfo* aclRights);
|
||||
virtual ~ClearFolderRightsProxyEvent();
|
||||
NS_IMETHOD HandleEvent();
|
||||
TIMAPACLRightsInfo m_aclRightsInfo;
|
||||
nsIMAPACLRightsInfo m_aclRightsInfo;
|
||||
};
|
||||
|
||||
struct AddFolderRightsProxyEvent : nsImapExtensionProxyEvent
|
||||
{
|
||||
AddFolderRightsProxyEvent(nsImapExtensionProxy* aProxy,
|
||||
TIMAPACLRightsInfo* aclRights);
|
||||
nsIMAPACLRightsInfo* aclRights);
|
||||
virtual ~AddFolderRightsProxyEvent();
|
||||
NS_IMETHOD HandleEvent();
|
||||
TIMAPACLRightsInfo m_aclRightsInfo;
|
||||
nsIMAPACLRightsInfo m_aclRightsInfo;
|
||||
};
|
||||
|
||||
struct RefreshFolderRightsProxyEvent : nsImapExtensionProxyEvent
|
||||
{
|
||||
RefreshFolderRightsProxyEvent(nsImapExtensionProxy* aProxy,
|
||||
TIMAPACLRightsInfo* aclRights);
|
||||
nsIMAPACLRightsInfo* aclRights);
|
||||
virtual ~RefreshFolderRightsProxyEvent();
|
||||
NS_IMETHOD HandleEvent();
|
||||
TIMAPACLRightsInfo m_aclRightsInfo;
|
||||
nsIMAPACLRightsInfo m_aclRightsInfo;
|
||||
};
|
||||
|
||||
struct FolderNeedsACLInitializedProxyEvent : nsImapExtensionProxyEvent
|
||||
{
|
||||
FolderNeedsACLInitializedProxyEvent(nsImapExtensionProxy* aProxy,
|
||||
TIMAPACLRightsInfo* aclRights);
|
||||
nsIMAPACLRightsInfo* aclRights);
|
||||
virtual ~FolderNeedsACLInitializedProxyEvent();
|
||||
NS_IMETHOD HandleEvent();
|
||||
TIMAPACLRightsInfo m_aclRightsInfo;
|
||||
nsIMAPACLRightsInfo m_aclRightsInfo;
|
||||
};
|
||||
|
||||
struct SetFolderAdminURLProxyEvent : nsImapExtensionProxyEvent
|
||||
|
|
|
@ -29,14 +29,6 @@
|
|||
|
||||
extern PRLogModuleInfo* IMAP;
|
||||
|
||||
// **************?????***********????*************????***********************
|
||||
// ***** IMPORTANT **** jefft -- this is a temporary implementation for the
|
||||
// testing purpose. Eventually, we will have a host service object in
|
||||
// controlling the host session list.
|
||||
// Remove the following when the host service object is in place.
|
||||
// **************************************************************************
|
||||
extern nsIMAPHostSessionList*gImapHostSessionList;
|
||||
|
||||
nsImapServerResponseParser::nsImapServerResponseParser(nsImapProtocol &imapProtocolConnection) :
|
||||
nsIMAPGenericParser(),
|
||||
fServerConnection(imapProtocolConnection),
|
||||
|
@ -420,10 +412,10 @@ void nsImapServerResponseParser::ProcessOkCommand(const char *commandToken)
|
|||
else if (m_shell->GetIsValid())
|
||||
{
|
||||
// If we have a valid shell that has not already been cached, then cache it.
|
||||
if (!m_shell->IsShellCached()) // cache is responsible for destroying it
|
||||
if (!m_shell->IsShellCached() && fHostSessionList) // cache is responsible for destroying it
|
||||
{
|
||||
PR_LOG(IMAP, PR_LOG_ALWAYS, ("BODYSHELL: Adding shell to cache."));
|
||||
GetHostSessionList()->AddShellToCacheForHost(fServerConnection.GetImapHostName(), fServerConnection.GetImapUserName(), m_shell);
|
||||
fHostSessionList->AddShellToCacheForHost(fServerConnection.GetImapHostName(), fServerConnection.GetImapUserName(), m_shell);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -810,14 +802,14 @@ void nsImapServerResponseParser::mailbox(mailbox_spec *boxSpec)
|
|||
fNextToken = GetNextToken();
|
||||
}
|
||||
|
||||
if (boxname)
|
||||
if (boxname && fHostSessionList)
|
||||
{
|
||||
// should the namespace check go before or after the Utf7 conversion?
|
||||
GetHostSessionList()->SetNamespaceHierarchyDelimiterFromMailboxForHost(fServerConnection.GetImapHostName(), fServerConnection.GetImapUserName(), boxname, boxSpec->hierarchySeparator);
|
||||
fHostSessionList->SetNamespaceHierarchyDelimiterFromMailboxForHost(fServerConnection.GetImapHostName(), fServerConnection.GetImapUserName(), boxname, boxSpec->hierarchySeparator);
|
||||
|
||||
|
||||
nsIMAPNamespace *ns = nsnull;
|
||||
GetHostSessionList()->GetNamespaceForMailboxForHost(fServerConnection.GetImapHostName(), fServerConnection.GetImapUserName(),boxname, ns);
|
||||
fHostSessionList->GetNamespaceForMailboxForHost(fServerConnection.GetImapHostName(), fServerConnection.GetImapUserName(),boxname, ns);
|
||||
if (ns)
|
||||
{
|
||||
switch (ns->GetType())
|
||||
|
@ -1645,10 +1637,11 @@ void nsImapServerResponseParser::capability_data()
|
|||
!at_end_of_line() &&
|
||||
ContinueParse());
|
||||
|
||||
GetHostSessionList()->SetCapabilityForHost(
|
||||
fServerConnection.GetImapHostName(),
|
||||
fServerConnection.GetImapUserName(),
|
||||
fCapabilityFlag);
|
||||
if (fHostSessionList)
|
||||
fHostSessionList->SetCapabilityForHost(
|
||||
fServerConnection.GetImapHostName(),
|
||||
fServerConnection.GetImapUserName(),
|
||||
fCapabilityFlag);
|
||||
nsImapProtocol *navCon = &fServerConnection;
|
||||
NS_ASSERTION(navCon, "null imap protocol connection while parsing capability response"); // we should always have this
|
||||
if (navCon)
|
||||
|
@ -1765,8 +1758,8 @@ 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()->AddNewNamespaceForHost(fServerConnection.GetImapHostName(), fServerConnection.GetImapUserName(), newNamespace);
|
||||
if (newNamespace && fHostSessionList)
|
||||
fHostSessionList->AddNewNamespaceForHost(fServerConnection.GetImapHostName(), fServerConnection.GetImapUserName(), newNamespace);
|
||||
|
||||
skip_to_close_paren(); // Ignore any extension data
|
||||
|
||||
|
@ -1809,10 +1802,10 @@ void nsImapServerResponseParser::namespace_data()
|
|||
}
|
||||
skip_to_CRLF();
|
||||
|
||||
if (!namespacesCommitted)
|
||||
if (!namespacesCommitted && fHostSessionList)
|
||||
{
|
||||
PRBool success;
|
||||
GetHostSessionList()->FlushUncommittedNamespacesForHost(fServerConnection.GetImapHostName(), fServerConnection.GetImapUserName(), success);
|
||||
fHostSessionList->FlushUncommittedNamespacesForHost(fServerConnection.GetImapHostName(), fServerConnection.GetImapUserName(), success);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2033,7 +2026,10 @@ void nsImapServerResponseParser::UseCachedShell(nsIMAPBodyShell *cachedShell)
|
|||
|
||||
void nsImapServerResponseParser::ResetCapabilityFlag()
|
||||
{
|
||||
GetHostSessionList()->SetCapabilityForHost(fServerConnection.GetImapHostName(), fServerConnection.GetImapUserName(), kCapabilityUndefined);
|
||||
if (fHostSessionList)
|
||||
fHostSessionList->SetCapabilityForHost(
|
||||
fServerConnection.GetImapHostName(),
|
||||
fServerConnection.GetImapUserName(), kCapabilityUndefined);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2197,9 +2193,9 @@ struct mailbox_spec *nsImapServerResponseParser::CreateCurrentMailboxSpec(const
|
|||
const char *host =
|
||||
fServerConnection.GetImapHostName();
|
||||
nsIMAPNamespace *ns = nsnull;
|
||||
if (host != nsnull)
|
||||
if (host != nsnull && fHostSessionList)
|
||||
{
|
||||
GetHostSessionList()->GetNamespaceForMailboxForHost(host, fServerConnection.GetImapUserName(), mailboxNameToConvert, ns); // for delimiter
|
||||
fHostSessionList->GetNamespaceForMailboxForHost(host, fServerConnection.GetImapUserName(), mailboxNameToConvert, ns); // for delimiter
|
||||
}
|
||||
|
||||
if (ns)
|
||||
|
@ -2259,20 +2255,18 @@ void nsImapServerResponseParser::ClearLastFetchChunkReceived()
|
|||
fLastChunk = PR_FALSE;
|
||||
}
|
||||
|
||||
nsIMAPHostSessionList*
|
||||
void nsImapServerResponseParser::SetHostSessionList(nsIImapHostSessionList*
|
||||
aHostSessionList)
|
||||
{
|
||||
NS_IF_RELEASE (fHostSessionList);
|
||||
fHostSessionList = aHostSessionList;
|
||||
NS_IF_ADDREF (fHostSessionList);
|
||||
}
|
||||
|
||||
nsIImapHostSessionList*
|
||||
nsImapServerResponseParser::GetHostSessionList()
|
||||
{
|
||||
if (!fHostSessionList)
|
||||
{
|
||||
if (!gImapHostSessionList)
|
||||
{
|
||||
gImapHostSessionList = new nsIMAPHostSessionList();
|
||||
// It's a global. Addref to it to make sure it won't get deleted
|
||||
NS_IF_ADDREF (gImapHostSessionList);
|
||||
}
|
||||
fHostSessionList = gImapHostSessionList;
|
||||
NS_IF_ADDREF (fHostSessionList);
|
||||
}
|
||||
NS_IF_ADDREF(fHostSessionList);
|
||||
return fHostSessionList;
|
||||
}
|
||||
|
||||
|
|
|
@ -127,6 +127,8 @@ public:
|
|||
|
||||
PRBool GetFillingInShell();
|
||||
void UseCachedShell(nsIMAPBodyShell *cachedShell);
|
||||
void SetHostSessionList(nsIImapHostSessionList *aHostSession);
|
||||
nsIImapHostSessionList *GetHostSessionList();
|
||||
|
||||
protected:
|
||||
virtual void flags();
|
||||
|
@ -172,7 +174,6 @@ protected:
|
|||
virtual PRBool GetNextLineForParser(char **nextLine);
|
||||
virtual void end_of_line();
|
||||
|
||||
nsIMAPHostSessionList *GetHostSessionList();
|
||||
private:
|
||||
PRBool fProcessingTaggedResponse;
|
||||
PRBool fCurrentCommandFailed;
|
||||
|
@ -241,7 +242,7 @@ private:
|
|||
// The connection object
|
||||
nsImapProtocol &fServerConnection;
|
||||
|
||||
nsIMAPHostSessionList *fHostSessionList;
|
||||
nsIImapHostSessionList *fHostSessionList;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -863,9 +863,10 @@ NS_IMETHODIMP nsImapUrl::GetImapPartToFetch(char **result) const
|
|||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapUrl::AllocateCannonicalPath(const char *serverPath, char onlineDelimiter, char **allocatedPath ) const
|
||||
NS_IMETHODIMP nsImapUrl::AllocateCanonicalPath(const char *serverPath, char onlineDelimiter, char **allocatedPath ) const
|
||||
{
|
||||
NS_LOCK_INSTANCE();
|
||||
*allocatedPath = nsnull;
|
||||
#if 0 // here's the old code.
|
||||
char delimiterToUse = onlineDelimiter;
|
||||
if (onlineDelimiter == kOnlineHierarchySeparatorUnknown ||
|
||||
|
@ -924,7 +925,7 @@ NS_IMETHODIMP nsImapUrl::AllocateCannonicalPath(const char *serverPath, char onl
|
|||
return canonicalPath;
|
||||
#endif // 0
|
||||
NS_UNLOCK_INSTANCE();
|
||||
return NS_OK;
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -105,7 +105,7 @@ public:
|
|||
NS_IMETHOD ToString(PRUnichar* *aString) const;
|
||||
|
||||
NS_IMETHOD GetImapPartToFetch(char **result) const;
|
||||
NS_IMETHOD AllocateCannonicalPath(const char *serverPath, char onlineDelimiter, char **allocatedPath ) const;
|
||||
NS_IMETHOD AllocateCanonicalPath(const char *serverPath, char onlineDelimiter, char **allocatedPath ) const;
|
||||
|
||||
NS_IMETHOD CreateListOfMessageIdsString(char **result) const;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче