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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 #endif | 56 #endif |
57 | 57 |
58 WCHAR* CPluginSettings::s_dataPath; | 58 WCHAR* CPluginSettings::s_dataPath; |
59 WCHAR* CPluginSettings::s_dataPathParent; | 59 WCHAR* CPluginSettings::s_dataPathParent; |
60 | 60 |
61 CPluginSettings* CPluginSettings::s_instance = NULL; | 61 CPluginSettings* CPluginSettings::s_instance = NULL; |
62 bool CPluginSettings::s_isLightOnly = false; | 62 bool CPluginSettings::s_isLightOnly = false; |
63 | 63 |
64 CComAutoCriticalSection CPluginSettings::s_criticalSectionLocal; | 64 CComAutoCriticalSection CPluginSettings::s_criticalSectionLocal; |
65 #ifdef SUPPORT_FILTER | |
66 CComAutoCriticalSection CPluginSettings::s_criticalSectionFilters; | |
67 #endif | |
68 #ifdef SUPPORT_WHITELIST | 65 #ifdef SUPPORT_WHITELIST |
69 CComAutoCriticalSection CPluginSettings::s_criticalSectionDomainHistory; | 66 CComAutoCriticalSection CPluginSettings::s_criticalSectionDomainHistory; |
70 #endif | 67 #endif |
71 | 68 |
72 | 69 |
73 CPluginSettings::CPluginSettings() : | 70 CPluginSettings::CPluginSettings() : |
74 m_settingsVersion("1"), m_isDirty(false), m_isFirstRun(false), m_isFirstRunUpd
ate(false), m_dwMainProcessId(0), m_dwMainThreadId(0), m_dwWorkingThreadId(0), | 71 m_settingsVersion("1"), m_isDirty(false), m_isFirstRun(false), m_isFirstRunUpd
ate(false), m_dwMainProcessId(0), m_dwMainThreadId(0), m_dwWorkingThreadId(0), |
75 m_isDirtyTab(false), m_isPluginEnabledTab(true), m_tabNumber("1") | 72 m_isDirtyTab(false), m_isPluginEnabledTab(true), m_tabNumber("1") |
76 { | 73 { |
77 | 74 |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 | 280 |
284 CPluginSettingsLock lock; | 281 CPluginSettingsLock lock; |
285 if (lock.IsLocked()) | 282 if (lock.IsLocked()) |
286 { | 283 { |
287 isRead = m_settingsFile->Read(); | 284 isRead = m_settingsFile->Read(); |
288 if (isRead) | 285 if (isRead) |
289 { | 286 { |
290 if (m_settingsFile->IsValidChecksum()) | 287 if (m_settingsFile->IsValidChecksum()) |
291 { | 288 { |
292 m_properties = m_settingsFile->GetSectionData("Settings"); | 289 m_properties = m_settingsFile->GetSectionData("Settings"); |
293 | |
294 #ifdef SUPPORT_FILTER | |
295 // Unpack filter URLs | |
296 CPluginIniFileW::TSectionData filters = m_settingsFile->GetSectionData
("Filters"); | |
297 int filterCount = 0; | |
298 bool bContinue = true; | |
299 | |
300 s_criticalSectionFilters.Lock(); | |
301 { | |
302 m_filterUrlList.clear(); | |
303 | |
304 do | |
305 { | |
306 CString filterCountStr; | |
307 filterCountStr.Format(L"%d", ++filterCount); | |
308 | |
309 CPluginIniFileW::TSectionData::iterator filterIt = filters.find(L"
filter" + filterCountStr); | |
310 CPluginIniFileW::TSectionData::iterator versionIt = filters.find(L
"filter" + filterCountStr + "v"); | |
311 CPluginIniFileW::TSectionData::iterator fileNameIt = filters.find(
L"filter" + filterCountStr + "fileName"); | |
312 CPluginIniFileW::TSectionData::iterator languageIt = filters.find(
L"filter" + filterCountStr + "language"); | |
313 CPluginIniFileW::TSectionData::iterator languageTitleIt = filters.
find(L"filter" + filterCountStr + "languageTitle"); | |
314 CPluginIniFileW::TSectionData::iterator dltIt = filters.find(L"fil
ter" + filterCountStr + "refreshin"); | |
315 | |
316 if (bContinue = (filterIt != filters.end() && versionIt != filters
.end())) | |
317 { | |
318 m_filterUrlList[filterIt->second] = _wtoi(versionIt->second); | |
319 } | |
320 | |
321 if (filterIt != filters.end() && fileNameIt != filters.end()) | |
322 { | |
323 m_filterFileNameList[filterIt->second] = fileNameIt->second; | |
324 } | |
325 | |
326 if (filterIt != filters.end() && languageIt != filters.end()) | |
327 { | |
328 m_filterLanguagesList[filterIt->second] = languageIt->second; | |
329 } | |
330 | |
331 if (filterIt != filters.end() && languageIt != filters.end() &&
languageTitleIt != filters.end()) | |
332 { | |
333 m_filterLanguageTitleList[languageIt->second] = languageTitleIt-
>second; | |
334 } | |
335 | |
336 if (filterIt != filters.end() && dltIt != filters.end()) | |
337 { | |
338 m_filterDownloadTimesList[filterIt->second] = (time_t)_wtoi(dltI
t->second.GetString()); | |
339 } | |
340 | |
341 } while (bContinue); | |
342 } | |
343 s_criticalSectionFilters.Unlock(); | |
344 | |
345 #endif // SUPPORT_FILTER | |
346 } | 290 } |
347 else | 291 else |
348 { | 292 { |
349 DEBUG_SETTINGS("Settings:Invalid checksum - Deleting file") | 293 DEBUG_SETTINGS("Settings:Invalid checksum - Deleting file") |
350 | 294 |
351 Clear(); | 295 Clear(); |
352 | 296 |
353 DEBUG_ERROR_LOG(m_settingsFile->GetLastError(), PLUGIN_ERROR_SETTINGS,
PLUGIN_ERROR_SETTINGS_FILE_READ_CHECKSUM, "Settings::Read - Checksum") | 297 DEBUG_ERROR_LOG(m_settingsFile->GetLastError(), PLUGIN_ERROR_SETTINGS,
PLUGIN_ERROR_SETTINGS_FILE_READ_CHECKSUM, "Settings::Read - Checksum") |
354 isRead = false; | 298 isRead = false; |
355 m_isDirty = true; | 299 m_isDirty = true; |
356 } | 300 } |
357 } | 301 } |
358 else if (m_settingsFile->GetLastError() == ERROR_FILE_NOT_FOUND) | 302 else if (m_settingsFile->GetLastError() == ERROR_FILE_NOT_FOUND) |
359 { | 303 { |
360 DEBUG_ERROR_LOG(m_settingsFile->GetLastError(), PLUGIN_ERROR_SETTINGS, P
LUGIN_ERROR_SETTINGS_FILE_READ, "Settings::Read") | 304 DEBUG_ERROR_LOG(m_settingsFile->GetLastError(), PLUGIN_ERROR_SETTINGS, P
LUGIN_ERROR_SETTINGS_FILE_READ, "Settings::Read") |
361 m_isDirty = true; | 305 m_isDirty = true; |
362 } | 306 } |
363 else | 307 else |
364 { | 308 { |
(...skipping 20 matching lines...) Expand all Loading... |
385 { | 329 { |
386 // Default settings | 330 // Default settings |
387 s_criticalSectionLocal.Lock(); | 331 s_criticalSectionLocal.Lock(); |
388 { | 332 { |
389 m_properties.clear(); | 333 m_properties.clear(); |
390 | 334 |
391 m_properties[SETTING_PLUGIN_VERSION] = IEPLUGIN_VERSION; | 335 m_properties[SETTING_PLUGIN_VERSION] = IEPLUGIN_VERSION; |
392 m_properties[SETTING_LANGUAGE] = "en"; | 336 m_properties[SETTING_LANGUAGE] = "en"; |
393 } | 337 } |
394 s_criticalSectionLocal.Unlock(); | 338 s_criticalSectionLocal.Unlock(); |
395 | |
396 // Default filters | |
397 #ifdef SUPPORT_FILTER | |
398 | |
399 s_criticalSectionFilters.Lock(); | |
400 { | |
401 m_filterUrlList.clear(); | |
402 } | |
403 s_criticalSectionFilters.Unlock(); | |
404 | |
405 #endif // SUPPORT_FILTER | |
406 } | 339 } |
407 | 340 |
408 bool CPluginSettings::MakeRequestForUpdate() | 341 bool CPluginSettings::MakeRequestForUpdate() |
409 { | 342 { |
410 time_t updateTime = this->GetValue(SETTING_LAST_UPDATE_TIME); | 343 time_t updateTime = this->GetValue(SETTING_LAST_UPDATE_TIME); |
411 | 344 |
412 if (time(NULL) <= updateTime) | 345 if (time(NULL) <= updateTime) |
413 return false; | 346 return false; |
414 | 347 |
415 CPluginHttpRequest httpRequest(PLUGIN_UPDATE_URL); | 348 CPluginHttpRequest httpRequest(PLUGIN_UPDATE_URL); |
(...skipping 30 matching lines...) Expand all Loading... |
446 { | 379 { |
447 CString ver(it->second); | 380 CString ver(it->second); |
448 SetString(SETTING_PLUGIN_UPDATE_VERSION, ver); | 381 SetString(SETTING_PLUGIN_UPDATE_VERSION, ver); |
449 m_isDirty = true; | 382 m_isDirty = true; |
450 DEBUG_SETTINGS("Settings::Configuration plugin update version:" + it->seco
nd); | 383 DEBUG_SETTINGS("Settings::Configuration plugin update version:" + it->seco
nd); |
451 } | 384 } |
452 } | 385 } |
453 | 386 |
454 return true; | 387 return true; |
455 } | 388 } |
456 bool CPluginSettings::CheckFilterAndDownload() | |
457 { | |
458 s_criticalSectionLocal.Lock(); | |
459 TFilterUrlList currentFilterUrlList = this->GetFilterUrlList(); | |
460 std::map<CString, CString> fileNamesList = this->GetFilterFileNamesList(); | |
461 | |
462 bool filterAvailable = false; | |
463 for (TFilterUrlList::iterator it = currentFilterUrlList.begin(); it != current
FilterUrlList.end(); ++it) | |
464 { | |
465 CString downloadFilterName = it->first; | |
466 | |
467 std::map<CString, CString>::const_iterator fni = fileNamesList.find(download
FilterName); | |
468 CString filename = ""; | |
469 if (fni != fileNamesList.end()) | |
470 { | |
471 filename = fni->second; | |
472 } | |
473 else | |
474 { | |
475 filename = downloadFilterName.Trim().Right(downloadFilterName.GetLength()
- downloadFilterName.ReverseFind('/') - 1).Trim(); | |
476 } | |
477 int version = it->second; | |
478 | |
479 DEBUG_GENERAL("*** before FilterShouldLoad: " + downloadFilterName); | |
480 | |
481 if ((this->FilterShouldLoad(downloadFilterName))) | |
482 { | |
483 filterAvailable = true; | |
484 DEBUG_GENERAL("*** before FilterlistExpired: " + downloadFilterName); | |
485 if (this->FilterlistExpired(downloadFilterName)) | |
486 { | |
487 DEBUG_GENERAL("*** before DownloadFilterFile: " + downloadFilterName); | |
488 // CPluginFilter::DownloadFilterFile(downloadFilterName, filename); | |
489 this->SetFilterRefreshDate(downloadFilterName, time(NULL) + (5 * 24 * 60
* 60) * ((rand() % 100) / 100 * 0.4 + 0.8)); | |
490 } | |
491 } | |
492 else | |
493 { | |
494 //Cleanup, since we don't need the filter definition | |
495 DeleteFile(CPluginSettings::GetDataPath(filename)); | |
496 this->SetFilterRefreshDate(downloadFilterName, 0); | |
497 } | |
498 } | |
499 | |
500 if (!filterAvailable) | |
501 { | |
502 //If no filter list found, default to "en" | |
503 | |
504 this->SetString(SETTING_LANGUAGE, (BSTR)L"en"); | |
505 | |
506 CPluginDictionary* dict = CPluginDictionary::GetInstance(); | |
507 dict->SetLanguage(L"en"); | |
508 | |
509 for (std::map<CString, CString>::iterator it = m_filterLanguagesList.begin()
; it != m_filterLanguagesList.end(); ++it) | |
510 { | |
511 if (it->second == L"en") | |
512 { | |
513 // CPluginFilter::DownloadFilterFile(it->first, m_filterFileNameList.find
(it->first)->second); | |
514 this->SetFilterRefreshDate(it->first, time(NULL) + (5 * 24 * 60 * 60) *
((rand() % 100) / 100 * 0.4 + 0.8)); | |
515 } | |
516 } | |
517 } | |
518 | |
519 this->Write(); | |
520 | |
521 this->IncrementTabVersion(SETTING_TAB_FILTER_VERSION); | |
522 | |
523 s_criticalSectionLocal.Unlock(); | |
524 return true; | |
525 } | |
526 | 389 |
527 CString CPluginSettings::GetDataPathParent() | 390 CString CPluginSettings::GetDataPathParent() |
528 { | 391 { |
529 if (s_dataPathParent == NULL) | 392 if (s_dataPathParent == NULL) |
530 { | 393 { |
531 WCHAR* lpData = new WCHAR[MAX_PATH]; | 394 WCHAR* lpData = new WCHAR[MAX_PATH]; |
532 | 395 |
533 OSVERSIONINFO osVersionInfo; | 396 OSVERSIONINFO osVersionInfo; |
534 ::ZeroMemory(&osVersionInfo, sizeof(OSVERSIONINFO)); | 397 ::ZeroMemory(&osVersionInfo, sizeof(OSVERSIONINFO)); |
535 | 398 |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 SetString(key, value ? "true":"false"); | 729 SetString(key, value ? "true":"false"); |
867 } | 730 } |
868 | 731 |
869 | 732 |
870 bool CPluginSettings::IsPluginEnabled() const | 733 bool CPluginSettings::IsPluginEnabled() const |
871 { | 734 { |
872 return m_isPluginEnabledTab; | 735 return m_isPluginEnabledTab; |
873 } | 736 } |
874 | 737 |
875 | 738 |
876 #ifdef SUPPORT_FILTER | |
877 | |
878 void CPluginSettings::SetFilterUrlList(const TFilterUrlList& filters) | |
879 { | |
880 DEBUG_SETTINGS(L"Settings::SetFilterUrlList") | |
881 | |
882 s_criticalSectionFilters.Lock(); | |
883 { | |
884 if (m_filterUrlList != filters) | |
885 { | |
886 m_filterUrlList = filters; | |
887 m_isDirty = true; | |
888 } | |
889 } | |
890 s_criticalSectionFilters.Unlock(); | |
891 } | |
892 | |
893 void CPluginSettings::SetFilterFileNamesList(const std::map<CString, CString>& f
ilters) | |
894 { | |
895 DEBUG_SETTINGS(L"Settings::SetFilterUrlList") | |
896 | |
897 s_criticalSectionFilters.Lock(); | |
898 { | |
899 if (m_filterFileNameList != filters) | |
900 { | |
901 m_filterFileNameList = filters; | |
902 m_isDirty = true; | |
903 } | |
904 } | |
905 s_criticalSectionFilters.Unlock(); | |
906 } | |
907 | |
908 TFilterUrlList CPluginSettings::GetFilterUrlList() const | |
909 { | |
910 TFilterUrlList filterUrlList; | |
911 | |
912 s_criticalSectionFilters.Lock(); | |
913 { | |
914 filterUrlList = m_filterUrlList; | |
915 } | |
916 s_criticalSectionFilters.Unlock(); | |
917 | |
918 return filterUrlList; | |
919 } | |
920 | |
921 | |
922 std::map<CString, CString> CPluginSettings::GetFilterFileNamesList() const | |
923 { | |
924 std::map<CString, CString> filterFileNamesList; | |
925 | |
926 s_criticalSectionFilters.Lock(); | |
927 { | |
928 filterFileNamesList = m_filterFileNameList; | |
929 } | |
930 s_criticalSectionFilters.Unlock(); | |
931 | |
932 return filterFileNamesList; | |
933 } | |
934 | |
935 | 739 |
936 std::map<CString, CString> CPluginSettings::GetFilterLanguageTitleList() const | 740 std::map<CString, CString> CPluginSettings::GetFilterLanguageTitleList() const |
937 { | 741 { |
938 std::map<CString, CString> filterList; | 742 std::map<CString, CString> filterList; |
939 | 743 std::vector<Subscription> subs = CPluginClient::GetInstance()->GetFilterEngine
()->GetSubscriptions(); |
940 s_criticalSectionFilters.Lock(); | 744 for (std::vector<Subscription>::iterator it = subs.begin(); it != subs.end();
++it) |
941 { | 745 { |
942 filterList = m_filterLanguageTitleList; | 746 CString title = CA2T((*it).title.c_str(), CP_UTF8); |
| 747 CString url = CA2T((*it).url.c_str(), CP_UTF8); |
| 748 filterList.insert(std::make_pair(title, url)); |
943 } | 749 } |
944 s_criticalSectionFilters.Unlock(); | |
945 | |
946 return filterList; | 750 return filterList; |
947 } | 751 } |
948 | 752 |
949 | 753 |
950 bool CPluginSettings::FilterlistExpired(CString filterlist) const | |
951 { | |
952 std::map<CString, time_t>::const_iterator it = m_filterDownloadTimesList.find(
filterlist); | |
953 if (it == m_filterDownloadTimesList.end()) | |
954 return false; | |
955 if (time(NULL) >= it->second) | |
956 return true; | |
957 return false; | |
958 } | |
959 | |
960 bool CPluginSettings::FilterShouldLoad(CString filterlist) const | |
961 { | |
962 std::map<CString, CString>::const_iterator it = m_filterLanguagesList.find(fil
terlist); | |
963 if (it == m_filterLanguagesList.end()) | |
964 return false; | |
965 CPluginSettings* pluginSettings = CPluginSettings::GetInstance(); | |
966 if (it->second == pluginSettings->GetString(SETTING_LANGUAGE)) | |
967 return true; | |
968 return false; | |
969 } | |
970 | |
971 | |
972 bool CPluginSettings::SetFilterRefreshDate(CString filterlist, time_t refreshtim
e) | |
973 { | |
974 m_filterDownloadTimesList[filterlist] = refreshtime; | |
975 m_isDirty = true; | |
976 return true; | |
977 } | |
978 void CPluginSettings::AddFilterUrl(const CString& url, int version) | |
979 { | |
980 s_criticalSectionFilters.Lock(); | |
981 { | |
982 TFilterUrlList::iterator it = m_filterUrlList.find(url); | |
983 if (it == m_filterUrlList.end() || it->second != version) | |
984 { | |
985 m_filterUrlList[url] = version; | |
986 m_isDirty = true; | |
987 } | |
988 } | |
989 s_criticalSectionFilters.Unlock(); | |
990 } | |
991 | |
992 void CPluginSettings::AddFilterFileName(const CString& url, const CString& fileN
ame) | |
993 { | |
994 s_criticalSectionFilters.Lock(); | |
995 { | |
996 std::map<CString, CString>::iterator it = m_filterFileNameList.find(url); | |
997 if (it == m_filterFileNameList.end() || it->second != fileName) | |
998 { | |
999 m_filterFileNameList[url] = fileName; | |
1000 m_isDirty = true; | |
1001 } | |
1002 } | |
1003 s_criticalSectionFilters.Unlock(); | |
1004 } | |
1005 #endif // SUPPORT_FILTER | |
1006 | |
1007 bool CPluginSettings::Write(bool isDebug) | 754 bool CPluginSettings::Write(bool isDebug) |
1008 { | 755 { |
1009 bool isWritten = true; | 756 bool isWritten = true; |
1010 | 757 |
1011 if (!m_isDirty) | 758 if (!m_isDirty) |
1012 { | 759 { |
1013 return isWritten; | 760 return isWritten; |
1014 } | 761 } |
1015 | 762 |
1016 if (isDebug) | 763 if (isDebug) |
(...skipping 13 matching lines...) Expand all Loading... |
1030 { | 777 { |
1031 for (TProperties::iterator it = m_properties.begin(); it != m_properties.e
nd(); ++it) | 778 for (TProperties::iterator it = m_properties.begin(); it != m_properties.e
nd(); ++it) |
1032 { | 779 { |
1033 settings[it->first] = it->second; | 780 settings[it->first] = it->second; |
1034 } | 781 } |
1035 } | 782 } |
1036 s_criticalSectionLocal.Unlock(); | 783 s_criticalSectionLocal.Unlock(); |
1037 | 784 |
1038 m_settingsFile->UpdateSection("Settings", settings); | 785 m_settingsFile->UpdateSection("Settings", settings); |
1039 | 786 |
1040 // Filter URL's | |
1041 #ifdef SUPPORT_FILTER | |
1042 | |
1043 int filterCount = 0; | |
1044 CPluginIniFileW::TSectionData filters; | |
1045 | |
1046 s_criticalSectionFilters.Lock(); | |
1047 { | |
1048 for (TFilterUrlList::iterator it = m_filterUrlList.begin(); it != m_filter
UrlList.end(); ++it) | |
1049 { | |
1050 CString filterCountStr; | |
1051 filterCountStr.Format(L"%d", ++filterCount); | |
1052 | |
1053 CString filterVersion; | |
1054 filterVersion.Format(L"%d", it->second); | |
1055 | |
1056 filters[L"filter" + filterCountStr] = it->first; | |
1057 filters[L"filter" + filterCountStr + L"v"] = filterVersion; | |
1058 if (m_filterFileNameList.size() > 0) | |
1059 { | |
1060 std::map<CString, CString>::iterator fni = m_filterFileNameList.find(i
t->first); | |
1061 if (fni != m_filterFileNameList.end()) | |
1062 { | |
1063 CString fileName = fni->second; | |
1064 filters[L"filter" + filterCountStr + "fileName"] = fileName; | |
1065 } | |
1066 } | |
1067 if (m_filterLanguagesList.size() > 0) | |
1068 { | |
1069 std::map<CString, CString>::iterator fli = m_filterLanguagesList.find(
it->first); | |
1070 if (fli != m_filterLanguagesList.end()) | |
1071 { | |
1072 CString language = fli->second; | |
1073 filters[L"filter" + filterCountStr + "language"] = language; | |
1074 | |
1075 if (m_filterLanguageTitleList.size() > 0) | |
1076 { | |
1077 std::map<CString, CString>::iterator fli = m_filterLanguageTitleLi
st.find(language); | |
1078 if (fli != m_filterLanguageTitleList.end()) | |
1079 { | |
1080 CString language = fli->second; | |
1081 filters[L"filter" + filterCountStr + "languageTitle"] = language
; | |
1082 } | |
1083 } | |
1084 | |
1085 } | |
1086 } | |
1087 if (m_filterDownloadTimesList.size() > 0) | |
1088 { | |
1089 std::map<CString, time_t>::iterator fdti = m_filterDownloadTimesList.f
ind(it->first); | |
1090 if (fdti != m_filterDownloadTimesList.end()) | |
1091 { | |
1092 CString timeString; | |
1093 timeString.Format(L"%d", (int)fdti->second); | |
1094 filters[L"filter" + filterCountStr + "refreshin"] = timeString; | |
1095 } | |
1096 } | |
1097 | |
1098 } | |
1099 } | |
1100 s_criticalSectionFilters.Unlock(); | |
1101 | |
1102 m_settingsFile->UpdateSection("Filters", filters); | |
1103 | |
1104 #endif // SUPPORT_FILTER | |
1105 | |
1106 // Write file | 787 // Write file |
1107 isWritten = m_settingsFile->Write(); | 788 isWritten = m_settingsFile->Write(); |
1108 if (!isWritten) | 789 if (!isWritten) |
1109 { | 790 { |
1110 DEBUG_ERROR_LOG(m_settingsFile->GetLastError(), PLUGIN_ERROR_SETTINGS, PLU
GIN_ERROR_SETTINGS_FILE_WRITE, "Settings::Write") | 791 DEBUG_ERROR_LOG(m_settingsFile->GetLastError(), PLUGIN_ERROR_SETTINGS, PLU
GIN_ERROR_SETTINGS_FILE_WRITE, "Settings::Write") |
1111 } | 792 } |
1112 | 793 |
1113 m_isDirty = false; | 794 m_isDirty = false; |
1114 | 795 |
1115 IncrementTabVersion(SETTING_TAB_SETTINGS_VERSION); | 796 IncrementTabVersion(SETTING_TAB_SETTINGS_VERSION); |
(...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2294 | 1975 |
2295 osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); | 1976 osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); |
2296 bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO*) &osvi); | 1977 bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO*) &osvi); |
2297 | 1978 |
2298 m_WindowsBuildNumber = osvi.dwBuildNumber; | 1979 m_WindowsBuildNumber = osvi.dwBuildNumber; |
2299 } | 1980 } |
2300 | 1981 |
2301 return m_WindowsBuildNumber; | 1982 return m_WindowsBuildNumber; |
2302 } | 1983 } |
2303 | 1984 |
| 1985 void CPluginSettings::SetSubscription(BSTR language) |
| 1986 { |
| 1987 std::string lngConverted = CT2A(language); |
| 1988 SetSubscription(lngConverted); |
| 1989 } |
| 1990 |
| 1991 void CPluginSettings::SetSubscription(std::string language) |
| 1992 { |
| 1993 FilterEngine* filterEngine= CPluginClient::GetInstance()->GetFilterEngine(); |
| 1994 //TODO: negotiate who should store what? Is the plugin responsible for storing
selected subscription? |
| 1995 const AdblockPlus::Subscription* subscription = filterEngine->FindSubscription(
language); |
| 1996 if (subscription != NULL) |
| 1997 { |
| 1998 //TODO: API for this? |
| 1999 // filterEngine->SetActiveSubscription(*subscription); |
| 2000 } |
| 2001 } |
| 2002 |
| 2003 void CPluginSettings::RefreshFilterlist() |
| 2004 { |
| 2005 //TODO: Why does this have subscription as parameter? Shouldn't it update curr
ently active filter? |
| 2006 // CPluginClient::GetInstance()->GetFilterEngine()->UpdateSubscriptionFilters()
; |
| 2007 } |
| 2008 |
2304 #endif // SUPPORT_WHITELIST | 2009 #endif // SUPPORT_WHITELIST |
OLD | NEW |