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

Side by Side Diff: Shared/PluginUserSettings.cpp

Issue 9998007: Initial libadblockplus integration (Closed)
Patch Set: More integration, reflecting latest libadblockplus changes Created April 9, 2013, 5:48 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/PluginTabBase.cpp ('k') | html/static/js/IESettings.js » ('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 #include "PluginUserSettings.h" 2 #include "PluginUserSettings.h"
3 #include <algorithm> 3 #include <algorithm>
4 #include "PluginSettings.h" 4 #include "PluginSettings.h"
5 #include "PluginClient.h" 5 #include "PluginClient.h"
6 #include "PluginIniFileW.h" 6 #include "PluginIniFileW.h"
7 #include "PluginDictionary.h" 7 #include "PluginDictionary.h"
8 8
9 static const CString s_GetMessage = L"GetMessage"; 9 static const CString s_GetMessage = L"GetMessage";
10 static const CString s_GetLanguageCount = L"GetLanguageCount"; 10 static const CString s_GetLanguageCount = L"GetLanguageCount";
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 } 245 }
246 } 246 }
247 else if (s_SetLanguage == method) 247 else if (s_SetLanguage == method)
248 { 248 {
249 if (1 != pDispparams->cArgs) 249 if (1 != pDispparams->cArgs)
250 return DISP_E_BADPARAMCOUNT; 250 return DISP_E_BADPARAMCOUNT;
251 251
252 if (VT_BSTR != pDispparams->rgvarg[0].vt) 252 if (VT_BSTR != pDispparams->rgvarg[0].vt)
253 return DISP_E_TYPEMISMATCH; 253 return DISP_E_TYPEMISMATCH;
254 254
255 CComBSTR language = pDispparams->rgvarg[0].bstrVal; 255 CComBSTR url = pDispparams->rgvarg[0].bstrVal;
256 256
257 settings->SetString(SETTING_LANGUAGE, (BSTR)language); 257 settings->SetSubscription((BSTR)url);
258 settings->Write();
259 settings->CheckFilterAndDownload();
260 } 258 }
261 else if (s_GetLanguage == method) 259 else if (s_GetLanguage == method)
262 { 260 {
263 if (pDispparams->cArgs) 261 if (pDispparams->cArgs)
264 return DISP_E_BADPARAMCOUNT; 262 return DISP_E_BADPARAMCOUNT;
265 263
266 if (pVarResult) 264 if (pVarResult)
267 { 265 {
268 CString language = settings->GetString(SETTING_LANGUAGE); 266 CString url = settings->GetSubscription();
269 267
270 pVarResult->vt = VT_BSTR; 268 pVarResult->vt = VT_BSTR;
271 pVarResult->bstrVal = SysAllocString(language); 269 pVarResult->bstrVal = SysAllocString(url);
272 } 270 }
273 } 271 }
274 else if (s_GetWhitelistDomains == method) 272 else if (s_GetWhitelistDomains == method)
275 { 273 {
276 if (pDispparams->cArgs) 274 if (pDispparams->cArgs)
277 return DISP_E_BADPARAMCOUNT; 275 return DISP_E_BADPARAMCOUNT;
278 276
279 if (pVarResult) 277 if (pVarResult)
280 { 278 {
279 //TODO: How and where is this stored?
281 TDomainList whiteList = settings->GetWhiteListedDomainList(true); 280 TDomainList whiteList = settings->GetWhiteListedDomainList(true);
282 CString sWhiteList; 281 CString sWhiteList;
283 for (TDomainList::const_iterator it = whiteList.begin(); it != whiteList.e nd(); ++it) 282 for (TDomainList::const_iterator it = whiteList.begin(); it != whiteList.e nd(); ++it)
284 { 283 {
285 if (!sWhiteList.IsEmpty()) 284 if (!sWhiteList.IsEmpty())
286 { 285 {
287 sWhiteList += ','; 286 sWhiteList += ',';
288 } 287 }
289 sWhiteList += it->first; 288 sWhiteList += it->first;
290 } 289 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 settings->AddWhiteListedDomain((BSTR)domain, 3, true); 323 settings->AddWhiteListedDomain((BSTR)domain, 3, true);
325 CPluginClient::GetInstance()->ClearWhiteListCache(); 324 CPluginClient::GetInstance()->ClearWhiteListCache();
326 } 325 }
327 } 326 }
328 else 327 else
329 return DISP_E_MEMBERNOTFOUND; 328 return DISP_E_MEMBERNOTFOUND;
330 329
331 return S_OK; 330 return S_OK;
332 } 331 }
333 332
OLDNEW
« no previous file with comments | « Shared/PluginTabBase.cpp ('k') | html/static/js/IESettings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld