added poke event
This commit is contained in:
@@ -13,7 +13,7 @@ LEDHandler::LEDHandler(QUdpSocket* sock, TS3Functions ts3Functions)
|
||||
void LEDHandler::talkingStarted()
|
||||
{
|
||||
printf("started\n");
|
||||
sendColor(0, 0, 255, 255, 255);
|
||||
sendColor(125, 125, 255, 125, 255);
|
||||
}
|
||||
|
||||
void LEDHandler::talkingEnded()
|
||||
@@ -22,17 +22,31 @@ void LEDHandler::talkingEnded()
|
||||
sendColor(0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
void LEDHandler::poked()
|
||||
{
|
||||
// start timer
|
||||
sendColor(0, 0, 0, 255, 5);
|
||||
}
|
||||
|
||||
void LEDHandler::sendColor(int R, int G, int B, int W, int t)
|
||||
{
|
||||
QByteArray msg;
|
||||
msg[0] = 3; // protocol: DRGBW
|
||||
msg[1] = t; // timeout
|
||||
msg[2] = R; // R
|
||||
msg[2] = B; // G
|
||||
msg[2] = G; // B
|
||||
msg[2] = W; // W
|
||||
msg.append(2);
|
||||
msg.append(t);
|
||||
msg.append(R);
|
||||
msg.append(G);
|
||||
msg.append(B);
|
||||
msg.append(W);
|
||||
|
||||
for (int i = 0; i < msg.size(); i++)
|
||||
printf("%1", msg[i]);
|
||||
printf("\n");
|
||||
|
||||
if (mSock->isValid() && mSock->isOpen())
|
||||
mSock->write(msg);
|
||||
else
|
||||
printf("SOCKET ERROR: %1", mSock->errorString().toStdString().c_str());
|
||||
|
||||
}
|
||||
|
||||
void LEDHandler::connected()
|
||||
|
||||
@@ -15,6 +15,7 @@ public:
|
||||
|
||||
void talkingEnded();
|
||||
void talkingStarted();
|
||||
void poked();
|
||||
|
||||
public slots:
|
||||
void connected();
|
||||
|
||||
@@ -56,7 +56,7 @@ const char* ts3plugin_name() {
|
||||
|
||||
/* Plugin version */
|
||||
const char* ts3plugin_version() {
|
||||
return "0.4";
|
||||
return "0.4b";
|
||||
}
|
||||
|
||||
/* Plugin API version. Must be the same as the clients API major version, else the plugin fails to load. */
|
||||
@@ -881,8 +881,6 @@ void ts3plugin_onClientBanFromServerEvent(uint64 serverConnectionHandlerID, anyI
|
||||
}
|
||||
|
||||
int ts3plugin_onClientPokeEvent(uint64 serverConnectionHandlerID, anyID fromClientID, const char* pokerName, const char* pokerUniqueIdentity, const char* message, int ffIgnored) {
|
||||
anyID myID;
|
||||
|
||||
printf("PLUGIN onClientPokeEvent: %llu %d %s %s %d\n", (long long unsigned int)serverConnectionHandlerID, fromClientID, pokerName, message, ffIgnored);
|
||||
|
||||
/* Check if the Friend/Foe manager has already blocked this poke */
|
||||
@@ -890,20 +888,7 @@ int ts3plugin_onClientPokeEvent(uint64 serverConnectionHandlerID, anyID fromClie
|
||||
return 0; /* Client will block anyways, doesn't matter what we return */
|
||||
}
|
||||
|
||||
// if (curl) {
|
||||
// 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);
|
||||
// }
|
||||
mLedHandler->poked();
|
||||
return 0; /* 0 = handle normally, 1 = client will ignore the poke */
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user