Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 #include <AdblockPlus.h> | 1 #include <AdblockPlus.h> |
2 #include <functional> | 2 #include <functional> |
3 #include <vector> | 3 #include <vector> |
4 #include <Windows.h> | 4 #include <Windows.h> |
5 | 5 |
6 #include "../shared/AutoHandle.h" | 6 #include "../shared/AutoHandle.h" |
7 #include "../shared/Communication.h" | 7 #include "../shared/Communication.h" |
8 #include "../shared/Dictionary.h" | 8 #include "../shared/Dictionary.h" |
9 #include "../shared/Utils.h" | 9 #include "../shared/Utils.h" |
10 #include "../shared/Version.h" | 10 #include "../shared/Version.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
109 WriteSubscriptions(response, filterEngine->GetListedSubscriptions()); | 109 WriteSubscriptions(response, filterEngine->GetListedSubscriptions()); |
110 break; | 110 break; |
111 } | 111 } |
112 case Communication::PROC_SET_SUBSCRIPTION: | 112 case Communication::PROC_SET_SUBSCRIPTION: |
113 { | 113 { |
114 std::string url; | 114 std::string url; |
115 request >> url; | 115 request >> url; |
116 | 116 |
117 AdblockPlus::JsValuePtr valuePtr = filterEngine->GetPref("subscriptions_ exceptionsurl"); | 117 AdblockPlus::JsValuePtr valuePtr = filterEngine->GetPref("subscriptions_ exceptionsurl"); |
118 std::string aaUrl = ""; | 118 std::string aaUrl = ""; |
119 if (valuePtr->IsString()) | 119 if (!valuePtr->IsNull()) |
120 { | 120 { |
121 aaUrl = valuePtr->AsString(); | 121 aaUrl = valuePtr->AsString(); |
122 } | 122 } |
Eric
2014/06/25 14:34:15
Why the partial type enforcement? Is there any rea
Felix Dahlke
2014/06/30 17:24:04
I guess this is because the pref could be missing,
| |
123 std::vector<AdblockPlus::SubscriptionPtr> subscriptions = filterEngine-> GetListedSubscriptions(); | 123 std::vector<AdblockPlus::SubscriptionPtr> subscriptions = filterEngine-> GetListedSubscriptions(); |
124 | 124 |
125 // Remove all subscriptions, besides the Acceptable Ads | 125 // Remove all subscriptions, besides the Acceptable Ads |
Felix Dahlke
2014/06/30 17:24:04
Wow, this is hacky. So we currently only support e
Oleksandr
2014/07/18 19:06:42
https://issues.adblockplus.org/ticket/1084
On 2014
| |
126 for (size_t i = 0, count = subscriptions.size(); i < count; i++) | 126 for (size_t i = 0, count = subscriptions.size(); i < count; i++) |
127 { | 127 { |
128 if (subscriptions[i].get()->GetProperty("url")->AsString() != aaUrl) | 128 if (subscriptions[i]->GetProperty("url")->AsString() != aaUrl) |
Felix Dahlke
2014/06/30 17:24:04
Are you sure the .get() is required here? That sho
| |
129 { | 129 { |
130 subscriptions[i]->RemoveFromList(); | 130 subscriptions[i]->RemoveFromList(); |
131 } | 131 } |
132 } | 132 } |
133 | 133 |
134 // Add new subscription | |
Felix Dahlke
2014/06/30 17:24:04
Kinda obvious IMHO :P
| |
135 filterEngine->GetSubscription(url)->AddToList(); | 134 filterEngine->GetSubscription(url)->AddToList(); |
136 break; | 135 break; |
137 } | 136 } |
138 case Communication::PROC_ADD_SUBSCRIPTION: | 137 case Communication::PROC_ADD_SUBSCRIPTION: |
139 { | 138 { |
140 std::string url; | 139 std::string url; |
141 request >> url; | 140 request >> url; |
142 | 141 |
143 filterEngine->GetSubscription(url)->AddToList(); | 142 filterEngine->GetSubscription(url)->AddToList(); |
144 break; | 143 break; |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
448 } | 447 } |
449 catch (std::runtime_error e) | 448 catch (std::runtime_error e) |
450 { | 449 { |
451 DebugException(e); | 450 DebugException(e); |
452 return 1; | 451 return 1; |
453 } | 452 } |
454 } | 453 } |
455 | 454 |
456 return 0; | 455 return 0; |
457 } | 456 } |
LEFT | RIGHT |