From c27745d81c50d0fadd541eff81eeca7883321c50 Mon Sep 17 00:00:00 2001 From: Naffanya Date: Sun, 14 Jul 2013 21:50:14 +0300 Subject: [PATCH] Method GetParamValue --- include/stg/user.h | 2 + include/stg/users.h | 1 + projects/stargazer/main.cpp | 4 +- projects/stargazer/user_impl.cpp | 115 +++++++++++++++++++++++++++++++ projects/stargazer/user_impl.h | 2 + 5 files changed, 122 insertions(+), 2 deletions(-) diff --git a/include/stg/user.h b/include/stg/user.h index b9d638d6..b0115555 100644 --- a/include/stg/user.h +++ b/include/stg/user.h @@ -100,6 +100,8 @@ public: virtual void OnAdd() = 0; virtual void OnDelete() = 0; + + virtual const std::string & GetParamValue(const std::string & name) const = 0; }; typedef USER * USER_PTR; diff --git a/include/stg/users.h b/include/stg/users.h index 2ba23833..ed9af901 100644 --- a/include/stg/users.h +++ b/include/stg/users.h @@ -60,6 +60,7 @@ public: virtual int Start() = 0; virtual int Stop() = 0; + }; #endif diff --git a/projects/stargazer/main.cpp b/projects/stargazer/main.cpp index c2134f49..020af9da 100644 --- a/projects/stargazer/main.cpp +++ b/projects/stargazer/main.cpp @@ -267,7 +267,7 @@ if (settings->ReadSettings()) if (settings->GetLogFileName() != "") WriteServLog.SetLogFileName(settings->GetLogFileName()); - + WriteServLog("ReadSettings error. %s", settings->GetStrError().c_str()); exit(1); } @@ -279,7 +279,7 @@ if (settings->ReadSettings()) printfd(__FILE__, "%s\n", it->c_str()); ++it; } - printfd(__FILE__, "--- End dump ---\n"); + printfd(__FILE__, "--- End dump ---\n"); /*************************************************************************************************/ #ifndef NO_DAEMON std::string startFile(settings->GetConfDir() + START_FILE); diff --git a/projects/stargazer/user_impl.cpp b/projects/stargazer/user_impl.cpp index ac8399ca..95989c45 100644 --- a/projects/stargazer/user_impl.cpp +++ b/projects/stargazer/user_impl.cpp @@ -1457,6 +1457,121 @@ while (it != messages.end()) } } //----------------------------------------------------------------------------- +const std::string & USER_IMPL::GetParamValue(const std::string & name) const + { + std::string value; + + if (name=="cash") + { + value=property.cash; + } + if (name=="freeMb") + { + value=property.freeMb; + } + if (name=="passive") + { + value=property.passive; + } + if (name=="disabled") + { + value=property.disabled; + } + if (name=="alwaysOnline") + { + value=property.alwaysOnline; + } + if (name=="tariffName") + { + value=property.tariffName; + } + if (name=="nextTariff") + { + value=property.nextTariff; + } + if (name=="address") + { + value=property.address; + } + if (name=="note") + { + value=property.note; + } + if (name=="group") + { + value=property.group; + } + if (name=="email") + { + value=property.email; + } + if (name=="phone") + { + value=property.phone; + } + if (name=="realName") + { + value=property.realName; + } + if (name=="credit") + { + value=property.credit; + } + if (name=="userdata0") + { + value=property.userdata0; + } + if (name=="userdata1") + { + value=property.userdata1; + } + if (name=="userdata2") + { + value=property.userdata2; + } + if (name=="userdata3") + { + value=property.userdata3; + } + if (name=="userdata4") + { + value=property.userdata4; + } + if (name=="userdata5") + { + value=property.userdata5; + } + if (name=="userdata6") + { + value=property.userdata6; + } + if (name=="userdata7") + { + value=property.userdata7; + } + if (name=="userdata8") + { + value=property.userdata8; + } + if (name=="userdata9") + { + value=property.userdata9; + } + if (name=="id") + { + value=id; + } + if (name=="login") + { + value=login; + } + if (name=="ip") + { + value=currIP; + } + return value; + } +//----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void CHG_PASSIVE_NOTIFIER::Notify(const int & oldPassive, const int & newPassive) diff --git a/projects/stargazer/user_impl.h b/projects/stargazer/user_impl.h index 5e8f49db..5fe02bb3 100644 --- a/projects/stargazer/user_impl.h +++ b/projects/stargazer/user_impl.h @@ -216,6 +216,8 @@ public: void OnAdd(); void OnDelete(); + virtual const std::string & GetParamValue(const std::string & name) const; + private: USER_IMPL & operator=(const USER_IMPL & rvalue); -- 2.43.2