#163: also saving messages for nzbs in history

If an nzb was already removed from queue (put into history), the
messages were not added to it’s log. Fixed.
This commit is contained in:
Andrey Prygunkov
2016-03-13 19:42:05 +01:00
parent 1a48feba72
commit ca088ef2e6
2 changed files with 15 additions and 15 deletions

View File

@@ -174,7 +174,7 @@ void QueueScriptController::AddMessage(Message::EKind kind, const char* text)
{
*value = '\0';
DownloadQueue* downloadQueue = DownloadQueue::Lock();
NzbInfo* nzbInfo = downloadQueue->GetQueue()->Find(m_id);
NzbInfo* nzbInfo = QueueScriptCoordinator::FindNzbInfo(downloadQueue, m_id);
if (nzbInfo)
{
nzbInfo->GetParameters()->SetParameter(param, value + 1);
@@ -190,7 +190,7 @@ void QueueScriptController::AddMessage(Message::EKind kind, const char* text)
m_event == QueueScriptCoordinator::qeNzbDownloaded)
{
DownloadQueue* downloadQueue = DownloadQueue::Lock();
NzbInfo* nzbInfo = downloadQueue->GetQueue()->Find(m_id);
NzbInfo* nzbInfo = QueueScriptCoordinator::FindNzbInfo(downloadQueue, m_id);
if (nzbInfo)
{
nzbInfo->SetFinalDir(msgText + 6 + 10);
@@ -201,7 +201,7 @@ void QueueScriptController::AddMessage(Message::EKind kind, const char* text)
{
m_markBad = true;
DownloadQueue* downloadQueue = DownloadQueue::Lock();
NzbInfo* nzbInfo = downloadQueue->GetQueue()->Find(m_id);
NzbInfo* nzbInfo = QueueScriptCoordinator::FindNzbInfo(downloadQueue, m_id);
if (nzbInfo)
{
SetLogPrefix(nullptr);
@@ -219,7 +219,7 @@ void QueueScriptController::AddMessage(Message::EKind kind, const char* text)
else
{
DownloadQueue* downloadQueue = DownloadQueue::Lock();
NzbInfo* nzbInfo = downloadQueue->GetQueue()->Find(m_id);
NzbInfo* nzbInfo = QueueScriptCoordinator::FindNzbInfo(downloadQueue, m_id);
if (nzbInfo)
{
nzbInfo->AddMessage(kind, text);
@@ -394,18 +394,18 @@ bool QueueScriptCoordinator::UsableScript(ScriptConfig::Script& script, NzbInfo*
NzbInfo* QueueScriptCoordinator::FindNzbInfo(DownloadQueue* downloadQueue, int nzbId)
{
NzbInfo* nzbInfo = downloadQueue->GetQueue()->Find(nzbId);
if (!nzbInfo)
if (nzbInfo)
{
for (HistoryInfo* historyInfo : downloadQueue->GetHistory())
{
if (historyInfo->GetNzbInfo() && historyInfo->GetNzbInfo()->GetId() == nzbId)
{
nzbInfo = historyInfo->GetNzbInfo();
break;
}
}
return nzbInfo;
}
return nzbInfo;
HistoryInfo* historyInfo = downloadQueue->GetHistory()->Find(nzbId);
if (historyInfo)
{
return historyInfo->GetNzbInfo();
}
return nullptr;
}
void QueueScriptCoordinator::CheckQueue()