diff options
author | Pranam Lashkari <lpranam@collabora.com> | 2021-06-02 19:06:52 +0530 |
---|---|---|
committer | Pranam Lashkari <lpranam@collabora.com> | 2021-08-16 09:01:11 +0200 |
commit | 513120d24c770079773559367202d54ff62b39b4 (patch) | |
tree | c037d98b6d0068ee031fdd77b05ad2353bf1f012 /comphelper | |
parent | f34146b7d5d0bb66c805504a691cb70d5b3da6b2 (diff) |
LOK: introduced Freemium LOK API
also block the uno commands from deny list
Change-Id: Iee994411891b73b865e6496403682f996d5e9321
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116384
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Pranam Lashkari <lpranam@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120482
Tested-by: Jenkins
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/misc/lok.cxx | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/comphelper/source/misc/lok.cxx b/comphelper/source/misc/lok.cxx index b11bf4e83582..c7c57cb61e27 100644 --- a/comphelper/source/misc/lok.cxx +++ b/comphelper/source/misc/lok.cxx @@ -10,6 +10,7 @@ #include <comphelper/lok.hxx> #include <i18nlangtag/languagetag.hxx> #include <sal/log.hxx> +#include <algorithm> #include <iostream> @@ -34,6 +35,8 @@ static bool g_bLocalRendering(false); static Compat g_eCompatFlags(Compat::none); +static std::vector<OUString> g_vFreemiumDenyList; + namespace { @@ -282,6 +285,31 @@ void statusIndicatorFinish() pStatusIndicatorCallback(pStatusIndicatorCallbackData, statusIndicatorCallbackType::Finish, 0, nullptr); } +void setFreemiumDenyList(const char* freemiumDenyList) +{ + if(!g_vFreemiumDenyList.empty()) + return; + + OUString DenyListString(freemiumDenyList, strlen(freemiumDenyList), RTL_TEXTENCODING_UTF8); + + OUString command = DenyListString.getToken(0, ' '); + for (size_t i = 1; !command.isEmpty(); i++) + { + g_vFreemiumDenyList.emplace_back(command); + command = DenyListString.getToken(i, ' '); + } +} + +const std::vector<OUString>& getFreemiumDenyList() +{ + return g_vFreemiumDenyList; +} + +bool isCommandFreemiumDenied(const OUString& command) +{ + return std::find(g_vFreemiumDenyList.begin(), g_vFreemiumDenyList.end(), command) != g_vFreemiumDenyList.end(); +} + } // namespace /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |