| 489 | |
| 490 | |
| 491 | void CIPFilter::DownloadFinished(uint32 result) |
| 492 | { |
| 493 | wxString datName = "ipfilter.dat"; |
| 494 | if (result == HTTP_Success) { |
| 495 | // download succeeded. proceed with ipfilter loading |
| 496 | wxString newDat = thePrefs::GetConfigDir() + "ipfilter.download"; |
| 497 | wxString oldDat = thePrefs::GetConfigDir() + datName; |
| 498 | |
| 499 | if (wxFileExists(oldDat) && !wxRemoveFile(oldDat)) { |
| 500 | AddLogLineC(CFormat(_("Failed to remove %s file, aborting update.")) % datName); |
| 501 | result = HTTP_Error; |
| 502 | } else if (!wxRenameFile(newDat, oldDat)) { |
| 503 | AddLogLineC(CFormat(_("Failed to rename new %s file, aborting update.")) % datName); |
| 504 | result = HTTP_Error; |
| 505 | } else { |
| 506 | AddLogLineN(CFormat(_("Successfully updated %s")) % datName); |
| 507 | } |
| 508 | // cppcheck-suppress duplicateBranch |
| 509 | } else if (result == HTTP_Skipped) { |
| 510 | AddLogLineN(CFormat(_("Skipped download of %s, because requested file is not newer.")) % datName); |
| 511 | } else { |
| 512 | AddLogLineC(CFormat(_("Failed to download %s from %s")) % datName % m_URL); |
| 513 | } |
| 514 | |
| 515 | if (result == HTTP_Success) { |
| 516 | // Reload both ipfilter files on success |
| 517 | Reload(); |
| 518 | } |
| 519 | } |
| 520 | |
| 521 | |
| 522 | void CIPFilter::OnIPFilterEvent(CIPFilterEvent& evt) |
no test coverage detected