Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: Shared/PluginConfiguration.cpp

Issue 9998007: Initial libadblockplus integration (Closed)
Patch Set: Subscription changes and filter management cleanup Created April 5, 2013, 1:56 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Shared/PluginClassThread.cpp ('k') | Shared/PluginFilter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 2
3 #include "PluginConfiguration.h" 3 #include "PluginConfiguration.h"
4 #include "PluginClient.h" 4 #include "PluginClient.h"
5 #include "PluginIniFile.h" 5 #include "PluginIniFile.h"
6 #include "PluginSettings.h" 6 #include "PluginSettings.h"
7 #include "PluginSystem.h" 7 #include "PluginSystem.h"
8 #include "PluginHttpRequest.h" 8 #include "PluginHttpRequest.h"
9 9
10 10
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 whiteListToGoSent.insert(std::make_pair(it->first, it->second)); 99 whiteListToGoSent.insert(std::make_pair(it->first, it->second));
100 } 100 }
101 101
102 httpRequest.Add("wlist", whiteList); 102 httpRequest.Add("wlist", whiteList);
103 } 103 }
104 104
105 #endif // SUPPORT_WHITELIST 105 #endif // SUPPORT_WHITELIST
106 106
107 httpRequest.Add("dicv", settings->GetValue(SETTING_DICTIONARY_VERSION, 0)); 107 httpRequest.Add("dicv", settings->GetValue(SETTING_DICTIONARY_VERSION, 0));
108 108
109 #ifdef SUPPORT_FILTER
110 httpRequest.Add("filterv", settings->GetValue(SETTING_FILTER_VERSION, 0));
111 #endif
112 #ifdef SUPPORT_CONFIG 109 #ifdef SUPPORT_CONFIG
113 httpRequest.Add("configv", settings->GetValue(SETTING_CONFIG_VERSION, 0)); 110 httpRequest.Add("configv", settings->GetValue(SETTING_CONFIG_VERSION, 0));
114 #endif 111 #endif
115 112
116 if (!isOk) 113 if (!isOk)
117 { 114 {
118 return false; 115 return false;
119 } 116 }
120 117
121 if (!httpRequest.Send(false)) 118 if (!httpRequest.Send(false))
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 215
219 DEBUG_SETTINGS("Settings::Configuration file version:" + it->second); 216 DEBUG_SETTINGS("Settings::Configuration file version:" + it->second);
220 } 217 }
221 else 218 else
222 { 219 {
223 m_isValidConfig = false; 220 m_isValidConfig = false;
224 } 221 }
225 222
226 #endif // SUPPORT_CONFIG 223 #endif // SUPPORT_CONFIG
227 224
228 #ifdef SUPPORT_FILTER
229
230 // Unpack filter URL's
231 m_isValidFilter = iniFile->HasSection("Filters");
232 if (m_isValidFilter)
233 {
234 it = settingsData.find(SETTING_FILTER_VERSION);
235 if (it != settingsData.end())
236 {
237 m_filterVersion = atoi(it->second);
238 }
239
240 CPluginIniFile::TSectionData filters = iniFile->GetSectionData("Filters");
241
242 int filterCount = 0;
243 bool bContinue = true;
244
245 m_filterUrlList.clear();
246
247 do
248 {
249 CStringA filterCountStr;
250 filterCountStr.Format("%d", ++filterCount);
251
252 CPluginIniFile::TSectionData::iterator filterIt = filters.find("filter" + filterCountStr);
253 CPluginIniFile::TSectionData::iterator versionIt = filters.find("filter" + filterCountStr + "v");
254 CPluginIniFile::TSectionData::iterator fileNameIt = filters.find("filter" + filterCountStr + "filename");
255
256 if (bContinue = (filterIt != filters.end() && versionIt != filters.end()))
257 {
258 m_filterUrlList[CString(filterIt->second)] = atoi(versionIt->second);
259 if (fileNameIt != filters.end())
260 {
261 m_filterFileNameList[CString(filterIt->second)] = fileNameIt->second;
262 }
263 }
264
265 } while (bContinue);
266 }
267
268 #endif // SUPPORT_FILTER
269
270 #ifdef SUPPORT_WHITELIST 225 #ifdef SUPPORT_WHITELIST
271 226
272 // Unpack whitelist domains 227 // Unpack whitelist domains
273 m_isValidWhiteList = iniFile->HasSection("Whitelist"); 228 m_isValidWhiteList = iniFile->HasSection("Whitelist");
274 if (m_isValidWhiteList) 229 if (m_isValidWhiteList)
275 { 230 {
276 CPluginIniFile::TSectionData whitelist = iniFile->GetSectionData("Whitelist" ); 231 CPluginIniFile::TSectionData whitelist = iniFile->GetSectionData("Whitelist" );
277 232
278 int domainCount = 0; 233 int domainCount = 0;
279 bool bContinue = true; 234 bool bContinue = true;
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 446
492 #endif // SUPPORT_CONFIG 447 #endif // SUPPORT_CONFIG
493 448
494 449
495 #ifdef PRODUCT_AIDOINLINE 450 #ifdef PRODUCT_AIDOINLINE
496 CString CPluginConfiguration::GetCollectedStatus() const 451 CString CPluginConfiguration::GetCollectedStatus() const
497 { 452 {
498 return m_collectedStatus; 453 return m_collectedStatus;
499 } 454 }
500 #endif 455 #endif
OLDNEW
« no previous file with comments | « Shared/PluginClassThread.cpp ('k') | Shared/PluginFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld