/* * 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) */ // Header #include "tsplayer.h" //Libraries #include IMPLEMENT_CLASS(TSPlayer, wxObject) //------------------------------------------------------------------------------ //Default CTor, Initializes the object. TSPlayer::TSPlayer() { m_Id = 0; m_Flags = 0; m_Privileges = 0; m_ChannelId = 0; m_ChannelPrivileges = 0; m_Anonymous = true; m_ServerAssingnsNickname = false; } //------------------------------------------------------------------------------ //Default DTor. TSPlayer::~TSPlayer() { } //------------------------------------------------------------------------------ // Sets the player id. bool TSPlayer::SetId(wxUint32 const id) { m_Id = id; return true; } //------------------------------------------------------------------------------ // Sets the player channel Id. bool TSPlayer::SetChannelId(wxUint32 const id) { m_ChannelId = id; return true; } //------------------------------------------------------------------------------ // Sets the player flags. bool TSPlayer::SetFlags(wxUint16 const flags) { m_Flags = flags; return true; } //------------------------------------------------------------------------------ // Sets the player privileges. bool TSPlayer::SetPrivileges(wxUint16 const privs) { m_Privileges = privs; return true; } //------------------------------------------------------------------------------ // Sets the channel privileges. bool TSPlayer::SetChannelPrivileges(wxUint16 const privs) { m_ChannelPrivileges = privs; return true; } //------------------------------------------------------------------------------ // Sets the player nickname. bool TSPlayer::SetNickname(wxString const &str) { if(str.Length() == 0) { SetLastError(_T("empty string")); return false; } m_Nickname = str; return true; } //------------------------------------------------------------------------------ // Sets the login name. bool TSPlayer::SetLoginName(wxString const &str) { if(str.Length() == 0) { m_Anonymous = ANONYMOUS_YES; return true; } m_LoginName = str; m_Anonymous = ANONYMOUS_NO; return true; } //------------------------------------------------------------------------------ // Sets the login password. bool TSPlayer::SetLoginPassword(wxString const &str) { if(str.Length() == 0) { SetLastError(_T("empty string")); return false; } m_LoginPassword = str; return true; } //------------------------------------------------------------------------------ // Sets the default channel. bool TSPlayer::SetDefaultChannel(wxString const &str) { if(str.Length() == 0) { SetLastError(_T("empty string")); return false; } m_DefaultChannel = str; return true; } //------------------------------------------------------------------------------ // Sets the default subchannel. bool TSPlayer::SetDefaultSubchannel(wxString const &str) { if(str.Length() == 0) { SetLastError(_T("empty string")); return false; } m_DefaultSubchannel = str; return true; } //------------------------------------------------------------------------------ // Sets the default channel password. bool TSPlayer::SetDefaultChannelPassword(wxString const &str) { if(str.Length() == 0) { SetLastError(_T("empty string")); return false; } m_DefaultChannelPassword = str; return true; } //------------------------------------------------------------------------------ // Dumps object. void TSPlayer::Dump(wxOutputStream &ostrm) const { wxTextOutputStream out(ostrm); out << _T("Object: TSPlayer (") << wxString::Format(_T("0x%X"), this) << _T(")") << endl; out << _T("-wxUint32 m_Id: ") << wxString::Format(_T("0x%X"), m_Id) << endl; out << _T("-wxUint16 m_Flags: ") << wxString::Format(_T("0x%X"), m_Flags) << endl; out << _T("-wxUint16 m_Privileges: ") << wxString::Format(_T("0x%X"), m_Privileges) << endl; out << _T("-wxUint32 m_ChannelId: ") << wxString::Format(_T("0x%X"), m_ChannelId) << endl; out << _T("-wxUint16 m_ChannelPrivileges: ") << wxString::Format(_T("0x%X"), m_ChannelPrivileges) << endl; out << _T("-wxString m_Nickname: ") << m_Nickname << endl; out << _T("-wxString m_LoginName: ") << m_LoginName << endl; out << _T("-wxString m_LoginPassword: ") << m_LoginPassword << endl; out << _T("-wxString m_DefaultChannel: ") << m_DefaultChannel << endl; out << _T("-wxString m_DefaultSubchannel: ") << m_DefaultSubchannel << endl; out << _T("-wxString m_DefaultChannelPassword: ") << m_DefaultChannelPassword << endl; out << _T("-wxUint8 m_Anonymous: ") << wxString::Format(_T("0x%X"), m_Anonymous) << endl; out << _T("-wxUint8 m_ServerAssingnsNickname: ") << wxString::Format(_T("0x%X"), m_ServerAssingnsNickname) << endl; out << _T("-wxString m_LastError: ") << m_LastError << endl; } //------------------------------------------------------------------------------ // Should the server assing a nickname. bool TSPlayer::SetServerAssingnsNickname(wxUint8 const assing) { m_ServerAssingnsNickname = assing; return true; }