X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/72229403aae25f742c07d07d625bdc1e313b401d..58c44b8153f2164b07be44e463bf7b92044098bd:/projects/stargazer/plugins/configuration/sgconfig/parser_admin.cpp
diff --git a/projects/stargazer/plugins/configuration/sgconfig/parser_admin.cpp b/projects/stargazer/plugins/configuration/sgconfig/parser_admin.cpp
index d93b3448..7783888e 100644
--- a/projects/stargazer/plugins/configuration/sgconfig/parser_admin.cpp
+++ b/projects/stargazer/plugins/configuration/sgconfig/parser_admin.cpp
@@ -30,24 +30,18 @@ void PARSER_GET_ADMINS::CreateAnswer()
const PRIV * priv = currAdmin->GetPriv();
if (!priv->adminChg)
{
- //answerList->clear();
- answerList->erase(answerList->begin(), answerList->end());
-
- answerList->push_back("");
+ answer = "";
return;
}
-std::string s;
-//answerList->clear();
-answerList->erase(answerList->begin(), answerList->end());
+answer.clear();
-answerList->push_back("");
+answer += "";
ADMIN_CONF ac;
int h = admins->OpenSearch();
while (admins->SearchNext(h, &ac) == 0)
{
- //memcpy(&p, &ac.priv, sizeof(unsigned int));
unsigned int p = (ac.priv.userStat << 0) +
(ac.priv.userConf << 2) +
(ac.priv.userCash << 4) +
@@ -55,11 +49,10 @@ while (admins->SearchNext(h, &ac) == 0)
(ac.priv.userAddDel << 8) +
(ac.priv.adminChg << 10) +
(ac.priv.tariffChg << 12);
- strprintf(&s, "", ac.login.c_str(), p);
- answerList->push_back(s);
+ answer += "";
}
admins->CloseSearch(h);
-answerList->push_back("");
+answer += "";
}
//-----------------------------------------------------------------------------
@@ -89,19 +82,10 @@ return -1;
//-----------------------------------------------------------------------------
void PARSER_DEL_ADMIN::CreateAnswer()
{
-//answerList->clear();
-answerList->erase(answerList->begin(), answerList->end());
-
if (admins->Del(adminToDel, currAdmin) == 0)
- {
- answerList->push_back("");
- }
+ answer = "";
else
- {
- std::string s;
- strprintf(&s, "", admins->GetStrError().c_str());
- answerList->push_back(s);
- }
+ answer = "GetStrError() + "\"/>";
}
//-----------------------------------------------------------------------------
// ADD ADMIN
@@ -118,9 +102,6 @@ return -1;
//-----------------------------------------------------------------------------
int PARSER_ADD_ADMIN::ParseEnd(void *, const char *el)
{
-//answerList->clear();
-answerList->erase(answerList->begin(), answerList->end());
-
if (strcasecmp(el, "AddAdmin") == 0)
{
CreateAnswer();
@@ -131,19 +112,10 @@ return -1;
//-----------------------------------------------------------------------------
void PARSER_ADD_ADMIN::CreateAnswer()
{
-//answerList->clear();
-answerList->erase(answerList->begin(), answerList->end());
-
if (admins->Add(adminToAdd, currAdmin) == 0)
- {
- answerList->push_back("");
- }
+ answer = "";
else
- {
- std::string s;
- strprintf(&s, "", admins->GetStrError().c_str());
- answerList->push_back(s);
- }
+ answer = "GetStrError() + "\"/>";
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
@@ -195,16 +167,13 @@ return -1;
//-----------------------------------------------------------------------------
void PARSER_CHG_ADMIN::CreateAnswer()
{
-answerList->erase(answerList->begin(), answerList->end());
-
-
if (!login.empty())
{
ADMIN * origAdmin = NULL;
if (admins->Find(login.data(), &origAdmin))
{
- answerList->push_back(std::string("");
+ answer = "";
return;
}
@@ -218,7 +187,7 @@ if (!login.empty())
int p = 0;
if (str2x(privAsString.data().c_str(), p) < 0)
{
- answerList->push_back("");
+ answer = "";
return;
}
@@ -226,20 +195,10 @@ if (!login.empty())
}
if (admins->Change(conf, currAdmin) != 0)
- {
- std::string s;
- strprintf(&s, "", admins->GetStrError().c_str());
- answerList->push_back(s);
- }
+ answer = "GetStrError() + "\"/>";
else
- {
- answerList->push_back("");
- }
+ answer = "";
}
else
- {
- answerList->push_back("");
- }
+ answer = "";
}
-//-----------------------------------------------------------------------------*/
-