X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/250a7d6e7a4c8ffd644931b7b3964289a8f99151..e3cdee36859207bc21ab469aff0d8846a738f6ed:/projects/stargazer/plugins/configuration/sgconfig/parser_admins.cpp
diff --git a/projects/stargazer/plugins/configuration/sgconfig/parser_admins.cpp b/projects/stargazer/plugins/configuration/sgconfig/parser_admins.cpp
index c75dc8a7..d9b6cfc9 100644
--- a/projects/stargazer/plugins/configuration/sgconfig/parser_admins.cpp
+++ b/projects/stargazer/plugins/configuration/sgconfig/parser_admins.cpp
@@ -31,18 +31,23 @@ using STG::PARSER::ADD_ADMIN;
using STG::PARSER::DEL_ADMIN;
using STG::PARSER::CHG_ADMIN;
+const char * GET_ADMINS::tag = "GetAdmins";
+const char * ADD_ADMIN::tag = "AddAdmin";
+const char * DEL_ADMIN::tag = "DelAdmin";
+const char * CHG_ADMIN::tag = "ChgAdmin";
+
void GET_ADMINS::CreateAnswer()
{
- const PRIV * priv = currAdmin.GetPriv();
+ const PRIV * priv = m_currAdmin.GetPriv();
if (!priv->adminChg)
{
- answer = "";
+ m_answer = "";
return;
}
- answer.clear();
+ m_answer.clear();
- answer += GetOpenTag();
+ m_answer += GetOpenTag();
ADMIN_CONF ac;
int h = m_admins.OpenSearch();
@@ -55,17 +60,17 @@ void GET_ADMINS::CreateAnswer()
(ac.priv.userAddDel << 8) +
(ac.priv.adminChg << 10) +
(ac.priv.tariffChg << 12);
- answer += "";
+ m_answer += "";
}
m_admins.CloseSearch(h);
- answer += GetCloseTag();
+ m_answer += GetCloseTag();
}
int DEL_ADMIN::Start(void *, const char * el, const char ** attr)
{
- if (strcasecmp(el, tag.c_str()) == 0)
+ if (strcasecmp(el, m_tag.c_str()) == 0)
{
- admin = attr[1];
+ m_admin = attr[1];
return 0;
}
return -1;
@@ -73,17 +78,17 @@ int DEL_ADMIN::Start(void *, const char * el, const char ** attr)
void DEL_ADMIN::CreateAnswer()
{
- if (m_admins.Del(admin, &currAdmin) == 0)
- answer = "<" + tag + " Result=\"Ok\"/>";
+ if (m_admins.Del(m_admin, &m_currAdmin) == 0)
+ m_answer = "<" + m_tag + " Result=\"Ok\"/>";
else
- answer = "<" + tag + " Result=\"Error. " + m_admins.GetStrError() + "\"/>";
+ m_answer = "<" + m_tag + " Result=\"Error. " + m_admins.GetStrError() + "\"/>";
}
int ADD_ADMIN::Start(void *, const char *el, const char **attr)
{
- if (strcasecmp(el, tag.c_str()) == 0)
+ if (strcasecmp(el, m_tag.c_str()) == 0)
{
- admin = attr[1];
+ m_admin = attr[1];
return 0;
}
return -1;
@@ -91,15 +96,15 @@ int ADD_ADMIN::Start(void *, const char *el, const char **attr)
void ADD_ADMIN::CreateAnswer()
{
- if (m_admins.Add(admin, &currAdmin) == 0)
- answer = "<" + tag + " Result=\"Ok\"/>";
+ if (m_admins.Add(m_admin, &m_currAdmin) == 0)
+ m_answer = "<" + m_tag + " Result=\"Ok\"/>";
else
- answer = "<" + tag + " Result=\"Error. " + m_admins.GetStrError() + "\"/>";
+ m_answer = "<" + m_tag + " Result=\"Error. " + m_admins.GetStrError() + "\"/>";
}
int CHG_ADMIN::Start(void *, const char * el, const char ** attr)
{
- if (strcasecmp(el, tag.c_str()) == 0)
+ if (strcasecmp(el, m_tag.c_str()) == 0)
{
for (size_t i = 0; i < 6; i += 2)
{
@@ -139,7 +144,7 @@ void CHG_ADMIN::CreateAnswer()
if (m_admins.Find(login, &origAdmin))
{
- answer = "<" + tag + " Result = \"Admin '" + login + "' is not found.\"/>";
+ m_answer = "<" + m_tag + " Result = \"Admin '" + login + "' is not found.\"/>";
return;
}
@@ -153,18 +158,18 @@ void CHG_ADMIN::CreateAnswer()
int p = 0;
if (str2x(privAsString.data().c_str(), p) < 0)
{
- answer = "<" + tag + " Result = \"Incorrect parameter Priv.\"/>";
+ m_answer = "<" + m_tag + " Result = \"Incorrect parameter Priv.\"/>";
return;
}
conf.priv.FromInt(p);
}
- if (m_admins.Change(conf, &currAdmin) != 0)
- answer = "<" + tag + " Result = \"" + m_admins.GetStrError() + "\"/>";
+ if (m_admins.Change(conf, &m_currAdmin) != 0)
+ m_answer = "<" + m_tag + " Result = \"" + m_admins.GetStrError() + "\"/>";
else
- answer = "<" + tag + " Result = \"Ok\"/>";
+ m_answer = "<" + m_tag + " Result = \"Ok\"/>";
}
else
- answer = "<" + tag + " Result = \"Incorrect parameter login.\"/>";
+ m_answer = "<" + m_tag + " Result = \"Incorrect parameter login.\"/>";
}