summaryrefslogtreecommitdiff
path: root/comphelper
diff options
context:
space:
mode:
authorPranam Lashkari <lpranam@collabora.com>2021-06-02 19:06:52 +0530
committerPranam Lashkari <lpranam@collabora.com>2021-06-23 17:11:46 +0200
commit1b9fe58acb7b5bbbc83ecca30e17663fff7f0db4 (patch)
tree5f957f515079cae501c2b2f12d08cbd77bd82461 /comphelper
parentce275a824aab6601c9de0b61f4b8568b9478ce19 (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>
Diffstat (limited to 'comphelper')
-rw-r--r--comphelper/source/misc/lok.cxx28
1 files changed, 28 insertions, 0 deletions
diff --git a/comphelper/source/misc/lok.cxx b/comphelper/source/misc/lok.cxx
index 796a3dc3b839..5c922e84e2b1 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
{
@@ -284,6 +287,31 @@ void statusIndicatorFinish()
pStatusIndicatorCallback(pStatusIndicatorCallbackData, statusIndicatorCallbackType::Finish, 0);
}
+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: */