X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/c00e81f9f50c4fe50ee32b02a689d68c9bc595b6..8d4e3b241054c1977a36e33121a2f7540f320f44:/projects/sgconf/corps.cpp diff --git a/projects/sgconf/corps.cpp b/projects/sgconf/corps.cpp index 82673377..18217705 100644 --- a/projects/sgconf/corps.cpp +++ b/projects/sgconf/corps.cpp @@ -3,6 +3,7 @@ #include "api_action.h" #include "options.h" #include "config.h" +#include "utils.h" #include "stg/servconf.h" #include "stg/servconf_types.h" @@ -111,20 +112,30 @@ return proto.DelCorp(arg, SimpleCallback, NULL) == STG::st_ok; bool AddCorpFunction(const SGCONF::CONFIG & config, const std::string & arg, - const std::map & /*options*/) + const std::map & options) { -// TODO -std::cerr << "Unimplemented.\n"; -return false; +CORP_CONF_RES conf; +conf.name = arg; +SGCONF::MaybeSet(options, "cash", conf.cash); +STG::SERVCONF proto(config.server.data(), + config.port.data(), + config.userName.data(), + config.userPass.data()); +return proto.AddCorp(arg, conf, SimpleCallback, NULL) == STG::st_ok; } bool ChgCorpFunction(const SGCONF::CONFIG & config, const std::string & arg, const std::map & options) { -// TODO -std::cerr << "Unimplemented.\n"; -return false; +CORP_CONF_RES conf; +conf.name = arg; +SGCONF::MaybeSet(options, "cash", conf.cash); +STG::SERVCONF proto(config.server.data(), + config.port.data(), + config.userName.data(), + config.userPass.data()); +return proto.ChgCorp(conf, SimpleCallback, NULL) == STG::st_ok; } } // namespace anonymous