Index: src/engine/main.cpp |
=================================================================== |
--- a/src/engine/main.cpp |
+++ b/src/engine/main.cpp |
@@ -143,6 +143,31 @@ |
filterEngine->GetFilter(text)->RemoveFromList(); |
break; |
} |
+ case Communication::PROC_SET_PREF: |
+ { |
+ std::string prefName = ""; |
+ std::string prefValue = ""; |
Wladimir Palant
2013/07/11 12:53:10
Please don't initialize these variables, their ini
|
+ request >> prefName; |
+ request >> prefValue; |
Wladimir Palant
2013/07/11 12:53:10
These lines can be merged:
request >> prefName >>
|
+ filterEngine->SetPref(prefName, filterEngine->GetJsEngine()->NewValue(prefValue)); |
Wladimir Palant
2013/07/11 12:53:10
What about preferences with non-string values? Thi
|
+ break; |
+ } |
+ case Communication::PROC_GET_PREF: |
+ { |
+ std::string name; |
+ request >> name; |
+ |
+ AdblockPlus::JsValuePtr valuePtr = filterEngine->GetPref(name); |
+ if ((valuePtr->IsNull()) || (!valuePtr->IsString())) |
Wladimir Palant
2013/07/11 12:53:10
I think checking valuePtr->IsString() is sufficien
|
+ response << 0; |
Wladimir Palant
2013/07/11 12:53:10
Please don't use an integer as a boolean, this sho
|
+ else |
+ { |
+ response << 1; |
+ response << valuePtr->AsString(); |
Wladimir Palant
2013/07/11 12:53:10
These two lines can be merged:
response << true
|
+ } |
+ break; |
+ } |
+ |
} |
return response; |
} |