]> git.stg.codes - stg.git/commitdiff
Correcting verification exist parameter
authorNaffanya <naffanya@naffanya.(none)>
Sat, 11 Jan 2014 21:45:42 +0000 (23:45 +0200)
committerNaffanya <naffanya@naffanya.(none)>
Sat, 11 Jan 2014 21:45:42 +0000 (23:45 +0200)
include/stg/user_property.h
projects/stargazer/plugins/other/rscript/rscript.cpp
projects/stargazer/user_impl.cpp

index 7d68e73410fc502ecf5ef8831dd4d7c090b474ba..7c0f4da15dd4554e325f1f03d2f221f4823189ab 100644 (file)
@@ -138,7 +138,7 @@ public:
     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;
@@ -400,8 +400,7 @@ return it->second->ToString();
 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();
 }
 //-------------------------------------------------------------------------
 //-------------------------------------------------------------------------
index 640fc95ba20858325d9a037afb0adb317b9bcfb7..5c94606b41a6905aa284db3039fc796d58197db1 100644 (file)
@@ -426,7 +426,6 @@ 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()));
     if (params.length() + parameter.length() > RS_PARAMS_LEN - 1)
         break;
index 51637a1b88775a287bf6412a0f8128388053f6f4..63af98e1963933a6a2d2e837fe8a4349625ae230 100644 (file)
@@ -1474,24 +1474,21 @@ while (it != messages.end())
 //-----------------------------------------------------------------------------
 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 "";
+        }
 }
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------