X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/31b24cededa8b07468cb5e1c49b2a208fe19173e..cdfd5986f699e9333962db96a8b24d5b7ee6c748:/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 640fc95b..4e454b5e 100644 --- a/projects/stargazer/plugins/other/rscript/rscript.cpp +++ b/projects/stargazer/plugins/other/rscript/rscript.cpp @@ -324,6 +324,9 @@ std::for_each(authorizedUsers.begin(), authorizedUsers.end(), UpdateRouter(*this)); +logger("%s reloaded successfully.", rsSettings.GetMapFileName().c_str()); +printfd(__FILE__, "REMOTE_SCRIPT::Reload() %s reloaded successfully.\n"); + return 0; } //----------------------------------------------------------------------------- @@ -426,10 +429,16 @@ for(it = rsSettings.GetUserParams().begin(); it != rsSettings.GetUserParams().end(); ++it) { -// std::string parameter(GetUserParam(rsu.user, *it)); - std::string parameter(rsu.user->GetParamValue(it->c_str())); + std::string parameter; + if (*it == "tariffName") + parameter = rsu.user->GetParamValue("tariff"); + else + parameter = rsu.user->GetParamValue(*it); if (params.length() + parameter.length() > RS_PARAMS_LEN - 1) + { + logger("Script params string length %i exceeds the limit of %i symbols.", params.length() + parameter.length(), RS_PARAMS_LEN); break; + } params += parameter + " "; } strncpy((char *)packetTail.params, params.c_str(), RS_PARAMS_LEN); @@ -547,14 +556,25 @@ authorizedUsers.insert(std::make_pair(user->GetCurrIP(), rsu)); void REMOTE_SCRIPT::DelRSU(USER_PTR user) { STG_LOCKER lock(&mutex, __FILE__, __LINE__); -const std::map::iterator it( +std::map::iterator it(authorizedUsers.begin()); +while (it != authorizedUsers.end()) + { + if (it->second.user == user) + { + Send(it->second, true); + authorizedUsers.erase(it); + return; + } + ++it; + } +/*const std::map::iterator it( authorizedUsers.find(user->GetCurrIP()) ); if (it != authorizedUsers.end()) { Send(it->second, true); authorizedUsers.erase(it); - } + }*/ } //----------------------------------------------------------------------------- void RS::IP_NOTIFIER::Notify(const uint32_t & /*oldValue*/, const uint32_t & newValue)