removed example code and added poke event

This commit is contained in:
2020-04-04 19:19:09 +02:00
parent 0fe777c168
commit 2d8eacef1d

View File

@@ -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 */
}