X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/c00e81f9f50c4fe50ee32b02a689d68c9bc595b6..f5776429a3145d59f5b131c25d0f9428ae947f4e:/projects/sgconf/admins.cpp?ds=inline
diff --git a/projects/sgconf/admins.cpp b/projects/sgconf/admins.cpp
index 6a59fa28..c16e6e2b 100644
--- a/projects/sgconf/admins.cpp
+++ b/projects/sgconf/admins.cpp
@@ -120,6 +120,8 @@ bool GetAdminsFunction(const SGCONF::CONFIG & config,
{
STG::SERVCONF proto(config.server.data(),
config.port.data(),
+ config.localAddress.data(),
+ config.localPort.data(),
config.userName.data(),
config.userPass.data());
return proto.GetAdmins(GetAdminsCallback, NULL) == STG::st_ok;
@@ -131,6 +133,8 @@ bool GetAdminFunction(const SGCONF::CONFIG & config,
{
STG::SERVCONF proto(config.server.data(),
config.port.data(),
+ config.localAddress.data(),
+ config.localPort.data(),
config.userName.data(),
config.userPass.data());
// STG currently doesn't support .
@@ -145,6 +149,8 @@ bool DelAdminFunction(const SGCONF::CONFIG & config,
{
STG::SERVCONF proto(config.server.data(),
config.port.data(),
+ config.localAddress.data(),
+ config.localPort.data(),
config.userName.data(),
config.userPass.data());
return proto.DelAdmin(arg, SimpleCallback, NULL) == STG::st_ok;
@@ -154,12 +160,14 @@ bool AddAdminFunction(const SGCONF::CONFIG & config,
const std::string & arg,
const std::map & options)
{
-// TODO
ADMIN_CONF_RES conf;
conf.login = arg;
SGCONF::MaybeSet(options, "priv", conf.priv, ConvPriv);
+SGCONF::MaybeSet(options, "password", conf.password);
STG::SERVCONF proto(config.server.data(),
config.port.data(),
+ config.localAddress.data(),
+ config.localPort.data(),
config.userName.data(),
config.userPass.data());
return proto.AddAdmin(arg, conf, SimpleCallback, NULL) == STG::st_ok;
@@ -169,9 +177,17 @@ bool ChgAdminFunction(const SGCONF::CONFIG & config,
const std::string & arg,
const std::map & options)
{
-// TODO
-std::cerr << "Unimplemented.\n";
-return false;
+ADMIN_CONF_RES conf;
+conf.login = arg;
+SGCONF::MaybeSet(options, "priv", conf.priv, ConvPriv);
+SGCONF::MaybeSet(options, "password", conf.password);
+STG::SERVCONF proto(config.server.data(),
+ config.port.data(),
+ config.localAddress.data(),
+ config.localPort.data(),
+ config.userName.data(),
+ config.userPass.data());
+return proto.ChgAdmin(conf, SimpleCallback, NULL) == STG::st_ok;
}
} // namespace anonymous