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

Method AutoUpdate

src/ServerList.cpp:878–917  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

876
877
878void CServerList::AutoUpdate()
879{
880
881 uint8 url_count = theApp->glob_prefs->addresses_list.GetCount();
882
883 if (!url_count) {
884 AddLogLineC(_("No server list address entry in 'addresses.dat' found. Please paste a valid server list address into this file in order to auto-update your server list"));
885 return;
886 }
887 // Do current URL. Callback function will take care of the others.
888 while ( current_url_index < url_count ) {
889 wxString URI = theApp->glob_prefs->addresses_list[current_url_index];
890 // wxURL only registers protocol handlers for http and ftp, so
891 // any https URL would come back as wxURL_NOPROTO and be rejected
892 // here — but the download itself goes through wxWebRequest,
893 // which handles https fine (#714). Validate with wxURI (RFC
894 // 3986 parser) + an explicit scheme check instead.
895 wxURI uri(URI);
896 const wxString scheme = uri.HasScheme() ? uri.GetScheme().Lower() : wxString();
897 if ( uri.HasServer() && (scheme == "http" || scheme == "https") ) {
898 // Ok, got a valid URI
899 m_URLUpdate = URI;
900 wxString strTempFilename =
901 thePrefs::GetConfigDir() + "server_auto.met";
902 AddLogLineC(CFormat(
903 _("Start downloading server list from %s")) % URI);
904 CHTTPDownloadThread *downloader = new CHTTPDownloadThread(
905 URI, strTempFilename, thePrefs::GetConfigDir() + "server.met", HTTP_ServerMetAuto, false, false);
906 downloader->Create();
907 downloader->Run();
908
909 return;
910 } else {
911 AddLogLineC(CFormat(
912 _("WARNING: invalid URL specified for auto-updating of servers: %s") ) % URI);
913 }
914 current_url_index++;
915 }
916 AddLogLineC(_("No valid server.met auto-download url on addresses.dat"));
917}
918
919
920void CServerList::AutoDownloadFinished(uint32 result)

Callers

nothing calls this directly

Calls 6

GetConfigDirFunction · 0.85
CFormatClass · 0.85
RunMethod · 0.80
wxStringClass · 0.70
GetCountMethod · 0.45
CreateMethod · 0.45

Tested by

no test coverage detected