From 3b7377b215a7d46c7d03949d28ecebf87ccbe792 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Mon, 21 Mar 2011 13:08:38 +0200 Subject: [PATCH] Cosmetic changes --- projects/stargazer/user_property.h | 124 ++++++++++++++--------------- 1 file changed, 61 insertions(+), 63 deletions(-) diff --git a/projects/stargazer/user_property.h b/projects/stargazer/user_property.h index 41a0cfb5..cb7718c4 100644 --- a/projects/stargazer/user_property.h +++ b/projects/stargazer/user_property.h @@ -12,12 +12,10 @@ $Author: faust $ #include #include #include -#include #include "store.h" #include "stg_logger.h" #include "admin.h" -#include "settings.h" #include "notifer.h" #include "stg_logger.h" #include "stg_locker.h" @@ -57,8 +55,8 @@ public: private: varT & value; time_t modificationTime; - set *> beforeNotifiers; - set *> afterNotifiers; + std::set *> beforeNotifiers; + std::set *> afterNotifiers; mutable pthread_mutex_t mutex; }; //----------------------------------------------------------------------------- @@ -66,7 +64,7 @@ template class USER_PROPERTY_LOGGED: public USER_PROPERTY { public: USER_PROPERTY_LOGGED(varT & val, - const string n, + const std::string n, bool isPassword, bool isStat, STG_LOGGER & logger, @@ -75,35 +73,35 @@ public: USER_PROPERTY_LOGGED * GetPointer() throw(); const varT & Get() const; - const string & GetName() const; + const std::string & GetName() const; bool Set(const varT & val, const ADMIN * admin, - const string & login, + const std::string & login, const STORE * store, - const string & msg = ""); + const std::string & msg = ""); private: - void WriteAccessDenied(const string & login, + void WriteAccessDenied(const std::string & login, const ADMIN * admin, - const string & parameter); + const std::string & parameter); - void WriteSuccessChange(const string & login, + void WriteSuccessChange(const std::string & login, const ADMIN * admin, - const string & parameter, - const string & oldValue, - const string & newValue, - const string & msg, + const std::string & parameter, + const std::string & oldValue, + const std::string & newValue, + const std::string & msg, const STORE * store); - void OnChange(const string & login, - const string & paramName, - const string & oldValue, - const string & newValue, + void OnChange(const std::string & login, + const std::string & paramName, + const std::string & oldValue, + const std::string & newValue, const ADMIN * admin); - STG_LOGGER & stgLogger; // server's logger - bool isPassword; // is parameter password. when true, it will be logged as ******* - bool isStat; // is parameter a stat data or conf data? - string name; // parameter name. needed for logging + STG_LOGGER & stgLogger; + bool isPassword; + bool isStat; + std::string name; const std::string scriptsDir; }; //----------------------------------------------------------------------------- @@ -141,32 +139,32 @@ public: USER_PROPERTY_LOGGED freeMb; USER_PROPERTY_LOGGED lastActivityTime; - USER_PROPERTY_LOGGED password; + USER_PROPERTY_LOGGED password; USER_PROPERTY_LOGGED passive; USER_PROPERTY_LOGGED disabled; USER_PROPERTY_LOGGED disabledDetailStat; USER_PROPERTY_LOGGED alwaysOnline; - USER_PROPERTY_LOGGED tariffName; - USER_PROPERTY_LOGGED nextTariff; - USER_PROPERTY_LOGGED address; - USER_PROPERTY_LOGGED note; - USER_PROPERTY_LOGGED group; - USER_PROPERTY_LOGGED email; - USER_PROPERTY_LOGGED phone; - USER_PROPERTY_LOGGED realName; + USER_PROPERTY_LOGGED tariffName; + USER_PROPERTY_LOGGED nextTariff; + USER_PROPERTY_LOGGED address; + USER_PROPERTY_LOGGED note; + USER_PROPERTY_LOGGED group; + USER_PROPERTY_LOGGED email; + USER_PROPERTY_LOGGED phone; + USER_PROPERTY_LOGGED realName; USER_PROPERTY_LOGGED credit; USER_PROPERTY_LOGGED creditExpire; USER_PROPERTY_LOGGED ips; - USER_PROPERTY_LOGGED userdata0; - USER_PROPERTY_LOGGED userdata1; - USER_PROPERTY_LOGGED userdata2; - USER_PROPERTY_LOGGED userdata3; - USER_PROPERTY_LOGGED userdata4; - USER_PROPERTY_LOGGED userdata5; - USER_PROPERTY_LOGGED userdata6; - USER_PROPERTY_LOGGED userdata7; - USER_PROPERTY_LOGGED userdata8; - USER_PROPERTY_LOGGED userdata9; + USER_PROPERTY_LOGGED userdata0; + USER_PROPERTY_LOGGED userdata1; + USER_PROPERTY_LOGGED userdata2; + USER_PROPERTY_LOGGED userdata3; + USER_PROPERTY_LOGGED userdata4; + USER_PROPERTY_LOGGED userdata5; + USER_PROPERTY_LOGGED userdata6; + USER_PROPERTY_LOGGED userdata7; + USER_PROPERTY_LOGGED userdata8; + USER_PROPERTY_LOGGED userdata9; }; //============================================================================= @@ -189,7 +187,7 @@ USER_PROPERTY::~USER_PROPERTY() template void USER_PROPERTY::ModifyTime() throw() { - modificationTime = stgTime; +modificationTime = stgTime; } //----------------------------------------------------------------------------- template @@ -197,7 +195,7 @@ void USER_PROPERTY::Set(const varT & rvalue) { STG_LOCKER locker(&mutex, __FILE__, __LINE__); -typename set *>::iterator ni; +typename std::set *>::iterator ni; varT oldVal = value; @@ -278,7 +276,7 @@ return modificationTime; //----------------------------------------------------------------------------- template USER_PROPERTY_LOGGED::USER_PROPERTY_LOGGED(varT& val, - string n, + std::string n, bool isPass, bool isSt, STG_LOGGER & logger, @@ -311,7 +309,7 @@ return USER_PROPERTY::ConstData(); }; //------------------------------------------------------------------------- template -const string & USER_PROPERTY_LOGGED::GetName() const +const std::string & USER_PROPERTY_LOGGED::GetName() const { return name; }; @@ -319,13 +317,13 @@ return name; template bool USER_PROPERTY_LOGGED::Set(const varT & val, const ADMIN * admin, - const string & login, + const std::string & login, const STORE * store, - const string & msg) + const std::string & msg) { const PRIV * priv = admin->GetPriv(); -string adm_login = admin->GetLogin(); -string adm_ip = admin->GetIPStr(); +std::string adm_login = admin->GetLogin(); +std::string adm_ip = admin->GetIPStr(); if ((priv->userConf && !isStat) || (priv->userStat && isStat) || (priv->userPasswd && isPassword) || (priv->userCash && name == "cash")) { @@ -360,21 +358,21 @@ return true; } //------------------------------------------------------------------------- template -void USER_PROPERTY_LOGGED::WriteAccessDenied(const string & login, +void USER_PROPERTY_LOGGED::WriteAccessDenied(const std::string & login, const ADMIN * admin, - const string & parameter) + const std::string & parameter) { stgLogger("%s Change user \'%s.\' Parameter \'%s\'. Access denied.", admin->GetLogStr().c_str(), login.c_str(), parameter.c_str()); } //------------------------------------------------------------------------- template -void USER_PROPERTY_LOGGED::WriteSuccessChange(const string & login, +void USER_PROPERTY_LOGGED::WriteSuccessChange(const std::string & login, const ADMIN * admin, - const string & parameter, - const string & oldValue, - const string & newValue, - const string & msg, + const std::string & parameter, + const std::string & oldValue, + const std::string & newValue, + const std::string & msg, const STORE * store) { stgLogger("%s User \'%s\': \'%s\' parameter changed from \'%s\' to \'%s\'. %s", @@ -389,19 +387,19 @@ store->WriteUserChgLog(login, admin->GetLogin(), admin->GetIP(), parameter, oldV } //------------------------------------------------------------------------- template -void USER_PROPERTY_LOGGED::OnChange(const string & login, - const string & paramName, - const string & oldValue, - const string & newValue, +void USER_PROPERTY_LOGGED::OnChange(const std::string & login, + const std::string & paramName, + const std::string & oldValue, + const std::string & newValue, const ADMIN * admin) { -string str1; +std::string str1; str1 = scriptsDir + "/OnChange"; if (access(str1.c_str(), X_OK) == 0) { - string str2("\"" + str1 + "\" \"" + login + "\" \"" + paramName + "\" \"" + oldValue + "\" \"" + newValue + "\" \"" + admin->GetLogin() + "\" \"" + admin->GetIPStr() + "\""); + std::string str2("\"" + str1 + "\" \"" + login + "\" \"" + paramName + "\" \"" + oldValue + "\" \"" + newValue + "\" \"" + admin->GetLogin() + "\" \"" + admin->GetIPStr() + "\""); ScriptExec(str2); } else -- 2.43.2