]> git.stg.codes - stg.git/blobdiff - stargazer/plugins/configuration/sgconfig/parser_admins.cpp
RawPacket-related changes.
[stg.git] / stargazer / plugins / configuration / sgconfig / parser_admins.cpp
index 0db867bb3e680e1132e59a7c7a1aaaac29a0891f..0e390ffdd350ef4a04e5d559a8e1b5734da53874 100644 (file)
@@ -22,6 +22,8 @@
 #include "parser_admins.h"
 
 #include "stg/admins.h"
 #include "parser_admins.h"
 
 #include "stg/admins.h"
+#include "stg/admin.h"
+#include "stg/admin_conf.h"
 
 #include <strings.h> // strcasecmp
 
 
 #include <strings.h> // strcasecmp
 
@@ -37,7 +39,7 @@ const char * CHG_ADMIN::tag  = "ChgAdmin";
 
 void GET_ADMINS::CreateAnswer()
 {
 
 void GET_ADMINS::CreateAnswer()
 {
-    const PRIV * priv = m_currAdmin.GetPriv();
+    const auto priv = m_currAdmin.GetPriv();
     if (!priv->adminChg)
     {
         m_answer = "<Error Result=\"Error. Access denied.\"/>";
     if (!priv->adminChg)
     {
         m_answer = "<Error Result=\"Error. Access denied.\"/>";
@@ -45,7 +47,7 @@ void GET_ADMINS::CreateAnswer()
     }
 
     m_answer = "<Admins>";
     }
 
     m_answer = "<Admins>";
-    ADMIN_CONF ac;
+    AdminConf ac;
     int h = m_admins.OpenSearch();
 
     while (m_admins.SearchNext(h, &ac) == 0)
     int h = m_admins.OpenSearch();
 
     while (m_admins.SearchNext(h, &ac) == 0)
@@ -57,7 +59,7 @@ void GET_ADMINS::CreateAnswer()
                          (ac.priv.userAddDel << 8) +
                          (ac.priv.adminChg << 10) +
                          (ac.priv.tariffChg << 12);
                          (ac.priv.userAddDel << 8) +
                          (ac.priv.adminChg << 10) +
                          (ac.priv.tariffChg << 12);
-        m_answer += "<admin login=\"" + ac.login + "\" priv=\"" + x2str(p) + "\"/>";
+        m_answer += "<admin login=\"" + ac.login + "\" priv=\"" + std::to_string(p) + "\"/>";
     }
     m_admins.CloseSearch(h);
     m_answer += "</Admins>";
     }
     m_admins.CloseSearch(h);
     m_answer += "</Admins>";
@@ -137,7 +139,7 @@ void CHG_ADMIN::CreateAnswer()
 {
     if (!login.empty())
     {
 {
     if (!login.empty())
     {
-        ADMIN * origAdmin = NULL;
+        Admin * origAdmin = NULL;
 
         if (m_admins.Find(login, &origAdmin))
         {
 
         if (m_admins.Find(login, &origAdmin))
         {
@@ -145,7 +147,7 @@ void CHG_ADMIN::CreateAnswer()
             return;
         }
 
             return;
         }
 
-        ADMIN_CONF conf(origAdmin->GetConf());
+        AdminConf conf(origAdmin->GetConf());
 
         if (!password.empty())
             conf.password = password.data();
 
         if (!password.empty())
             conf.password = password.data();
@@ -159,7 +161,7 @@ void CHG_ADMIN::CreateAnswer()
                 return;
             }
 
                 return;
             }
 
-            conf.priv.FromInt(p);
+            conf.priv = Priv(p);
         }
 
         if (m_admins.Change(conf, &m_currAdmin) != 0)
         }
 
         if (m_admins.Change(conf, &m_currAdmin) != 0)