Use our new scriptable version of nsIImapUrl.idl and make the .h version obsolete.

r=bienvenu
This commit is contained in:
mscott%netscape.com 2000-03-18 18:35:54 +00:00
Родитель 012f6835c8
Коммит 4335aa3455
16 изменённых файлов: 2159 добавлений и 2386 удалений

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

@ -23,28 +23,28 @@ DEPTH=..\..\..
MODULE= msgimap MODULE= msgimap
XPIDLSRCS = \ XPIDLSRCS = \
.\nsIImapServerSink.idl \ .\nsIImapUrl.idl \
.\nsIImapMessageSink.idl \ .\nsIImapServerSink.idl \
.\nsIImapMessageSink.idl \
.\nsIImapIncomingServer.idl \ .\nsIImapIncomingServer.idl \
.\nsIImapFlagAndUidState.idl \ .\nsIImapFlagAndUidState.idl \
.\nsIImapMockChannel.idl \ .\nsIImapMockChannel.idl \
.\nsIImapProtocol.idl \ .\nsIImapProtocol.idl \
.\nsIMailboxSpec.idl \ .\nsIMailboxSpec.idl \
.\nsIImapMailFolderSink.idl \ .\nsIImapMailFolderSink.idl \
.\nsIMsgImapMailFolder.idl \ .\nsIMsgImapMailFolder.idl \
.\nsIMsgLogonRedirector.idl \ .\nsIMsgLogonRedirector.idl \
$(NULL) $(NULL)
################################################################################ ################################################################################
## exports ## exports
EXPORTS = \ EXPORTS = \
nsIImapUrl.h \ nsIImapLog.h \
nsIImapLog.h \ nsIIMAPHostSessionList.h \
nsIIMAPHostSessionList.h \ nsIImapExtensionSink.h \
nsIImapExtensionSink.h \
nsIImapMiscellaneousSink.h \ nsIImapMiscellaneousSink.h \
nsIImapService.h \ nsIImapService.h \
$(NULL) $(NULL)

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

@ -72,7 +72,7 @@ public:
NS_IMETHOD FetchMessage( NS_IMETHOD FetchMessage(
nsIImapUrl * aUrl, nsIImapUrl * aUrl,
nsIImapUrl::nsImapAction aImapAction, nsImapAction aImapAction,
nsIMsgFolder * aImapMailFolder, nsIMsgFolder * aImapMailFolder,
nsIImapMessageSink * aImapMessage, nsIImapMessageSink * aImapMessage,
nsIURI ** aURL, nsIURI ** aURL,

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

@ -51,6 +51,7 @@
#include "nsINetSupportDialogService.h" #include "nsINetSupportDialogService.h"
#include "nsEnumeratorUtils.h" #include "nsEnumeratorUtils.h"
#include "nsIEventQueueService.h" #include "nsIEventQueueService.h"
#include "nsIMsgMailNewsUrl.h"
#include "nsITimer.h" #include "nsITimer.h"

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

@ -34,8 +34,8 @@
/* get some implementation from nsMsgIncomingServer */ /* get some implementation from nsMsgIncomingServer */
class nsImapIncomingServer : public nsMsgIncomingServer, class nsImapIncomingServer : public nsMsgIncomingServer,
public nsIImapIncomingServer, public nsIImapIncomingServer,
public nsIImapServerSink, public nsIImapServerSink,
public nsIMsgLogonRedirectionRequester public nsIMsgLogonRedirectionRequester
{ {
public: public:
@ -65,18 +65,18 @@ protected:
PRBool AllDescendentsAreNoSelect(nsIFolder *parentFolder); PRBool AllDescendentsAreNoSelect(nsIFolder *parentFolder);
private: private:
nsresult CreateImapConnection (nsIEventQueue* aEventQueue, nsresult CreateImapConnection (nsIEventQueue* aEventQueue,
nsIImapUrl* aImapUrl, nsIImapUrl* aImapUrl,
nsIImapProtocol** aImapConnection); nsIImapProtocol** aImapConnection);
nsresult CreateProtocolInstance(nsIEventQueue *aEventQueue, nsresult CreateProtocolInstance(nsIEventQueue *aEventQueue,
nsIImapProtocol ** aImapConnection); nsIImapProtocol ** aImapConnection);
nsresult RequestOverrideInfo(nsIMsgWindow *aMsgWindow); nsresult RequestOverrideInfo(nsIMsgWindow *aMsgWindow);
PRBool ConnectionTimeOut(nsIImapProtocol* aImapConnection); PRBool ConnectionTimeOut(nsIImapProtocol* aImapConnection);
nsCOMPtr<nsISupportsArray> m_connectionCache; nsCOMPtr<nsISupportsArray> m_connectionCache;
nsCOMPtr<nsISupportsArray> m_urlQueue; nsCOMPtr<nsISupportsArray> m_urlQueue;
nsCOMPtr<nsIStringBundle> m_stringBundle; nsCOMPtr<nsIStringBundle> m_stringBundle;
nsVoidArray m_urlConsumers; nsVoidArray m_urlConsumers;
PRUint32 m_capability; PRUint32 m_capability;
nsCString m_manageMailAccountUrl; nsCString m_manageMailAccountUrl;
PRBool m_waitingForConnectionInfo; PRBool m_waitingForConnectionInfo;

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -42,6 +42,8 @@
#include "prmon.h" #include "prmon.h"
#include "nsIEventQueue.h" #include "nsIEventQueue.h"
#include "nsIMsgImapMailFolder.h" #include "nsIMsgImapMailFolder.h"
#include "nsIImapMailFolderSink.h"
#include "nsIImapServerSink.h"
class nsImapMoveCoalescer; class nsImapMoveCoalescer;

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -34,6 +34,13 @@
#include "nsImapCore.h" #include "nsImapCore.h"
#include "nsString.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 "nsImapServerResponseParser.h"
#include "nsImapProxyEvent.h" #include "nsImapProxyEvent.h"
#include "nsImapFlagAndUidState.h" #include "nsImapFlagAndUidState.h"
@ -138,20 +145,18 @@ public:
// message id string utilities. // message id string utilities.
PRUint32 CountMessagesInIdString(const char *idString); PRUint32 CountMessagesInIdString(const char *idString);
PRUint32 CountMessagesInIdString(nsCString &idString);
static PRBool HandlingMultipleMessages(const char *messageIdString); static PRBool HandlingMultipleMessages(const char *messageIdString);
static PRBool HandlingMultipleMessages(nsCString &messageIdString);
// used to start fetching a message. // used to start fetching a message.
PRBool GetShouldDownloadArbitraryHeaders(); PRBool GetShouldDownloadArbitraryHeaders();
char *GetArbitraryHeadersToDownload(); char *GetArbitraryHeadersToDownload();
virtual void AdjustChunkSize(); virtual void AdjustChunkSize();
virtual void FetchMessage(nsCString &messageIds, virtual void FetchMessage(const char * messageIds,
nsIMAPeFetchFields whatToFetch, nsIMAPeFetchFields whatToFetch,
PRBool idAreUid, PRBool idAreUid,
PRUint32 startByte = 0, PRUint32 endByte = 0, PRUint32 startByte = 0, PRUint32 endByte = 0,
char *part = 0); char *part = 0);
void FetchTryChunking(nsCString &messageIds, void FetchTryChunking(const char * messageIds,
nsIMAPeFetchFields whatToFetch, nsIMAPeFetchFields whatToFetch,
PRBool idIsUid, PRBool idIsUid,
char *part, char *part,
@ -181,7 +186,7 @@ public:
PRBool GetPseudoInterrupted(); PRBool GetPseudoInterrupted();
void PseudoInterrupt(PRBool the_interrupt); void PseudoInterrupt(PRBool the_interrupt);
PRUint32 GetMessageSize(nsCString &messageId, PRBool idsAreUids); PRUint32 GetMessageSize(const char * messageId, PRBool idsAreUids);
PRBool GetSubscribingNow(); PRBool GetSubscribingNow();
PRBool DeathSignalReceived(); PRBool DeathSignalReceived();
@ -224,19 +229,19 @@ public:
PRUnichar * CreatePRUnicharStringFromUTF7(const char * aSourceString); PRUnichar * CreatePRUnicharStringFromUTF7(const char * aSourceString);
void Copy(nsCString &messageList, const char *destinationMailbox, void Copy(const char * messageList, const char *destinationMailbox,
PRBool idsAreUid); PRBool idsAreUid);
void Search(nsCString &searchCriteria, PRBool useUID, void Search(const char * searchCriteria, PRBool useUID,
PRBool notifyHit = PR_TRUE); PRBool notifyHit = PR_TRUE);
// imap commands issued by the parser // imap commands issued by the parser
void Store(nsCString &aMessageList, const char * aMessageData, PRBool void Store(const char * aMessageList, const char * aMessageData, PRBool
aIdsAreUid); aIdsAreUid);
void ProcessStoreFlags(nsCString &messageIds, void ProcessStoreFlags(const char * messageIds,
PRBool idsAreUids, PRBool idsAreUids,
imapMessageFlagsType flags, imapMessageFlagsType flags,
PRBool addFlags); PRBool addFlags);
void Expunge(); void Expunge();
void UidExpunge(const char* messageSet); void UidExpunge(const char* messageSet);
void Close(); void Close();
void Check(); void Check();
void SelectMailbox(const char *mailboxName); void SelectMailbox(const char *mailboxName);
@ -290,7 +295,7 @@ private:
PRBool m_gotFEEventCompletion; PRBool m_gotFEEventCompletion;
PRUint32 m_flags; // used to store flag information PRUint32 m_flags; // used to store flag information
nsCOMPtr<nsIImapUrl> m_runningUrl; // the nsIImapURL that is currently running 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_userName;
char *m_hostName; char *m_hostName;
@ -346,7 +351,6 @@ private:
nsCOMPtr<nsIMsgIncomingServer> m_server; nsCOMPtr<nsIMsgIncomingServer> m_server;
nsCOMPtr<nsIImapIncomingServer> m_imapServer; nsCOMPtr<nsIImapIncomingServer> m_imapServer;
nsCOMPtr<nsIImapLog> m_imapLog;
nsCOMPtr<nsIImapMailFolderSink> m_imapMailFolderSink; nsCOMPtr<nsIImapMailFolderSink> m_imapMailFolderSink;
nsCOMPtr<nsIImapMessageSink> m_imapMessageSink; nsCOMPtr<nsIImapMessageSink> m_imapMessageSink;

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

@ -104,80 +104,6 @@ nsImapProxyBase::~nsImapProxyBase()
NS_IF_RELEASE(m_eventQueue); 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, nsImapExtensionSinkProxy::nsImapExtensionSinkProxy(nsIImapExtensionSink* aImapExtensionSink,
nsIImapProtocol* aProtocol, nsIImapProtocol* aProtocol,
nsIEventQueue* aEventQ, nsIEventQueue* aEventQ,

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

@ -27,7 +27,6 @@
#include "prthread.h" #include "prthread.h"
#include "nsISupports.h" #include "nsISupports.h"
#include "nsIURL.h" #include "nsIURL.h"
#include "nsIImapLog.h"
#include "nsIImapMailFolderSink.h" #include "nsIImapMailFolderSink.h"
#include "nsIImapMessageSink.h" #include "nsIImapMessageSink.h"
#include "nsIImapExtensionSink.h" #include "nsIImapExtensionSink.h"
@ -35,6 +34,8 @@
#include "nsIImapIncomingServer.h" #include "nsIImapIncomingServer.h"
#include "nsImapCore.h" #include "nsImapCore.h"
#include "nsIImapUrl.h" #include "nsIImapUrl.h"
#include "nsIImapMailFolderSink.h"
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
class nsImapProxyBase class nsImapProxyBase
@ -50,24 +51,6 @@ public:
nsIImapProtocol* m_protocol; 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, class nsImapExtensionSinkProxy : public nsIImapExtensionSink,
public nsImapProxyBase public nsImapProxyBase
{ {
@ -166,17 +149,6 @@ struct nsImapEvent : public PLEvent
PRBool m_notifyCompletion; 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 struct nsImapExtensionSinkProxyEvent : nsImapEvent
{ {
nsImapExtensionSinkProxyEvent(nsImapExtensionSinkProxy* aProxy); nsImapExtensionSinkProxyEvent(nsImapExtensionSinkProxy* aProxy);
@ -222,15 +194,15 @@ struct FolderNeedsACLInitializedProxyEvent : nsImapExtensionSinkProxyEvent
struct SetCopyResponseUidProxyEvent : nsImapExtensionSinkProxyEvent struct SetCopyResponseUidProxyEvent : nsImapExtensionSinkProxyEvent
{ {
SetCopyResponseUidProxyEvent(nsImapExtensionSinkProxy* aProxy, SetCopyResponseUidProxyEvent(nsImapExtensionSinkProxy* aProxy,
nsMsgKeyArray* aKeyArray, nsMsgKeyArray* aKeyArray,
const char* msgIdString, const char* msgIdString,
nsIImapUrl * aUr); nsIImapUrl * aUr);
virtual ~SetCopyResponseUidProxyEvent(); virtual ~SetCopyResponseUidProxyEvent();
NS_IMETHOD HandleEvent(); NS_IMETHOD HandleEvent();
nsMsgKeyArray m_copyKeyArray; nsMsgKeyArray m_copyKeyArray;
nsCString m_msgIdString; nsCString m_msgIdString;
nsCOMPtr<nsIImapUrl> m_Url; nsCOMPtr<nsIImapUrl> m_Url;
}; };
struct SetAppendMsgUidProxyEvent : nsImapExtensionSinkProxyEvent struct SetAppendMsgUidProxyEvent : nsImapExtensionSinkProxyEvent

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

@ -2134,7 +2134,7 @@ PRBool nsImapServerResponseParser::msg_fetch_literal(PRBool chunk, PRInt32 origi
PRBool lastChunk = !chunk || (origin + numberOfCharsInThisChunk >= fTotalDownloadSize); PRBool lastChunk = !chunk || (origin + numberOfCharsInThisChunk >= fTotalDownloadSize);
nsIImapUrl::nsImapAction imapAction; nsImapAction imapAction;
fServerConnection.GetCurrentUrl()->GetImapAction(&imapAction); fServerConnection.GetCurrentUrl()->GetImapAction(&imapAction);
if (!lastCRLFwasCRCRLF && if (!lastCRLFwasCRCRLF &&
fServerConnection.GetIOTunnellingEnabled() && fServerConnection.GetIOTunnellingEnabled() &&

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

@ -396,17 +396,17 @@ nsImapService::CopyMessages(nsMsgKeyArray *keys, nsIMsgFolder *srcFolder, nsIStr
nsXPIDLCString msgKey; nsXPIDLCString msgKey;
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
{ {
nsCOMPtr<nsIImapMessageSink> imapMessageSink(do_QueryInterface(folder, &rv)); nsCOMPtr<nsIImapMessageSink> imapMessageSink(do_QueryInterface(folder, &rv));
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
{ {
nsCString messageIds; nsCString messageIds;
AllocateImapUidString(keys->GetArray(), keys->GetSize(), messageIds); AllocateImapUidString(keys->GetArray(), keys->GetSize(), messageIds);
nsCOMPtr<nsIImapUrl> imapUrl; nsCOMPtr<nsIImapUrl> imapUrl;
nsCAutoString urlSpec; nsCAutoString urlSpec;
PRUnichar hierarchySeparator = GetHierarchyDelimiter(folder); PRUnichar hierarchySeparator = GetHierarchyDelimiter(folder);
rv = CreateStartOfImapUrl(getter_AddRefs(imapUrl), folder, aUrlListener, urlSpec, hierarchySeparator); rv = CreateStartOfImapUrl(getter_AddRefs(imapUrl), folder, aUrlListener, urlSpec, hierarchySeparator);
nsIImapUrl::nsImapAction action; nsImapAction action;
if (moveMessage) if (moveMessage)
action = nsIImapUrl::nsImapOnlineToOfflineMove; action = nsIImapUrl::nsImapOnlineToOfflineMove;
else else
@ -417,9 +417,9 @@ nsImapService::CopyMessages(nsMsgKeyArray *keys, nsIMsgFolder *srcFolder, nsIStr
aURL, streamSupport, messageIds.GetBuffer(), PR_TRUE); aURL, streamSupport, messageIds.GetBuffer(), PR_TRUE);
// ### end of copy operation should know how to do the delete.if this is a move // ### 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 got an imap message sink
} // if we decomposed the imap message } // if we decomposed the imap message
return rv; return rv;
} }
@ -492,7 +492,7 @@ NS_IMETHODIMP nsImapService::SaveMessageToDisk(const char *aMessageURI,
NS_IMETHODIMP NS_IMETHODIMP
nsImapService::FetchMessage(nsIImapUrl * aImapUrl, nsImapService::FetchMessage(nsIImapUrl * aImapUrl,
nsIImapUrl::nsImapAction aImapAction, nsImapAction aImapAction,
nsIMsgFolder * aImapMailFolder, nsIMsgFolder * aImapMailFolder,
nsIImapMessageSink * aImapMessage, nsIImapMessageSink * aImapMessage,
nsIURI ** aURL, nsIURI ** aURL,
@ -1118,8 +1118,8 @@ nsresult
nsImapService::SetImapUrlSink(nsIMsgFolder* aMsgFolder, nsImapService::SetImapUrlSink(nsIMsgFolder* aMsgFolder,
nsIImapUrl* aImapUrl) nsIImapUrl* aImapUrl)
{ {
nsresult rv = NS_ERROR_NULL_POINTER; nsresult rv = NS_ERROR_NULL_POINTER;
nsISupports* aInst = nsnull; nsISupports* aInst = nsnull;
nsCOMPtr <nsIMsgIncomingServer> incomingServer; nsCOMPtr <nsIMsgIncomingServer> incomingServer;
nsCOMPtr <nsIImapServerSink> imapServerSink; nsCOMPtr <nsIImapServerSink> imapServerSink;
@ -1134,41 +1134,36 @@ nsImapService::SetImapUrlSink(nsIMsgFolder* aMsgFolder,
if (imapServerSink) if (imapServerSink)
aImapUrl->SetImapServerSink(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), rv = aMsgFolder->QueryInterface(NS_GET_IID(nsIImapMailFolderSink),
(void**)&aInst); (void**)&aInst);
if (NS_SUCCEEDED(rv) && aInst) if (NS_SUCCEEDED(rv) && aInst)
aImapUrl->SetImapMailFolderSink((nsIImapMailFolderSink*) aInst); aImapUrl->SetImapMailFolderSink((nsIImapMailFolderSink*) aInst);
NS_IF_RELEASE (aInst); NS_IF_RELEASE (aInst);
aInst = nsnull; aInst = nsnull;
rv = aMsgFolder->QueryInterface(NS_GET_IID(nsIImapMessageSink), rv = aMsgFolder->QueryInterface(NS_GET_IID(nsIImapMessageSink),
(void**)&aInst); (void**)&aInst);
if (NS_SUCCEEDED(rv) && aInst) if (NS_SUCCEEDED(rv) && aInst)
aImapUrl->SetImapMessageSink((nsIImapMessageSink*) aInst); aImapUrl->SetImapMessageSink((nsIImapMessageSink*) aInst);
NS_IF_RELEASE (aInst); NS_IF_RELEASE (aInst);
aInst = nsnull; aInst = nsnull;
rv = aMsgFolder->QueryInterface(NS_GET_IID(nsIImapExtensionSink), rv = aMsgFolder->QueryInterface(NS_GET_IID(nsIImapExtensionSink),
(void**)&aInst); (void**)&aInst);
if (NS_SUCCEEDED(rv) && aInst) if (NS_SUCCEEDED(rv) && aInst)
aImapUrl->SetImapExtensionSink((nsIImapExtensionSink*) aInst); aImapUrl->SetImapExtensionSink((nsIImapExtensionSink*) aInst);
NS_IF_RELEASE (aInst); NS_IF_RELEASE (aInst);
aInst = nsnull; aInst = nsnull;
rv = aMsgFolder->QueryInterface(NS_GET_IID(nsIImapMiscellaneousSink), rv = aMsgFolder->QueryInterface(NS_GET_IID(nsIImapMiscellaneousSink),
(void**)&aInst); (void**)&aInst);
if (NS_SUCCEEDED(rv) && aInst) if (NS_SUCCEEDED(rv) && aInst)
aImapUrl->SetImapMiscellaneousSink((nsIImapMiscellaneousSink*) aInst); aImapUrl->SetImapMiscellaneousSink((nsIImapMiscellaneousSink*) aInst);
NS_IF_RELEASE (aInst); NS_IF_RELEASE (aInst);
aInst = nsnull; aInst = nsnull;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP

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

@ -65,11 +65,11 @@ public:
nsIURI ** aURL); nsIURI ** aURL);
NS_IMETHOD FetchMessage( NS_IMETHOD FetchMessage(
nsIImapUrl * aImapUrl, nsIImapUrl * aImapUrl,
nsIImapUrl::nsImapAction aImapAction, nsImapAction aImapAction,
nsIMsgFolder * aImapMailFolder, nsIMsgFolder * aImapMailFolder,
nsIImapMessageSink * aImapMessage, nsIImapMessageSink * aImapMessage,
nsIURI ** aURL, nsIURI ** aURL,
nsISupports *aConsumer, nsISupports *aConsumer,
const char *messageIdentifierList, const char *messageIdentifierList,
PRBool messageIdsAreUID); PRBool messageIdsAreUID);
NS_IMETHOD Noop(nsIEventQueue * aClientEventQueue, NS_IMETHOD Noop(nsIEventQueue * aClientEventQueue,

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

@ -62,7 +62,6 @@ nsImapUrl::nsImapUrl()
// ** jt - the following are not ref counted // ** jt - the following are not ref counted
m_copyState = nsnull; m_copyState = nsnull;
m_imapLog = nsnull;
m_fileSpec = nsnull; m_fileSpec = nsnull;
m_imapMailFolderSink = nsnull; m_imapMailFolderSink = nsnull;
m_imapMessageSink = nsnull; m_imapMessageSink = nsnull;
@ -95,25 +94,10 @@ NS_IMPL_ADDREF_INHERITED(nsImapUrl, nsMsgMailNewsUrl)
NS_IMPL_RELEASE_INHERITED(nsImapUrl, nsMsgMailNewsUrl) NS_IMPL_RELEASE_INHERITED(nsImapUrl, nsMsgMailNewsUrl)
NS_INTERFACE_MAP_BEGIN(nsImapUrl)
NS_IMETHODIMP NS_INTERFACE_MAP_ENTRY(nsIImapUrl)
nsImapUrl::QueryInterface(REFNSIID aIID, void** aInstancePtr) NS_INTERFACE_MAP_ENTRY(nsIMsgMessageUrl)
{ NS_INTERFACE_MAP_END_INHERITING(nsMsgMailNewsUrl)
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);
}
//////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////
// Begin nsIImapUrl specific support // Begin nsIImapUrl specific support
@ -135,22 +119,16 @@ NS_IMETHODIMP nsImapUrl::GetRequiredImapState(nsImapState * aImapUrlState)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsImapUrl::GetImapLog(nsIImapLog ** aImapLog) NS_IMETHODIMP nsImapUrl::GetImapAction(nsImapAction * aImapAction)
{ {
if (aImapLog) *aImapAction = m_imapAction;
{
*aImapLog = m_imapLog;
NS_IF_ADDREF(*aImapLog );
}
return NS_OK; 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_imapAction = aImapAction;
m_imapLog = aImapLog; return NS_OK;
return NS_OK;
} }
NS_IMETHODIMP nsImapUrl::GetImapMailFolderSink(nsIImapMailFolderSink ** NS_IMETHODIMP nsImapUrl::GetImapMailFolderSink(nsIImapMailFolderSink **
@ -212,7 +190,6 @@ NS_IMETHODIMP nsImapUrl::SetImapServerSink(nsIImapServerSink * aImapServerSink)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsImapUrl::GetImapExtensionSink(nsIImapExtensionSink ** aImapExtensionSink) NS_IMETHODIMP nsImapUrl::GetImapExtensionSink(nsIImapExtensionSink ** aImapExtensionSink)
{ {
if (aImapExtensionSink) if (aImapExtensionSink)
@ -284,20 +261,21 @@ nsresult nsImapUrl::ParseUrl()
return NS_OK; 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... // this method should only be called from the imap thread...
// o.t. add lock protection.. // o.t. add lock protection..
if (nsnull == aResult || !m_searchCriteriaString) if (nsnull == aResult || !m_searchCriteriaString)
return NS_ERROR_NULL_POINTER; return NS_ERROR_NULL_POINTER;
aResult->Assign(m_searchCriteriaString); *aResult = nsCRT::strdup(m_searchCriteriaString);
return NS_OK; return NS_OK;
} }
// this method gets called from the UI thread and the imap thread // 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); nsAutoCMonitor(this);
nsCAutoString newStr;
if (nsnull == aResult || !m_listOfMessageIds) if (nsnull == aResult || !m_listOfMessageIds)
return NS_ERROR_NULL_POINTER; return NS_ERROR_NULL_POINTER;
@ -319,7 +297,8 @@ NS_IMETHODIMP nsImapUrl::CreateListOfMessageIdsString(nsCString *aResult)
if (wherePart) if (wherePart)
bytesToCopy = PR_MIN(bytesToCopy, wherePart - m_listOfMessageIds); bytesToCopy = PR_MIN(bytesToCopy, wherePart - m_listOfMessageIds);
aResult->Assign(m_listOfMessageIds, bytesToCopy); newStr.Assign(m_listOfMessageIds, bytesToCopy);
*aResult = newStr.ToNewCString();
return NS_OK; return NS_OK;
} }

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

@ -28,7 +28,12 @@
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "nsMsgMailNewsUrl.h" #include "nsMsgMailNewsUrl.h"
#include "nsIMsgIncomingServer.h" #include "nsIMsgIncomingServer.h"
#include "nsIImapMailFolderSink.h"
#include "nsIImapServerSink.h" #include "nsIImapServerSink.h"
#include "nsIImapMessageSink.h"
#include "nsIImapExtensionSink.h"
#include "nsIImapMiscellaneousSink.h"
#include "nsXPIDLString.h" #include "nsXPIDLString.h"
class nsImapUrl : public nsIImapUrl, public nsMsgMailNewsUrl, public nsIMsgMessageUrl class nsImapUrl : public nsIImapUrl, public nsMsgMailNewsUrl, public nsIMsgMessageUrl
@ -43,68 +48,13 @@ public:
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// we support the nsIImapUrl interface // we support the nsIImapUrl interface
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
NS_DECL_NSIIMAPURL
NS_IMETHOD Initialize(); // nsIMsgMailNewsUrl override
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);
NS_IMETHOD IsUrlType(PRUint32 type, PRBool *isType); NS_IMETHOD IsUrlType(PRUint32 type, PRBool *isType);
// nsIMsgMessageUrl // nsIMsgMessageUrl
NS_DECL_NSIMSGMESSAGEURL NS_DECL_NSIMSGMESSAGEURL
// nsImapUrl // nsImapUrl
nsImapUrl(); nsImapUrl();
@ -127,11 +77,11 @@ protected:
void ParseMsgFlags(); void ParseMsgFlags();
void ParseListOfMessageIds(); void ParseListOfMessageIds();
char *m_sourceCanonicalFolderPathSubString; char *m_sourceCanonicalFolderPathSubString;
char *m_destinationCanonicalFolderPathSubString; char *m_destinationCanonicalFolderPathSubString;
char *m_tokenPlaceHolder; char *m_tokenPlaceHolder;
char *m_urlidSubString; char *m_urlidSubString;
char m_onlineSubDirSeparator; char m_onlineSubDirSeparator;
char *m_searchCriteriaString; // should we use m_search, or is this special? char *m_searchCriteriaString; // should we use m_search, or is this special?
PRBool m_validUrl; PRBool m_validUrl;
@ -147,28 +97,27 @@ protected:
imapMessageFlagsType m_flags; imapMessageFlagsType m_flags;
nsImapAction m_imapAction; nsImapAction m_imapAction;
// ** jt -- I am not usring nsCOMPtr here because I don't know when the // ** 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 // usr get deleted; netlib has a strange manipulation over the transport
// layer; the runningUrl can get swapped; using nsCOMPtr can cause object // layer; the runningUrl can get swapped; using nsCOMPtr can cause object
// never gets freed. // never gets freed.
nsIImapLog* m_imapLog; // not ref counted nsIImapMailFolderSink* m_imapMailFolderSink; // not ref counted
nsIImapMailFolderSink* m_imapMailFolderSink; // not ref counted nsIImapMessageSink* m_imapMessageSink; // not ref counted
nsIImapMessageSink* m_imapMessageSink; // not ref counted nsIImapExtensionSink* m_imapExtensionSink; // not ref counted
nsIImapExtensionSink* m_imapExtensionSink; // not ref counted nsIImapMiscellaneousSink* m_imapMiscellaneousSink; // not ref counted
nsIImapMiscellaneousSink* m_imapMiscellaneousSink; // not ref counted
// I AM using nsCOMPtr because I suspect the above problem has gone away. // I AM using nsCOMPtr because I suspect the above problem has gone away.
nsCOMPtr <nsIImapServerSink> m_imapServerSink; nsCOMPtr <nsIImapServerSink> m_imapServerSink;
// online message copy support; i don't have a better solution yet // online message copy support; i don't have a better solution yet
nsCOMPtr <nsISupports> m_copyState; // now, refcounted. nsCOMPtr <nsISupports> m_copyState; // now, refcounted.
nsIFileSpec* m_fileSpec; nsIFileSpec* m_fileSpec;
nsCOMPtr<nsIImapMockChannel> m_mockChannel; nsCOMPtr<nsIImapMockChannel> m_mockChannel;
// used by save message to disk // used by save message to disk
nsCOMPtr<nsIFileSpec> m_messageFileSpec; nsCOMPtr<nsIFileSpec> m_messageFileSpec;
PRBool m_addDummyEnvelope; PRBool m_addDummyEnvelope;
PRBool m_canonicalLineEnding; // CRLF PRBool m_canonicalLineEnding; // CRLF
}; };
#endif /* nsImapUrl_h___ */ #endif /* nsImapUrl_h___ */

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

@ -46,12 +46,10 @@
#include "nsIImapUrl.h" #include "nsIImapUrl.h"
#include "nsIImapProtocol.h" #include "nsIImapProtocol.h"
#include "nsIImapLog.h"
#include "nsIMsgIncomingServer.h" #include "nsIMsgIncomingServer.h"
#include "nsIImapIncomingServer.h" #include "nsIImapIncomingServer.h"
#include "nsIImapService.h" #include "nsIImapService.h"
#include "nsIMsgAccountManager.h" #include "nsIMsgAccountManager.h"
#include "nsIImapLog.h"
#include "nsIImapMailFolderSink.h" #include "nsIImapMailFolderSink.h"
#include "nsIImapMessageSink.h" #include "nsIImapMessageSink.h"
#include "nsIImapExtensionSink.h" #include "nsIImapExtensionSink.h"
@ -133,8 +131,7 @@ static NS_DEFINE_CID(kCImapResource, NS_IMAPRESOURCE_CID);
#define DEFAULT_PORT IMAP_PORT #define DEFAULT_PORT IMAP_PORT
#define DEFAULT_URL_TYPE "imap://" /* do NOT change this value until netlib re-write is done...*/ #define DEFAULT_URL_TYPE "imap://" /* do NOT change this value until netlib re-write is done...*/
class nsIMAP4TestDriver : public nsIUrlListener, class nsIMAP4TestDriver : public nsIUrlListener
public nsIImapLog
{ {
public: public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
@ -143,9 +140,6 @@ public:
NS_IMETHOD OnStartRunningUrl(nsIURI * aUrl); NS_IMETHOD OnStartRunningUrl(nsIURI * aUrl);
NS_IMETHOD OnStopRunningUrl(nsIURI * aUrl, nsresult aExitCode); NS_IMETHOD OnStopRunningUrl(nsIURI * aUrl, nsresult aExitCode);
// nsIImapLog support
NS_IMETHOD HandleImapLogData (const char * aLogData);
nsIMAP4TestDriver(nsIEventQueue *queue); nsIMAP4TestDriver(nsIEventQueue *queue);
virtual ~nsIMAP4TestDriver(); virtual ~nsIMAP4TestDriver();
@ -234,10 +228,6 @@ nsIMAP4TestDriver::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{ {
*aInstancePtr = (void*)(nsIUrlListener*)this; *aInstancePtr = (void*)(nsIUrlListener*)this;
} }
else if (aIID.Equals(NS_GET_IID(nsIImapLog)))
{
*aInstancePtr = (void*)(nsIImapLog*)this;
}
else if (aIID.Equals(kISupportsIID)) else if (aIID.Equals(kISupportsIID))
{ {
*aInstancePtr = (void*)(nsISupports*)(nsIUrlListener*)this; *aInstancePtr = (void*)(nsISupports*)(nsIUrlListener*)this;
@ -377,18 +367,6 @@ nsresult nsIMAP4TestDriver::OnStopRunningUrl(nsIURI * aUrl, nsresult aExitCode)
return NS_OK; 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() nsresult nsIMAP4TestDriver::OnExit()
{ {
@ -522,7 +500,6 @@ nsresult nsIMAP4TestDriver::OnRunIMAPCommand()
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_url); nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_url);
if (NS_SUCCEEDED(rv) && m_url) if (NS_SUCCEEDED(rv) && m_url)
{ {
m_url->SetImapLog(this);
rv = mailnewsurl->SetSpec(m_urlString); // reset spec rv = mailnewsurl->SetSpec(m_urlString); // reset spec
mailnewsurl->RegisterListener(this); mailnewsurl->RegisterListener(this);