зеркало из 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,6 +23,7 @@ DEPTH=..\..\..
|
||||||
MODULE= msgimap
|
MODULE= msgimap
|
||||||
|
|
||||||
XPIDLSRCS = \
|
XPIDLSRCS = \
|
||||||
|
.\nsIImapUrl.idl \
|
||||||
.\nsIImapServerSink.idl \
|
.\nsIImapServerSink.idl \
|
||||||
.\nsIImapMessageSink.idl \
|
.\nsIImapMessageSink.idl \
|
||||||
.\nsIImapIncomingServer.idl \
|
.\nsIImapIncomingServer.idl \
|
||||||
|
@ -39,7 +40,6 @@ XPIDLSRCS = \
|
||||||
## exports
|
## exports
|
||||||
|
|
||||||
EXPORTS = \
|
EXPORTS = \
|
||||||
nsIImapUrl.h \
|
|
||||||
nsIImapLog.h \
|
nsIImapLog.h \
|
||||||
nsIIMAPHostSessionList.h \
|
nsIIMAPHostSessionList.h \
|
||||||
nsIImapExtensionSink.h \
|
nsIImapExtensionSink.h \
|
||||||
|
|
|
@ -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"
|
||||||
|
|
||||||
|
|
|
@ -2704,14 +2704,14 @@ nsImapMailFolder::OnlineCopyCompleted(nsIImapProtocol *aProtocol, ImapOnlineCopy
|
||||||
rv = aProtocol->GetRunningImapURL(getter_AddRefs(imapUrl));
|
rv = aProtocol->GetRunningImapURL(getter_AddRefs(imapUrl));
|
||||||
if (NS_FAILED(rv) || !imapUrl) return NS_ERROR_FAILURE;
|
if (NS_FAILED(rv) || !imapUrl) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
nsIImapUrl::nsImapAction action;
|
nsImapAction action;
|
||||||
rv = imapUrl->GetImapAction(&action);
|
rv = imapUrl->GetImapAction(&action);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
if (action == nsIImapUrl::nsImapOnlineToOfflineMove)
|
if (action == nsIImapUrl::nsImapOnlineToOfflineMove)
|
||||||
{
|
{
|
||||||
nsCString messageIds;
|
nsXPIDLCString messageIds;
|
||||||
rv = imapUrl->CreateListOfMessageIdsString(&messageIds);
|
rv = imapUrl->CreateListOfMessageIdsString(getter_Copies(messageIds));
|
||||||
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
nsCOMPtr<nsIEventQueue> queue;
|
nsCOMPtr<nsIEventQueue> queue;
|
||||||
|
@ -2728,13 +2728,13 @@ nsImapMailFolder::OnlineCopyCompleted(nsIImapProtocol *aProtocol, ImapOnlineCopy
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
rv = imapService->AddMessageFlags(queue, this, nsnull, nsnull,
|
rv = imapService->AddMessageFlags(queue, this, nsnull, nsnull,
|
||||||
messageIds.GetBuffer(),
|
messageIds,
|
||||||
kImapMsgDeletedFlag,
|
kImapMsgDeletedFlag,
|
||||||
PR_TRUE);
|
PR_TRUE);
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
nsMsgKeyArray affectedMessages;
|
nsMsgKeyArray affectedMessages;
|
||||||
char *keyTokenString = messageIds.ToNewCString();
|
char *keyTokenString = nsCRT::strdup(messageIds);
|
||||||
ParseUidString(keyTokenString, affectedMessages);
|
ParseUidString(keyTokenString, affectedMessages);
|
||||||
if (mDatabase)
|
if (mDatabase)
|
||||||
mDatabase->DeleteMessages(&affectedMessages,NULL);
|
mDatabase->DeleteMessages(&affectedMessages,NULL);
|
||||||
|
@ -2812,12 +2812,12 @@ nsImapMailFolder::NotifyMessageFlags(PRUint32 flags, nsMsgKey msgKey)
|
||||||
|
|
||||||
if(NS_SUCCEEDED(rv) && dbHdr)
|
if(NS_SUCCEEDED(rv) && dbHdr)
|
||||||
{
|
{
|
||||||
|
|
||||||
mDatabase->MarkHdrRead(dbHdr, (flags & kImapMsgSeenFlag) != 0, nsnull);
|
mDatabase->MarkHdrRead(dbHdr, (flags & kImapMsgSeenFlag) != 0, nsnull);
|
||||||
mDatabase->MarkHdrReplied(dbHdr, (flags & kImapMsgAnsweredFlag) != 0, nsnull);
|
mDatabase->MarkHdrReplied(dbHdr, (flags & kImapMsgAnsweredFlag) != 0, nsnull);
|
||||||
mDatabase->MarkHdrMarked(dbHdr, (flags & kImapMsgFlaggedFlag) != 0, nsnull);
|
mDatabase->MarkHdrMarked(dbHdr, (flags & kImapMsgFlaggedFlag) != 0, nsnull);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3024,7 +3024,7 @@ nsImapMailFolder::OnStopRunningUrl(nsIURI *aUrl, nsresult aExitCode)
|
||||||
|
|
||||||
if (imapUrl)
|
if (imapUrl)
|
||||||
{
|
{
|
||||||
nsIImapUrl::nsImapAction imapAction = nsIImapUrl::nsImapTest;
|
nsImapAction imapAction = nsIImapUrl::nsImapTest;
|
||||||
imapUrl->GetImapAction(&imapAction);
|
imapUrl->GetImapAction(&imapAction);
|
||||||
switch(imapAction)
|
switch(imapAction)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -434,18 +434,6 @@ nsImapProtocol::SetupSinkProxy()
|
||||||
NS_ASSERTION(m_sinkEventQueue && m_thread, "fatal... null sink event queue or thread");
|
NS_ASSERTION(m_sinkEventQueue && m_thread, "fatal... null sink event queue or thread");
|
||||||
nsresult res;
|
nsresult res;
|
||||||
|
|
||||||
if (!m_imapLog)
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsIImapLog> aImapLog;
|
|
||||||
res = m_runningUrl->GetImapLog(getter_AddRefs(aImapLog));
|
|
||||||
if (NS_SUCCEEDED(res) && aImapLog)
|
|
||||||
{
|
|
||||||
nsImapLogProxy * alog = new nsImapLogProxy (aImapLog, this,
|
|
||||||
m_sinkEventQueue, m_thread);
|
|
||||||
m_imapLog = do_QueryInterface(alog);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIProxyObjectManager> proxyManager(do_GetService(kProxyObjectManagerCID));
|
nsCOMPtr<nsIProxyObjectManager> proxyManager(do_GetService(kProxyObjectManagerCID));
|
||||||
if (proxyManager) // if we don't get one of these are as good as dead...
|
if (proxyManager) // if we don't get one of these are as good as dead...
|
||||||
{
|
{
|
||||||
|
@ -705,15 +693,11 @@ NS_IMETHODIMP nsImapProtocol::Run()
|
||||||
me->m_sinkEventQueue = null_nsCOMPtr();
|
me->m_sinkEventQueue = null_nsCOMPtr();
|
||||||
me->m_eventQueue = null_nsCOMPtr();
|
me->m_eventQueue = null_nsCOMPtr();
|
||||||
me->m_server = null_nsCOMPtr();
|
me->m_server = null_nsCOMPtr();
|
||||||
me->m_imapLog = null_nsCOMPtr();
|
|
||||||
me->m_imapMailFolderSink = null_nsCOMPtr();
|
me->m_imapMailFolderSink = null_nsCOMPtr();
|
||||||
me->m_imapExtensionSink = null_nsCOMPtr();
|
me->m_imapExtensionSink = null_nsCOMPtr();
|
||||||
me->m_imapMessageSink = null_nsCOMPtr();
|
me->m_imapMessageSink = null_nsCOMPtr();
|
||||||
me->m_imapMiscellaneousSink = null_nsCOMPtr();
|
me->m_imapMiscellaneousSink = null_nsCOMPtr();
|
||||||
m_iThread = null_nsCOMPtr();
|
m_iThread = null_nsCOMPtr();
|
||||||
|
|
||||||
//this is bogus, we need to find the leak
|
|
||||||
//NS_RELEASE(me);
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -830,7 +814,7 @@ nsImapProtocol::PseudoInterruptMsgLoad(nsIImapUrl *aImapUrl, PRBool *interrupted
|
||||||
|
|
||||||
if (m_runningUrl)
|
if (m_runningUrl)
|
||||||
{
|
{
|
||||||
nsIImapUrl::nsImapAction imapAction;
|
nsImapAction imapAction;
|
||||||
m_runningUrl->GetImapAction(&imapAction);
|
m_runningUrl->GetImapAction(&imapAction);
|
||||||
|
|
||||||
if (imapAction == nsIImapUrl::nsImapMsgFetch)
|
if (imapAction == nsIImapUrl::nsImapMsgFetch)
|
||||||
|
@ -1107,7 +1091,7 @@ PRBool nsImapProtocol::ProcessCurrentURL()
|
||||||
{
|
{
|
||||||
if (m_runningUrl)
|
if (m_runningUrl)
|
||||||
FindMailboxesIfNecessary();
|
FindMailboxesIfNecessary();
|
||||||
nsIImapUrl::nsImapState imapState;
|
nsImapState imapState;
|
||||||
if (m_runningUrl)
|
if (m_runningUrl)
|
||||||
m_runningUrl->GetRequiredImapState(&imapState);
|
m_runningUrl->GetRequiredImapState(&imapState);
|
||||||
if (imapState == nsIImapUrl::nsImapAuthenticatedState)
|
if (imapState == nsIImapUrl::nsImapAuthenticatedState)
|
||||||
|
@ -1364,7 +1348,7 @@ nsresult nsImapProtocol::LoadUrl(nsIURI * aURL, nsISupports * aConsumer)
|
||||||
m_lastActiveTime = PR_Now();
|
m_lastActiveTime = PR_Now();
|
||||||
if (m_channel && m_runningUrl)
|
if (m_channel && m_runningUrl)
|
||||||
{
|
{
|
||||||
nsIImapUrl::nsImapAction imapAction;
|
nsImapAction imapAction;
|
||||||
m_runningUrl->GetImapAction(&imapAction);
|
m_runningUrl->GetImapAction(&imapAction);
|
||||||
|
|
||||||
// if we're running a select or delete all, do a noop first.
|
// if we're running a select or delete all, do a noop first.
|
||||||
|
@ -1453,7 +1437,7 @@ NS_IMETHODIMP nsImapProtocol::CanHandleUrl(nsIImapUrl * aImapUrl,
|
||||||
}
|
}
|
||||||
else if (isBusy)
|
else if (isBusy)
|
||||||
{
|
{
|
||||||
nsIImapUrl::nsImapState curUrlImapState;
|
nsImapState curUrlImapState;
|
||||||
m_runningUrl->GetRequiredImapState(&curUrlImapState);
|
m_runningUrl->GetRequiredImapState(&curUrlImapState);
|
||||||
if (curUrlImapState == nsIImapUrl::nsImapSelectedState)
|
if (curUrlImapState == nsIImapUrl::nsImapSelectedState)
|
||||||
{
|
{
|
||||||
|
@ -1462,7 +1446,7 @@ NS_IMETHODIMP nsImapProtocol::CanHandleUrl(nsIImapUrl * aImapUrl,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIImapUrl::nsImapState imapState;
|
nsImapState imapState;
|
||||||
aImapUrl->GetRequiredImapState(&imapState);
|
aImapUrl->GetRequiredImapState(&imapState);
|
||||||
|
|
||||||
PRBool isSelectedStateUrl = imapState ==
|
PRBool isSelectedStateUrl = imapState ==
|
||||||
|
@ -1662,9 +1646,8 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
case nsIImapUrl::nsImapSaveMessageToDisk:
|
case nsIImapUrl::nsImapSaveMessageToDisk:
|
||||||
case nsIImapUrl::nsImapMsgFetch:
|
case nsIImapUrl::nsImapMsgFetch:
|
||||||
{
|
{
|
||||||
nsCString messageIdString;
|
nsXPIDLCString messageIdString;
|
||||||
|
m_runningUrl->CreateListOfMessageIdsString(getter_Copies(messageIdString));
|
||||||
m_runningUrl->CreateListOfMessageIdsString(&messageIdString);
|
|
||||||
// we dont want to send the flags back in a group
|
// we dont want to send the flags back in a group
|
||||||
// GetServerStateParser().ResetFlagInfo(0);
|
// GetServerStateParser().ResetFlagInfo(0);
|
||||||
if (HandlingMultipleMessages(messageIdString))
|
if (HandlingMultipleMessages(messageIdString))
|
||||||
|
@ -1694,7 +1677,7 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
// We actually want a specific MIME part of the message.
|
// We actually want a specific MIME part of the message.
|
||||||
// The Body Shell will generate it, even though we haven't downloaded it yet.
|
// The Body Shell will generate it, even though we haven't downloaded it yet.
|
||||||
|
|
||||||
#ifdef DOING_MPOD
|
#ifdef DOING_MPOD
|
||||||
IMAP_ContentModifiedType modType = GetShowAttachmentsInline() ?
|
IMAP_ContentModifiedType modType = GetShowAttachmentsInline() ?
|
||||||
IMAP_CONTENT_MODIFIED_VIEW_INLINE :
|
IMAP_CONTENT_MODIFIED_VIEW_INLINE :
|
||||||
IMAP_CONTENT_MODIFIED_VIEW_AS_LINKS;
|
IMAP_CONTENT_MODIFIED_VIEW_AS_LINKS;
|
||||||
|
@ -1720,7 +1703,7 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
foundShell->Generate(imappart);
|
foundShell->Generate(imappart);
|
||||||
GetServerStateParser().UseCachedShell(NULL);
|
GetServerStateParser().UseCachedShell(NULL);
|
||||||
}
|
}
|
||||||
#endif // DOING_MPOD
|
#endif // DOING_MPOD
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1738,7 +1721,7 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
// or if we are required to get the whole thing. Some instances where we are allowed
|
// or if we are required to get the whole thing. Some instances where we are allowed
|
||||||
// to do it by parts: when viewing a message, or its source
|
// to do it by parts: when viewing a message, or its source
|
||||||
// Some times when we're NOT allowed: when forwarding a message, saving it, moving it, etc.
|
// Some times when we're NOT allowed: when forwarding a message, saving it, moving it, etc.
|
||||||
#ifdef DOING_MPOD
|
#ifdef DOING_MPOD
|
||||||
PRBool allowedToBreakApart = (ce && !DeathSignalReceived()) ? ce->URL_s->allow_content_change : PR_FALSE;
|
PRBool allowedToBreakApart = (ce && !DeathSignalReceived()) ? ce->URL_s->allow_content_change : PR_FALSE;
|
||||||
|
|
||||||
if (gMIMEOnDemand &&
|
if (gMIMEOnDemand &&
|
||||||
|
@ -1777,7 +1760,7 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
Bodystructure(messageIdString, bMessageIdsAreUids);
|
Bodystructure(messageIdString, bMessageIdsAreUids);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif // DOING_MPOD
|
#endif // DOING_MPOD
|
||||||
{
|
{
|
||||||
// Not doing bodystructure. Fetch the whole thing, and try to do
|
// Not doing bodystructure. Fetch the whole thing, and try to do
|
||||||
// it in chunks.
|
// it in chunks.
|
||||||
|
@ -1798,8 +1781,8 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
break;
|
break;
|
||||||
case nsIImapUrl::nsImapMsgHeader:
|
case nsIImapUrl::nsImapMsgHeader:
|
||||||
{
|
{
|
||||||
nsCString messageIds;
|
nsXPIDLCString messageIds;
|
||||||
m_runningUrl->CreateListOfMessageIdsString(&messageIds);
|
m_runningUrl->CreateListOfMessageIdsString(getter_Copies(messageIds));
|
||||||
|
|
||||||
// we don't want to send the flags back in a group
|
// we don't want to send the flags back in a group
|
||||||
// GetServerStateParser().ResetFlagInfo(0);
|
// GetServerStateParser().ResetFlagInfo(0);
|
||||||
|
@ -1810,28 +1793,27 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
break;
|
break;
|
||||||
case nsIImapUrl::nsImapSearch:
|
case nsIImapUrl::nsImapSearch:
|
||||||
{
|
{
|
||||||
nsCString searchCriteriaString;
|
nsXPIDLCString searchCriteriaString;
|
||||||
m_runningUrl->CreateSearchCriteriaString(&searchCriteriaString);
|
m_runningUrl->CreateSearchCriteriaString(getter_Copies(searchCriteriaString));
|
||||||
Search(searchCriteriaString, bMessageIdsAreUids);
|
Search(searchCriteriaString, bMessageIdsAreUids);
|
||||||
// drop the results on the floor for now
|
// drop the results on the floor for now
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case nsIImapUrl::nsImapDeleteMsg:
|
case nsIImapUrl::nsImapDeleteMsg:
|
||||||
{
|
{
|
||||||
nsCString messageIdString;
|
nsXPIDLCString messageIdString;
|
||||||
|
|
||||||
m_runningUrl->CreateListOfMessageIdsString(&messageIdString);
|
m_runningUrl->CreateListOfMessageIdsString(getter_Copies(messageIdString));
|
||||||
if (HandlingMultipleMessages(messageIdString))
|
if (HandlingMultipleMessages(messageIdString))
|
||||||
ProgressEventFunctionUsingId (IMAP_DELETING_MESSAGES);
|
ProgressEventFunctionUsingId (IMAP_DELETING_MESSAGES);
|
||||||
else
|
else
|
||||||
ProgressEventFunctionUsingId(IMAP_DELETING_MESSAGE);
|
ProgressEventFunctionUsingId(IMAP_DELETING_MESSAGE);
|
||||||
Store(messageIdString, "+FLAGS (\\Deleted)",
|
|
||||||
bMessageIdsAreUids);
|
Store(messageIdString, "+FLAGS (\\Deleted)", bMessageIdsAreUids);
|
||||||
|
|
||||||
if (GetServerStateParser().LastCommandSuccessful())
|
if (GetServerStateParser().LastCommandSuccessful())
|
||||||
{
|
{
|
||||||
//delete_message_struct *deleteMsg = (delete_message_struct *) PR_Malloc (sizeof(delete_message_struct));
|
//delete_message_struct *deleteMsg = (delete_message_struct *) PR_Malloc (sizeof(delete_message_struct));
|
||||||
|
|
||||||
// convert name back from utf7
|
// convert name back from utf7
|
||||||
utf_name_struct *nameStruct = (utf_name_struct *) PR_Malloc(sizeof(utf_name_struct));
|
utf_name_struct *nameStruct = (utf_name_struct *) PR_Malloc(sizeof(utf_name_struct));
|
||||||
char *canonicalName = NULL;
|
char *canonicalName = NULL;
|
||||||
|
@ -1858,9 +1840,8 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
uint32 numberOfMessages = GetServerStateParser().NumberOfMessages();
|
uint32 numberOfMessages = GetServerStateParser().NumberOfMessages();
|
||||||
if (numberOfMessages)
|
if (numberOfMessages)
|
||||||
{
|
{
|
||||||
nsCString messageIdString("1:*");
|
|
||||||
|
|
||||||
Store(messageIdString, "+FLAGS.SILENT (\\Deleted)",
|
Store("1:*", "+FLAGS.SILENT (\\Deleted)",
|
||||||
PR_FALSE); // use sequence #'s
|
PR_FALSE); // use sequence #'s
|
||||||
|
|
||||||
if (GetServerStateParser().LastCommandSuccessful())
|
if (GetServerStateParser().LastCommandSuccessful())
|
||||||
|
@ -1895,8 +1876,8 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
break;
|
break;
|
||||||
case nsIImapUrl::nsImapAddMsgFlags:
|
case nsIImapUrl::nsImapAddMsgFlags:
|
||||||
{
|
{
|
||||||
nsCString messageIdString;
|
nsXPIDLCString messageIdString;
|
||||||
m_runningUrl->CreateListOfMessageIdsString(&messageIdString);
|
m_runningUrl->CreateListOfMessageIdsString(getter_Copies(messageIdString));
|
||||||
|
|
||||||
ProcessStoreFlags(messageIdString, bMessageIdsAreUids,
|
ProcessStoreFlags(messageIdString, bMessageIdsAreUids,
|
||||||
msgFlags, PR_TRUE);
|
msgFlags, PR_TRUE);
|
||||||
|
@ -1915,8 +1896,8 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
break;
|
break;
|
||||||
case nsIImapUrl::nsImapSubtractMsgFlags:
|
case nsIImapUrl::nsImapSubtractMsgFlags:
|
||||||
{
|
{
|
||||||
nsCString messageIdString;
|
nsXPIDLCString messageIdString;
|
||||||
m_runningUrl->CreateListOfMessageIdsString(&messageIdString);
|
m_runningUrl->CreateListOfMessageIdsString(getter_Copies(messageIdString));
|
||||||
|
|
||||||
ProcessStoreFlags(messageIdString, bMessageIdsAreUids,
|
ProcessStoreFlags(messageIdString, bMessageIdsAreUids,
|
||||||
msgFlags, PR_FALSE);
|
msgFlags, PR_FALSE);
|
||||||
|
@ -1925,8 +1906,8 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
break;
|
break;
|
||||||
case nsIImapUrl::nsImapSetMsgFlags:
|
case nsIImapUrl::nsImapSetMsgFlags:
|
||||||
{
|
{
|
||||||
nsCString messageIdString;
|
nsXPIDLCString messageIdString;
|
||||||
m_runningUrl->CreateListOfMessageIdsString(&messageIdString);
|
m_runningUrl->CreateListOfMessageIdsString(getter_Copies(messageIdString));
|
||||||
|
|
||||||
ProcessStoreFlags(messageIdString, bMessageIdsAreUids,
|
ProcessStoreFlags(messageIdString, bMessageIdsAreUids,
|
||||||
msgFlags, PR_TRUE);
|
msgFlags, PR_TRUE);
|
||||||
|
@ -1940,10 +1921,9 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
case nsIImapUrl::nsImapOnlineCopy:
|
case nsIImapUrl::nsImapOnlineCopy:
|
||||||
case nsIImapUrl::nsImapOnlineMove:
|
case nsIImapUrl::nsImapOnlineMove:
|
||||||
{
|
{
|
||||||
nsCString messageIdString;
|
nsXPIDLCString messageIdString;
|
||||||
m_runningUrl->CreateListOfMessageIdsString(&messageIdString);
|
m_runningUrl->CreateListOfMessageIdsString(getter_Copies(messageIdString));
|
||||||
char *destinationMailbox =
|
char *destinationMailbox = OnCreateServerDestinationFolderPathString();
|
||||||
OnCreateServerDestinationFolderPathString();
|
|
||||||
|
|
||||||
if (destinationMailbox)
|
if (destinationMailbox)
|
||||||
{
|
{
|
||||||
|
@ -1960,6 +1940,7 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
else
|
else
|
||||||
ProgressEventFunctionUsingIdWithString (IMAP_COPYING_MESSAGE_TO, destinationMailbox);
|
ProgressEventFunctionUsingIdWithString (IMAP_COPYING_MESSAGE_TO, destinationMailbox);
|
||||||
}
|
}
|
||||||
|
|
||||||
Copy(messageIdString, destinationMailbox, bMessageIdsAreUids);
|
Copy(messageIdString, destinationMailbox, bMessageIdsAreUids);
|
||||||
PR_FREEIF( destinationMailbox);
|
PR_FREEIF( destinationMailbox);
|
||||||
ImapOnlineCopyState copyState;
|
ImapOnlineCopyState copyState;
|
||||||
|
@ -1994,8 +1975,8 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
case nsIImapUrl::nsImapOnlineToOfflineCopy:
|
case nsIImapUrl::nsImapOnlineToOfflineCopy:
|
||||||
case nsIImapUrl::nsImapOnlineToOfflineMove:
|
case nsIImapUrl::nsImapOnlineToOfflineMove:
|
||||||
{
|
{
|
||||||
nsCString messageIdString;
|
nsXPIDLCString messageIdString;
|
||||||
nsresult rv = m_runningUrl->CreateListOfMessageIdsString(&messageIdString);
|
nsresult rv = m_runningUrl->CreateListOfMessageIdsString(getter_Copies(messageIdString));
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
SetProgressString(IMAP_FOLDER_RECEIVING_MESSAGE_OF);
|
SetProgressString(IMAP_FOLDER_RECEIVING_MESSAGE_OF);
|
||||||
|
@ -2018,8 +1999,7 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
if (GetServerStateParser().LastCommandSuccessful() &&
|
if (GetServerStateParser().LastCommandSuccessful() &&
|
||||||
(m_imapAction == nsIImapUrl::nsImapOnlineToOfflineMove))
|
(m_imapAction == nsIImapUrl::nsImapOnlineToOfflineMove))
|
||||||
{
|
{
|
||||||
Store(messageIdString, "+FLAGS (\\Deleted)",
|
Store(messageIdString, "+FLAGS (\\Deleted)",bMessageIdsAreUids);
|
||||||
bMessageIdsAreUids);
|
|
||||||
if (GetServerStateParser().LastCommandSuccessful())
|
if (GetServerStateParser().LastCommandSuccessful())
|
||||||
copyStatus = ImapOnlineCopyStateType::kSuccessfulDelete;
|
copyStatus = ImapOnlineCopyStateType::kSuccessfulDelete;
|
||||||
else
|
else
|
||||||
|
@ -2032,6 +2012,7 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
else
|
else
|
||||||
HandleMemoryFailure();
|
HandleMemoryFailure();
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (GetServerStateParser().LastCommandSuccessful() && !uidValidityOk)
|
if (GetServerStateParser().LastCommandSuccessful() && !uidValidityOk)
|
||||||
ProcessMailboxUpdate(PR_FALSE); // handle uidvalidity change
|
ProcessMailboxUpdate(PR_FALSE); // handle uidvalidity change
|
||||||
|
@ -2042,7 +2023,6 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
}
|
}
|
||||||
else if (!DeathSignalReceived())
|
else if (!DeathSignalReceived())
|
||||||
HandleMemoryFailure();
|
HandleMemoryFailure();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsImapProtocol::AutoSubscribeToMailboxIfNecessary(const char *mailboxName)
|
void nsImapProtocol::AutoSubscribeToMailboxIfNecessary(const char *mailboxName)
|
||||||
|
@ -2262,7 +2242,7 @@ void nsImapProtocol::SelectMailbox(const char *mailboxName)
|
||||||
ParseIMAPandCheckForNewMail();
|
ParseIMAPandCheckForNewMail();
|
||||||
|
|
||||||
PRInt32 numOfMessagesInFlagState = 0;
|
PRInt32 numOfMessagesInFlagState = 0;
|
||||||
nsIImapUrl::nsImapAction imapAction;
|
nsImapAction imapAction;
|
||||||
m_flagState->GetNumberOfMessages(&numOfMessagesInFlagState);
|
m_flagState->GetNumberOfMessages(&numOfMessagesInFlagState);
|
||||||
res = m_runningUrl->GetImapAction(&imapAction);
|
res = m_runningUrl->GetImapAction(&imapAction);
|
||||||
// if we've selected a mailbox, and we're not going to do an update because of the
|
// if we've selected a mailbox, and we're not going to do an update because of the
|
||||||
|
@ -2368,7 +2348,7 @@ void nsImapProtocol::PipelinedFetchMessageParts(const char *uid, nsIMAPMessagePa
|
||||||
// message...
|
// message...
|
||||||
|
|
||||||
void
|
void
|
||||||
nsImapProtocol::FetchMessage(nsCString &messageIds,
|
nsImapProtocol::FetchMessage(const char * messageIds,
|
||||||
nsIMAPeFetchFields whatToFetch,
|
nsIMAPeFetchFields whatToFetch,
|
||||||
PRBool idIsUid,
|
PRBool idIsUid,
|
||||||
PRUint32 startByte, PRUint32 endByte,
|
PRUint32 startByte, PRUint32 endByte,
|
||||||
|
@ -2545,15 +2525,13 @@ nsImapProtocol::FetchMessage(nsCString &messageIds,
|
||||||
|
|
||||||
// since messageIds can be infinitely long, use a dynamic buffer rather than the fixed one
|
// since messageIds can be infinitely long, use a dynamic buffer rather than the fixed one
|
||||||
const char *commandTag = GetServerCommandTag();
|
const char *commandTag = GetServerCommandTag();
|
||||||
int protocolStringSize = commandString.Length() + messageIds.Length() + PL_strlen(commandTag) + 1 +
|
int protocolStringSize = commandString.Length() + nsCRT::strlen(messageIds) + PL_strlen(commandTag) + 1 +
|
||||||
(part ? PL_strlen(part) : 0);
|
(part ? PL_strlen(part) : 0);
|
||||||
char *protocolString = (char *) PR_CALLOC( protocolStringSize );
|
char *protocolString = (char *) PR_CALLOC( protocolStringSize );
|
||||||
|
|
||||||
if (protocolString)
|
if (protocolString)
|
||||||
{
|
{
|
||||||
char *cCommandStr = commandString.ToNewCString();
|
char *cCommandStr = commandString.ToNewCString();
|
||||||
char *cMessageIdsStr = messageIds.ToNewCString();
|
|
||||||
|
|
||||||
if ((whatToFetch == kMIMEPart) ||
|
if ((whatToFetch == kMIMEPart) ||
|
||||||
(whatToFetch == kMIMEHeader))
|
(whatToFetch == kMIMEHeader))
|
||||||
{
|
{
|
||||||
|
@ -2561,7 +2539,7 @@ nsImapProtocol::FetchMessage(nsCString &messageIds,
|
||||||
protocolStringSize, // max size
|
protocolStringSize, // max size
|
||||||
cCommandStr, // format string
|
cCommandStr, // format string
|
||||||
commandTag, // command tag
|
commandTag, // command tag
|
||||||
cMessageIdsStr,
|
messageIds,
|
||||||
part);
|
part);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2570,13 +2548,12 @@ nsImapProtocol::FetchMessage(nsCString &messageIds,
|
||||||
protocolStringSize, // max size
|
protocolStringSize, // max size
|
||||||
cCommandStr, // format string
|
cCommandStr, // format string
|
||||||
commandTag, // command tag
|
commandTag, // command tag
|
||||||
cMessageIdsStr);
|
messageIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult rv = SendData(protocolString);
|
nsresult rv = SendData(protocolString);
|
||||||
|
|
||||||
nsAllocator::Free(cCommandStr);
|
nsAllocator::Free(cCommandStr);
|
||||||
nsAllocator::Free(cMessageIdsStr);
|
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
ParseIMAPandCheckForNewMail(protocolString);
|
ParseIMAPandCheckForNewMail(protocolString);
|
||||||
PR_Free(protocolString);
|
PR_Free(protocolString);
|
||||||
|
@ -2585,7 +2562,7 @@ nsImapProtocol::FetchMessage(nsCString &messageIds,
|
||||||
HandleMemoryFailure();
|
HandleMemoryFailure();
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsImapProtocol::FetchTryChunking(nsCString &messageIds,
|
void nsImapProtocol::FetchTryChunking(const char * messageIds,
|
||||||
nsIMAPeFetchFields whatToFetch,
|
nsIMAPeFetchFields whatToFetch,
|
||||||
PRBool idIsUid,
|
PRBool idIsUid,
|
||||||
char *part,
|
char *part,
|
||||||
|
@ -2944,9 +2921,11 @@ void nsImapProtocol::ProcessMailboxUpdate(PRBool handlePossibleUndo)
|
||||||
if (handlePossibleUndo)
|
if (handlePossibleUndo)
|
||||||
{
|
{
|
||||||
// undo any delete flags we may have asked to
|
// undo any delete flags we may have asked to
|
||||||
nsCString undoIds;
|
nsXPIDLCString undoIdsStr;
|
||||||
|
nsCAutoString undoIds;
|
||||||
|
|
||||||
GetCurrentUrl()->CreateListOfMessageIdsString(&undoIds);
|
GetCurrentUrl()->CreateListOfMessageIdsString(getter_Copies(undoIdsStr));
|
||||||
|
undoIds = undoIdsStr;
|
||||||
if (undoIds.Length() > 0)
|
if (undoIds.Length() > 0)
|
||||||
{
|
{
|
||||||
char firstChar = (char) undoIds.CharAt(0);
|
char firstChar = (char) undoIds.CharAt(0);
|
||||||
|
@ -2999,7 +2978,7 @@ void nsImapProtocol::ProcessMailboxUpdate(PRBool handlePossibleUndo)
|
||||||
{
|
{
|
||||||
if (!DeathSignalReceived())
|
if (!DeathSignalReceived())
|
||||||
{
|
{
|
||||||
nsIImapUrl::nsImapAction imapAction;
|
nsImapAction imapAction;
|
||||||
nsresult res = m_runningUrl->GetImapAction(&imapAction);
|
nsresult res = m_runningUrl->GetImapAction(&imapAction);
|
||||||
if (NS_SUCCEEDED(res) && imapAction == nsIImapUrl::nsImapExpungeFolder)
|
if (NS_SUCCEEDED(res) && imapAction == nsIImapUrl::nsImapExpungeFolder)
|
||||||
new_spec->box_flags |= kJustExpunged;
|
new_spec->box_flags |= kJustExpunged;
|
||||||
|
@ -3307,18 +3286,17 @@ void nsImapProtocol::Log(const char *logSubName, const char *extraInfo, const ch
|
||||||
// In 4.5, this posted an event back to libmsg and blocked until it got a response.
|
// In 4.5, this posted an event back to libmsg and blocked until it got a response.
|
||||||
// We may still have to do this.It would be nice if we could preflight this value,
|
// We may still have to do this.It would be nice if we could preflight this value,
|
||||||
// but we may not always know when we'll need it.
|
// but we may not always know when we'll need it.
|
||||||
PRUint32 nsImapProtocol::GetMessageSize(nsCString &messageId,
|
PRUint32 nsImapProtocol::GetMessageSize(const char * messageId,
|
||||||
PRBool idsAreUids)
|
PRBool idsAreUids)
|
||||||
{
|
{
|
||||||
const char *folderFromParser =
|
const char *folderFromParser = GetServerStateParser().GetSelectedMailboxName();
|
||||||
GetServerStateParser().GetSelectedMailboxName();
|
|
||||||
if (folderFromParser)
|
if (folderFromParser)
|
||||||
{
|
{
|
||||||
char *id = (char *)PR_CALLOC(messageId.Length() + 1);
|
char *id = (char *)PR_CALLOC(nsCRT::strlen(messageId) + 1);
|
||||||
char *folderName;
|
char *folderName;
|
||||||
PRUint32 size;
|
PRUint32 size;
|
||||||
|
|
||||||
PL_strcpy(id, messageId.GetBuffer());
|
PL_strcpy(id, messageId);
|
||||||
|
|
||||||
nsIMAPNamespace *nsForMailbox = nsnull;
|
nsIMAPNamespace *nsForMailbox = nsnull;
|
||||||
m_hostSessionList->GetNamespaceForMailboxForHost(GetImapServerKey(), folderFromParser,
|
m_hostSessionList->GetNamespaceForMailboxForHost(GetImapServerKey(), folderFromParser,
|
||||||
|
@ -3371,15 +3349,6 @@ PRBool nsImapProtocol::GetShowAttachmentsInline()
|
||||||
PL_strchr(messageIdString,':') != nsnull);
|
PL_strchr(messageIdString,':') != nsnull);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */PRBool nsImapProtocol::HandlingMultipleMessages(nsCString &messageIdString)
|
|
||||||
{
|
|
||||||
return (messageIdString.FindCharInSet(",:") != -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
PRUint32 nsImapProtocol::CountMessagesInIdString(nsCString &idString)
|
|
||||||
{
|
|
||||||
return CountMessagesInIdString((const char *) idString.GetBuffer());
|
|
||||||
}
|
|
||||||
|
|
||||||
PRUint32 nsImapProtocol::CountMessagesInIdString(const char *idString)
|
PRUint32 nsImapProtocol::CountMessagesInIdString(const char *idString)
|
||||||
{
|
{
|
||||||
|
@ -4091,7 +4060,7 @@ PRUnichar * nsImapProtocol::CreatePRUnicharStringFromUTF7(const char * aSourceSt
|
||||||
|
|
||||||
// imap commands issued by the parser
|
// imap commands issued by the parser
|
||||||
void
|
void
|
||||||
nsImapProtocol::Store(nsCString &messageList, const char * messageData,
|
nsImapProtocol::Store(const char * messageList, const char * messageData,
|
||||||
PRBool idsAreUid)
|
PRBool idsAreUid)
|
||||||
{
|
{
|
||||||
IncrementCommandTagNumber();
|
IncrementCommandTagNumber();
|
||||||
|
@ -4108,7 +4077,7 @@ nsImapProtocol::Store(nsCString &messageList, const char * messageData,
|
||||||
|
|
||||||
const char *commandTag = GetServerCommandTag();
|
const char *commandTag = GetServerCommandTag();
|
||||||
int protocolStringSize = PL_strlen(formatString) +
|
int protocolStringSize = PL_strlen(formatString) +
|
||||||
PL_strlen(messageList.GetBuffer()) + PL_strlen(messageData) +
|
PL_strlen(messageList) + PL_strlen(messageData) +
|
||||||
PL_strlen(commandTag) + 1;
|
PL_strlen(commandTag) + 1;
|
||||||
char *protocolString = (char *) PR_CALLOC( protocolStringSize );
|
char *protocolString = (char *) PR_CALLOC( protocolStringSize );
|
||||||
|
|
||||||
|
@ -4118,7 +4087,7 @@ nsImapProtocol::Store(nsCString &messageList, const char * messageData,
|
||||||
protocolStringSize, // max size
|
protocolStringSize, // max size
|
||||||
formatString, // format string
|
formatString, // format string
|
||||||
commandTag, // command tag
|
commandTag, // command tag
|
||||||
messageList.GetBuffer(),
|
messageList,
|
||||||
messageData);
|
messageData);
|
||||||
|
|
||||||
nsresult rv = SendData(protocolString);
|
nsresult rv = SendData(protocolString);
|
||||||
|
@ -4477,7 +4446,7 @@ void nsImapProtocol::UploadMessageFromFile (nsIFileSpec* fileSpec,
|
||||||
rv = SendData(CRLF); // complete the append
|
rv = SendData(CRLF); // complete the append
|
||||||
ParseIMAPandCheckForNewMail(command.GetBuffer());
|
ParseIMAPandCheckForNewMail(command.GetBuffer());
|
||||||
|
|
||||||
nsIImapUrl::nsImapAction imapAction;
|
nsImapAction imapAction;
|
||||||
m_runningUrl->GetImapAction(&imapAction);
|
m_runningUrl->GetImapAction(&imapAction);
|
||||||
|
|
||||||
if (GetServerStateParser().LastCommandSuccessful() &&
|
if (GetServerStateParser().LastCommandSuccessful() &&
|
||||||
|
@ -4494,15 +4463,14 @@ void nsImapProtocol::UploadMessageFromFile (nsIFileSpec* fileSpec,
|
||||||
m_runningUrl);
|
m_runningUrl);
|
||||||
WaitForFEEventCompletion();
|
WaitForFEEventCompletion();
|
||||||
}
|
}
|
||||||
nsCString oldMsgId;
|
nsXPIDLCString oldMsgId;
|
||||||
rv =
|
rv = m_runningUrl->CreateListOfMessageIdsString(getter_Copies(oldMsgId));
|
||||||
m_runningUrl->CreateListOfMessageIdsString(&oldMsgId);
|
if (NS_SUCCEEDED(rv) && nsCRT::strlen(oldMsgId) > 0)
|
||||||
if (NS_SUCCEEDED(rv) && oldMsgId.Length() > 0)
|
|
||||||
{
|
{
|
||||||
PRBool idsAreUids = PR_TRUE;
|
PRBool idsAreUids = PR_TRUE;
|
||||||
m_runningUrl->MessageIdsAreUids(&idsAreUids);
|
m_runningUrl->MessageIdsAreUids(&idsAreUids);
|
||||||
Store(oldMsgId, "+FLAGS (\\Deleted)", idsAreUids);
|
Store(oldMsgId, "+FLAGS (\\Deleted)", idsAreUids);
|
||||||
UidExpunge(oldMsgId.GetBuffer());
|
UidExpunge(oldMsgId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_imapExtensionSink)
|
else if (m_imapExtensionSink)
|
||||||
|
@ -5210,7 +5178,7 @@ void nsImapProtocol::FindMailboxesIfNecessary()
|
||||||
//PR_EnterMonitor(fFindingMailboxesMonitor);
|
//PR_EnterMonitor(fFindingMailboxesMonitor);
|
||||||
// biff should not discover mailboxes
|
// biff should not discover mailboxes
|
||||||
PRBool foundMailboxesAlready = PR_FALSE;
|
PRBool foundMailboxesAlready = PR_FALSE;
|
||||||
nsIImapUrl::nsImapAction imapAction;
|
nsImapAction imapAction;
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
rv = m_runningUrl->GetImapAction(&imapAction);
|
rv = m_runningUrl->GetImapAction(&imapAction);
|
||||||
|
@ -5668,7 +5636,7 @@ void nsImapProtocol::Unsubscribe(const char *mailboxName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void nsImapProtocol::Search(nsCString &searchCriteria,
|
void nsImapProtocol::Search(const char * searchCriteria,
|
||||||
PRBool useUID,
|
PRBool useUID,
|
||||||
PRBool notifyHit /* PR_TRUE */)
|
PRBool notifyHit /* PR_TRUE */)
|
||||||
{
|
{
|
||||||
|
@ -5689,7 +5657,7 @@ void nsImapProtocol::Search(nsCString &searchCriteria,
|
||||||
ParseIMAPandCheckForNewMail();
|
ParseIMAPandCheckForNewMail();
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsImapProtocol::Copy(nsCString &messageList,
|
void nsImapProtocol::Copy(const char * messageList,
|
||||||
const char *destinationMailbox,
|
const char *destinationMailbox,
|
||||||
PRBool idsAreUid)
|
PRBool idsAreUid)
|
||||||
{
|
{
|
||||||
|
@ -5697,7 +5665,7 @@ void nsImapProtocol::Copy(nsCString &messageList,
|
||||||
|
|
||||||
char *escapedDestination = CreateEscapedMailboxName(destinationMailbox);
|
char *escapedDestination = CreateEscapedMailboxName(destinationMailbox);
|
||||||
|
|
||||||
nsCString protocolString(GetServerCommandTag());
|
nsCAutoString protocolString(GetServerCommandTag());
|
||||||
if (idsAreUid)
|
if (idsAreUid)
|
||||||
protocolString.Append(" uid");
|
protocolString.Append(" uid");
|
||||||
protocolString.Append(" copy ");
|
protocolString.Append(" copy ");
|
||||||
|
@ -5749,7 +5717,7 @@ void nsImapProtocol::NthLevelChildList(const char* onlineMailboxPrefix,
|
||||||
|
|
||||||
void nsImapProtocol::ProcessAuthenticatedStateURL()
|
void nsImapProtocol::ProcessAuthenticatedStateURL()
|
||||||
{
|
{
|
||||||
nsIImapUrl::nsImapAction imapAction;
|
nsImapAction imapAction;
|
||||||
char * sourceMailbox = nsnull;
|
char * sourceMailbox = nsnull;
|
||||||
m_runningUrl->GetImapAction(&imapAction);
|
m_runningUrl->GetImapAction(&imapAction);
|
||||||
|
|
||||||
|
@ -5958,7 +5926,7 @@ void nsImapProtocol::SetupMessageFlagsString(nsCString& flagString,
|
||||||
flagString.SetLength(flagString.Length()-1);
|
flagString.SetLength(flagString.Length()-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsImapProtocol::ProcessStoreFlags(nsCString &messageIdsString,
|
void nsImapProtocol::ProcessStoreFlags(const char * messageIdsString,
|
||||||
PRBool idsAreUids,
|
PRBool idsAreUids,
|
||||||
imapMessageFlagsType flags,
|
imapMessageFlagsType flags,
|
||||||
PRBool addFlags)
|
PRBool addFlags)
|
||||||
|
|
|
@ -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,14 +229,14 @@ 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);
|
||||||
|
@ -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);
|
||||||
|
|
|
@ -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() &&
|
||||||
|
|
|
@ -406,7 +406,7 @@ nsImapService::CopyMessages(nsMsgKeyArray *keys, nsIMsgFolder *srcFolder, nsIStr
|
||||||
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
|
||||||
|
@ -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,
|
||||||
|
@ -1134,11 +1134,6 @@ 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);
|
||||||
|
|
|
@ -65,7 +65,7 @@ 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,
|
||||||
|
|
|
@ -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,21 +119,15 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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,64 +48,9 @@ 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
|
||||||
|
@ -151,7 +101,6 @@ protected:
|
||||||
// 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
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче