X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/78e14695fc1b743f225a5aa30ca98784bce576c1..c016156ebb870d9d81219b8c4165aa75703f1e85:/projects/stargazer/plugins/configuration/rpcconfig/users_methods.cpp?ds=inline diff --git a/projects/stargazer/plugins/configuration/rpcconfig/users_methods.cpp b/projects/stargazer/plugins/configuration/rpcconfig/users_methods.cpp index fd9f86be..fcd81a5e 100644 --- a/projects/stargazer/plugins/configuration/rpcconfig/users_methods.cpp +++ b/projects/stargazer/plugins/configuration/rpcconfig/users_methods.cpp @@ -1,16 +1,16 @@ #include -#include "users_methods.h" - -#include "../../../users.h" -#include "../../../admins.h" -#include "../../../tariffs.h" +#include "stg/users.h" +#include "stg/admins.h" +#include "stg/tariffs.h" +#include "stg/user_ips.h" +#include "stg/common.h" +#include "stg/user_property.h" +#include "users_methods.h" #include "rpcconfig.h" #include "user_helper.h" -#include "user_ips.h" #include "utils.h" -#include "common.h" //------------------------------------------------------------------------------ @@ -32,7 +32,7 @@ if (config->GetAdminInfo(cookie, &adminInfo)) return; } -user_iter u; +USER_PTR u; if (users->FindByName(login, &u)) { @@ -70,7 +70,7 @@ if (config->GetAdminInfo(cookie, &adminInfo)) return; } -ADMIN admin; +ADMIN * admin = NULL; if (admins->FindAdmin(adminInfo.admin, &admin)) { @@ -78,7 +78,7 @@ if (admins->FindAdmin(adminInfo.admin, &admin)) return; } -user_iter u; +USER_PTR u; if (users->FindByName(login, &u)) { @@ -114,7 +114,7 @@ if (config->GetAdminInfo(cookie, &adminInfo)) return; } -ADMIN admin; +ADMIN * admin; if (admins->FindAdmin(adminInfo.admin, &admin)) { @@ -122,9 +122,9 @@ if (admins->FindAdmin(adminInfo.admin, &admin)) return; } -user_iter u; +USER_PTR u; -if (users->FindByName(login, &u)) +if (!users->FindByName(login, &u)) { users->Del(login, admin); *retvalPtr = xmlrpc_c::value_boolean(true); @@ -158,7 +158,7 @@ if (config->GetAdminInfo(cookie, &adminInfo)) bool hidePassword = !adminInfo.priviledges.userConf || !adminInfo.priviledges.userPasswd; -user_iter u; +USER_PTR u; int h = users->OpenSearch(); if (!h) @@ -206,7 +206,7 @@ if (config->GetAdminInfo(cookie, &adminInfo)) return; } -ADMIN admin; +ADMIN * admin; if (admins->FindAdmin(adminInfo.admin, &admin)) { @@ -214,7 +214,7 @@ if (admins->FindAdmin(adminInfo.admin, &admin)) return; } -user_iter u; +USER_PTR u; if (users->FindByName(login, &u)) { @@ -259,7 +259,7 @@ if (config->GetAdminInfo(cookie, &adminInfo)) return; } -ADMIN admin; +ADMIN * admin; if (admins->FindAdmin(adminInfo.admin, &admin)) { @@ -267,7 +267,7 @@ if (admins->FindAdmin(adminInfo.admin, &admin)) return; } -user_iter u; +USER_PTR u; if (users->FindByName(login, &u)) { @@ -275,10 +275,10 @@ if (users->FindByName(login, &u)) return; } -double cash = u->property.cash.Get(); +double cash = u->GetProperty().cash.Get(); cash += amount; -if (!u->property.cash.Set(cash, admin, login, store, comment)) +if (!u->GetProperty().cash.Set(cash, admin, login, store, comment)) { *retvalPtr = xmlrpc_c::value_boolean(false); return; @@ -309,7 +309,7 @@ if (config->GetAdminInfo(cookie, &adminInfo)) return; } -ADMIN admin; +ADMIN * admin; if (admins->FindAdmin(adminInfo.admin, &admin)) { @@ -317,7 +317,7 @@ if (admins->FindAdmin(adminInfo.admin, &admin)) return; } -user_iter u; +USER_PTR u; if (users->FindByName(login, &u)) { @@ -325,7 +325,7 @@ if (users->FindByName(login, &u)) return; } -if (!u->property.cash.Set(cash, admin, login, store, comment)) +if (!u->GetProperty().cash.Set(cash, admin, login, store, comment)) { *retvalPtr = xmlrpc_c::value_boolean(false); return; @@ -357,7 +357,7 @@ if (config->GetAdminInfo(cookie, &adminInfo)) return; } -ADMIN admin; +ADMIN * admin; if (admins->FindAdmin(adminInfo.admin, &admin)) { @@ -365,7 +365,7 @@ if (admins->FindAdmin(adminInfo.admin, &admin)) return; } -user_iter u; +USER_PTR u; if (users->FindByName(login, &u)) { @@ -377,10 +377,10 @@ if (tariffs->FindByName(tariff)) { if (delayed) { - if (u->property.nextTariff.Set(tariff, - admin, - login, - store)) + if (u->GetProperty().nextTariff.Set(tariff, + admin, + login, + store)) { u->WriteConf(); *retvalPtr = xmlrpc_c::value_boolean(true); @@ -389,11 +389,12 @@ if (tariffs->FindByName(tariff)) } else { - if (u->property.tariffName.Set(tariff, - admin, - login, - store)) + if (u->GetProperty().tariffName.Set(tariff, + admin, + login, + store)) { + u->ResetNextTariff(); u->WriteConf(); *retvalPtr = xmlrpc_c::value_boolean(true); return; @@ -442,7 +443,7 @@ if (config->GetAdminInfo(cookie, &adminInfo)) std::vector ips; -user_iter u; +USER_PTR u; int handle = users->OpenSearch(); if (!handle)