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
|
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors: Manuel Mausz (manuel@mausz.at)
* Christian Raschko (c.raschko@netcore.at)
*/
#ifndef TSPLAYER_H
#define TSPLAYER_H
#include "tsheaders.h"
//Libraries
#include <wx/wx.h>
#include <wx/dynarray.h>
//------------------------------------------------------------------------------
// Player flags
//! Channel Commander
#define TS_CHANNEL_COMMANDER 1
//! Voice Request
#define TS_VOICE_REQUEST 2
//! Doesnt Accept Whispers
#define TS_DOESNT_ACCEPT_WHISPER 4
//! Away
#define TS_AWAY 8
//! Microphone Muted
#define TS_MICROPHONE_MUTED 16
//! Sound Muted
#define TS_SOUND_MUTED 32
//! Recording
#define TS_RECORDING 64
//------------------------------------------------------------------------------
//! Player privileges
//! SA server admin
#define TS_SERVER_ADMIN 1
//! Allow Registration
#define TS_ALLOW_REGISTRATION 2
//! Registered
#define TS_REGISTERED 4
//! Internal Use
#define TS_INTERNAL_USE 8
//! Stickey
#define TS_STICKY 16
//------------------------------------------------------------------------------
//! Channel privileges
//! Channel Admin
#define TS_CHANNEL_ADMIN 1
//! Operator
#define TS_OPERATOR 2
//! Voice
#define TS_VOICE 4
//! Auto Operator
#define TS_AUTO_OPERATOR 8
//! Auto Voice
#define TS_AUTO_VOICE 16
//------------------------------------------------------------------------------
//! Anonymous login
//!
#define ANONYMOUS_YES 1
//!
#define ANONYMOUS_NO 2
//------------------------------------------------------------------------------
//! Server assingns nickname
//!
#define SAN_YES 1
//!
#define SAN_NO 0
//! TeamSpeak player.
/*! TSPlayer is used to hold all player informations.
* After calling TSClient::Connect(), you can read
* out all the player attributes. These stepps are
* necessary to connect to a server and read all information
* out.
* - Create a TSServer object,edit and link it to the TSClient object
* (For more information see TSClient)
* - Call TSClient::Connect()
* - Call TSClient::GetPlayer() or GetPlayers()
* - Now the class is filled up with the player information
*/
class TSPlayer : public wxObject
{
DECLARE_CLASS(TSPlayer)
public:
/*! Default CTor, Initializes the object.
*/
TSPlayer();
/*! Default DTor.
*/
~TSPlayer();
/*! Sets the player Id.
* \param id Player Id.
* \return Returns false if fails, check GetLastError for details.
* \sa GetLastError()
*/
bool SetId(wxUint32 const id);
/*! Sets the player channel Id.
* \param id Player channel Id.
* \return Returns false if fails, check GetLastError for details.
* \sa GetLastError()
*/
bool SetChannelId(wxUint32 const id);
/*! Sets the player flags.
* \param flags Player flags.
* \return Returns false if fails, check GetLastError for details.
* \sa GetLastError()
*/
bool SetFlags(wxUint16 const flags);
/*! Sets the player privileges.
* \param privs Player privileges.
* \return Returns false if fails, check GetLastError for details.
* \sa GetLastError()
*/
bool SetPrivileges(wxUint16 const privs);
/*! Sets the channel privileges.
* \param privs Channel privileges.
* \return Returns false if fails, check GetLastError for details.
* \sa GetLastError()
*/
bool SetChannelPrivileges(wxUint16 const privs);
/*! Sets the player nickname.
* \param str Player nickname.
* \return Returns false if fails, check GetLastError for details.
* \sa GetLastError()
*/
bool SetNickname(wxString const &str);
/*! Sets the login name.
* If called with an empty string, Anonymous login is enabled,
* which is also default. Else Anonymous login is disabled.
* \param str Login name.
* \return Returns false if fails, check GetLastError for details.
* \sa GetLastError()
*/
bool SetLoginName(wxString const &str);
/*! Sets the login password.
* \param str Login password.
* \return Returns false if fails, check GetLastError for details.
* \sa GetLastError()
*/
bool SetLoginPassword(wxString const &str);
/*! Sets the default channel.
* \param str Default channel.
* \return Returns false if fails, check GetLastError for details.
* \sa GetLastError()
*/
bool SetDefaultChannel(wxString const &str);
/*! Sets the default subchannel.
* \param str Default subchannel.
* \return Returns false if fails, check GetLastError for details.
* \sa GetLastError()
*/
bool SetDefaultSubchannel(wxString const &str);
/*! Sets the default channel password.
* \param str Default channel password.
* \return Returns false if fails, check GetLastError for details.
* \sa GetLastError()
*/
bool SetDefaultChannelPassword(wxString const &str);
/*! Should the server assing a nickname.
* - no: 0
* - yes: 1
* \param assing Server assing a nickname.
* \return Returns false if fails, check GetLastError for details.
* \sa GetLastError()
*/
bool SetServerAssingnsNickname(wxUint8 const assing);
/*! Gets the player Id.
* \return Player Id.
*/
wxUint32 GetId() const
{
return m_Id;
}
/*! Gets the player flags.
* \return Player flags.
*/
wxUint32 GetFlags() const
{
return m_Flags;
}
/*! Gets the player privileges.
* \return Player privileges.
*/
wxUint32 GetPrivileges() const
{
return m_Privileges;
}
/*! Gets the channel Id.
* \return Channel Id.
*/
wxUint32 GetChannelId() const
{
return m_ChannelId;
}
/*! Gets the channel privileges.
* \return Channel privileges.
*/
wxUint32 GetChannelPrivileges() const
{
return m_ChannelPrivileges;
}
/*! Gets the player nickname.
* \return Player nickname.
*/
wxString const &GetNickname() const
{
return m_Nickname;
}
/*! Gets the player login name.
* \return Player login name.
*/
wxString const &GetLoginName() const
{
return m_LoginName;
}
/*! Gets the player login password.
* \return Player login password.
*/
wxString const &GetLoginPassword() const
{
return m_LoginPassword;
}
/*! Gets the player default channel.
* \return Player default channel.
*/
wxString const &GetDefaultChannel() const
{
return m_DefaultChannel;
}
/*! Gets the player default sub channel.
* \return Player default sub channel.
*/
wxString const &GetDefaultSubchannel() const
{
return m_DefaultSubchannel;
}
/*! Gets the player default channel password.
* \return Player default channel password.
*/
wxString const &GetDefaultChannelPassword() const
{
return m_DefaultChannelPassword;
}
/*! Gets the player server assingns nickname status.
* \return Player ServerAssingnsNickname.
*/
wxUint8 GetServerAssingnsNickname() const
{
return m_ServerAssingnsNickname;
}
/*! Gets the player anonymous login status.
* \return Player default channel password.
*/
wxUint8 GetAnonymous() const
{
return m_Anonymous;
}
/*! Dumps object.
* \param ostrm Stream to write.
*/
void Dump(wxOutputStream &ostrm) const;
/*! Gets the LastError message, call this method
* to get more information for an error.
* \return LastError message.
*/
wxString const &GetLastError() const
{
return m_LastError;
}
private:
//Sets the LastError message.
void SetLastError(wxString const &str)
{
m_LastError = str;
}
//members
wxUint32 m_Id;
wxUint16 m_Flags;
wxUint16 m_Privileges;
wxUint32 m_ChannelId;
wxUint16 m_ChannelPrivileges;
wxString m_Nickname;
wxString m_LoginName;
wxString m_LoginPassword;
wxString m_DefaultChannel;
wxString m_DefaultSubchannel;
wxString m_DefaultChannelPassword;
wxString m_LastError;
wxUint8 m_Anonymous;
wxUint8 m_ServerAssingnsNickname;
};
#endif
|