From 40023ff0b61074cb65ff364945f5dc62e55b3ccd Mon Sep 17 00:00:00 2001 From: OpenGnSys Support Team Date: Wed, 29 May 2019 12:06:49 +0200 Subject: #915 add og_cmd_legacy_send() Add function to send legacy command to clients. --- sources/ogAdmServer.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sources/ogAdmServer.cpp b/sources/ogAdmServer.cpp index 204b5b3..970cf2b 100644 --- a/sources/ogAdmServer.cpp +++ b/sources/ogAdmServer.cpp @@ -3458,20 +3458,21 @@ static int og_json_parse_clients(json_t *element, struct og_msg_params *params) return 0; } -static int og_cmd_legacy_sondeo(struct og_msg_params *params) +static int og_cmd_legacy_send(struct og_msg_params *params, const char *cmd, + const char *state) { char buf[4096] = {}; int len, err = 0; TRAMA *msg; - len = snprintf(buf, sizeof(buf), "nfn=Sondeo\r"); + len = snprintf(buf, sizeof(buf), "nfn=%s\r", cmd); msg = og_msg_alloc(buf, len); if (!msg) return -1; if (!og_send_cmd((char **)params->ips_array, params->ips_array_len, - CLIENTE_APAGADO, msg)) + state, msg)) err = -1; og_msg_free(msg); @@ -3496,7 +3497,7 @@ static int og_cmd_post_clients(json_t *element, struct og_msg_params *params) break; } - return og_cmd_legacy_sondeo(params); + return og_cmd_legacy_send(params, "Sondeo", CLIENTE_APAGADO); } struct og_buffer { -- cgit v1.2.3-18-g5258