more work on offline imap downloadg, sr=sspitzer,mscott 15865

This commit is contained in:
bienvenu%netscape.com 2001-02-01 15:20:31 +00:00
Родитель 5c414f1399
Коммит 42828d4cff
3 изменённых файлов: 17 добавлений и 4 удалений

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

@ -175,7 +175,7 @@ interface nsIImapService : nsISupports
in nsISupports aCopyState);
void downloadMessagesForOffline(in string aMessageIds, in nsIMsgFolder aSrcFolder,
in nsIMsgWindow aMsgWindow);
in nsIUrlListener aListener, in nsIMsgWindow aMsgWindow);
nsIURI moveFolder(in nsIEventQueue aClientEventQueue,
in nsIMsgFolder aSrcFolder,
in nsIMsgFolder aDstFolder,

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

@ -203,6 +203,7 @@ nsImapProtocol::nsImapProtocol() :
m_connectionStatus = 0;
m_hostSessionList = nsnull;
m_flagState = nsnull;
m_fetchBodyIdList = nsnull;
if (!gInitialized)
GlobalInitialization();
@ -349,6 +350,7 @@ nsImapProtocol::~nsImapProtocol()
{
PR_FREEIF(m_userName);
PR_FREEIF(m_serverKey);
PR_FREEIF(m_fetchBodyIdList);
nsCRT::free(m_hostName);
@ -3209,7 +3211,10 @@ NS_IMETHODIMP nsImapProtocol::NotifyHdrsToDownload(PRUint32 *keys, PRUint32 keyC
NS_IMETHODIMP nsImapProtocol::NotifyBodysToDownload(PRUint32 *keys, PRUint32 keyCount)
{
PR_EnterMonitor(m_fetchBodyListMonitor);
m_fetchBodyIdList = keys;
PR_FREEIF(m_fetchBodyIdList);
m_fetchBodyIdList = (PRUint32 *) PR_MALLOC(keyCount * sizeof(PRUint32));
if (m_fetchBodyIdList)
nsCRT::memcpy(m_fetchBodyIdList, keys, keyCount * sizeof(PRUint32));
m_fetchBodyCount = keyCount;
m_fetchBodyListIsNew = PR_TRUE;
PR_Notify(m_fetchBodyListMonitor);

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

@ -3232,7 +3232,7 @@ nsImapService::UnsubscribeFolder(nsIEventQueue* eventQueue,
}
NS_IMETHODIMP
nsImapService::DownloadMessagesForOffline(const char *messageIds, nsIMsgFolder *aFolder, nsIMsgWindow *aMsgWindow)
nsImapService::DownloadMessagesForOffline(const char *messageIds, nsIMsgFolder *aFolder, nsIUrlListener *aUrlListener, nsIMsgWindow *aMsgWindow)
{
NS_ENSURE_ARG_POINTER(aFolder);
NS_ENSURE_ARG_POINTER(messageIds);
@ -3247,11 +3247,19 @@ nsImapService::DownloadMessagesForOffline(const char *messageIds, nsIMsgFolder *
{
if (NS_SUCCEEDED(rv))
{
nsCOMPtr <nsIURI> runningURI;
// need to pass in stream listener in order to get the channel created correctly
nsCOMPtr<nsIImapMessageSink> imapMessageSink(do_QueryInterface(aFolder, &rv));
nsCOMPtr<nsIStreamListener> folderStreamListener(do_QueryInterface(aFolder, &rv));
rv = FetchMessage(imapUrl, nsImapUrl::nsImapMsgFetch,aFolder, imapMessageSink,
aMsgWindow, nsnull, folderStreamListener, messageIds, PR_TRUE);
aMsgWindow, getter_AddRefs(runningURI), folderStreamListener, messageIds, PR_TRUE);
if (runningURI && aUrlListener)
{
nsCOMPtr<nsIMsgMailNewsUrl> msgurl (do_QueryInterface(runningURI));
if (msgurl)
msgurl->RegisterListener(aUrlListener);
}
}
}
return rv;