forked from BoyC/GW2TacO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TS3Connection.h
86 lines (64 loc) · 1.5 KB
/
TS3Connection.h
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
#pragma once
#include "Bedrock/BaseLib/BaseLib.h"
class TS3Connection
{
CSocket connection;
struct CommandResponse
{
CStringArray Lines;
TS32 ErrorCode = -1;
CString Message;
};
TS32 currentHandlerID = 1;
void ProcessNotification( CString &s );
void ProcessChannelList( CString &channeldata, TS32 handler );
void ProcessClientList( CString &clientdata, TS32 handler );
CString ReadLine();
TS32 LastPingTime = 0;
public:
class TS3Client
{
public:
TS32 clientid = 0;
TS32 channelid = 0;
CString name;
TS32 talkStatus = 0;
TS32 inputmuted = 0;
TS32 outputmuted = 0;
TU64 lastTalkTime = 0;
};
class TS3Channel
{
public:
TS32 id = 0;
TS32 parentid = 0;
TS32 order = 0;
CString name;
};
class TS3Schandler
{
public:
TS32 id = 0;
TBOOL Connected = false;
TS32 myclientid = 0;
TBOOL clientIDInvalid = true;
CDictionaryEnumerable<TS32, TS3Channel> Channels;
CDictionaryEnumerable<TS32, TS3Client> Clients;
CString name;
};
CDictionary<TS32, TS3Schandler> handlers;
TS3Connection();
virtual ~TS3Connection();
TBOOL TryConnect();
void TryValidateClientID();
void Tick();
void InitConnection();
CommandResponse SendCommand( CString &message );
CommandResponse SendCommand( TCHAR *message );
void ProcessNotifications();
void WaitForResponse();
TBOOL IsConnected();
CString unescape( CString string );
bool authenticated = true;
};
extern TS3Connection teamSpeakConnection;