summaryrefslogtreecommitdiff
path: root/comphelper
diff options
context:
space:
mode:
authorPranam Lashkari <lpranam@collabora.com>2021-06-02 19:06:52 +0530
committerJan Holesovsky <kendy@collabora.com>2021-06-28 15:45:35 +0200
commit2fb76306afdf50d52ec5021088e7aaa49008b71a (patch)
tree7f18ca1478b452512b523e91b3b72d16e31ec591 /comphelper
parentcf46699c41a1bf36442cb6733dd0abf11516d80a (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/+/117799 Reviewed-by: Jan Holesovsky <kendy@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 208fe7bb25df..1ef1ae5766b3 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>
#include <map>
@@ -38,6 +39,8 @@ static bool g_bLocalRendering(false);
static Compat g_eCompatFlags(Compat::none);
+static std::vector<OUString> g_vFreemiumDenyList;
+
namespace
{
@@ -288,6 +291,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 LibreOfficeKit
} // namespace comphelper