void SetProperties(const USER_PROPERTIES & p) { stat = p.stat; conf = p.conf; }
std::string GetPropertyValue(const std::string & name) const;
- bool Exists(const std::string & name) const;
+ bool Exists(const std::string & name) const;
USER_PROPERTY_LOGGED<double> cash;
USER_PROPERTY_LOGGED<DIR_TRAFF> up;
inline
bool USER_PROPERTIES::Exists(const std::string & name) const
{
-if (properties.find(name)!=properties.end()) return true;
-return false;
+return properties.find(name) != properties.end();
}
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
it != rsSettings.GetUserParams().end();
++it)
{
-// std::string parameter(GetUserParam(rsu.user, *it));
std::string parameter(rsu.user->GetParamValue(it->c_str()));
if (params.length() + parameter.length() > RS_PARAMS_LEN - 1)
break;
//-----------------------------------------------------------------------------
std::string USER_IMPL::GetParamValue(const std::string & name) const
{
-if (property.Exists(name))
- {
if (name == "id")
{
std::ostringstream stream;
stream << id;
return stream.str();
}
- if (name == "login") return login;
- if (name == "ip") return currIP.ToString();
- if (name == "enabledDirs") return GetEnabledDirs();
- return property.GetPropertyValue(name);
- }
-else
- {
- WriteServLog("Error getting parametr value", name.c_str());
- return "";
- }
+ if (name == "login") return login;
+ if (name == "ip") return currIP.ToString();
+ if (name == "enabledDirs") return GetEnabledDirs();
+ if (property.Exists(name)) return property.GetPropertyValue(name);
+ else
+ {
+ WriteServLog("User’s parameter '%s' does not exist.", name.c_str());
+ return "";
+ }
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------