removed example code and added poke event
This commit is contained in:
25
src/plugin.c
25
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_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_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_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;
|
anyID myClientID = 0;
|
||||||
|
|
||||||
|
|
||||||
@@ -938,17 +939,21 @@ int ts3plugin_onClientPokeEvent(uint64 serverConnectionHandlerID, anyID fromClie
|
|||||||
if(ffIgnored) {
|
if(ffIgnored) {
|
||||||
return 0; /* Client will block anyways, doesn't matter what we return */
|
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 */
|
curl_easy_setopt(curl, CURLOPT_URL, LED_URL_POKE);
|
||||||
if(ts3Functions.getClientID(serverConnectionHandlerID, &myID) != ERROR_ok) { /* Get own client ID */
|
res = curl_easy_perform(curl);
|
||||||
ts3Functions.logMessage("Error querying own client id", LogLevel_ERROR, "Plugin", serverConnectionHandlerID);
|
Sleep(500);
|
||||||
return 0;
|
res = curl_easy_perform(curl);
|
||||||
}
|
Sleep(500);
|
||||||
if(fromClientID != myID) { /* Don't reply when source is own client */
|
res = curl_easy_perform(curl);
|
||||||
if(ts3Functions.requestSendPrivateTextMsg(serverConnectionHandlerID, "Received your poke!", fromClientID, NULL) != ERROR_ok) {
|
Sleep(500);
|
||||||
ts3Functions.logMessage("Error requesting send text message", LogLevel_ERROR, "Plugin", serverConnectionHandlerID);
|
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 */
|
return 0; /* 0 = handle normally, 1 = client will ignore the poke */
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user