| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| 1 #include "PluginStdAfx.h" | 1 #include "PluginStdAfx.h" |
| 2 | 2 |
| 3 #include <Wbemidl.h> | 3 #include <Wbemidl.h> |
| 4 #include <time.h> | 4 #include <time.h> |
| 5 #include "PluginIniFileW.h" | 5 #include "PluginIniFileW.h" |
| 6 #include "PluginIniFile.h" | 6 #include "PluginIniFile.h" |
| 7 #include "PluginSettings.h" | 7 #include "PluginSettings.h" |
| 8 #include "PluginDictionary.h" | 8 #include "PluginDictionary.h" |
| 9 #include "PluginClient.h" | 9 #include "PluginClient.h" |
| 10 #include "PluginChecksum.h" | 10 #include "PluginChecksum.h" |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 392 m_properties[SETTING_LANGUAGE] = "en"; | 392 m_properties[SETTING_LANGUAGE] = "en"; |
| 393 } | 393 } |
| 394 s_criticalSectionLocal.Unlock(); | 394 s_criticalSectionLocal.Unlock(); |
| 395 | 395 |
| 396 // Default filters | 396 // Default filters |
| 397 #ifdef SUPPORT_FILTER | 397 #ifdef SUPPORT_FILTER |
| 398 | 398 |
| 399 s_criticalSectionFilters.Lock(); | 399 s_criticalSectionFilters.Lock(); |
| 400 { | 400 { |
| 401 m_filterUrlList.clear(); | 401 m_filterUrlList.clear(); |
| 402 /* m_filterUrlList[CString(FILTERS_PROTOCOL) + CString(FILTERS_HOST ) + "/easylist.txt"] = 1; | |
| 403 | |
| 404 m_filterFileNameList.clear(); | |
| 405 m_filterFileNameList[CString(FILTERS_PROTOCOL) + CString(FILTERS_HOST) + "/e asylist.txt"] = "filter1.txt"; | |
| 406 | |
| 407 m_filterLanguagesList.clear(); | |
| 408 m_filterLanguagesList[CString(FILTERS_PROTOCOL) + CString(FILTERS_HOST) + "/ easylist.txt"] = "en"; | |
| 409 | |
| 410 m_filterDownloadTimesList.clear(); | |
| 411 m_filterDownloadTimesList[CString(FILTERS_PROTOCOL) + CString(FILTERS_HOST) + "/easylist.txt"] = time(NULL); | |
| 412 */ | |
| 413 } | 402 } |
| 414 s_criticalSectionFilters.Unlock(); | 403 s_criticalSectionFilters.Unlock(); |
| 415 | 404 |
| 416 #endif // SUPPORT_FILTER | 405 #endif // SUPPORT_FILTER |
| 417 } | 406 } |
| 418 | 407 |
| 419 bool CPluginSettings::MakeRequestForUpdate() | 408 bool CPluginSettings::MakeRequestForUpdate() |
|
Felix Dahlke
2013/04/03 05:35:27
Shouldn't this call UpdateSubscription()?
| |
| 420 { | 409 { |
| 421 time_t updateTime = this->GetValue(SETTING_LAST_UPDATE_TIME); | 410 time_t updateTime = this->GetValue(SETTING_LAST_UPDATE_TIME); |
| 422 | 411 |
| 423 if (time(NULL) <= updateTime) | 412 if (time(NULL) <= updateTime) |
| 424 return false; | 413 return false; |
| 425 | 414 |
| 426 CPluginHttpRequest httpRequest(PLUGIN_UPDATE_URL); | 415 CPluginHttpRequest httpRequest(PLUGIN_UPDATE_URL); |
| 427 | 416 |
| 428 CPluginSystem* system = CPluginSystem::GetInstance(); | 417 CPluginSystem* system = CPluginSystem::GetInstance(); |
| 429 | 418 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 489 | 478 |
| 490 DEBUG_GENERAL("*** before FilterShouldLoad: " + downloadFilterName); | 479 DEBUG_GENERAL("*** before FilterShouldLoad: " + downloadFilterName); |
| 491 | 480 |
| 492 if ((this->FilterShouldLoad(downloadFilterName))) | 481 if ((this->FilterShouldLoad(downloadFilterName))) |
| 493 { | 482 { |
| 494 filterAvailable = true; | 483 filterAvailable = true; |
| 495 DEBUG_GENERAL("*** before FilterlistExpired: " + downloadFilterName); | 484 DEBUG_GENERAL("*** before FilterlistExpired: " + downloadFilterName); |
| 496 if (this->FilterlistExpired(downloadFilterName)) | 485 if (this->FilterlistExpired(downloadFilterName)) |
| 497 { | 486 { |
| 498 DEBUG_GENERAL("*** before DownloadFilterFile: " + downloadFilterName); | 487 DEBUG_GENERAL("*** before DownloadFilterFile: " + downloadFilterName); |
| 499 CPluginFilter::DownloadFilterFile(downloadFilterName, filename); | 488 // CPluginFilter::DownloadFilterFile(downloadFilterName, filename); |
|
Felix Dahlke
2013/04/03 05:35:27
Might as well remove this line, likewise below.
| |
| 500 this->SetFilterRefreshDate(downloadFilterName, time(NULL) + (5 * 24 * 60 * 60) * ((rand() % 100) / 100 * 0.4 + 0.8)); | 489 this->SetFilterRefreshDate(downloadFilterName, time(NULL) + (5 * 24 * 60 * 60) * ((rand() % 100) / 100 * 0.4 + 0.8)); |
| 501 } | 490 } |
| 502 } | 491 } |
| 503 else | 492 else |
| 504 { | 493 { |
| 505 //Cleanup, since we don't need the filter definition | 494 //Cleanup, since we don't need the filter definition |
| 506 DeleteFile(CPluginSettings::GetDataPath(filename)); | 495 DeleteFile(CPluginSettings::GetDataPath(filename)); |
| 507 this->SetFilterRefreshDate(downloadFilterName, 0); | 496 this->SetFilterRefreshDate(downloadFilterName, 0); |
| 508 } | 497 } |
| 509 } | 498 } |
| 510 | 499 |
| 511 if (!filterAvailable) | 500 if (!filterAvailable) |
| 512 { | 501 { |
| 513 //If no filter list found, default to "en" | 502 //If no filter list found, default to "en" |
| 514 | 503 |
| 515 this->SetString(SETTING_LANGUAGE, (BSTR)L"en"); | 504 this->SetString(SETTING_LANGUAGE, (BSTR)L"en"); |
| 516 | 505 |
| 517 CPluginDictionary* dict = CPluginDictionary::GetInstance(); | 506 CPluginDictionary* dict = CPluginDictionary::GetInstance(); |
| 518 dict->SetLanguage(L"en"); | 507 dict->SetLanguage(L"en"); |
| 519 | 508 |
| 520 for (std::map<CString, CString>::iterator it = m_filterLanguagesList.begin() ; it != m_filterLanguagesList.end(); ++it) | 509 for (std::map<CString, CString>::iterator it = m_filterLanguagesList.begin() ; it != m_filterLanguagesList.end(); ++it) |
| 521 { | 510 { |
| 522 if (it->second == L"en") | 511 if (it->second == L"en") |
| 523 { | 512 { |
| 524 CPluginFilter::DownloadFilterFile(it->first, m_filterFileNameList.find(i t->first)->second); | 513 // CPluginFilter::DownloadFilterFile(it->first, m_filterFileNameList.find (it->first)->second); |
| 525 this->SetFilterRefreshDate(it->first, time(NULL) + (5 * 24 * 60 * 60) * ((rand() % 100) / 100 * 0.4 + 0.8)); | 514 this->SetFilterRefreshDate(it->first, time(NULL) + (5 * 24 * 60 * 60) * ((rand() % 100) / 100 * 0.4 + 0.8)); |
| 526 } | 515 } |
| 527 } | 516 } |
| 528 } | 517 } |
| 529 | 518 |
| 530 this->Write(); | 519 this->Write(); |
| 531 | 520 |
| 532 this->IncrementTabVersion(SETTING_TAB_FILTER_VERSION); | 521 this->IncrementTabVersion(SETTING_TAB_FILTER_VERSION); |
| 533 | 522 |
| 534 s_criticalSectionLocal.Unlock(); | 523 s_criticalSectionLocal.Unlock(); |
| (...skipping 1771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2306 osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); | 2295 osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); |
| 2307 bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO*) &osvi); | 2296 bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO*) &osvi); |
| 2308 | 2297 |
| 2309 m_WindowsBuildNumber = osvi.dwBuildNumber; | 2298 m_WindowsBuildNumber = osvi.dwBuildNumber; |
| 2310 } | 2299 } |
| 2311 | 2300 |
| 2312 return m_WindowsBuildNumber; | 2301 return m_WindowsBuildNumber; |
| 2313 } | 2302 } |
| 2314 | 2303 |
| 2315 #endif // SUPPORT_WHITELIST | 2304 #endif // SUPPORT_WHITELIST |
| OLD | NEW |