bool HistoryCoordinator::EditList(DownloadQueue* pDownloadQueue, IDList* pIDList, DownloadQueue::EEditAction eAction, int iOffset, const char* szText) { bool bOK = false; PrepareEdit(pDownloadQueue, pIDList, eAction); for (IDList::iterator itID = pIDList->begin(); itID != pIDList->end(); itID++) { int iID = *itID; for (HistoryList::iterator itHistory = pDownloadQueue->GetHistory()->begin(); itHistory != pDownloadQueue->GetHistory()->end(); itHistory++) { HistoryInfo* pHistoryInfo = *itHistory; if (pHistoryInfo->GetID() == iID) { bOK = true; switch (eAction) { case DownloadQueue::eaHistoryDelete: case DownloadQueue::eaHistoryFinalDelete: HistoryDelete(pDownloadQueue, itHistory, pHistoryInfo, eAction == DownloadQueue::eaHistoryFinalDelete); break; case DownloadQueue::eaHistoryReturn: case DownloadQueue::eaHistoryProcess: HistoryReturn(pDownloadQueue, itHistory, pHistoryInfo, eAction == DownloadQueue::eaHistoryProcess); break; case DownloadQueue::eaHistoryRedownload: HistoryRedownload(pDownloadQueue, itHistory, pHistoryInfo, false); break; case DownloadQueue::eaHistorySetParameter: bOK = HistorySetParameter(pHistoryInfo, szText); break; case DownloadQueue::eaHistorySetCategory: bOK = HistorySetCategory(pHistoryInfo, szText); break; case DownloadQueue::eaHistorySetName: bOK = HistorySetName(pHistoryInfo, szText); break; case DownloadQueue::eaHistorySetDupeKey: case DownloadQueue::eaHistorySetDupeScore: case DownloadQueue::eaHistorySetDupeMode: case DownloadQueue::eaHistorySetDupeBackup: HistorySetDupeParam(pHistoryInfo, eAction, szText); break; case DownloadQueue::eaHistoryMarkBad: g_pDupeCoordinator->HistoryMark(pDownloadQueue, pHistoryInfo, NZBInfo::ksBad); break; case DownloadQueue::eaHistoryMarkGood: g_pDupeCoordinator->HistoryMark(pDownloadQueue, pHistoryInfo, NZBInfo::ksGood); break; case DownloadQueue::eaHistoryMarkSuccess: g_pDupeCoordinator->HistoryMark(pDownloadQueue, pHistoryInfo, NZBInfo::ksSuccess); break; default: // nothing, just to avoid compiler warning break; } break; } } } if (bOK) { pDownloadQueue->Save(); } return bOK; }
void HistoryCoordinator::Redownload(DownloadQueue* pDownloadQueue, HistoryInfo* pHistoryInfo) { HistoryList::iterator it = std::find(pDownloadQueue->GetHistory()->begin(), pDownloadQueue->GetHistory()->end(), pHistoryInfo); HistoryRedownload(pDownloadQueue, it, pHistoryInfo, true); }
bool HistoryCoordinator::EditList(DownloadQueue* downloadQueue, IdList* idList, DownloadQueue::EEditAction action, int offset, const char* text) { bool ok = false; PrepareEdit(downloadQueue, idList, action); for (int id : *idList) { for (HistoryList::iterator itHistory = downloadQueue->GetHistory()->begin(); itHistory != downloadQueue->GetHistory()->end(); itHistory++) { HistoryInfo* historyInfo = (*itHistory).get(); if (historyInfo->GetId() == id) { ok = true; switch (action) { case DownloadQueue::eaHistoryDelete: case DownloadQueue::eaHistoryFinalDelete: HistoryDelete(downloadQueue, itHistory, historyInfo, action == DownloadQueue::eaHistoryFinalDelete); break; case DownloadQueue::eaHistoryReturn: HistoryReturn(downloadQueue, itHistory, historyInfo); break; case DownloadQueue::eaHistoryProcess: HistoryProcess(downloadQueue, itHistory, historyInfo); break; case DownloadQueue::eaHistoryRedownload: HistoryRedownload(downloadQueue, itHistory, historyInfo, false); break; case DownloadQueue::eaHistoryRetryFailed: HistoryRetry(downloadQueue, itHistory, historyInfo, true, false); break; case DownloadQueue::eaHistorySetParameter: ok = HistorySetParameter(historyInfo, text); break; case DownloadQueue::eaHistorySetCategory: ok = HistorySetCategory(historyInfo, text); break; case DownloadQueue::eaHistorySetName: ok = HistorySetName(historyInfo, text); break; case DownloadQueue::eaHistorySetDupeKey: case DownloadQueue::eaHistorySetDupeScore: case DownloadQueue::eaHistorySetDupeMode: case DownloadQueue::eaHistorySetDupeBackup: HistorySetDupeParam(historyInfo, action, text); break; case DownloadQueue::eaHistoryMarkBad: g_DupeCoordinator->HistoryMark(downloadQueue, historyInfo, NzbInfo::ksBad); break; case DownloadQueue::eaHistoryMarkGood: g_DupeCoordinator->HistoryMark(downloadQueue, historyInfo, NzbInfo::ksGood); break; case DownloadQueue::eaHistoryMarkSuccess: g_DupeCoordinator->HistoryMark(downloadQueue, historyInfo, NzbInfo::ksSuccess); break; default: // nothing, just to avoid compiler warning break; } break; } } } if (ok) { downloadQueue->HistoryChanged(); downloadQueue->Save(); } return ok; }