OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 m_criticalSectionFilter.Lock(); | 254 m_criticalSectionFilter.Lock(); |
255 { | 255 { |
256 isHidden = filter && filter->IsElementHidden(tag, pEl, domain, indent); | 256 isHidden = filter && filter->IsElementHidden(tag, pEl, domain, indent); |
257 } | 257 } |
258 m_criticalSectionFilter.Unlock(); | 258 m_criticalSectionFilter.Unlock(); |
259 return isHidden; | 259 return isHidden; |
260 } | 260 } |
261 | 261 |
262 bool CAdblockPlusClient::IsWhitelistedUrl(const std::wstring& url) | 262 bool CAdblockPlusClient::IsWhitelistedUrl(const std::wstring& url) |
263 { | 263 { |
| 264 std::string filterText; |
| 265 return IsWhitelistedUrl(url, filterText); |
| 266 } |
| 267 |
| 268 bool CAdblockPlusClient::IsWhitelistedUrl(const std::wstring& url, std::string&
filterText) |
| 269 { |
264 DEBUG_GENERAL((L"IsWhitelistedUrl: " + url + L" start").c_str()); | 270 DEBUG_GENERAL((L"IsWhitelistedUrl: " + url + L" start").c_str()); |
265 Communication::OutputBuffer request; | 271 Communication::OutputBuffer request; |
266 request << Communication::PROC_IS_WHITELISTED_URL << ToUtf8String(url); | 272 request << Communication::PROC_IS_WHITELISTED_URL << ToUtf8String(url); |
267 | 273 |
268 Communication::InputBuffer response; | 274 Communication::InputBuffer response; |
269 if (!CallEngine(request, response)) | 275 if (!CallEngine(request, response)) |
270 return false; | 276 return false; |
271 | 277 |
272 bool isWhitelisted; | 278 response >> filterText; |
273 response >> isWhitelisted; | |
274 | 279 |
275 DEBUG_GENERAL((L"IsWhitelistedUrl: " + url + L" end").c_str()); | 280 DEBUG_GENERAL((L"IsWhitelistedUrl: " + url + L" end").c_str()); |
276 return isWhitelisted; | 281 return !filterText.empty(); |
277 } | 282 } |
278 | 283 |
279 bool CAdblockPlusClient::IsElemhideWhitelistedOnDomain(const std::wstring& url) | 284 bool CAdblockPlusClient::IsElemhideWhitelistedOnDomain(const std::wstring& url) |
280 { | 285 { |
281 Communication::OutputBuffer request; | 286 Communication::OutputBuffer request; |
282 request << Communication::PROC_IS_ELEMHIDE_WHITELISTED_ON_URL << ToUtf8String(
url); | 287 request << Communication::PROC_IS_ELEMHIDE_WHITELISTED_ON_URL << ToUtf8String(
url); |
283 | 288 |
284 Communication::InputBuffer response; | 289 Communication::InputBuffer response; |
285 if (!CallEngine(request, response)) | 290 if (!CallEngine(request, response)) |
286 return false; | 291 return false; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 | 404 |
400 void CAdblockPlusClient::AddFilter(const std::wstring& text) | 405 void CAdblockPlusClient::AddFilter(const std::wstring& text) |
401 { | 406 { |
402 Communication::OutputBuffer request; | 407 Communication::OutputBuffer request; |
403 request << Communication::PROC_ADD_FILTER << ToUtf8String(text); | 408 request << Communication::PROC_ADD_FILTER << ToUtf8String(text); |
404 CallEngine(request); | 409 CallEngine(request); |
405 } | 410 } |
406 | 411 |
407 void CAdblockPlusClient::RemoveFilter(const std::wstring& text) | 412 void CAdblockPlusClient::RemoveFilter(const std::wstring& text) |
408 { | 413 { |
| 414 RemoveFilter(ToUtf8String(text)); |
| 415 } |
| 416 |
| 417 void CAdblockPlusClient::RemoveFilter(const std::string& text) |
| 418 { |
409 Communication::OutputBuffer request; | 419 Communication::OutputBuffer request; |
410 request << Communication::PROC_REMOVE_FILTER << ToUtf8String(text); | 420 request << Communication::PROC_REMOVE_FILTER << text; |
411 CallEngine(request); | 421 CallEngine(request); |
412 } | 422 } |
413 | 423 |
414 void CAdblockPlusClient::SetPref(const std::wstring& name, const std::wstring& v
alue) | 424 void CAdblockPlusClient::SetPref(const std::wstring& name, const std::wstring& v
alue) |
415 { | 425 { |
416 Communication::OutputBuffer request; | 426 Communication::OutputBuffer request; |
417 request << Communication::PROC_SET_PREF << ToUtf8String(name) << ToUtf8String(
value); | 427 request << Communication::PROC_SET_PREF << ToUtf8String(name) << ToUtf8String(
value); |
418 CallEngine(request); | 428 CallEngine(request); |
419 } | 429 } |
420 | 430 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 DEBUG_GENERAL("CompareVersions"); | 568 DEBUG_GENERAL("CompareVersions"); |
559 Communication::OutputBuffer request; | 569 Communication::OutputBuffer request; |
560 request << Communication::PROC_COMPARE_VERSIONS << ToUtf8String(v1) << ToUtf8S
tring(v2); | 570 request << Communication::PROC_COMPARE_VERSIONS << ToUtf8String(v1) << ToUtf8S
tring(v2); |
561 Communication::InputBuffer response; | 571 Communication::InputBuffer response; |
562 if (!CallEngine(request, response)) | 572 if (!CallEngine(request, response)) |
563 return 0; | 573 return 0; |
564 int result; | 574 int result; |
565 response >> result; | 575 response >> result; |
566 return result; | 576 return result; |
567 } | 577 } |
OLD | NEW |