From 2d8eacef1d0aa263fb99ea5cfa4e74e13552b4f1 Mon Sep 17 00:00:00 2001 From: rogo Date: Sat, 4 Apr 2020 19:19:09 +0200 Subject: [PATCH] removed example code and added poke event --- src/plugin.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/plugin.c b/src/plugin.c index d704ba0..0c0d5bb 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -54,6 +54,7 @@ CURLcode res; const char* LED_URL_SAVE = "http://10.0.0.222/win&PS=16&NN"; const char* LED_URL_ON = "http://10.0.0.222/win&T=1&FX=0&R=0&B=255&G=0&W=0&A=255&NN"; const char* LED_URL_OFF= "http://10.0.0.222/win&PL=16&NN"; +const char* LED_URL_POKE = "http://10.0.0.222/win&PL=15&NN"; anyID myClientID = 0; @@ -938,17 +939,21 @@ int ts3plugin_onClientPokeEvent(uint64 serverConnectionHandlerID, anyID fromClie if(ffIgnored) { return 0; /* Client will block anyways, doesn't matter what we return */ } + curl = curl_easy_init(); - /* Example code: Send text message back to poking client */ - if(ts3Functions.getClientID(serverConnectionHandlerID, &myID) != ERROR_ok) { /* Get own client ID */ - ts3Functions.logMessage("Error querying own client id", LogLevel_ERROR, "Plugin", serverConnectionHandlerID); - return 0; - } - if(fromClientID != myID) { /* Don't reply when source is own client */ - if(ts3Functions.requestSendPrivateTextMsg(serverConnectionHandlerID, "Received your poke!", fromClientID, NULL) != ERROR_ok) { - ts3Functions.logMessage("Error requesting send text message", LogLevel_ERROR, "Plugin", serverConnectionHandlerID); - } - } + curl_easy_setopt(curl, CURLOPT_URL, LED_URL_POKE); + res = curl_easy_perform(curl); + Sleep(500); + res = curl_easy_perform(curl); + Sleep(500); + res = curl_easy_perform(curl); + Sleep(500); + res = curl_easy_perform(curl); + Sleep(500); + + curl_easy_setopt(curl, CURLOPT_URL, LED_URL_OFF); + res = curl_easy_perform(curl); + curl_easy_cleanup(curl); return 0; /* 0 = handle normally, 1 = client will ignore the poke */ }