Bug 226049 DRefTool analysis for nntp files

r=roc sr=roc
This commit is contained in:
timeless%mozdev.org 2003-11-18 21:32:53 +00:00
Родитель cd45244168
Коммит da11b2e065
3 изменённых файлов: 40 добавлений и 32 удалений

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

@ -832,6 +832,9 @@ nsresult nsNNTPProtocol::ReadFromMemCache(nsICacheEntryDescriptor *entry)
rv = ParseURL(m_url, getter_Copies(group), &m_messageID, getter_Copies(commandSpecificData));
nsNntpCacheStreamListener * cacheListener = new nsNntpCacheStreamListener();
if (!cacheListener)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(cacheListener);
SetLoadGroup(m_loadGroup);
@ -896,6 +899,9 @@ PRBool nsNNTPProtocol::ReadFromLocalCache()
m_typeWanted = ARTICLE_WANTED;
nsNntpCacheStreamListener * cacheListener = new nsNntpCacheStreamListener();
if (!cacheListener)
return PR_FALSE;
NS_ADDREF(cacheListener);
cacheListener->Init(m_channelListener, NS_STATIC_CAST(nsIChannel *, this), mailnewsUrl);

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

@ -544,6 +544,7 @@ nsresult nsMsgDownloadAllNewsgroups::ProcessNextGroup()
nsresult nsMsgDownloadAllNewsgroups::DownloadMsgsForCurrentGroup()
{
NS_ENSURE_TRUE(m_downloaderForGroup, NS_ERROR_OUT_OF_MEMORY);
nsCOMPtr <nsIMsgDatabase> db;
nsCOMPtr <nsISupportsArray> termList;
nsCOMPtr <nsIMsgDownloadSettings> downloadSettings;
@ -568,11 +569,11 @@ nsresult nsMsgDownloadAllNewsgroups::DownloadMsgsForCurrentGroup()
PRUint32 ageLimitOfMsgsToDownload;
downloadSettings->GetDownloadByDate(&downloadByDate);
downloadSettings->GetDownloadUnreadOnly(&downloadUnreadOnly);
downloadSettings->GetAgeLimitOfMsgsToDownload(&ageLimitOfMsgsToDownload);
downloadSettings->GetDownloadUnreadOnly(&downloadUnreadOnly);
downloadSettings->GetAgeLimitOfMsgsToDownload(&ageLimitOfMsgsToDownload);
nsCOMPtr <nsIMsgSearchTerm> term;
nsCOMPtr <nsIMsgSearchValue> value;
nsCOMPtr <nsIMsgSearchValue> value;
rv = searchSession->CreateTerm(getter_AddRefs(term));
NS_ENSURE_SUCCESS(rv, rv);
@ -584,14 +585,14 @@ nsresult nsMsgDownloadAllNewsgroups::DownloadMsgsForCurrentGroup()
value->SetStatus(MSG_FLAG_READ);
searchSession->AddSearchTerm(nsMsgSearchAttrib::MsgStatus, nsMsgSearchOp::Isnt, value, PR_TRUE, nsnull);
}
if (downloadByDate)
{
if (downloadByDate)
{
value->SetAttrib(nsMsgSearchAttrib::AgeInDays);
value->SetAge(ageLimitOfMsgsToDownload);
searchSession->AddSearchTerm(nsMsgSearchAttrib::AgeInDays, nsMsgSearchOp::IsLessThan, value, nsMsgSearchBooleanOp::BooleanAND, nsnull);
}
value->SetAge(ageLimitOfMsgsToDownload);
searchSession->AddSearchTerm(nsMsgSearchAttrib::AgeInDays, nsMsgSearchOp::IsLessThan, value, nsMsgSearchBooleanOp::BooleanAND, nsnull);
}
value->SetAttrib(nsMsgSearchAttrib::MsgStatus);
value->SetStatus(MSG_FLAG_OFFLINE);
value->SetStatus(MSG_FLAG_OFFLINE);
searchSession->AddSearchTerm(nsMsgSearchAttrib::MsgStatus, nsMsgSearchOp::Isnt, value, nsMsgSearchBooleanOp::BooleanAND, nsnull);
m_downloaderForGroup->RunSearch(m_currentFolder, db, searchSession);

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

@ -815,20 +815,20 @@ nsNntpIncomingServer::WriteHostInfoFile()
if (!mHostInfoHasChanged) {
return NS_OK;
}
}
PRInt32 firstnewdate;
PRInt32 firstnewdate;
LL_L2I(firstnewdate, mFirstNewDate);
LL_L2I(firstnewdate, mFirstNewDate);
nsXPIDLCString hostname;
rv = GetHostName(getter_Copies(hostname));
nsXPIDLCString hostname;
rv = GetHostName(getter_Copies(hostname));
NS_ENSURE_SUCCESS(rv,rv);
nsFileSpec hostinfoFileSpec;
if (!mHostInfoFile)
return NS_ERROR_UNEXPECTED;
return NS_ERROR_UNEXPECTED;
rv = mHostInfoFile->GetFileSpec(&hostinfoFileSpec);
NS_ENSURE_SUCCESS(rv,rv);
@ -836,34 +836,35 @@ nsNntpIncomingServer::WriteHostInfoFile()
if (mHostInfoStream) {
mHostInfoStream->close();
delete mHostInfoStream;
mHostInfoStream = nsnull;
}
mHostInfoStream = new nsIOFileStream(hostinfoFileSpec, (PR_RDWR | PR_CREATE_FILE | PR_TRUNCATE));
NS_ASSERTION(mHostInfoStream, "no stream!");
if (!mHostInfoStream)
return NS_ERROR_OUT_OF_MEMORY;
// todo, missing some formatting, see the 4.x code
*mHostInfoStream << "# News host information file." << MSG_LINEBREAK;
*mHostInfoStream << "# This is a generated file! Do not edit." << MSG_LINEBREAK;
*mHostInfoStream << "" << MSG_LINEBREAK;
*mHostInfoStream << "version=" << VALID_VERSION << MSG_LINEBREAK;
*mHostInfoStream << "newsrcname=" << (const char*)hostname << MSG_LINEBREAK;
*mHostInfoStream << "lastgroupdate=" << mLastGroupDate << MSG_LINEBREAK;
*mHostInfoStream << "firstnewdate=" << firstnewdate << MSG_LINEBREAK;
*mHostInfoStream << "uniqueid=" << mUniqueId << MSG_LINEBREAK;
*mHostInfoStream << "" << MSG_LINEBREAK;
*mHostInfoStream << "begingroups" << MSG_LINEBREAK;
*mHostInfoStream
<< "# News host information file." << MSG_LINEBREAK
<< "# This is a generated file! Do not edit." << MSG_LINEBREAK
<< "" << MSG_LINEBREAK
<< "version=" << VALID_VERSION << MSG_LINEBREAK
<< "newsrcname=" << (const char*)hostname << MSG_LINEBREAK
<< "lastgroupdate=" << mLastGroupDate << MSG_LINEBREAK
<< "firstnewdate=" << firstnewdate << MSG_LINEBREAK
<< "uniqueid=" << mUniqueId << MSG_LINEBREAK
<< "" << MSG_LINEBREAK
<< "begingroups" << MSG_LINEBREAK;
// XXX todo, sort groups first?
// XXX todo, sort groups first?
mGroupsOnServer.EnumerateForwards((nsCStringArrayEnumFunc)writeGroupToHostInfoFile, (void *)mHostInfoStream);
mGroupsOnServer.EnumerateForwards((nsCStringArrayEnumFunc)writeGroupToHostInfoFile, (void *)mHostInfoStream);
mHostInfoStream->close();
delete mHostInfoStream;
mHostInfoStream = nsnull;
mHostInfoHasChanged = PR_FALSE;
return NS_OK;
mHostInfoHasChanged = PR_FALSE;
return NS_OK;
}
nsresult