]> git.stg.codes - stg.git/blobdiff - projects/sgconf/services.cpp
Fixed return value for serach methods.
[stg.git] / projects / sgconf / services.cpp
index b6ce1a33a3a4cba61fcd817cee800b892aea0957..e2bf9bf621c3ffc00582e19dd1716724e45a4857 100644 (file)
@@ -28,7 +28,7 @@ void PrintService(const STG::GET_SERVICE::INFO & info, size_t level = 0)
 {
 std::cout << Indent(level, true) << "name: " << info.name << "\n"
           << Indent(level)       << "cost: " << info.cost << "\n"
 {
 std::cout << Indent(level, true) << "name: " << info.name << "\n"
           << Indent(level)       << "cost: " << info.cost << "\n"
-          << Indent(level)       << "payment day: " << info.payDay << "\n"
+          << Indent(level)       << "payment day: " << static_cast<unsigned>(info.payDay) << "\n"
           << Indent(level)       << "comment: " << info.comment << "\n";
 }
 
           << Indent(level)       << "comment: " << info.comment << "\n";
 }
 
@@ -87,6 +87,8 @@ bool GetServicesFunction(const SGCONF::CONFIG & config,
 {
 STG::SERVCONF proto(config.server.data(),
                     config.port.data(),
 {
 STG::SERVCONF proto(config.server.data(),
                     config.port.data(),
+                    config.localAddress.data(),
+                    config.localPort.data(),
                     config.userName.data(),
                     config.userPass.data());
 return proto.GetServices(GetServicesCallback, NULL) == STG::st_ok;
                     config.userName.data(),
                     config.userPass.data());
 return proto.GetServices(GetServicesCallback, NULL) == STG::st_ok;
@@ -98,6 +100,8 @@ bool GetServiceFunction(const SGCONF::CONFIG & config,
 {
 STG::SERVCONF proto(config.server.data(),
                     config.port.data(),
 {
 STG::SERVCONF proto(config.server.data(),
                     config.port.data(),
+                    config.localAddress.data(),
+                    config.localPort.data(),
                     config.userName.data(),
                     config.userPass.data());
 return proto.GetService(arg, GetServiceCallback, NULL) == STG::st_ok;
                     config.userName.data(),
                     config.userPass.data());
 return proto.GetService(arg, GetServiceCallback, NULL) == STG::st_ok;
@@ -109,6 +113,8 @@ bool DelServiceFunction(const SGCONF::CONFIG & config,
 {
 STG::SERVCONF proto(config.server.data(),
                     config.port.data(),
 {
 STG::SERVCONF proto(config.server.data(),
                     config.port.data(),
+                    config.localAddress.data(),
+                    config.localPort.data(),
                     config.userName.data(),
                     config.userPass.data());
 return proto.DelService(arg, SimpleCallback, NULL) == STG::st_ok;
                     config.userName.data(),
                     config.userPass.data());
 return proto.DelService(arg, SimpleCallback, NULL) == STG::st_ok;
@@ -125,6 +131,8 @@ SGCONF::MaybeSet(options, "pay-day", conf.payDay);
 SGCONF::MaybeSet(options, "comment", conf.comment);
 STG::SERVCONF proto(config.server.data(),
                     config.port.data(),
 SGCONF::MaybeSet(options, "comment", conf.comment);
 STG::SERVCONF proto(config.server.data(),
                     config.port.data(),
+                    config.localAddress.data(),
+                    config.localPort.data(),
                     config.userName.data(),
                     config.userPass.data());
 return proto.AddService(arg, conf, SimpleCallback, NULL) == STG::st_ok;
                     config.userName.data(),
                     config.userPass.data());
 return proto.AddService(arg, conf, SimpleCallback, NULL) == STG::st_ok;
@@ -141,6 +149,8 @@ SGCONF::MaybeSet(options, "pay-day", conf.payDay);
 SGCONF::MaybeSet(options, "comment", conf.comment);
 STG::SERVCONF proto(config.server.data(),
                     config.port.data(),
 SGCONF::MaybeSet(options, "comment", conf.comment);
 STG::SERVCONF proto(config.server.data(),
                     config.port.data(),
+                    config.localAddress.data(),
+                    config.localPort.data(),
                     config.userName.data(),
                     config.userPass.data());
 return proto.ChgService(conf, SimpleCallback, NULL) == STG::st_ok;
                     config.userName.data(),
                     config.userPass.data());
 return proto.ChgService(conf, SimpleCallback, NULL) == STG::st_ok;
@@ -155,6 +165,6 @@ blocks.Add("Service management options")
       .Add("get-services", SGCONF::MakeAPIAction(commands, GetServicesFunction), "\tget service list")
       .Add("get-service", SGCONF::MakeAPIAction(commands, "<name>", GetServiceFunction), "get service")
       .Add("add-service", SGCONF::MakeAPIAction(commands, "<name>", params, AddServiceFunction), "add service")
       .Add("get-services", SGCONF::MakeAPIAction(commands, GetServicesFunction), "\tget service list")
       .Add("get-service", SGCONF::MakeAPIAction(commands, "<name>", GetServiceFunction), "get service")
       .Add("add-service", SGCONF::MakeAPIAction(commands, "<name>", params, AddServiceFunction), "add service")
-      .Add("del-service", SGCONF::MakeAPIAction(commands, "<name>", DelServiceFunction), "del service")
+      .Add("del-service", SGCONF::MakeAPIAction(commands, "<name>", DelServiceFunction), "delete service")
       .Add("chg-service", SGCONF::MakeAPIAction(commands, "<name>", params, ChgServiceFunction), "change service");
 }
       .Add("chg-service", SGCONF::MakeAPIAction(commands, "<name>", params, ChgServiceFunction), "change service");
 }