From 5bba5e9a69e68cae944a492a8852c9def9f6ff8c Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Tue, 4 Jun 2019 09:59:55 -0400 Subject: [PATCH] Add "disabled" property to module object in manifest. --- src/plugin/Plugin.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/plugin/Plugin.cpp b/src/plugin/Plugin.cpp index 5d92fbd6..8c768b0c 100644 --- a/src/plugin/Plugin.cpp +++ b/src/plugin/Plugin.cpp @@ -88,6 +88,14 @@ void Plugin::fromJson(json_t *rootJ) { size_t moduleId; json_t *moduleJ; json_array_foreach(modulesJ, moduleId, moduleJ) { + // Check if module is disabled + json_t *disabledJ = json_object_get(moduleJ, "disabled"); + if (disabledJ) { + if (json_boolean_value(disabledJ)) + continue; + } + + // Get model slug json_t *modelSlugJ = json_object_get(moduleJ, "slug"); if (!modelSlugJ) { throw UserException(string::f("No slug found for module entry %d", moduleId)); @@ -99,6 +107,7 @@ void Plugin::fromJson(json_t *rootJ) { throw UserException(string::f("Module slug \"%s\" is invalid", modelSlug.c_str())); } + // Get model Model *model = getModel(modelSlug); if (!model) { throw UserException(string::f("Manifest contains module %s but it is not defined in the plugin", modelSlug.c_str()));