From f4470ccbe73ac808a1a76ab9f34e93c942a70c15 Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Thu, 4 Jan 2024 15:57:29 +0100 Subject: [PATCH] allow to not set the res value from a plugin function Add PluginInfo::has_res (bool, default true). If set to false by a plugin function then the PluginInfo::res value is not taken into account when calculating how many plugins have returned true or false. --- winixd/core/plugin.cpp | 15 +++++++++------ winixd/core/plugin.h | 11 +++++++++-- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/winixd/core/plugin.cpp b/winixd/core/plugin.cpp index 232a8c9..72383f8 100644 --- a/winixd/core/plugin.cpp +++ b/winixd/core/plugin.cpp @@ -4,8 +4,8 @@ * Author: Tomasz Sowa */ -/* - * Copyright (c) 2008-2022, Tomasz Sowa +/* + * Copyright (c) 2008-2023, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -370,10 +370,13 @@ PluginRes Plugin::Call(morm::ModelConnector * model_connector, Log * plog, Cur * Call(model_connector, plog, cur, message, i, info); - if( info.res ) - ++res.res_true; - else - ++res.res_false; + if( info.has_res ) + { + if( info.res ) + ++res.res_true; + else + ++res.res_false; + } } current_plugin = old_current_plugin; diff --git a/winixd/core/plugin.h b/winixd/core/plugin.h index e672b54..73deb65 100644 --- a/winixd/core/plugin.h +++ b/winixd/core/plugin.h @@ -4,8 +4,8 @@ * Author: Tomasz Sowa */ -/* - * Copyright (c) 2008-2022, Tomasz Sowa +/* + * Copyright (c) 2008-2023, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -120,6 +120,12 @@ struct PluginInfo // to create your plugin's session data PluginDataBase * plugin_data_base; // !! zmienic nazwe na plugin_session_base ? a moze session_base; a moze plugin_session? + // whether or not there is a res (bool) value set + // default: true + // if set to false then the 'res' is not taken into account when calculating how many plugins + // have returned true or false + bool has_res; + // function return status // default: false (if not set by the plugin) bool res; @@ -137,6 +143,7 @@ struct PluginInfo plugin_id = -1; plugin_data_base = 0; + has_res = true; res = false; }