summaryrefslogtreecommitdiffstats
path: root/tsplayer.h
diff options
context:
space:
mode:
Diffstat (limited to 'tsplayer.h')
-rw-r--r--tsplayer.h339
1 files changed, 339 insertions, 0 deletions
diff --git a/tsplayer.h b/tsplayer.h
new file mode 100644
index 0000000..84daa9b
--- /dev/null
+++ b/tsplayer.h
@@ -0,0 +1,339 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; version 2 of the License.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
14 *
15 * Authors: Manuel Mausz (manuel@mausz.at)
16 * Christian Raschko (c.raschko@netcore.at)
17 */
18
19#ifndef TSPLAYER_H
20#define TSPLAYER_H
21
22#include "tsheaders.h"
23
24//Libraries
25#include <wx/wx.h>
26#include <wx/dynarray.h>
27
28//------------------------------------------------------------------------------
29// Player flags
30//! Channel Commander
31#define TS_CHANNEL_COMMANDER 1
32//! Voice Request
33#define TS_VOICE_REQUEST 2
34//! Doesnt Accept Whispers
35#define TS_DOESNT_ACCEPT_WHISPER 4
36//! Away
37#define TS_AWAY 8
38//! Microphone Muted
39#define TS_MICROPHONE_MUTED 16
40//! Sound Muted
41#define TS_SOUND_MUTED 32
42//! Recording
43#define TS_RECORDING 64
44
45//------------------------------------------------------------------------------
46//! Player privileges
47//! SA server admin
48#define TS_SERVER_ADMIN 1
49//! Allow Registration
50#define TS_ALLOW_REGISTRATION 2
51//! Registered
52#define TS_REGISTERED 4
53//! Internal Use
54#define TS_INTERNAL_USE 8
55//! Stickey
56#define TS_STICKY 16
57
58//------------------------------------------------------------------------------
59//! Channel privileges
60//! Channel Admin
61#define TS_CHANNEL_ADMIN 1
62//! Operator
63#define TS_OPERATOR 2
64//! Voice
65#define TS_VOICE 4
66//! Auto Operator
67#define TS_AUTO_OPERATOR 8
68//! Auto Voice
69#define TS_AUTO_VOICE 16
70
71//------------------------------------------------------------------------------
72//! Anonymous login
73//!
74#define ANONYMOUS_YES 1
75//!
76#define ANONYMOUS_NO 2
77
78//------------------------------------------------------------------------------
79//! Server assingns nickname
80//!
81#define SAN_YES 1
82//!
83#define SAN_NO 0
84
85//! TeamSpeak player.
86/*! TSPlayer is used to hold all player informations.
87 * After calling TSClient::Connect(), you can read
88 * out all the player attributes. These stepps are
89 * necessary to connect to a server and read all information
90 * out.
91 * - Create a TSServer object,edit and link it to the TSClient object
92 * (For more information see TSClient)
93 * - Call TSClient::Connect()
94 * - Call TSClient::GetPlayer() or GetPlayers()
95 * - Now the class is filled up with the player information
96 */
97class TSPlayer : public wxObject
98{
99 DECLARE_CLASS(TSPlayer)
100 public:
101 /*! Default CTor, Initializes the object.
102 */
103 TSPlayer();
104
105 /*! Default DTor.
106 */
107 ~TSPlayer();
108
109 /*! Sets the player Id.
110 * \param id Player Id.
111 * \return Returns false if fails, check GetLastError for details.
112 * \sa GetLastError()
113 */
114 bool SetId(wxUint32 const id);
115
116 /*! Sets the player channel Id.
117 * \param id Player channel Id.
118 * \return Returns false if fails, check GetLastError for details.
119 * \sa GetLastError()
120 */
121 bool SetChannelId(wxUint32 const id);
122
123 /*! Sets the player flags.
124 * \param flags Player flags.
125 * \return Returns false if fails, check GetLastError for details.
126 * \sa GetLastError()
127 */
128 bool SetFlags(wxUint16 const flags);
129
130 /*! Sets the player privileges.
131 * \param privs Player privileges.
132 * \return Returns false if fails, check GetLastError for details.
133 * \sa GetLastError()
134 */
135 bool SetPrivileges(wxUint16 const privs);
136
137 /*! Sets the channel privileges.
138 * \param privs Channel privileges.
139 * \return Returns false if fails, check GetLastError for details.
140 * \sa GetLastError()
141 */
142 bool SetChannelPrivileges(wxUint16 const privs);
143
144 /*! Sets the player nickname.
145 * \param str Player nickname.
146 * \return Returns false if fails, check GetLastError for details.
147 * \sa GetLastError()
148 */
149 bool SetNickname(wxString const &str);
150
151 /*! Sets the login name.
152 * If called with an empty string, Anonymous login is enabled,
153 * which is also default. Else Anonymous login is disabled.
154 * \param str Login name.
155 * \return Returns false if fails, check GetLastError for details.
156 * \sa GetLastError()
157 */
158 bool SetLoginName(wxString const &str);
159
160 /*! Sets the login password.
161 * \param str Login password.
162 * \return Returns false if fails, check GetLastError for details.
163 * \sa GetLastError()
164 */
165 bool SetLoginPassword(wxString const &str);
166
167 /*! Sets the default channel.
168 * \param str Default channel.
169 * \return Returns false if fails, check GetLastError for details.
170 * \sa GetLastError()
171 */
172 bool SetDefaultChannel(wxString const &str);
173
174 /*! Sets the default subchannel.
175 * \param str Default subchannel.
176 * \return Returns false if fails, check GetLastError for details.
177 * \sa GetLastError()
178 */
179 bool SetDefaultSubchannel(wxString const &str);
180
181 /*! Sets the default channel password.
182 * \param str Default channel password.
183 * \return Returns false if fails, check GetLastError for details.
184 * \sa GetLastError()
185 */
186 bool SetDefaultChannelPassword(wxString const &str);
187
188 /*! Should the server assing a nickname.
189 * - no: 0
190 * - yes: 1
191 * \param assing Server assing a nickname.
192 * \return Returns false if fails, check GetLastError for details.
193 * \sa GetLastError()
194 */
195 bool SetServerAssingnsNickname(wxUint8 const assing);
196
197 /*! Gets the player Id.
198 * \return Player Id.
199 */
200 wxUint32 GetId() const
201 {
202 return m_Id;
203 }
204
205 /*! Gets the player flags.
206 * \return Player flags.
207 */
208 wxUint32 GetFlags() const
209 {
210 return m_Flags;
211 }
212
213 /*! Gets the player privileges.
214 * \return Player privileges.
215 */
216 wxUint32 GetPrivileges() const
217 {
218 return m_Privileges;
219 }
220
221 /*! Gets the channel Id.
222 * \return Channel Id.
223 */
224 wxUint32 GetChannelId() const
225 {
226 return m_ChannelId;
227 }
228
229 /*! Gets the channel privileges.
230 * \return Channel privileges.
231 */
232 wxUint32 GetChannelPrivileges() const
233 {
234 return m_ChannelPrivileges;
235 }
236
237 /*! Gets the player nickname.
238 * \return Player nickname.
239 */
240 wxString const &GetNickname() const
241 {
242 return m_Nickname;
243 }
244
245 /*! Gets the player login name.
246 * \return Player login name.
247 */
248 wxString const &GetLoginName() const
249 {
250 return m_LoginName;
251 }
252
253 /*! Gets the player login password.
254 * \return Player login password.
255 */
256 wxString const &GetLoginPassword() const
257 {
258 return m_LoginPassword;
259 }
260
261 /*! Gets the player default channel.
262 * \return Player default channel.
263 */
264 wxString const &GetDefaultChannel() const
265 {
266 return m_DefaultChannel;
267 }
268
269 /*! Gets the player default sub channel.
270 * \return Player default sub channel.
271 */
272 wxString const &GetDefaultSubchannel() const
273 {
274 return m_DefaultSubchannel;
275 }
276
277 /*! Gets the player default channel password.
278 * \return Player default channel password.
279 */
280 wxString const &GetDefaultChannelPassword() const
281 {
282 return m_DefaultChannelPassword;
283 }
284
285 /*! Gets the player server assingns nickname status.
286 * \return Player ServerAssingnsNickname.
287 */
288 wxUint8 GetServerAssingnsNickname() const
289 {
290 return m_ServerAssingnsNickname;
291 }
292
293 /*! Gets the player anonymous login status.
294 * \return Player default channel password.
295 */
296 wxUint8 GetAnonymous() const
297 {
298 return m_Anonymous;
299 }
300
301 /*! Dumps object.
302 * \param ostrm Stream to write.
303 */
304 void Dump(wxOutputStream &ostrm) const;
305
306 /*! Gets the LastError message, call this method
307 * to get more information for an error.
308 * \return LastError message.
309 */
310 wxString const &GetLastError() const
311 {
312 return m_LastError;
313 }
314
315 private:
316 //Sets the LastError message.
317 void SetLastError(wxString const &str)
318 {
319 m_LastError = str;
320 }
321
322 //members
323 wxUint32 m_Id;
324 wxUint16 m_Flags;
325 wxUint16 m_Privileges;
326 wxUint32 m_ChannelId;
327 wxUint16 m_ChannelPrivileges;
328 wxString m_Nickname;
329 wxString m_LoginName;
330 wxString m_LoginPassword;
331 wxString m_DefaultChannel;
332 wxString m_DefaultSubchannel;
333 wxString m_DefaultChannelPassword;
334 wxString m_LastError;
335 wxUint8 m_Anonymous;
336 wxUint8 m_ServerAssingnsNickname;
337};
338
339#endif