зеркало из https://github.com/mozilla/gecko-dev.git
Use our new scriptable version of nsIImapUrl.idl and make the .h version obsolete.
r=bienvenu
This commit is contained in:
Родитель
012f6835c8
Коммит
4335aa3455
|
@ -23,28 +23,28 @@ DEPTH=..\..\..
|
|||
MODULE= msgimap
|
||||
|
||||
XPIDLSRCS = \
|
||||
.\nsIImapServerSink.idl \
|
||||
.\nsIImapMessageSink.idl \
|
||||
.\nsIImapUrl.idl \
|
||||
.\nsIImapServerSink.idl \
|
||||
.\nsIImapMessageSink.idl \
|
||||
.\nsIImapIncomingServer.idl \
|
||||
.\nsIImapFlagAndUidState.idl \
|
||||
.\nsIImapMockChannel.idl \
|
||||
.\nsIImapProtocol.idl \
|
||||
.\nsIMailboxSpec.idl \
|
||||
.\nsIImapMailFolderSink.idl \
|
||||
.\nsIMsgImapMailFolder.idl \
|
||||
.\nsIImapMockChannel.idl \
|
||||
.\nsIImapProtocol.idl \
|
||||
.\nsIMailboxSpec.idl \
|
||||
.\nsIImapMailFolderSink.idl \
|
||||
.\nsIMsgImapMailFolder.idl \
|
||||
.\nsIMsgLogonRedirector.idl \
|
||||
$(NULL)
|
||||
|
||||
################################################################################
|
||||
## exports
|
||||
|
||||
EXPORTS = \
|
||||
nsIImapUrl.h \
|
||||
nsIImapLog.h \
|
||||
nsIIMAPHostSessionList.h \
|
||||
nsIImapExtensionSink.h \
|
||||
EXPORTS = \
|
||||
nsIImapLog.h \
|
||||
nsIIMAPHostSessionList.h \
|
||||
nsIImapExtensionSink.h \
|
||||
nsIImapMiscellaneousSink.h \
|
||||
nsIImapService.h \
|
||||
nsIImapService.h \
|
||||
$(NULL)
|
||||
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ public:
|
|||
|
||||
NS_IMETHOD FetchMessage(
|
||||
nsIImapUrl * aUrl,
|
||||
nsIImapUrl::nsImapAction aImapAction,
|
||||
nsImapAction aImapAction,
|
||||
nsIMsgFolder * aImapMailFolder,
|
||||
nsIImapMessageSink * aImapMessage,
|
||||
nsIURI ** aURL,
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "nsINetSupportDialogService.h"
|
||||
#include "nsEnumeratorUtils.h"
|
||||
#include "nsIEventQueueService.h"
|
||||
#include "nsIMsgMailNewsUrl.h"
|
||||
|
||||
#include "nsITimer.h"
|
||||
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
/* get some implementation from nsMsgIncomingServer */
|
||||
class nsImapIncomingServer : public nsMsgIncomingServer,
|
||||
public nsIImapIncomingServer,
|
||||
public nsIImapServerSink,
|
||||
public nsIMsgLogonRedirectionRequester
|
||||
public nsIImapServerSink,
|
||||
public nsIMsgLogonRedirectionRequester
|
||||
|
||||
{
|
||||
public:
|
||||
|
@ -65,18 +65,18 @@ protected:
|
|||
PRBool AllDescendentsAreNoSelect(nsIFolder *parentFolder);
|
||||
|
||||
private:
|
||||
nsresult CreateImapConnection (nsIEventQueue* aEventQueue,
|
||||
nsresult CreateImapConnection (nsIEventQueue* aEventQueue,
|
||||
nsIImapUrl* aImapUrl,
|
||||
nsIImapProtocol** aImapConnection);
|
||||
nsresult CreateProtocolInstance(nsIEventQueue *aEventQueue,
|
||||
nsIImapProtocol ** aImapConnection);
|
||||
nsresult RequestOverrideInfo(nsIMsgWindow *aMsgWindow);
|
||||
|
||||
PRBool ConnectionTimeOut(nsIImapProtocol* aImapConnection);
|
||||
nsCOMPtr<nsISupportsArray> m_connectionCache;
|
||||
nsCOMPtr<nsISupportsArray> m_urlQueue;
|
||||
PRBool ConnectionTimeOut(nsIImapProtocol* aImapConnection);
|
||||
nsCOMPtr<nsISupportsArray> m_connectionCache;
|
||||
nsCOMPtr<nsISupportsArray> m_urlQueue;
|
||||
nsCOMPtr<nsIStringBundle> m_stringBundle;
|
||||
nsVoidArray m_urlConsumers;
|
||||
nsVoidArray m_urlConsumers;
|
||||
PRUint32 m_capability;
|
||||
nsCString m_manageMailAccountUrl;
|
||||
PRBool m_waitingForConnectionInfo;
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -42,6 +42,8 @@
|
|||
#include "prmon.h"
|
||||
#include "nsIEventQueue.h"
|
||||
#include "nsIMsgImapMailFolder.h"
|
||||
#include "nsIImapMailFolderSink.h"
|
||||
#include "nsIImapServerSink.h"
|
||||
|
||||
class nsImapMoveCoalescer;
|
||||
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -34,6 +34,13 @@
|
|||
#include "nsImapCore.h"
|
||||
#include "nsString.h"
|
||||
|
||||
// imap event sinks
|
||||
#include "nsIImapMailFolderSink.h"
|
||||
#include "nsIImapServerSink.h"
|
||||
#include "nsIImapMessageSink.h"
|
||||
#include "nsIImapExtensionSink.h"
|
||||
#include "nsIImapMiscellaneousSink.h"
|
||||
|
||||
#include "nsImapServerResponseParser.h"
|
||||
#include "nsImapProxyEvent.h"
|
||||
#include "nsImapFlagAndUidState.h"
|
||||
|
@ -138,20 +145,18 @@ public:
|
|||
|
||||
// message id string utilities.
|
||||
PRUint32 CountMessagesInIdString(const char *idString);
|
||||
PRUint32 CountMessagesInIdString(nsCString &idString);
|
||||
static PRBool HandlingMultipleMessages(const char *messageIdString);
|
||||
static PRBool HandlingMultipleMessages(nsCString &messageIdString);
|
||||
|
||||
// used to start fetching a message.
|
||||
PRBool GetShouldDownloadArbitraryHeaders();
|
||||
char *GetArbitraryHeadersToDownload();
|
||||
virtual void AdjustChunkSize();
|
||||
virtual void FetchMessage(nsCString &messageIds,
|
||||
nsIMAPeFetchFields whatToFetch,
|
||||
PRBool idAreUid,
|
||||
PRUint32 startByte = 0, PRUint32 endByte = 0,
|
||||
char *part = 0);
|
||||
void FetchTryChunking(nsCString &messageIds,
|
||||
virtual void FetchMessage(const char * messageIds,
|
||||
nsIMAPeFetchFields whatToFetch,
|
||||
PRBool idAreUid,
|
||||
PRUint32 startByte = 0, PRUint32 endByte = 0,
|
||||
char *part = 0);
|
||||
void FetchTryChunking(const char * messageIds,
|
||||
nsIMAPeFetchFields whatToFetch,
|
||||
PRBool idIsUid,
|
||||
char *part,
|
||||
|
@ -181,7 +186,7 @@ public:
|
|||
PRBool GetPseudoInterrupted();
|
||||
void PseudoInterrupt(PRBool the_interrupt);
|
||||
|
||||
PRUint32 GetMessageSize(nsCString &messageId, PRBool idsAreUids);
|
||||
PRUint32 GetMessageSize(const char * messageId, PRBool idsAreUids);
|
||||
PRBool GetSubscribingNow();
|
||||
|
||||
PRBool DeathSignalReceived();
|
||||
|
@ -224,19 +229,19 @@ public:
|
|||
|
||||
PRUnichar * CreatePRUnicharStringFromUTF7(const char * aSourceString);
|
||||
|
||||
void Copy(nsCString &messageList, const char *destinationMailbox,
|
||||
void Copy(const char * messageList, const char *destinationMailbox,
|
||||
PRBool idsAreUid);
|
||||
void Search(nsCString &searchCriteria, PRBool useUID,
|
||||
void Search(const char * searchCriteria, PRBool useUID,
|
||||
PRBool notifyHit = PR_TRUE);
|
||||
// imap commands issued by the parser
|
||||
void Store(nsCString &aMessageList, const char * aMessageData, PRBool
|
||||
void Store(const char * aMessageList, const char * aMessageData, PRBool
|
||||
aIdsAreUid);
|
||||
void ProcessStoreFlags(nsCString &messageIds,
|
||||
PRBool idsAreUids,
|
||||
imapMessageFlagsType flags,
|
||||
PRBool addFlags);
|
||||
void ProcessStoreFlags(const char * messageIds,
|
||||
PRBool idsAreUids,
|
||||
imapMessageFlagsType flags,
|
||||
PRBool addFlags);
|
||||
void Expunge();
|
||||
void UidExpunge(const char* messageSet);
|
||||
void UidExpunge(const char* messageSet);
|
||||
void Close();
|
||||
void Check();
|
||||
void SelectMailbox(const char *mailboxName);
|
||||
|
@ -290,7 +295,7 @@ private:
|
|||
PRBool m_gotFEEventCompletion;
|
||||
PRUint32 m_flags; // used to store flag information
|
||||
nsCOMPtr<nsIImapUrl> m_runningUrl; // the nsIImapURL that is currently running
|
||||
nsIImapUrl::nsImapAction m_imapAction; // current imap action associated with this connnection...
|
||||
nsImapAction m_imapAction; // current imap action associated with this connnection...
|
||||
|
||||
char *m_userName;
|
||||
char *m_hostName;
|
||||
|
@ -346,7 +351,6 @@ private:
|
|||
nsCOMPtr<nsIMsgIncomingServer> m_server;
|
||||
nsCOMPtr<nsIImapIncomingServer> m_imapServer;
|
||||
|
||||
nsCOMPtr<nsIImapLog> m_imapLog;
|
||||
nsCOMPtr<nsIImapMailFolderSink> m_imapMailFolderSink;
|
||||
nsCOMPtr<nsIImapMessageSink> m_imapMessageSink;
|
||||
|
||||
|
|
|
@ -104,80 +104,6 @@ nsImapProxyBase::~nsImapProxyBase()
|
|||
NS_IF_RELEASE(m_eventQueue);
|
||||
}
|
||||
|
||||
nsImapLogProxy::nsImapLogProxy(nsIImapLog* aImapLog,
|
||||
nsIImapProtocol* aProtocol,
|
||||
nsIEventQueue* aEventQ,
|
||||
PRThread* aThread) :
|
||||
nsImapProxyBase(aProtocol, aEventQ, aThread)
|
||||
{
|
||||
NS_ASSERTION(aImapLog, "nsImapLogProxy: invalid aImapLog");
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
m_realImapLog = aImapLog;
|
||||
NS_ADDREF(m_realImapLog);
|
||||
}
|
||||
|
||||
nsImapLogProxy::~nsImapLogProxy()
|
||||
{
|
||||
NS_IF_RELEASE(m_realImapLog);
|
||||
}
|
||||
|
||||
/*
|
||||
* Implementation of thread save nsISupports methods ....
|
||||
*/
|
||||
static NS_DEFINE_IID(kIImapLogIID, NS_IIMAPLOG_IID);
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS(nsImapLogProxy, kIImapLogIID);
|
||||
|
||||
NS_IMETHODIMP nsImapLogProxy::HandleImapLogData(const char *aLogData)
|
||||
{
|
||||
NS_PRECONDITION(aLogData, "HandleImapLogData: invalid log data");
|
||||
nsresult res = NS_OK;
|
||||
|
||||
if(PR_GetCurrentThread() == m_thread)
|
||||
{
|
||||
nsImapLogProxyEvent *ev =
|
||||
new nsImapLogProxyEvent(this, aLogData);
|
||||
if (nsnull == ev)
|
||||
{
|
||||
res = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
else
|
||||
{
|
||||
ev->PostEvent(m_eventQueue);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
res = m_realImapLog->HandleImapLogData(aLogData);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
nsImapLogProxyEvent::nsImapLogProxyEvent(nsImapLogProxy* aProxy,
|
||||
const char* aLogData)
|
||||
{
|
||||
NS_ASSERTION (aProxy && aLogData,
|
||||
"nsImapLogProxyEvent: invalid aProxy or aLogData");
|
||||
m_logData = PL_strdup(aLogData);
|
||||
m_proxy = aProxy;
|
||||
NS_ADDREF(m_proxy);
|
||||
}
|
||||
|
||||
nsImapLogProxyEvent::~nsImapLogProxyEvent()
|
||||
{
|
||||
PR_Free(m_logData);
|
||||
NS_IF_RELEASE(m_proxy);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapLogProxyEvent::HandleEvent()
|
||||
{
|
||||
nsresult res = m_proxy->m_realImapLog->HandleImapLogData(m_logData);
|
||||
if (m_notifyCompletion)
|
||||
m_proxy->m_protocol->NotifyFEEventCompletion();
|
||||
return res;
|
||||
}
|
||||
|
||||
nsImapExtensionSinkProxy::nsImapExtensionSinkProxy(nsIImapExtensionSink* aImapExtensionSink,
|
||||
nsIImapProtocol* aProtocol,
|
||||
nsIEventQueue* aEventQ,
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include "prthread.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIImapLog.h"
|
||||
#include "nsIImapMailFolderSink.h"
|
||||
#include "nsIImapMessageSink.h"
|
||||
#include "nsIImapExtensionSink.h"
|
||||
|
@ -35,6 +34,8 @@
|
|||
#include "nsIImapIncomingServer.h"
|
||||
#include "nsImapCore.h"
|
||||
#include "nsIImapUrl.h"
|
||||
#include "nsIImapMailFolderSink.h"
|
||||
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
class nsImapProxyBase
|
||||
|
@ -50,24 +51,6 @@ public:
|
|||
nsIImapProtocol* m_protocol;
|
||||
};
|
||||
|
||||
class nsImapLogProxy : public nsIImapLog,
|
||||
public nsImapProxyBase
|
||||
{
|
||||
public:
|
||||
nsImapLogProxy(nsIImapLog* aImapLog,
|
||||
nsIImapProtocol* aProtocol,
|
||||
nsIEventQueue* aEventQ,
|
||||
PRThread* aThread);
|
||||
virtual ~nsImapLogProxy();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD HandleImapLogData(const char* aLogData);
|
||||
|
||||
nsIImapLog* m_realImapLog;
|
||||
};
|
||||
|
||||
|
||||
class nsImapExtensionSinkProxy : public nsIImapExtensionSink,
|
||||
public nsImapProxyBase
|
||||
{
|
||||
|
@ -166,17 +149,6 @@ struct nsImapEvent : public PLEvent
|
|||
PRBool m_notifyCompletion;
|
||||
};
|
||||
|
||||
struct nsImapLogProxyEvent : public nsImapEvent
|
||||
{
|
||||
nsImapLogProxyEvent(nsImapLogProxy* aProxy,
|
||||
const char* aLogData);
|
||||
virtual ~nsImapLogProxyEvent();
|
||||
|
||||
NS_IMETHOD HandleEvent();
|
||||
char *m_logData;
|
||||
nsImapLogProxy *m_proxy;
|
||||
};
|
||||
|
||||
struct nsImapExtensionSinkProxyEvent : nsImapEvent
|
||||
{
|
||||
nsImapExtensionSinkProxyEvent(nsImapExtensionSinkProxy* aProxy);
|
||||
|
@ -222,15 +194,15 @@ struct FolderNeedsACLInitializedProxyEvent : nsImapExtensionSinkProxyEvent
|
|||
|
||||
struct SetCopyResponseUidProxyEvent : nsImapExtensionSinkProxyEvent
|
||||
{
|
||||
SetCopyResponseUidProxyEvent(nsImapExtensionSinkProxy* aProxy,
|
||||
nsMsgKeyArray* aKeyArray,
|
||||
const char* msgIdString,
|
||||
nsIImapUrl * aUr);
|
||||
virtual ~SetCopyResponseUidProxyEvent();
|
||||
NS_IMETHOD HandleEvent();
|
||||
nsMsgKeyArray m_copyKeyArray;
|
||||
nsCString m_msgIdString;
|
||||
nsCOMPtr<nsIImapUrl> m_Url;
|
||||
SetCopyResponseUidProxyEvent(nsImapExtensionSinkProxy* aProxy,
|
||||
nsMsgKeyArray* aKeyArray,
|
||||
const char* msgIdString,
|
||||
nsIImapUrl * aUr);
|
||||
virtual ~SetCopyResponseUidProxyEvent();
|
||||
NS_IMETHOD HandleEvent();
|
||||
nsMsgKeyArray m_copyKeyArray;
|
||||
nsCString m_msgIdString;
|
||||
nsCOMPtr<nsIImapUrl> m_Url;
|
||||
};
|
||||
|
||||
struct SetAppendMsgUidProxyEvent : nsImapExtensionSinkProxyEvent
|
||||
|
|
|
@ -2134,7 +2134,7 @@ PRBool nsImapServerResponseParser::msg_fetch_literal(PRBool chunk, PRInt32 origi
|
|||
|
||||
PRBool lastChunk = !chunk || (origin + numberOfCharsInThisChunk >= fTotalDownloadSize);
|
||||
|
||||
nsIImapUrl::nsImapAction imapAction;
|
||||
nsImapAction imapAction;
|
||||
fServerConnection.GetCurrentUrl()->GetImapAction(&imapAction);
|
||||
if (!lastCRLFwasCRCRLF &&
|
||||
fServerConnection.GetIOTunnellingEnabled() &&
|
||||
|
|
|
@ -396,17 +396,17 @@ nsImapService::CopyMessages(nsMsgKeyArray *keys, nsIMsgFolder *srcFolder, nsIStr
|
|||
nsXPIDLCString msgKey;
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr<nsIImapMessageSink> imapMessageSink(do_QueryInterface(folder, &rv));
|
||||
nsCOMPtr<nsIImapMessageSink> imapMessageSink(do_QueryInterface(folder, &rv));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCString messageIds;
|
||||
|
||||
AllocateImapUidString(keys->GetArray(), keys->GetSize(), messageIds);
|
||||
nsCOMPtr<nsIImapUrl> imapUrl;
|
||||
nsCAutoString urlSpec;
|
||||
nsCOMPtr<nsIImapUrl> imapUrl;
|
||||
nsCAutoString urlSpec;
|
||||
PRUnichar hierarchySeparator = GetHierarchyDelimiter(folder);
|
||||
rv = CreateStartOfImapUrl(getter_AddRefs(imapUrl), folder, aUrlListener, urlSpec, hierarchySeparator);
|
||||
nsIImapUrl::nsImapAction action;
|
||||
rv = CreateStartOfImapUrl(getter_AddRefs(imapUrl), folder, aUrlListener, urlSpec, hierarchySeparator);
|
||||
nsImapAction action;
|
||||
if (moveMessage)
|
||||
action = nsIImapUrl::nsImapOnlineToOfflineMove;
|
||||
else
|
||||
|
@ -417,9 +417,9 @@ nsImapService::CopyMessages(nsMsgKeyArray *keys, nsIMsgFolder *srcFolder, nsIStr
|
|||
aURL, streamSupport, messageIds.GetBuffer(), PR_TRUE);
|
||||
// ### end of copy operation should know how to do the delete.if this is a move
|
||||
|
||||
} // if we got an imap message sink
|
||||
} // if we decomposed the imap message
|
||||
return rv;
|
||||
} // if we got an imap message sink
|
||||
} // if we decomposed the imap message
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
@ -492,7 +492,7 @@ NS_IMETHODIMP nsImapService::SaveMessageToDisk(const char *aMessageURI,
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsImapService::FetchMessage(nsIImapUrl * aImapUrl,
|
||||
nsIImapUrl::nsImapAction aImapAction,
|
||||
nsImapAction aImapAction,
|
||||
nsIMsgFolder * aImapMailFolder,
|
||||
nsIImapMessageSink * aImapMessage,
|
||||
nsIURI ** aURL,
|
||||
|
@ -1118,8 +1118,8 @@ nsresult
|
|||
nsImapService::SetImapUrlSink(nsIMsgFolder* aMsgFolder,
|
||||
nsIImapUrl* aImapUrl)
|
||||
{
|
||||
nsresult rv = NS_ERROR_NULL_POINTER;
|
||||
nsISupports* aInst = nsnull;
|
||||
nsresult rv = NS_ERROR_NULL_POINTER;
|
||||
nsISupports* aInst = nsnull;
|
||||
nsCOMPtr <nsIMsgIncomingServer> incomingServer;
|
||||
nsCOMPtr <nsIImapServerSink> imapServerSink;
|
||||
|
||||
|
@ -1134,41 +1134,36 @@ nsImapService::SetImapUrlSink(nsIMsgFolder* aMsgFolder,
|
|||
if (imapServerSink)
|
||||
aImapUrl->SetImapServerSink(imapServerSink);
|
||||
}
|
||||
rv = aMsgFolder->QueryInterface(NS_GET_IID(nsIImapLog), (void**)&aInst);
|
||||
if (NS_SUCCEEDED(rv) && aInst)
|
||||
aImapUrl->SetImapLog((nsIImapLog*) aInst);
|
||||
NS_IF_RELEASE (aInst);
|
||||
aInst = nsnull;
|
||||
|
||||
rv = aMsgFolder->QueryInterface(NS_GET_IID(nsIImapMailFolderSink),
|
||||
(void**)&aInst);
|
||||
if (NS_SUCCEEDED(rv) && aInst)
|
||||
aImapUrl->SetImapMailFolderSink((nsIImapMailFolderSink*) aInst);
|
||||
NS_IF_RELEASE (aInst);
|
||||
aInst = nsnull;
|
||||
|
||||
rv = aMsgFolder->QueryInterface(NS_GET_IID(nsIImapMessageSink),
|
||||
(void**)&aInst);
|
||||
if (NS_SUCCEEDED(rv) && aInst)
|
||||
aImapUrl->SetImapMessageSink((nsIImapMessageSink*) aInst);
|
||||
NS_IF_RELEASE (aInst);
|
||||
aInst = nsnull;
|
||||
|
||||
rv = aMsgFolder->QueryInterface(NS_GET_IID(nsIImapExtensionSink),
|
||||
(void**)&aInst);
|
||||
if (NS_SUCCEEDED(rv) && aInst)
|
||||
aImapUrl->SetImapExtensionSink((nsIImapExtensionSink*) aInst);
|
||||
NS_IF_RELEASE (aInst);
|
||||
aInst = nsnull;
|
||||
|
||||
rv = aMsgFolder->QueryInterface(NS_GET_IID(nsIImapMiscellaneousSink),
|
||||
(void**)&aInst);
|
||||
if (NS_SUCCEEDED(rv) && aInst)
|
||||
aImapUrl->SetImapMiscellaneousSink((nsIImapMiscellaneousSink*) aInst);
|
||||
NS_IF_RELEASE (aInst);
|
||||
aInst = nsnull;
|
||||
|
||||
rv = aMsgFolder->QueryInterface(NS_GET_IID(nsIImapMailFolderSink),
|
||||
(void**)&aInst);
|
||||
if (NS_SUCCEEDED(rv) && aInst)
|
||||
aImapUrl->SetImapMailFolderSink((nsIImapMailFolderSink*) aInst);
|
||||
NS_IF_RELEASE (aInst);
|
||||
aInst = nsnull;
|
||||
|
||||
rv = aMsgFolder->QueryInterface(NS_GET_IID(nsIImapMessageSink),
|
||||
(void**)&aInst);
|
||||
if (NS_SUCCEEDED(rv) && aInst)
|
||||
aImapUrl->SetImapMessageSink((nsIImapMessageSink*) aInst);
|
||||
NS_IF_RELEASE (aInst);
|
||||
aInst = nsnull;
|
||||
|
||||
rv = aMsgFolder->QueryInterface(NS_GET_IID(nsIImapExtensionSink),
|
||||
(void**)&aInst);
|
||||
if (NS_SUCCEEDED(rv) && aInst)
|
||||
aImapUrl->SetImapExtensionSink((nsIImapExtensionSink*) aInst);
|
||||
NS_IF_RELEASE (aInst);
|
||||
aInst = nsnull;
|
||||
|
||||
rv = aMsgFolder->QueryInterface(NS_GET_IID(nsIImapMiscellaneousSink),
|
||||
(void**)&aInst);
|
||||
if (NS_SUCCEEDED(rv) && aInst)
|
||||
aImapUrl->SetImapMiscellaneousSink((nsIImapMiscellaneousSink*) aInst);
|
||||
NS_IF_RELEASE (aInst);
|
||||
aInst = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -65,11 +65,11 @@ public:
|
|||
nsIURI ** aURL);
|
||||
NS_IMETHOD FetchMessage(
|
||||
nsIImapUrl * aImapUrl,
|
||||
nsIImapUrl::nsImapAction aImapAction,
|
||||
nsImapAction aImapAction,
|
||||
nsIMsgFolder * aImapMailFolder,
|
||||
nsIImapMessageSink * aImapMessage,
|
||||
nsIURI ** aURL,
|
||||
nsISupports *aConsumer,
|
||||
nsISupports *aConsumer,
|
||||
const char *messageIdentifierList,
|
||||
PRBool messageIdsAreUID);
|
||||
NS_IMETHOD Noop(nsIEventQueue * aClientEventQueue,
|
||||
|
|
|
@ -62,7 +62,6 @@ nsImapUrl::nsImapUrl()
|
|||
|
||||
// ** jt - the following are not ref counted
|
||||
m_copyState = nsnull;
|
||||
m_imapLog = nsnull;
|
||||
m_fileSpec = nsnull;
|
||||
m_imapMailFolderSink = nsnull;
|
||||
m_imapMessageSink = nsnull;
|
||||
|
@ -95,25 +94,10 @@ NS_IMPL_ADDREF_INHERITED(nsImapUrl, nsMsgMailNewsUrl)
|
|||
|
||||
NS_IMPL_RELEASE_INHERITED(nsImapUrl, nsMsgMailNewsUrl)
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapUrl::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
if (!aInstancePtr) return NS_ERROR_NULL_POINTER;
|
||||
*aInstancePtr = nsnull;
|
||||
if (aIID.Equals(NS_GET_IID(nsIImapUrl)))
|
||||
*aInstancePtr = NS_STATIC_CAST(nsIImapUrl*, this);
|
||||
else if (aIID.Equals(NS_GET_IID(nsIMsgMessageUrl)))
|
||||
*aInstancePtr = NS_STATIC_CAST(nsIMsgMessageUrl*, this);
|
||||
|
||||
if(*aInstancePtr)
|
||||
{
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return nsMsgMailNewsUrl::QueryInterface(aIID, aInstancePtr);
|
||||
}
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsImapUrl)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIImapUrl)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIMsgMessageUrl)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsMsgMailNewsUrl)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
// Begin nsIImapUrl specific support
|
||||
|
@ -135,22 +119,16 @@ NS_IMETHODIMP nsImapUrl::GetRequiredImapState(nsImapState * aImapUrlState)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapUrl::GetImapLog(nsIImapLog ** aImapLog)
|
||||
NS_IMETHODIMP nsImapUrl::GetImapAction(nsImapAction * aImapAction)
|
||||
{
|
||||
if (aImapLog)
|
||||
{
|
||||
*aImapLog = m_imapLog;
|
||||
NS_IF_ADDREF(*aImapLog );
|
||||
}
|
||||
|
||||
*aImapAction = m_imapAction;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapUrl::SetImapLog(nsIImapLog * aImapLog)
|
||||
NS_IMETHODIMP nsImapUrl::SetImapAction(nsImapAction aImapAction)
|
||||
{
|
||||
// ** jt - not ref counted; talk to me before you change the code
|
||||
m_imapLog = aImapLog;
|
||||
return NS_OK;
|
||||
m_imapAction = aImapAction;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapUrl::GetImapMailFolderSink(nsIImapMailFolderSink **
|
||||
|
@ -212,7 +190,6 @@ NS_IMETHODIMP nsImapUrl::SetImapServerSink(nsIImapServerSink * aImapServerSink)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsImapUrl::GetImapExtensionSink(nsIImapExtensionSink ** aImapExtensionSink)
|
||||
{
|
||||
if (aImapExtensionSink)
|
||||
|
@ -284,20 +261,21 @@ nsresult nsImapUrl::ParseUrl()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapUrl::CreateSearchCriteriaString(nsCString *aResult)
|
||||
NS_IMETHODIMP nsImapUrl::CreateSearchCriteriaString(char ** aResult)
|
||||
{
|
||||
// this method should only be called from the imap thread...
|
||||
// o.t. add lock protection..
|
||||
if (nsnull == aResult || !m_searchCriteriaString)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
aResult->Assign(m_searchCriteriaString);
|
||||
*aResult = nsCRT::strdup(m_searchCriteriaString);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// this method gets called from the UI thread and the imap thread
|
||||
NS_IMETHODIMP nsImapUrl::CreateListOfMessageIdsString(nsCString *aResult)
|
||||
NS_IMETHODIMP nsImapUrl::CreateListOfMessageIdsString(char ** aResult)
|
||||
{
|
||||
nsAutoCMonitor(this);
|
||||
nsCAutoString newStr;
|
||||
if (nsnull == aResult || !m_listOfMessageIds)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
|
@ -319,7 +297,8 @@ NS_IMETHODIMP nsImapUrl::CreateListOfMessageIdsString(nsCString *aResult)
|
|||
if (wherePart)
|
||||
bytesToCopy = PR_MIN(bytesToCopy, wherePart - m_listOfMessageIds);
|
||||
|
||||
aResult->Assign(m_listOfMessageIds, bytesToCopy);
|
||||
newStr.Assign(m_listOfMessageIds, bytesToCopy);
|
||||
*aResult = newStr.ToNewCString();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,12 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsMsgMailNewsUrl.h"
|
||||
#include "nsIMsgIncomingServer.h"
|
||||
#include "nsIImapMailFolderSink.h"
|
||||
#include "nsIImapServerSink.h"
|
||||
#include "nsIImapMessageSink.h"
|
||||
#include "nsIImapExtensionSink.h"
|
||||
#include "nsIImapMiscellaneousSink.h"
|
||||
|
||||
#include "nsXPIDLString.h"
|
||||
|
||||
class nsImapUrl : public nsIImapUrl, public nsMsgMailNewsUrl, public nsIMsgMessageUrl
|
||||
|
@ -43,68 +48,13 @@ public:
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// we support the nsIImapUrl interface
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
NS_DECL_NSIIMAPURL
|
||||
|
||||
NS_IMETHOD Initialize();
|
||||
|
||||
NS_IMETHOD GetImapLog(nsIImapLog ** aImapLog);
|
||||
NS_IMETHOD SetImapLog(nsIImapLog * aImapLog);
|
||||
|
||||
NS_IMETHOD GetImapMailFolderSink(nsIImapMailFolderSink** aImapMailFolderSink);
|
||||
NS_IMETHOD SetImapMailFolderSink(nsIImapMailFolderSink* aImapMailFolderSink);
|
||||
|
||||
NS_IMETHOD GetImapMessageSink(nsIImapMessageSink** aImapMessageSink);
|
||||
NS_IMETHOD SetImapMessageSink(nsIImapMessageSink* aImapMessageSink);
|
||||
|
||||
NS_IMETHOD GetImapExtensionSink(nsIImapExtensionSink** aImapExtensionSink);
|
||||
NS_IMETHOD SetImapExtensionSink(nsIImapExtensionSink* aImapExtensionSink);
|
||||
|
||||
NS_IMETHOD GetImapMiscellaneousSink(nsIImapMiscellaneousSink** aImapMiscellaneousSink);
|
||||
NS_IMETHOD SetImapMiscellaneousSink(nsIImapMiscellaneousSink* aImapMiscellaneousSink);
|
||||
|
||||
NS_IMETHOD GetImapServerSink(nsIImapServerSink** aImapServerSink);
|
||||
NS_IMETHOD SetImapServerSink(nsIImapServerSink* aImapServerSink);
|
||||
|
||||
NS_IMPL_CLASS_GETSET(ImapAction, nsImapAction, m_imapAction);
|
||||
NS_IMETHOD GetRequiredImapState(nsImapState * aImapUrlState);
|
||||
|
||||
NS_IMETHOD AddOnlineDirectoryIfNecessary(const char *onlineMailboxName, char ** directory);
|
||||
|
||||
NS_IMETHOD GetImapPartToFetch(char **result);
|
||||
NS_IMETHOD AllocateCanonicalPath(const char *serverPath, char onlineDelimiter, char **allocatedPath ) ;
|
||||
NS_IMETHOD AllocateServerPath(const char * aCanonicalPath, char aOnlineDelimiter, char ** aAllocatedPath);
|
||||
NS_IMETHOD CreateCanonicalSourceFolderPathString(char **result);
|
||||
NS_IMETHOD CreateServerSourceFolderPathString(char **result) ;
|
||||
NS_IMETHOD CreateServerDestinationFolderPathString(char **result);
|
||||
|
||||
NS_IMETHOD CreateSearchCriteriaString(nsCString *aResult);
|
||||
NS_IMETHOD CreateListOfMessageIdsString(nsCString *result) ;
|
||||
NS_IMETHOD MessageIdsAreUids(PRBool *result);
|
||||
NS_IMETHOD GetMsgFlags(imapMessageFlagsType *result); // kAddMsgFlags or kSubtractMsgFlags only
|
||||
NS_IMETHOD GetChildDiscoveryDepth(PRInt32* result);
|
||||
NS_IMETHOD GetOnlineSubDirSeparator(char* separator);
|
||||
NS_IMETHOD SetOnlineSubDirSeparator(char onlineDirSeparator);
|
||||
|
||||
// for enabling or disabling mime parts on demand. Setting this to PR_TRUE says we
|
||||
// can use mime parts on demand, if we chose.
|
||||
NS_IMETHOD SetAllowContentChange(PRBool allowContentChange);
|
||||
NS_IMETHOD GetAllowContentChange(PRBool *results);
|
||||
|
||||
NS_IMETHOD SetCopyState(nsISupports* copyState);
|
||||
NS_IMETHOD GetCopyState(nsISupports** copyState);
|
||||
|
||||
NS_IMETHOD SetMsgFileSpec(nsIFileSpec* fileSpec);
|
||||
NS_IMETHOD GetMsgFileSpec(nsIFileSpec** fileSpec);
|
||||
|
||||
NS_IMETHOD GetMockChannel(nsIImapMockChannel ** aChannel);
|
||||
NS_IMETHOD SetMockChannel(nsIImapMockChannel * aChannel);
|
||||
|
||||
NS_IMETHOD AddChannelToLoadGroup();
|
||||
NS_IMETHOD RemoveChannel(nsresult status);
|
||||
|
||||
// nsIMsgMailNewsUrl override
|
||||
NS_IMETHOD IsUrlType(PRUint32 type, PRBool *isType);
|
||||
|
||||
// nsIMsgMessageUrl
|
||||
NS_DECL_NSIMSGMESSAGEURL
|
||||
// nsIMsgMessageUrl
|
||||
NS_DECL_NSIMSGMESSAGEURL
|
||||
|
||||
// nsImapUrl
|
||||
nsImapUrl();
|
||||
|
@ -127,11 +77,11 @@ protected:
|
|||
void ParseMsgFlags();
|
||||
void ParseListOfMessageIds();
|
||||
|
||||
char *m_sourceCanonicalFolderPathSubString;
|
||||
char *m_destinationCanonicalFolderPathSubString;
|
||||
char *m_tokenPlaceHolder;
|
||||
char *m_sourceCanonicalFolderPathSubString;
|
||||
char *m_destinationCanonicalFolderPathSubString;
|
||||
char *m_tokenPlaceHolder;
|
||||
char *m_urlidSubString;
|
||||
char m_onlineSubDirSeparator;
|
||||
char m_onlineSubDirSeparator;
|
||||
char *m_searchCriteriaString; // should we use m_search, or is this special?
|
||||
|
||||
PRBool m_validUrl;
|
||||
|
@ -147,28 +97,27 @@ protected:
|
|||
imapMessageFlagsType m_flags;
|
||||
nsImapAction m_imapAction;
|
||||
|
||||
// ** jt -- I am not usring nsCOMPtr here because I don't know when the
|
||||
// usr get deleted; netlib has a strange manipulation over the transport
|
||||
// layer; the runningUrl can get swapped; using nsCOMPtr can cause object
|
||||
// never gets freed.
|
||||
nsIImapLog* m_imapLog; // not ref counted
|
||||
nsIImapMailFolderSink* m_imapMailFolderSink; // not ref counted
|
||||
nsIImapMessageSink* m_imapMessageSink; // not ref counted
|
||||
nsIImapExtensionSink* m_imapExtensionSink; // not ref counted
|
||||
nsIImapMiscellaneousSink* m_imapMiscellaneousSink; // not ref counted
|
||||
// ** jt -- I am not usring nsCOMPtr here because I don't know when the
|
||||
// usr get deleted; netlib has a strange manipulation over the transport
|
||||
// layer; the runningUrl can get swapped; using nsCOMPtr can cause object
|
||||
// never gets freed.
|
||||
nsIImapMailFolderSink* m_imapMailFolderSink; // not ref counted
|
||||
nsIImapMessageSink* m_imapMessageSink; // not ref counted
|
||||
nsIImapExtensionSink* m_imapExtensionSink; // not ref counted
|
||||
nsIImapMiscellaneousSink* m_imapMiscellaneousSink; // not ref counted
|
||||
|
||||
// I AM using nsCOMPtr because I suspect the above problem has gone away.
|
||||
nsCOMPtr <nsIImapServerSink> m_imapServerSink;
|
||||
|
||||
// online message copy support; i don't have a better solution yet
|
||||
nsCOMPtr <nsISupports> m_copyState; // now, refcounted.
|
||||
nsIFileSpec* m_fileSpec;
|
||||
nsCOMPtr<nsIImapMockChannel> m_mockChannel;
|
||||
// online message copy support; i don't have a better solution yet
|
||||
nsCOMPtr <nsISupports> m_copyState; // now, refcounted.
|
||||
nsIFileSpec* m_fileSpec;
|
||||
nsCOMPtr<nsIImapMockChannel> m_mockChannel;
|
||||
|
||||
// used by save message to disk
|
||||
nsCOMPtr<nsIFileSpec> m_messageFileSpec;
|
||||
PRBool m_addDummyEnvelope;
|
||||
PRBool m_canonicalLineEnding; // CRLF
|
||||
PRBool m_addDummyEnvelope;
|
||||
PRBool m_canonicalLineEnding; // CRLF
|
||||
};
|
||||
|
||||
#endif /* nsImapUrl_h___ */
|
||||
|
|
|
@ -46,12 +46,10 @@
|
|||
|
||||
#include "nsIImapUrl.h"
|
||||
#include "nsIImapProtocol.h"
|
||||
#include "nsIImapLog.h"
|
||||
#include "nsIMsgIncomingServer.h"
|
||||
#include "nsIImapIncomingServer.h"
|
||||
#include "nsIImapService.h"
|
||||
#include "nsIMsgAccountManager.h"
|
||||
#include "nsIImapLog.h"
|
||||
#include "nsIImapMailFolderSink.h"
|
||||
#include "nsIImapMessageSink.h"
|
||||
#include "nsIImapExtensionSink.h"
|
||||
|
@ -133,8 +131,7 @@ static NS_DEFINE_CID(kCImapResource, NS_IMAPRESOURCE_CID);
|
|||
#define DEFAULT_PORT IMAP_PORT
|
||||
#define DEFAULT_URL_TYPE "imap://" /* do NOT change this value until netlib re-write is done...*/
|
||||
|
||||
class nsIMAP4TestDriver : public nsIUrlListener,
|
||||
public nsIImapLog
|
||||
class nsIMAP4TestDriver : public nsIUrlListener
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
@ -143,9 +140,6 @@ public:
|
|||
NS_IMETHOD OnStartRunningUrl(nsIURI * aUrl);
|
||||
NS_IMETHOD OnStopRunningUrl(nsIURI * aUrl, nsresult aExitCode);
|
||||
|
||||
// nsIImapLog support
|
||||
NS_IMETHOD HandleImapLogData (const char * aLogData);
|
||||
|
||||
nsIMAP4TestDriver(nsIEventQueue *queue);
|
||||
virtual ~nsIMAP4TestDriver();
|
||||
|
||||
|
@ -234,10 +228,6 @@ nsIMAP4TestDriver::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
|||
{
|
||||
*aInstancePtr = (void*)(nsIUrlListener*)this;
|
||||
}
|
||||
else if (aIID.Equals(NS_GET_IID(nsIImapLog)))
|
||||
{
|
||||
*aInstancePtr = (void*)(nsIImapLog*)this;
|
||||
}
|
||||
else if (aIID.Equals(kISupportsIID))
|
||||
{
|
||||
*aInstancePtr = (void*)(nsISupports*)(nsIUrlListener*)this;
|
||||
|
@ -377,18 +367,6 @@ nsresult nsIMAP4TestDriver::OnStopRunningUrl(nsIURI * aUrl, nsresult aExitCode)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsIMAP4TestDriver::HandleImapLogData (const char * aLogData)
|
||||
{
|
||||
// for now, play dumb and just spit out what we were given...
|
||||
if (aLogData)
|
||||
{
|
||||
printf(aLogData);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult nsIMAP4TestDriver::OnExit()
|
||||
{
|
||||
|
@ -522,7 +500,6 @@ nsresult nsIMAP4TestDriver::OnRunIMAPCommand()
|
|||
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_url);
|
||||
if (NS_SUCCEEDED(rv) && m_url)
|
||||
{
|
||||
m_url->SetImapLog(this);
|
||||
rv = mailnewsurl->SetSpec(m_urlString); // reset spec
|
||||
mailnewsurl->RegisterListener(this);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче