MCPcopy Create free account
hub / github.com/amule-project/amule / DownloadFinished

Method DownloadFinished

src/IPFilter.cpp:491–519  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

489
490
491void 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
522void CIPFilter::OnIPFilterEvent(CIPFilterEvent& evt)

Callers 2

Calls 2

GetConfigDirFunction · 0.85
CFormatClass · 0.85

Tested by

no test coverage detected