зеркало из https://github.com/mozilla/gecko-dev.git
fix download now for newsgroups r=naving, sr=sspitzer 89726
This commit is contained in:
Родитель
8aaaf796a4
Коммит
42d1dcdc3e
|
@ -1678,12 +1678,49 @@ NS_IMETHODIMP nsMsgNewsFolder::SetSaveArticleOffline(PRBool aBool)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP nsMsgNewsFolder::DownloadAllForOffline(nsIUrlListener *listener, nsIMsgWindow *msgWindow)
|
||||||
|
{
|
||||||
|
nsMsgKeyArray srcKeyArray;
|
||||||
|
|
||||||
|
SetSaveArticleOffline(PR_TRUE);
|
||||||
|
nsresult rv;
|
||||||
|
|
||||||
|
// build up message keys.
|
||||||
|
if (mDatabase)
|
||||||
|
{
|
||||||
|
nsCOMPtr <nsISimpleEnumerator> enumerator;
|
||||||
|
rv = mDatabase->EnumerateMessages(getter_AddRefs(enumerator));
|
||||||
|
if (NS_SUCCEEDED(rv) && enumerator)
|
||||||
|
{
|
||||||
|
PRBool hasMore;
|
||||||
|
|
||||||
|
while (NS_SUCCEEDED(rv = enumerator->HasMoreElements(&hasMore)) && hasMore)
|
||||||
|
{
|
||||||
|
nsCOMPtr <nsIMsgDBHdr> pHeader;
|
||||||
|
rv = enumerator->GetNext(getter_AddRefs(pHeader));
|
||||||
|
NS_ASSERTION(NS_SUCCEEDED(rv), "nsMsgDBEnumerator broken");
|
||||||
|
if (pHeader && NS_SUCCEEDED(rv))
|
||||||
|
{
|
||||||
|
PRBool shouldStoreMsgOffline = PR_FALSE;
|
||||||
|
nsMsgKey msgKey;
|
||||||
|
pHeader->GetMessageKey(&msgKey);
|
||||||
|
MsgFitsDownloadCriteria(msgKey, &shouldStoreMsgOffline);
|
||||||
|
if (shouldStoreMsgOffline)
|
||||||
|
srcKeyArray.Add(msgKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DownloadNewsArticlesToOfflineStore *downloadState = new DownloadNewsArticlesToOfflineStore(msgWindow, mDatabase, nsnull);
|
||||||
|
if (downloadState)
|
||||||
|
return downloadState->DownloadArticles(msgWindow, this, &srcKeyArray);
|
||||||
|
else
|
||||||
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsMsgNewsFolder::DownloadMessagesForOffline(nsISupportsArray *messages, nsIMsgWindow *window)
|
NS_IMETHODIMP nsMsgNewsFolder::DownloadMessagesForOffline(nsISupportsArray *messages, nsIMsgWindow *window)
|
||||||
{
|
{
|
||||||
nsMsgKeyArray srcKeyArray;
|
nsMsgKeyArray srcKeyArray;
|
||||||
#ifdef DEBUG_bienvenu
|
|
||||||
// return DownloadAllForOffline(nsnull, window);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SetSaveArticleOffline(PR_TRUE); // ### TODO need to clear this when we've finished
|
SetSaveArticleOffline(PR_TRUE); // ### TODO need to clear this when we've finished
|
||||||
PRUint32 count = 0;
|
PRUint32 count = 0;
|
||||||
|
@ -1703,12 +1740,11 @@ NS_IMETHODIMP nsMsgNewsFolder::DownloadMessagesForOffline(nsISupportsArray *mess
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
srcKeyArray.Add(key);
|
srcKeyArray.Add(key);
|
||||||
}
|
}
|
||||||
DownloadNewsArticlesToOfflineStore *downloadState = new DownloadNewsArticlesToOfflineStore(window, mDatabase, nsnull);
|
DownloadNewsArticlesToOfflineStore *downloadState = new DownloadNewsArticlesToOfflineStore(window, mDatabase, nsnull);
|
||||||
if (downloadState)
|
if (downloadState)
|
||||||
return downloadState->DownloadArticles(window, this, &srcKeyArray);
|
return downloadState->DownloadArticles(window, this, &srcKeyArray);
|
||||||
else
|
else
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
return rv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -96,6 +96,7 @@ public:
|
||||||
|
|
||||||
NS_IMETHOD DownloadMessagesForOffline(nsISupportsArray *messages, nsIMsgWindow *window);
|
NS_IMETHOD DownloadMessagesForOffline(nsISupportsArray *messages, nsIMsgWindow *window);
|
||||||
NS_IMETHOD Compact(nsIUrlListener *aListener, nsIMsgWindow *aMsgWindow);
|
NS_IMETHOD Compact(nsIUrlListener *aListener, nsIMsgWindow *aMsgWindow);
|
||||||
|
NS_IMETHOD DownloadAllForOffline(nsIUrlListener *listener, nsIMsgWindow *msgWindow);
|
||||||
// for nsMsgLineBuffer
|
// for nsMsgLineBuffer
|
||||||
virtual PRInt32 HandleLine(char *line, PRUint32 line_size);
|
virtual PRInt32 HandleLine(char *line, PRUint32 line_size);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче