summaryrefslogtreecommitdiffstats
path: root/tsplayer.cpp
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2013-03-05 17:39:48 +0100
committermanuel <manuel@mausz.at>2013-03-05 17:39:48 +0100
commit310a2c101b32a5e71a616027b6a1b788a341bc02 (patch)
treea871e1dda8b1de141ae1400ba666fe3b1de96361 /tsplayer.cpp
downloadtsclient-310a2c101b32a5e71a616027b6a1b788a341bc02.tar.gz
tsclient-310a2c101b32a5e71a616027b6a1b788a341bc02.tar.bz2
tsclient-310a2c101b32a5e71a616027b6a1b788a341bc02.zip
initial GPLv2 releaseHEADmaster
Diffstat (limited to 'tsplayer.cpp')
-rw-r--r--tsplayer.cpp200
1 files changed, 200 insertions, 0 deletions
diff --git a/tsplayer.cpp b/tsplayer.cpp
new file mode 100644
index 0000000..268adfc
--- /dev/null
+++ b/tsplayer.cpp
@@ -0,0 +1,200 @@
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// Header
20#include "tsplayer.h"
21
22//Libraries
23#include <wx/txtstrm.h>
24
25IMPLEMENT_CLASS(TSPlayer, wxObject)
26
27//------------------------------------------------------------------------------
28//Default CTor, Initializes the object.
29TSPlayer::TSPlayer()
30{
31 m_Id = 0;
32 m_Flags = 0;
33 m_Privileges = 0;
34 m_ChannelId = 0;
35 m_ChannelPrivileges = 0;
36 m_Anonymous = true;
37 m_ServerAssingnsNickname = false;
38}
39
40//------------------------------------------------------------------------------
41//Default DTor.
42TSPlayer::~TSPlayer()
43{
44}
45
46//------------------------------------------------------------------------------
47// Sets the player id.
48bool TSPlayer::SetId(wxUint32 const id)
49{
50 m_Id = id;
51 return true;
52}
53
54//------------------------------------------------------------------------------
55// Sets the player channel Id.
56bool TSPlayer::SetChannelId(wxUint32 const id)
57{
58 m_ChannelId = id;
59 return true;
60}
61
62//------------------------------------------------------------------------------
63// Sets the player flags.
64bool TSPlayer::SetFlags(wxUint16 const flags)
65{
66 m_Flags = flags;
67 return true;
68}
69
70//------------------------------------------------------------------------------
71// Sets the player privileges.
72bool TSPlayer::SetPrivileges(wxUint16 const privs)
73{
74 m_Privileges = privs;
75 return true;
76}
77
78//------------------------------------------------------------------------------
79// Sets the channel privileges.
80bool TSPlayer::SetChannelPrivileges(wxUint16 const privs)
81{
82 m_ChannelPrivileges = privs;
83 return true;
84}
85
86//------------------------------------------------------------------------------
87// Sets the player nickname.
88bool TSPlayer::SetNickname(wxString const &str)
89{
90 if(str.Length() == 0)
91 {
92 SetLastError(_T("empty string"));
93 return false;
94 }
95
96 m_Nickname = str;
97 return true;
98}
99
100//------------------------------------------------------------------------------
101// Sets the login name.
102bool TSPlayer::SetLoginName(wxString const &str)
103{
104 if(str.Length() == 0)
105 {
106 m_Anonymous = ANONYMOUS_YES;
107 return true;
108 }
109
110 m_LoginName = str;
111 m_Anonymous = ANONYMOUS_NO;
112 return true;
113}
114
115//------------------------------------------------------------------------------
116// Sets the login password.
117bool TSPlayer::SetLoginPassword(wxString const &str)
118{
119 if(str.Length() == 0)
120 {
121 SetLastError(_T("empty string"));
122 return false;
123 }
124
125 m_LoginPassword = str;
126 return true;
127}
128
129//------------------------------------------------------------------------------
130// Sets the default channel.
131bool TSPlayer::SetDefaultChannel(wxString const &str)
132{
133 if(str.Length() == 0)
134 {
135 SetLastError(_T("empty string"));
136 return false;
137 }
138
139 m_DefaultChannel = str;
140 return true;
141}
142
143//------------------------------------------------------------------------------
144// Sets the default subchannel.
145 bool TSPlayer::SetDefaultSubchannel(wxString const &str)
146{
147 if(str.Length() == 0)
148 {
149 SetLastError(_T("empty string"));
150 return false;
151 }
152
153 m_DefaultSubchannel = str;
154 return true;
155}
156
157//------------------------------------------------------------------------------
158// Sets the default channel password.
159bool TSPlayer::SetDefaultChannelPassword(wxString const &str)
160{
161 if(str.Length() == 0)
162 {
163 SetLastError(_T("empty string"));
164 return false;
165 }
166
167 m_DefaultChannelPassword = str;
168 return true;
169}
170
171//------------------------------------------------------------------------------
172// Dumps object.
173void TSPlayer::Dump(wxOutputStream &ostrm) const
174{
175 wxTextOutputStream out(ostrm);
176 out << _T("Object: TSPlayer (") << wxString::Format(_T("0x%X"), this) << _T(")") << endl;
177 out << _T("-wxUint32 m_Id: ") << wxString::Format(_T("0x%X"), m_Id) << endl;
178 out << _T("-wxUint16 m_Flags: ") << wxString::Format(_T("0x%X"), m_Flags) << endl;
179 out << _T("-wxUint16 m_Privileges: ") << wxString::Format(_T("0x%X"), m_Privileges) << endl;
180 out << _T("-wxUint32 m_ChannelId: ") << wxString::Format(_T("0x%X"), m_ChannelId) << endl;
181 out << _T("-wxUint16 m_ChannelPrivileges: ") << wxString::Format(_T("0x%X"), m_ChannelPrivileges) << endl;
182 out << _T("-wxString m_Nickname: ") << m_Nickname << endl;
183 out << _T("-wxString m_LoginName: ") << m_LoginName << endl;
184 out << _T("-wxString m_LoginPassword: ") << m_LoginPassword << endl;
185 out << _T("-wxString m_DefaultChannel: ") << m_DefaultChannel << endl;
186 out << _T("-wxString m_DefaultSubchannel: ") << m_DefaultSubchannel << endl;
187 out << _T("-wxString m_DefaultChannelPassword: ") << m_DefaultChannelPassword << endl;
188 out << _T("-wxUint8 m_Anonymous: ") << wxString::Format(_T("0x%X"), m_Anonymous) << endl;
189 out << _T("-wxUint8 m_ServerAssingnsNickname: ") << wxString::Format(_T("0x%X"), m_ServerAssingnsNickname) << endl;
190 out << _T("-wxString m_LastError: ") << m_LastError << endl;
191}
192
193//------------------------------------------------------------------------------
194// Should the server assing a nickname.
195bool TSPlayer::SetServerAssingnsNickname(wxUint8 const assing)
196{
197 m_ServerAssingnsNickname = assing;
198 return true;
199}
200