| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 127 |
| 128 std::vector<SubscriptionDescription> ReadSubscriptions(Communication::InputBuf
fer& message) | 128 std::vector<SubscriptionDescription> ReadSubscriptions(Communication::InputBuf
fer& message) |
| 129 { | 129 { |
| 130 int32_t count; | 130 int32_t count; |
| 131 message >> count; | 131 message >> count; |
| 132 | 132 |
| 133 std::vector<SubscriptionDescription> result; | 133 std::vector<SubscriptionDescription> result; |
| 134 for (int32_t i = 0; i < count; i++) | 134 for (int32_t i = 0; i < count; i++) |
| 135 { | 135 { |
| 136 SubscriptionDescription description; | 136 SubscriptionDescription description; |
| 137 std::string url; | 137 message >> description.url; |
| 138 message >> url; | 138 message >> description.title; |
| 139 description.url = ToUtf16String(url); | 139 message >> description.specialization; |
| 140 std::string title; | |
| 141 message >> title; | |
| 142 description.title = ToUtf16String(title); | |
| 143 std::string specialization; | |
| 144 message >> specialization; | |
| 145 description.specialization = ToUtf16String(specialization); | |
| 146 message >> description.listed; | 140 message >> description.listed; |
| 147 result.push_back(description); | 141 result.push_back(description); |
| 148 } | 142 } |
| 149 return result; | 143 return result; |
| 150 } | 144 } |
| 151 } | 145 } |
| 152 | 146 |
| 153 CAdblockPlusClient* CAdblockPlusClient::s_instance = NULL; | 147 CAdblockPlusClient* CAdblockPlusClient::s_instance = NULL; |
| 154 CComAutoCriticalSection CAdblockPlusClient::s_criticalSectionLocal; | 148 CComAutoCriticalSection CAdblockPlusClient::s_criticalSectionLocal; |
| 155 | 149 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 return isHidden; | 253 return isHidden; |
| 260 } | 254 } |
| 261 | 255 |
| 262 bool CAdblockPlusClient::IsWhitelistedUrl(const std::wstring& url) | 256 bool CAdblockPlusClient::IsWhitelistedUrl(const std::wstring& url) |
| 263 { | 257 { |
| 264 return !GetWhitelistingFilter(url).empty(); | 258 return !GetWhitelistingFilter(url).empty(); |
| 265 } | 259 } |
| 266 | 260 |
| 267 std::string CAdblockPlusClient::GetWhitelistingFilter(const std::wstring& url) | 261 std::string CAdblockPlusClient::GetWhitelistingFilter(const std::wstring& url) |
| 268 { | 262 { |
| 269 DEBUG_GENERAL((L"IsWhitelistedUrl: " + url + L" start").c_str()); | 263 DEBUG_GENERAL((L"GetWhitelistingFilter: " + url + L" start").c_str()); |
| 270 Communication::OutputBuffer request; | 264 Communication::OutputBuffer request; |
| 271 request << Communication::PROC_GET_WHITELISTING_FITER << ToUtf8String(url); | 265 request << Communication::PROC_GET_WHITELISTING_FITER << url; |
| 272 | 266 |
| 273 Communication::InputBuffer response; | 267 Communication::InputBuffer response; |
| 274 if (!CallEngine(request, response)) | 268 if (!CallEngine(request, response)) |
| 275 return ""; | 269 return ""; |
| 276 | 270 |
| 277 std::string filterText; | 271 std::string filterText; |
| 278 response >> filterText; | 272 response >> filterText; |
| 279 | 273 |
| 280 DEBUG_GENERAL((L"IsWhitelistedUrl: " + url + L" end").c_str()); | 274 DEBUG_GENERAL((L"GetWhitelistingFilter: " + url + L" end").c_str()); |
| 281 return filterText; | 275 return filterText; |
| 282 } | 276 } |
| 283 | 277 |
| 284 bool CAdblockPlusClient::IsElemhideWhitelistedOnDomain(const std::wstring& url) | 278 bool CAdblockPlusClient::IsElemhideWhitelistedOnDomain(const std::wstring& url) |
| 285 { | 279 { |
| 286 Communication::OutputBuffer request; | 280 Communication::OutputBuffer request; |
| 287 request << Communication::PROC_IS_ELEMHIDE_WHITELISTED_ON_URL << ToUtf8String(
url); | 281 request << Communication::PROC_IS_ELEMHIDE_WHITELISTED_ON_URL << url; |
| 288 | 282 |
| 289 Communication::InputBuffer response; | 283 Communication::InputBuffer response; |
| 290 if (!CallEngine(request, response)) | 284 if (!CallEngine(request, response)) |
| 291 return false; | 285 return false; |
| 292 | 286 |
| 293 bool isWhitelisted; | 287 bool isWhitelisted; |
| 294 response >> isWhitelisted; | 288 response >> isWhitelisted; |
| 295 return isWhitelisted; | 289 return isWhitelisted; |
| 296 } | 290 } |
| 297 | 291 |
| 298 bool CAdblockPlusClient::Matches(const std::wstring& url, AdblockPlus::FilterEng
ine::ContentType contentType, const std::wstring& domain) | 292 bool CAdblockPlusClient::Matches(const std::wstring& url, AdblockPlus::FilterEng
ine::ContentType contentType, const std::wstring& domain) |
| 299 { | 293 { |
| 300 Communication::OutputBuffer request; | 294 Communication::OutputBuffer request; |
| 301 request << Communication::PROC_MATCHES << ToUtf8String(url) << static_cast<int
32_t>(contentType) << ToUtf8String(domain); | 295 request << Communication::PROC_MATCHES << url << contentType << domain; |
| 302 | 296 |
| 303 Communication::InputBuffer response; | 297 Communication::InputBuffer response; |
| 304 if (!CallEngine(request, response)) | 298 if (!CallEngine(request, response)) |
| 305 return false; | 299 return false; |
| 306 | 300 |
| 307 bool match; | 301 bool match; |
| 308 response >> match; | 302 response >> match; |
| 309 return match; | 303 return match; |
| 310 } | 304 } |
| 311 | 305 |
| 312 std::vector<std::wstring> CAdblockPlusClient::GetElementHidingSelectors(const st
d::wstring& domain) | 306 std::vector<std::wstring> CAdblockPlusClient::GetElementHidingSelectors(const st
d::wstring& domain) |
| 313 { | 307 { |
| 314 Communication::OutputBuffer request; | 308 Communication::OutputBuffer request; |
| 315 request << Communication::PROC_GET_ELEMHIDE_SELECTORS << ToUtf8String(domain); | 309 request << Communication::PROC_GET_ELEMHIDE_SELECTORS << domain; |
| 316 | 310 |
| 317 Communication::InputBuffer response; | 311 Communication::InputBuffer response; |
| 318 if (!CallEngine(request, response)) | 312 if (!CallEngine(request, response)) |
| 319 return std::vector<std::wstring>(); | 313 return std::vector<std::wstring>(); |
| 320 | 314 |
| 321 std::vector<std::string> selectors; | 315 std::vector<std::wstring> selectors; |
| 322 response >> selectors; | 316 response >> selectors; |
| 323 return ToUtf16Strings(selectors); | 317 return selectors; |
| 324 } | 318 } |
| 325 | 319 |
| 326 std::vector<SubscriptionDescription> CAdblockPlusClient::FetchAvailableSubscript
ions() | 320 std::vector<SubscriptionDescription> CAdblockPlusClient::FetchAvailableSubscript
ions() |
| 327 { | 321 { |
| 328 Communication::InputBuffer response; | 322 Communication::InputBuffer response; |
| 329 if (!CallEngine(Communication::PROC_AVAILABLE_SUBSCRIPTIONS, response)) | 323 if (!CallEngine(Communication::PROC_AVAILABLE_SUBSCRIPTIONS, response)) |
| 330 return std::vector<SubscriptionDescription>(); | 324 return std::vector<SubscriptionDescription>(); |
| 331 return ReadSubscriptions(response); | 325 return ReadSubscriptions(response); |
| 332 } | 326 } |
| 333 | 327 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 350 { | 344 { |
| 351 return true; | 345 return true; |
| 352 } | 346 } |
| 353 } | 347 } |
| 354 return false; | 348 return false; |
| 355 } | 349 } |
| 356 | 350 |
| 357 void CAdblockPlusClient::SetSubscription(const std::wstring& url) | 351 void CAdblockPlusClient::SetSubscription(const std::wstring& url) |
| 358 { | 352 { |
| 359 Communication::OutputBuffer request; | 353 Communication::OutputBuffer request; |
| 360 request << Communication::PROC_SET_SUBSCRIPTION << ToUtf8String(url); | 354 request << Communication::PROC_SET_SUBSCRIPTION << url; |
| 361 CallEngine(request); | 355 CallEngine(request); |
| 362 } | 356 } |
| 363 | 357 |
| 364 void CAdblockPlusClient::AddSubscription(const std::wstring& url) | 358 void CAdblockPlusClient::AddSubscription(const std::wstring& url) |
| 365 { | 359 { |
| 366 Communication::OutputBuffer request; | 360 Communication::OutputBuffer request; |
| 367 request << Communication::PROC_ADD_SUBSCRIPTION << ToUtf8String(url); | 361 request << Communication::PROC_ADD_SUBSCRIPTION << url; |
| 368 CallEngine(request); | 362 CallEngine(request); |
| 369 } | 363 } |
| 370 | 364 |
| 371 void CAdblockPlusClient::RemoveSubscription(const std::wstring& url) | 365 void CAdblockPlusClient::RemoveSubscription(const std::wstring& url) |
| 372 { | 366 { |
| 373 Communication::OutputBuffer request; | 367 Communication::OutputBuffer request; |
| 374 request << Communication::PROC_REMOVE_SUBSCRIPTION << ToUtf8String(url); | 368 request << Communication::PROC_REMOVE_SUBSCRIPTION << url; |
| 375 CallEngine(request); | 369 CallEngine(request); |
| 376 } | 370 } |
| 377 | 371 |
| 378 | 372 |
| 379 void CAdblockPlusClient::UpdateAllSubscriptions() | 373 void CAdblockPlusClient::UpdateAllSubscriptions() |
| 380 { | 374 { |
| 381 CallEngine(Communication::PROC_UPDATE_ALL_SUBSCRIPTIONS); | 375 CallEngine(Communication::PROC_UPDATE_ALL_SUBSCRIPTIONS); |
| 382 } | 376 } |
| 383 | 377 |
| 384 std::vector<std::wstring> CAdblockPlusClient::GetExceptionDomains() | 378 std::vector<std::wstring> CAdblockPlusClient::GetExceptionDomains() |
| 385 { | 379 { |
| 386 Communication::InputBuffer response; | 380 Communication::InputBuffer response; |
| 387 if (!CallEngine(Communication::PROC_GET_EXCEPTION_DOMAINS, response)) | 381 if (!CallEngine(Communication::PROC_GET_EXCEPTION_DOMAINS, response)) |
| 388 return std::vector<std::wstring>(); | 382 return std::vector<std::wstring>(); |
| 389 | 383 |
| 390 std::vector<std::string> domains; | 384 std::vector<std::wstring> domains; |
| 391 response >> domains; | 385 response >> domains; |
| 392 return ToUtf16Strings(domains); | 386 return domains; |
| 393 } | 387 } |
| 394 | 388 |
| 395 bool CAdblockPlusClient::IsFirstRun() | 389 bool CAdblockPlusClient::IsFirstRun() |
| 396 { | 390 { |
| 397 DEBUG_GENERAL("IsFirstRun"); | 391 DEBUG_GENERAL("IsFirstRun"); |
| 398 Communication::InputBuffer response; | 392 Communication::InputBuffer response; |
| 399 if (!CallEngine(Communication::PROC_IS_FIRST_RUN_ACTION_NEEDED, response)) ret
urn false; | 393 if (!CallEngine(Communication::PROC_IS_FIRST_RUN_ACTION_NEEDED, response)) ret
urn false; |
| 400 bool res; | 394 bool res; |
| 401 response >> res; | 395 response >> res; |
| 402 return res; | 396 return res; |
| 403 } | 397 } |
| 404 | 398 |
| 405 void CAdblockPlusClient::AddFilter(const std::wstring& text) | 399 void CAdblockPlusClient::AddFilter(const std::wstring& text) |
| 406 { | 400 { |
| 407 Communication::OutputBuffer request; | 401 Communication::OutputBuffer request; |
| 408 request << Communication::PROC_ADD_FILTER << ToUtf8String(text); | 402 request << Communication::PROC_ADD_FILTER << text; |
| 409 CallEngine(request); | 403 CallEngine(request); |
| 410 } | 404 } |
| 411 | 405 |
| 412 void CAdblockPlusClient::RemoveFilter(const std::wstring& text) | 406 void CAdblockPlusClient::RemoveFilter(const std::wstring& text) |
| 413 { | 407 { |
| 414 RemoveFilter(ToUtf8String(text)); | 408 RemoveFilter(ToUtf8String(text)); |
| 415 } | 409 } |
| 416 | 410 |
| 417 void CAdblockPlusClient::RemoveFilter(const std::string& text) | 411 void CAdblockPlusClient::RemoveFilter(const std::string& text) |
| 418 { | 412 { |
| 419 Communication::OutputBuffer request; | 413 Communication::OutputBuffer request; |
| 420 request << Communication::PROC_REMOVE_FILTER << text; | 414 request << Communication::PROC_REMOVE_FILTER << text; |
| 421 CallEngine(request); | 415 CallEngine(request); |
| 422 } | 416 } |
| 423 | 417 |
| 424 void CAdblockPlusClient::SetPref(const std::wstring& name, const std::wstring& v
alue) | 418 void CAdblockPlusClient::SetPref(const std::wstring& name, const std::wstring& v
alue) |
| 425 { | 419 { |
| 426 Communication::OutputBuffer request; | 420 Communication::OutputBuffer request; |
| 427 request << Communication::PROC_SET_PREF << ToUtf8String(name) << ToUtf8String(
value); | 421 request << Communication::PROC_SET_PREF << name << value; |
| 428 CallEngine(request); | 422 CallEngine(request); |
| 429 } | 423 } |
| 430 | 424 |
| 431 void CAdblockPlusClient::SetPref(const std::wstring& name, const int64_t & value
) | 425 void CAdblockPlusClient::SetPref(const std::wstring& name, const int64_t & value
) |
| 432 { | 426 { |
| 433 Communication::OutputBuffer request; | 427 Communication::OutputBuffer request; |
| 434 request << Communication::PROC_SET_PREF << ToUtf8String(name) << value; | 428 request << Communication::PROC_SET_PREF << name << value; |
| 435 CallEngine(request); | 429 CallEngine(request); |
| 436 } | 430 } |
| 437 | 431 |
| 438 void CAdblockPlusClient::SetPref(const std::wstring& name, bool value) | 432 void CAdblockPlusClient::SetPref(const std::wstring& name, bool value) |
| 439 { | 433 { |
| 440 Communication::OutputBuffer request; | 434 Communication::OutputBuffer request; |
| 441 request << Communication::PROC_SET_PREF << ToUtf8String(name) << value; | 435 request << Communication::PROC_SET_PREF << name << value; |
| 442 CallEngine(request); | 436 CallEngine(request); |
| 443 } | 437 } |
| 444 | 438 |
| 445 std::wstring CAdblockPlusClient::GetPref(const std::wstring& name, const wchar_t
* defaultValue) | 439 std::wstring CAdblockPlusClient::GetPref(const std::wstring& name, const wchar_t
* defaultValue) |
| 446 { | 440 { |
| 447 return GetPref(name, std::wstring(defaultValue)); | 441 return GetPref(name, std::wstring(defaultValue)); |
| 448 } | 442 } |
| 449 std::wstring CAdblockPlusClient::GetPref(const std::wstring& name, const std::ws
tring& defaultValue) | 443 std::wstring CAdblockPlusClient::GetPref(const std::wstring& name, const std::ws
tring& defaultValue) |
| 450 { | 444 { |
| 451 DEBUG_GENERAL((L"GetPref: " + name + L" start").c_str()); | 445 DEBUG_GENERAL((L"GetPref: " + name + L" start").c_str()); |
| 452 Communication::OutputBuffer request; | 446 Communication::OutputBuffer request; |
| 453 request << Communication::PROC_GET_PREF << ToUtf8String(name); | 447 request << Communication::PROC_GET_PREF << name; |
| 454 | 448 |
| 455 Communication::InputBuffer response; | 449 Communication::InputBuffer response; |
| 456 if (!CallEngine(request, response)) | 450 if (!CallEngine(request, response)) |
| 457 return defaultValue; | 451 return defaultValue; |
| 458 bool success; | 452 bool success; |
| 459 response >> success; | 453 response >> success; |
| 460 if (success) | 454 if (success) |
| 461 { | 455 { |
| 462 std::string value; | 456 std::wstring value; |
| 463 response >> value; | 457 response >> value; |
| 464 DEBUG_GENERAL((L"GetPref: " + name + L" end").c_str()); | 458 DEBUG_GENERAL((L"GetPref: " + name + L" end").c_str()); |
| 465 return ToUtf16String(value); | 459 return value; |
| 466 } | 460 } |
| 467 else | 461 else |
| 468 { | 462 { |
| 469 DEBUG_GENERAL((L"GetPref: " + name + L" end").c_str()); | 463 DEBUG_GENERAL((L"GetPref: " + name + L" end").c_str()); |
| 470 return defaultValue; | 464 return defaultValue; |
| 471 } | 465 } |
| 472 } | 466 } |
| 473 | 467 |
| 474 bool CAdblockPlusClient::GetPref(const std::wstring& name, bool defaultValue) | 468 bool CAdblockPlusClient::GetPref(const std::wstring& name, bool defaultValue) |
| 475 { | 469 { |
| 476 DEBUG_GENERAL((L"GetPref: " + name + L" start").c_str()); | 470 DEBUG_GENERAL((L"GetPref: " + name + L" start").c_str()); |
| 477 Communication::OutputBuffer request; | 471 Communication::OutputBuffer request; |
| 478 request << Communication::PROC_GET_PREF << ToUtf8String(name); | 472 request << Communication::PROC_GET_PREF << name; |
| 479 | 473 |
| 480 Communication::InputBuffer response; | 474 Communication::InputBuffer response; |
| 481 if (!CallEngine(request, response)) | 475 if (!CallEngine(request, response)) |
| 482 return defaultValue; | 476 return defaultValue; |
| 483 bool success; | 477 bool success; |
| 484 response >> success; | 478 response >> success; |
| 485 if (success) | 479 if (success) |
| 486 { | 480 { |
| 487 bool value; | 481 bool value; |
| 488 response >> value; | 482 response >> value; |
| 489 DEBUG_GENERAL((L"GetPref: " + name + L" end").c_str()); | 483 DEBUG_GENERAL((L"GetPref: " + name + L" end").c_str()); |
| 490 return value; | 484 return value; |
| 491 } | 485 } |
| 492 else | 486 else |
| 493 { | 487 { |
| 494 DEBUG_GENERAL((L"GetPref: " + name + L" end").c_str()); | 488 DEBUG_GENERAL((L"GetPref: " + name + L" end").c_str()); |
| 495 return defaultValue; | 489 return defaultValue; |
| 496 } | 490 } |
| 497 } | 491 } |
| 498 int64_t CAdblockPlusClient::GetPref(const std::wstring& name, int64_t defaultVal
ue) | 492 int64_t CAdblockPlusClient::GetPref(const std::wstring& name, int64_t defaultVal
ue) |
| 499 { | 493 { |
| 500 DEBUG_GENERAL((L"GetPref: " + name + L" start").c_str()); | 494 DEBUG_GENERAL((L"GetPref: " + name + L" start").c_str()); |
| 501 Communication::OutputBuffer request; | 495 Communication::OutputBuffer request; |
| 502 request << Communication::PROC_GET_PREF << ToUtf8String(name); | 496 request << Communication::PROC_GET_PREF << name; |
| 503 | 497 |
| 504 Communication::InputBuffer response; | 498 Communication::InputBuffer response; |
| 505 if (!CallEngine(request, response)) | 499 if (!CallEngine(request, response)) |
| 506 return defaultValue; | 500 return defaultValue; |
| 507 bool success; | 501 bool success; |
| 508 response >> success; | 502 response >> success; |
| 509 if (success) | 503 if (success) |
| 510 { | 504 { |
| 511 int64_t value; | 505 int64_t value; |
| 512 response >> value; | 506 response >> value; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 526 request << Communication::PROC_CHECK_FOR_UPDATES << reinterpret_cast<int32_t>(
callbackWindow); | 520 request << Communication::PROC_CHECK_FOR_UPDATES << reinterpret_cast<int32_t>(
callbackWindow); |
| 527 CallEngine(request); | 521 CallEngine(request); |
| 528 } | 522 } |
| 529 | 523 |
| 530 std::wstring CAdblockPlusClient::GetDocumentationLink() | 524 std::wstring CAdblockPlusClient::GetDocumentationLink() |
| 531 { | 525 { |
| 532 DEBUG_GENERAL("GetDocumentationLink"); | 526 DEBUG_GENERAL("GetDocumentationLink"); |
| 533 Communication::InputBuffer response; | 527 Communication::InputBuffer response; |
| 534 if (!CallEngine(Communication::PROC_GET_DOCUMENTATION_LINK, response)) | 528 if (!CallEngine(Communication::PROC_GET_DOCUMENTATION_LINK, response)) |
| 535 return L""; | 529 return L""; |
| 536 std::string docLink; | 530 std::wstring docLink; |
| 537 response >> docLink; | 531 response >> docLink; |
| 538 return ToUtf16String(docLink); | 532 return docLink; |
| 539 } | 533 } |
| 540 | 534 |
| 541 bool CAdblockPlusClient::TogglePluginEnabled() | 535 bool CAdblockPlusClient::TogglePluginEnabled() |
| 542 { | 536 { |
| 543 DEBUG_GENERAL("TogglePluginEnabled"); | 537 DEBUG_GENERAL("TogglePluginEnabled"); |
| 544 Communication::InputBuffer response; | 538 Communication::InputBuffer response; |
| 545 if (!CallEngine(Communication::PROC_TOGGLE_PLUGIN_ENABLED, response)) | 539 if (!CallEngine(Communication::PROC_TOGGLE_PLUGIN_ENABLED, response)) |
| 546 return false; | 540 return false; |
| 547 bool currentEnabledState; | 541 bool currentEnabledState; |
| 548 response >> currentEnabledState; | 542 response >> currentEnabledState; |
| 549 return currentEnabledState; | 543 return currentEnabledState; |
| 550 } | 544 } |
| 551 | 545 |
| 552 std::wstring CAdblockPlusClient::GetHostFromUrl(const std::wstring& url) | 546 std::wstring CAdblockPlusClient::GetHostFromUrl(const std::wstring& url) |
| 553 { | 547 { |
| 554 DEBUG_GENERAL("GetHostFromUrl"); | 548 DEBUG_GENERAL("GetHostFromUrl"); |
| 555 Communication::OutputBuffer request; | 549 Communication::OutputBuffer request; |
| 556 request << Communication::PROC_GET_HOST << ToUtf8String(url); | 550 request << Communication::PROC_GET_HOST << url; |
| 557 | 551 |
| 558 Communication::InputBuffer response; | 552 Communication::InputBuffer response; |
| 559 if (!CallEngine(request, response)) | 553 if (!CallEngine(request, response)) |
| 560 return L""; | 554 return L""; |
| 561 std::string host; | 555 std::wstring host; |
| 562 response >> host; | 556 response >> host; |
| 563 return ToUtf16String(host); | 557 return host; |
| 564 } | 558 } |
| 565 | 559 |
| 566 int CAdblockPlusClient::CompareVersions(const std::wstring& v1, const std::wstri
ng& v2) | 560 int CAdblockPlusClient::CompareVersions(const std::wstring& v1, const std::wstri
ng& v2) |
| 567 { | 561 { |
| 568 DEBUG_GENERAL("CompareVersions"); | 562 DEBUG_GENERAL("CompareVersions"); |
| 569 Communication::OutputBuffer request; | 563 Communication::OutputBuffer request; |
| 570 request << Communication::PROC_COMPARE_VERSIONS << ToUtf8String(v1) << ToUtf8S
tring(v2); | 564 request << Communication::PROC_COMPARE_VERSIONS << v1 << v2; |
| 571 Communication::InputBuffer response; | 565 Communication::InputBuffer response; |
| 572 if (!CallEngine(request, response)) | 566 if (!CallEngine(request, response)) |
| 573 return 0; | 567 return 0; |
| 574 int result; | 568 int result; |
| 575 response >> result; | 569 response >> result; |
| 576 return result; | 570 return result; |
| 577 } | 571 } |
| OLD | NEW |