X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/23d052c42f43430e4ff776a80b9643dbc7d1289d..97f1f905311bcb76c3b500e3e49c1b9f49dff491:/projects/sgconf/main.cpp diff --git a/projects/sgconf/main.cpp b/projects/sgconf/main.cpp index 507abaa5..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; @@ -885,12 +880,12 @@ if (missedOptionArg || !CheckParametersGet(&req)) } if (req.authBy) - return ProcessAuthBy(req.server, req.port, req.admLogin, req.admPasswd, req.login, req); + return ProcessAuthBy(req.server, req.port, req.admLogin, req.admPasswd, req.login); 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, NULL, 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 {