This repository was archived by the owner on Jun 20, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathgkey_functions.cpp
More file actions
673 lines (555 loc) · 20.6 KB
/
gkey_functions.cpp
File metadata and controls
673 lines (555 loc) · 20.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
/*
* TeamSpeak 3 G-key plugin
* Author: Jules Blok (jules@aerix.nl)
*
* Copyright (c) 2010-2012 Jules Blok
* Copyright (c) 2008-2012 TeamSpeak Systems GmbH
*/
#ifdef _WIN32
#pragma warning(disable : 4996) /* Disable unsafe localtime warning */
#endif
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "gkey_functions.h"
#include "public_errors.h"
#include "public_errors_rare.h"
#include "public_definitions.h"
#include "public_rare_definitions.h"
#include "ts3_functions.h"
#include "plugin.h"
#include "channel.h"
#include <vector>
#include <map>
#include <string>
#include <sstream>
bool GKeyFunctions::CheckAndLog(unsigned int returnCode, char* message)
{
if(returnCode != ERROR_ok)
{
char* errorMsg;
if(ts3Functions.getErrorMessage(returnCode, &errorMsg) == ERROR_ok)
{
if(message != NULL) ts3Functions.logMessage(message, LogLevel_WARNING, "G-Key Plugin", 0);
ts3Functions.logMessage(errorMsg, LogLevel_WARNING, "G-Key Plugin", 0);
ts3Functions.freeMemory(errorMsg);
return true;
}
}
return false;
}
GKeyFunctions::GKeyFunctions(void) :
pttActive(false),
vadActive(false),
inputActive(false),
whisperActive(false),
replyActive(false)
{
}
GKeyFunctions::~GKeyFunctions(void)
{
}
void GKeyFunctions::ErrorMessage(uint64 scHandlerID, char* message)
{
// If an info icon has been found create a styled message
if(!infoIcon.empty())
{
// Get the time
time_t timer;
char timeStr[11];
time(&timer);
strftime(timeStr, 11, "<%X>", localtime(&timer));
// Format and print the error message, use a transparent underscore because a double space will be collapsed
std::stringstream ss;
ss << "[img]" << infoIcon << "[/img][color=red]" << timeStr << "[color=transparent]_[/color]" << message << "[/color]";
ts3Functions.printMessageToCurrentTab(ss.str().c_str());
}
else
{
// Format a simplified styled error message
std::stringstream ss;
ss << "[color=red]" << message << "[/color]";
ts3Functions.printMessageToCurrentTab(ss.str().c_str());
}
// If an error sound has been found play it
if(!errorSound.empty()) CheckAndLog(ts3Functions.playWaveFile(scHandlerID, errorSound.c_str()), "Error playing error sound");
}
uint64 GKeyFunctions::GetActiveServerConnectionHandlerID()
{
uint64* servers;
uint64* server;
uint64 handle = NULL;
if(CheckAndLog(ts3Functions.getServerConnectionHandlerList(&servers), "Error retrieving list of servers"))
return NULL;
// Find the first server that matches the criteria
for(server = servers; *server != (uint64)NULL && handle == NULL; server++)
{
int result;
if(!CheckAndLog(ts3Functions.getClientSelfVariableAsInt(*server, CLIENT_INPUT_HARDWARE, &result), "Error retrieving client variable"))
{
if(result) handle = *server;
}
}
ts3Functions.freeMemory(servers);
return handle;
}
uint64 GKeyFunctions::GetServerHandleByVariable(char* value, size_t flag)
{
char* variable;
uint64* servers;
uint64* server;
uint64 result;
if(CheckAndLog(ts3Functions.getServerConnectionHandlerList(&servers), "Error retrieving list of servers"))
return (uint64)NULL;
// Find the first server that matches the criteria
for(server = servers, result = (uint64)NULL; *server != (uint64)NULL && result == (uint64)NULL; server++)
{
if(!CheckAndLog(ts3Functions.getServerVariableAsString(*server, flag, &variable), "Error retrieving server variable"))
{
// If the variable matches the value set the result, this will end the loop
if(!strcmp(value, variable)) result = *server;
ts3Functions.freeMemory(variable);
}
}
ts3Functions.freeMemory(servers);
return result;
}
uint64 GKeyFunctions::GetChannelIDByVariable(uint64 scHandlerID, char* value, size_t flag)
{
char* variable;
uint64* channels;
uint64* channel;
uint64 result;
if(CheckAndLog(ts3Functions.getChannelList(scHandlerID, &channels), "Error retrieving list of channels"))
return (uint64)NULL;
// Find the first channel that matches the criteria
for(channel = channels, result = (uint64)NULL; *channel != (uint64)NULL && result == NULL; channel++)
{
if(!CheckAndLog(ts3Functions.getChannelVariableAsString(scHandlerID, *channel, flag, &variable), "Error retrieving channel variable"))
{
// If the variable matches the value set the result, this will end the loop
if(!strcmp(value, variable)) result = *channel;
ts3Functions.freeMemory(variable);
}
}
ts3Functions.freeMemory(channels);
return result;
}
anyID GKeyFunctions::GetClientIDByVariable(uint64 scHandlerID, char* value, size_t flag)
{
char* variable;
anyID* clients;
anyID* client;
anyID result;
if(CheckAndLog(ts3Functions.getClientList(scHandlerID, &clients), "Error retrieving list of clients"))
return (anyID)NULL;
// Find the first client that matches the criteria
for(client = clients, result = (anyID)NULL; *client != (uint64)NULL && result == (anyID)NULL; client++)
{
if(!CheckAndLog(ts3Functions.getClientVariableAsString(scHandlerID, *client, flag, &variable), "Error retrieving client variable"))
{
// If the variable matches the value set the result, this will end the loop
if(!strcmp(value, variable)) result = *client;
ts3Functions.freeMemory(variable);
}
}
ts3Functions.freeMemory(clients);
return result;
}
bool GKeyFunctions::SetPushToTalk(uint64 scHandlerID, bool shouldTalk)
{
// If PTT is inactive, store the current settings
if(!pttActive)
{
// Get the current VAD setting
char* vad;
if(CheckAndLog(ts3Functions.getPreProcessorConfigValue(scHandlerID, "vad", &vad), "Error retrieving vad setting"))
return false;
vadActive = !strcmp(vad, "true");
ts3Functions.freeMemory(vad);
// Get the current input setting, this will indicate whether VAD is being used in combination with PTT
int input;
if(CheckAndLog(ts3Functions.getClientSelfVariableAsInt(scHandlerID, CLIENT_INPUT_DEACTIVATED, &input), "Error retrieving input setting"))
return false;
inputActive = !input; // We want to know when it is active, not when it is inactive
}
// If VAD is active and the input is active, disable VAD, restore VAD setting afterwards
if(CheckAndLog(ts3Functions.setPreProcessorConfigValue(scHandlerID, "vad",
(shouldTalk && (vadActive && inputActive)) ? "false" : (vadActive)?"true":"false"), "Error toggling vad"))
return false;
// Activate the input, restore the input setting afterwards
if(CheckAndLog(ts3Functions.setClientSelfVariableAsInt(scHandlerID, CLIENT_INPUT_DEACTIVATED,
(shouldTalk || inputActive) ? INPUT_ACTIVE : INPUT_DEACTIVATED), "Error toggling input"))
return false;
// Update the client
ts3Functions.flushClientSelfUpdates(scHandlerID, NULL);
// Commit the change
pttActive = shouldTalk;
return true;
}
bool GKeyFunctions::SetVoiceActivation(uint64 scHandlerID, bool shouldActivate)
{
// Activate Voice Activity Detection
if(CheckAndLog(ts3Functions.setPreProcessorConfigValue(scHandlerID, "vad", (shouldActivate && !pttActive)?"true":"false"), "Error toggling vad"))
return false;
// Activate the input, restore the input setting afterwards
if(CheckAndLog(ts3Functions.setClientSelfVariableAsInt(scHandlerID, CLIENT_INPUT_DEACTIVATED,
(shouldActivate) ? INPUT_ACTIVE : INPUT_DEACTIVATED), "Error toggling input"))
return false;
// Update the client
ts3Functions.flushClientSelfUpdates(scHandlerID, NULL);
// Commit the change
vadActive = shouldActivate;
inputActive = shouldActivate;
return true;
}
bool GKeyFunctions::SetContinuousTransmission(uint64 scHandlerID, bool shouldActivate)
{
// Activate the input, restore the input setting afterwards
if(CheckAndLog(ts3Functions.setClientSelfVariableAsInt(scHandlerID, CLIENT_INPUT_DEACTIVATED,
(shouldActivate || pttActive) ? INPUT_ACTIVE : INPUT_DEACTIVATED), "Error toggling input"))
return false;
// Update the client
ts3Functions.flushClientSelfUpdates(scHandlerID, NULL);
// Commit the change
inputActive = shouldActivate;
return true;
}
bool GKeyFunctions::SetInputMute(uint64 scHandlerID, bool shouldMute)
{
if(CheckAndLog(ts3Functions.setClientSelfVariableAsInt(scHandlerID, CLIENT_INPUT_MUTED,
shouldMute ? INPUT_DEACTIVATED : INPUT_ACTIVE), "Error toggling input mute"))
return false;
ts3Functions.flushClientSelfUpdates(scHandlerID, NULL);
return true;
}
bool GKeyFunctions::SetOutputMute(uint64 scHandlerID, bool shouldMute)
{
if(CheckAndLog(ts3Functions.setClientSelfVariableAsInt(scHandlerID, CLIENT_OUTPUT_MUTED,
shouldMute ? INPUT_DEACTIVATED : INPUT_ACTIVE), "Error toggling output mute"))
return false;
ts3Functions.flushClientSelfUpdates(scHandlerID, NULL);
return true;
}
bool GKeyFunctions::SetGlobalAway(bool isAway, char* msg)
{
uint64* servers;
uint64 handle;
int i;
if(CheckAndLog(ts3Functions.getServerConnectionHandlerList(&servers), "Error retrieving list of servers"))
return false;
handle = servers[0];
for(i = 1; handle != (uint64)NULL; i++)
{
SetAway(handle, isAway, msg);
handle = servers[i];
}
ts3Functions.freeMemory(servers);
return true;
}
bool GKeyFunctions::SetAway(uint64 scHandlerID, bool isAway, char* msg)
{
if(CheckAndLog(ts3Functions.setClientSelfVariableAsInt(scHandlerID, CLIENT_AWAY,
isAway ? AWAY_ZZZ : AWAY_NONE), "Error setting away status"))
return false;
if(CheckAndLog(ts3Functions.setClientSelfVariableAsString(scHandlerID, CLIENT_AWAY_MESSAGE, isAway && msg != NULL ? msg : ""), "Error setting away message"))
return false;
return CheckAndLog(ts3Functions.flushClientSelfUpdates(scHandlerID, NULL), "Error flushing after setting away status");
}
bool GKeyFunctions::JoinChannel(uint64 scHandlerID, uint64 channel)
{
anyID self;
if(CheckAndLog(ts3Functions.getClientID(scHandlerID, &self), "Error getting own client id"))
return false;
if(CheckAndLog(ts3Functions.requestClientMove(scHandlerID, self, channel, "", NULL), "Error joining channel"))
return false;
return true;
}
bool GKeyFunctions::SetWhisperList(uint64 scHandlerID, bool shouldWhisper)
{
WhisperIterator list;
if(shouldWhisper)
{
list = whisperLists.find(scHandlerID);
if(list == whisperLists.end()) shouldWhisper = false;
else
{
// Add the NULL-terminator
list->second.clients.push_back((anyID)NULL);
list->second.channels.push_back((uint64)NULL);
}
}
/*
* For efficiency purposes I will violate the vector abstraction and give a direct pointer to its internal C array
*/
if(CheckAndLog(ts3Functions.requestClientSetWhisperList(scHandlerID, (anyID)NULL, shouldWhisper?&list->second.channels[0]:(uint64*)NULL, shouldWhisper?&list->second.clients[0]:(anyID*)NULL, NULL), "Error setting whisper list"))
return false;
if(shouldWhisper)
{
// Remove the NULL-terminator
list->second.clients.pop_back();
list->second.channels.pop_back();
}
ts3Functions.flushClientSelfUpdates(scHandlerID, NULL);
whisperActive = shouldWhisper;
return true;
}
void GKeyFunctions::WhisperListClear(uint64 scHandlerID)
{
SetWhisperList(scHandlerID, false);
whisperLists.erase(scHandlerID);
}
void GKeyFunctions::WhisperAddClient(uint64 scHandlerID, anyID client)
{
// Find the whisperlist, create it if it doesn't exist
std::pair<WhisperIterator,bool> result = whisperLists.insert(std::pair<uint64,WhisperList>(scHandlerID, WhisperList()));
WhisperIterator list = result.first;
/*
* Do not add if duplicate. I could use a set, but that would be inefficient as
* ordering is unimportant and it would require me to convert to C arrays when
* activating the whisper list.
*/
for(std::vector<anyID>::iterator it=list->second.clients.begin(); it!=list->second.clients.end(); it++)
if(*it == client) return;
list->second.clients.push_back(client);
if(whisperActive) SetWhisperList(scHandlerID, true);
}
void GKeyFunctions::WhisperAddChannel(uint64 scHandlerID, uint64 channel)
{
// Find the whisperlist, create it if it doesn't exist
std::pair<WhisperIterator,bool> result = whisperLists.insert(std::pair<uint64,WhisperList>(scHandlerID, WhisperList()));
WhisperIterator list = result.first;
/*
* Do not add if duplicate. I could use a set, but that would be inefficient as
* ordering is unimportant and it would require me to convert to C arrays when
* activating the whisper list.
*/
for(std::vector<uint64>::iterator it=list->second.channels.begin(); it!=list->second.channels.end(); it++)
if(*it == channel) return;
list->second.channels.push_back(channel);
if(whisperActive) SetWhisperList(scHandlerID, true);
}
bool GKeyFunctions::SetReplyList(uint64 scHandlerID, bool shouldReply)
{
ReplyIterator list;
if(shouldReply)
{
list = replyLists.find(scHandlerID);
if(list == replyLists.end()) shouldReply = false;
else
{
// Add the NULL-terminator
list->second.push_back((anyID)NULL);
}
}
/*
* For efficiency I will violate the vector abstraction and give a direct pointer to its internal C array
*/
if(CheckAndLog(ts3Functions.requestClientSetWhisperList(scHandlerID, (anyID)NULL, NULL, shouldReply?&list->second[0]:(anyID*)NULL, NULL), "Error setting reply list"))
return false;
if(shouldReply)
{
// Remove the NULL-terminator
list->second.pop_back();
}
ts3Functions.flushClientSelfUpdates(scHandlerID, NULL);
replyActive = shouldReply;
if(!shouldReply) return SetWhisperList(scHandlerID, true);
return true;
}
void GKeyFunctions::ReplyListClear(uint64 scHandlerID)
{
SetReplyList(scHandlerID, false);
replyLists.erase(scHandlerID);
}
void GKeyFunctions::ReplyAddClient(uint64 scHandlerID, anyID client)
{
// Find the whisperlist, create it if it doesn't exist
std::pair<ReplyIterator,bool> result = replyLists.insert(std::pair<uint64,std::vector<anyID>>(scHandlerID, std::vector<anyID>()));
ReplyIterator list = result.first;
/*
* Do not add if duplicate. I could use a set, but that would be inefficient as
* ordering is unimportant and it would require me to convert to C arrays when
* activating the whisper list.
*/
for(std::vector<anyID>::iterator it=list->second.begin(); it!=list->second.end(); it++)
if(*it == client) return;
list->second.push_back(client);
if(replyActive) SetReplyList(scHandlerID, true);
}
bool GKeyFunctions::SetActiveServer(uint64 handle)
{
return CheckAndLog(ts3Functions.activateCaptureDevice(handle), "Error activating server");
}
bool GKeyFunctions::MuteClient(uint64 scHandlerID, anyID client)
{
if(CheckAndLog(ts3Functions.requestMuteClients(scHandlerID, &client, NULL), "Error muting client"))
return false;
return CheckAndLog(ts3Functions.requestClientVariables(scHandlerID, client, NULL), "Error flushing after muting client");
}
bool GKeyFunctions::UnmuteClient(uint64 scHandlerID, anyID client)
{
if(CheckAndLog(ts3Functions.requestUnmuteClients(scHandlerID, &client, NULL), "Error unmuting client"))
return false;
return CheckAndLog(ts3Functions.requestClientVariables(scHandlerID, client, NULL), "Error flushing after unmuting client");
}
bool GKeyFunctions::ServerKickClient(uint64 scHandlerID, anyID client)
{
return CheckAndLog(ts3Functions.requestClientKickFromServer(scHandlerID, client, "", NULL), "Error kicking client from server");
}
bool GKeyFunctions::ChannelKickClient(uint64 scHandlerID, anyID client)
{
return CheckAndLog(ts3Functions.requestClientKickFromChannel(scHandlerID, client, "", NULL), "Error kicking client from channel");
}
bool GKeyFunctions::SetMasterVolume(uint64 scHandlerID, float value)
{
// Clamp value
char str[6];
if(value < -40.0) value = -40.0;
if(value > 20.0) value = 20.0;
snprintf(str, 6, "%.1f", value);
return CheckAndLog(ts3Functions.setPlaybackConfigValue(scHandlerID, "volume_modifier", str), "Error setting master volume");
}
bool GKeyFunctions::JoinChannelRelative(uint64 scHandlerID, bool next)
{
anyID self;
uint64 ownId;
Channel root;
// Get channel hierarchy
if(Channel::GetChannelHierarchy(scHandlerID, &root) != 0) return false;
// Get own channel
if(CheckAndLog(ts3Functions.getClientID(scHandlerID, &self), "Error getting own client id"))
return false;
if(CheckAndLog(ts3Functions.getChannelOfClient(scHandlerID, self, &ownId), "Error getting own channel id"))
return false;
// Find own channel in hierarchy
Channel* channel = root.find(ownId);
// Find a joinable channel
bool found = false;
while(channel != NULL && !found)
{
if(next)
{
// If the channel has subchannels, go deeper
if(!channel->subchannels.empty()) channel = channel->first();
else channel = channel->next();
}
else channel = channel->prev();
// If this channel is passworded, join the next
int pswd;
CheckAndLog(ts3Functions.getChannelVariableAsInt(scHandlerID, channel->id, CHANNEL_FLAG_PASSWORD, &pswd), "Error getting channel info");
if(!pswd) found = true;
}
if(!found) return false;
// If a joinable channel was found, attempt to join it
return CheckAndLog(ts3Functions.requestClientMove(scHandlerID, self, channel->id, "", NULL), "Error joining channel");
}
bool GKeyFunctions::SetActiveServerRelative(uint64 scHandlerID, bool next)
{
uint64* servers;
uint64* server;
int result;
// Get server list
if(CheckAndLog(ts3Functions.getServerConnectionHandlerList(&servers), "Error retrieving list of servers"))
return false;
// Find active server in the list
for(server = servers; *server != (uint64)NULL && *server!=scHandlerID; server++);
// Find the server in the direction given
if(next)
{
if(*(server+1) != NULL) server++;
else server = servers; // Wrap around to first server
}
else
{
if(server != servers) server--;
else
{
for(server = servers; *server != (uint64)NULL; server++);
server--;
}
}
// Check if already active
bool ret = !CheckAndLog(ts3Functions.getClientSelfVariableAsInt(*server, CLIENT_INPUT_HARDWARE, &result), "Error retrieving client variable");
if(!result) SetActiveServer(*server);
ts3Functions.freeMemory(servers);
return ret;
}
uint64 GKeyFunctions::GetChannelIDFromPath(uint64 scHandlerID, char* path)
{
uint64 parent;
// Split the string, following the hierachy
char* str = path;
char* lastStr = path;
std::vector<char*> hierachy;
while(str != NULL)
{
lastStr = str;
str = strchr(lastStr, '/');
if(str!=NULL)
{
*str = NULL;
str++;
}
hierachy.push_back(lastStr);
}
hierachy.push_back(""); // Add the terminator
/*
* For efficiency I will violate the vector abstraction and give a direct pointer to its internal C array
*/
if(CheckAndLog(ts3Functions.getChannelIDFromChannelNames(scHandlerID, &hierachy[0], &parent), "Error getting parent channel ID"))
return false;
return parent;
}
bool GKeyFunctions::ConnectToBookmark(char* label, PluginConnectTab connectTab, uint64* scHandlerID)
{
// Get the bookmark list
PluginBookmarkList* bookmarks;
if(CheckAndLog(ts3Functions.getBookmarkList(&bookmarks), "Error getting bookmark list"))
return false;
// Find the bookmark
bool ret = true;
for(int i=0; i<bookmarks->itemcount; i++)
{
PluginBookmarkItem item = bookmarks->items[i];
// Seems pretty useless to try to connect to a folder, skip it
if(!item.isFolder)
{
// If the name matches the label we're looking for
if(!strcmp(item.name, label))
{
// Connect to the bookmark
ret = !CheckAndLog(ts3Functions.guiConnectBookmark(connectTab, item.uuid, scHandlerID), "Failed to connect to bookmark");
}
}
}
ts3Functions.freeMemory(bookmarks);
return ret;
}
std::string GKeyFunctions::GetDefaultPlaybackProfile()
{
char** profiles;
int defaultProfile;
if(CheckAndLog(ts3Functions.getProfileList(PLUGIN_GUI_SOUND_PLAYBACK, &defaultProfile, &profiles), "Error retrieving playback profiles"))
return std::string();
std::string profile = profiles[defaultProfile];
ts3Functions.freeMemory(profiles);
return profile;
}
std::string GKeyFunctions::GetDefaultCaptureProfile()
{
char** profiles;
int defaultProfile;
if(CheckAndLog(ts3Functions.getProfileList(PLUGIN_GUI_SOUND_CAPTURE, &defaultProfile, &profiles), "Error retrieving capture profiles"))
return std::string();
std::string profile = profiles[defaultProfile];
ts3Functions.freeMemory(profiles);
return profile;
}
int GKeyFunctions::GetConnectionStatus(uint64 scHandlerID)
{
int status;
if(CheckAndLog(ts3Functions.getConnectionStatus(scHandlerID, &status), "Error retrieving connection status"))
return STATUS_DISCONNECTED; // Assume we're not connected
return status;
}