X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/dda964a76b486001f0debf38deb594ad7c13f416..afcbfd1a09e22ff4839ba5db42047c96f355506c:/projects/stargazer/plugins/other/rscript/rscript.cpp diff --git a/projects/stargazer/plugins/other/rscript/rscript.cpp b/projects/stargazer/plugins/other/rscript/rscript.cpp index 00114df4..1e842d25 100644 --- a/projects/stargazer/plugins/other/rscript/rscript.cpp +++ b/projects/stargazer/plugins/other/rscript/rscript.cpp @@ -19,14 +19,10 @@ * Author : Maxim Mamontov */ -#include +#include "rscript.h" -#include -#include -#include -#include -#include -#include +#include "ur_functor.h" +#include "send_functor.h" #include "stg/common.h" #include "stg/locker.h" @@ -34,9 +30,17 @@ #include "stg/user_property.h" #include "stg/plugin_creator.h" #include "stg/logger.h" -#include "rscript.h" -#include "ur_functor.h" -#include "send_functor.h" + +#include + +#include +#include +#include +#include +#include + +#include +#include extern volatile time_t stgTime; @@ -47,7 +51,7 @@ namespace { template struct USER_IS { - USER_IS(USER_PTR u) : user(u) {} + explicit USER_IS(USER_PTR u) : user(u) {} bool operator()(const T & notifier) { return notifier.GetUser() == user; } USER_PTR user; @@ -73,12 +77,7 @@ return rsc.GetPlugin(); //----------------------------------------------------------------------------- RS::SETTINGS::SETTINGS() : sendPeriod(0), - port(0), - errorStr(), - netRouters(), - userParams(), - password(), - subnetFile() + port(0) { } //----------------------------------------------------------------------------- @@ -91,7 +90,7 @@ netRouters.clear(); /////////////////////////// pv.param = "Port"; pvi = find(s.moduleParams.begin(), s.moduleParams.end(), pv); -if (pvi == s.moduleParams.end()) +if (pvi == s.moduleParams.end() || pvi->value.empty()) { errorStr = "Parameter \'Port\' not found."; printfd(__FILE__, "Parameter 'Port' not found\n"); @@ -107,7 +106,7 @@ port = static_cast(p); /////////////////////////// pv.param = "SendPeriod"; pvi = find(s.moduleParams.begin(), s.moduleParams.end(), pv); -if (pvi == s.moduleParams.end()) +if (pvi == s.moduleParams.end() || pvi->value.empty()) { errorStr = "Parameter \'SendPeriod\' not found."; printfd(__FILE__, "Parameter 'SendPeriod' not found\n"); @@ -123,7 +122,7 @@ if (ParseIntInRange(pvi->value[0], 5, 600, &sendPeriod)) /////////////////////////// pv.param = "UserParams"; pvi = find(s.moduleParams.begin(), s.moduleParams.end(), pv); -if (pvi == s.moduleParams.end()) +if (pvi == s.moduleParams.end() || pvi->value.empty()) { errorStr = "Parameter \'UserParams\' not found."; printfd(__FILE__, "Parameter 'UserParams' not found\n"); @@ -133,7 +132,7 @@ userParams = pvi->value; /////////////////////////// pv.param = "Password"; pvi = find(s.moduleParams.begin(), s.moduleParams.end(), pv); -if (pvi == s.moduleParams.end()) +if (pvi == s.moduleParams.end() || pvi->value.empty()) { errorStr = "Parameter \'Password\' not found."; printfd(__FILE__, "Parameter 'Password' not found\n"); @@ -143,7 +142,7 @@ password = pvi->value[0]; /////////////////////////// pv.param = "SubnetFile"; pvi = find(s.moduleParams.begin(), s.moduleParams.end(), pv); -if (pvi == s.moduleParams.end()) +if (pvi == s.moduleParams.end() || pvi->value.empty()) { errorStr = "Parameter \'SubnetFile\' not found."; printfd(__FILE__, "Parameter 'SubnetFile' not found\n"); @@ -301,7 +300,7 @@ if (isRunning) return 0; } //----------------------------------------------------------------------------- -int REMOTE_SCRIPT::Reload() +int REMOTE_SCRIPT::Reload(const MODULE_SETTINGS & /*ms*/) { NRMapParser nrMapParser;