reuse of http handler
This commit is contained in:
13
src/plugin.c
13
src/plugin.c
@@ -143,6 +143,7 @@ int ts3plugin_init() {
|
||||
printf("PLUGIN: App path: %s\nResources path: %s\nConfig path: %s\nPlugin path: %s\n", appPath, resourcesPath, configPath, pluginPath);
|
||||
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
curl = curl_easy_init();
|
||||
|
||||
return 0; /* 0 = success, 1 = failure, -2 = failure but client will not show a "failed to load" warning */
|
||||
/* -2 is a very special case and should only be used if a plugin displays a dialog (e.g. overlay) asking the user to disable
|
||||
@@ -155,6 +156,7 @@ void ts3plugin_shutdown() {
|
||||
/* Your plugin cleanup code here */
|
||||
printf("PLUGIN: shutdown\n");
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
/*
|
||||
@@ -853,7 +855,7 @@ void ts3plugin_onTalkStatusChangeEvent(uint64 serverConnectionHandlerID, int sta
|
||||
char name[512];
|
||||
if(ts3Functions.getClientDisplayName(serverConnectionHandlerID, clientID, name, 512) == ERROR_ok) {
|
||||
if (clientID == myClientID) {
|
||||
curl = curl_easy_init();
|
||||
//curl = curl_easy_init();
|
||||
if (curl) {
|
||||
if (status == STATUS_TALKING) {
|
||||
curl_easy_setopt(curl, CURLOPT_URL, LED_URL_SAVE);
|
||||
@@ -867,7 +869,7 @@ void ts3plugin_onTalkStatusChangeEvent(uint64 serverConnectionHandlerID, int sta
|
||||
res = curl_easy_perform(curl);
|
||||
}
|
||||
}
|
||||
curl_easy_cleanup(curl);
|
||||
//curl_easy_cleanup(curl);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -937,8 +939,9 @@ 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();
|
||||
//curl = curl_easy_init();
|
||||
|
||||
if (curl) {
|
||||
curl_easy_setopt(curl, CURLOPT_URL, LED_URL_POKE);
|
||||
res = curl_easy_perform(curl);
|
||||
Sleep(500);
|
||||
@@ -951,8 +954,8 @@ int ts3plugin_onClientPokeEvent(uint64 serverConnectionHandlerID, anyID fromClie
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_URL, LED_URL_OFF);
|
||||
res = curl_easy_perform(curl);
|
||||
curl_easy_cleanup(curl);
|
||||
|
||||
//curl_easy_cleanup(curl);
|
||||
}
|
||||
return 0; /* 0 = handle normally, 1 = client will ignore the poke */
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user