X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/6d5f129aad1a6cbaf4d1441c68398e00fa949185..97f1f905311bcb76c3b500e3e49c1b9f49dff491:/projects/sgconf/main.cpp diff --git a/projects/sgconf/main.cpp b/projects/sgconf/main.cpp index f8a394d4..2c2a8a7b 100644 --- a/projects/sgconf/main.cpp +++ b/projects/sgconf/main.cpp @@ -34,11 +34,9 @@ #include #include #include -#include #include #include "stg/common.h" -#include "stg/netunit.h" #include "request.h" #include "common_sg.h" #include "sg_error_codes.h" @@ -75,9 +73,6 @@ return true; time_t stgTime; -int ParseReplyGet(void * data, list * ans); -//int ParseReplySet(void * data, list * ans); - struct option long_options_get[] = { {"server", 1, 0, 's'}, //Server {"port", 1, 0, 'p'}, //Port @@ -724,7 +719,7 @@ int CheckParametersSet(REQUEST * req) return CheckParameters(req); } //----------------------------------------------------------------------------- -int mainGet(int argc, char **argv) +bool mainGet(int argc, char **argv) { int c; REQUEST req; @@ -890,7 +885,7 @@ else return ProcessGetUser(req.server, req.port, req.admLogin, req.admPasswd, req.login, req); } //----------------------------------------------------------------------------- -int mainSet(int argc, char **argv) +bool mainSet(int argc, char **argv) { string str; @@ -1087,7 +1082,10 @@ char rstr[rLen]; memset(rstr, 0, rLen); CreateRequestSet(&req, rstr); -return ProcessSetUser(req.server, req.port, req.admLogin, req.admPasswd, rstr, isMessage); +if (isMessage) + return ProcessSendMessage(req.server, req.port, req.admLogin, req.admPasswd, rstr); + +return ProcessSetUser(req.server, req.port, req.admLogin, req.admPasswd, rstr); } //----------------------------------------------------------------------------- int main(int argc, char **argv) @@ -1106,7 +1104,9 @@ if (strcmp(argv[1], "get") == 0) else if (strcmp(argv[1], "set") == 0) { //printf("set\n"); - return mainSet(argc - 1, argv + 1); + if (mainSet(argc - 1, argv + 1) ) + return 0; + return -1; } else {