/* * 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 "tschannel.h" //Libraries #include IMPLEMENT_CLASS(TSChannel, wxObject) //------------------------------------------------------------------------------ // Default CTor, Initializes the object. TSChannel::TSChannel() { m_Id = 0; m_Parent = TS_NO_PARENT; m_Codec = 0; m_Order = 3200; m_Flags = 1; m_MaxUsers = 4; m_Users = 0; } //------------------------------------------------------------------------------ // Default DTor. TSChannel::~TSChannel() { } //------------------------------------------------------------------------------ // Sets the channel Id. bool TSChannel::SetId(wxUint32 const id) { m_Id = id; return true; } //------------------------------------------------------------------------------ // Sets the channel name. bool TSChannel::SetName(wxString const &str) { if(str.Length() == 0) { SetLastError(_T("empty string")); return false; } m_Name = str; return true; } //------------------------------------------------------------------------------ // Sets the channel topic. bool TSChannel::SetTopic(wxString const &str) { m_Topic = str; return true; } //------------------------------------------------------------------------------ // Sets the channel description. bool TSChannel::SetDescription(wxString const &str) { m_Description = str; return true; } //------------------------------------------------------------------------------ // Sets the channel password. bool TSChannel::SetPassword(wxString const &str) { if(str.Length() != 0) m_Flags |= TS_PASSWORD; else m_Flags &= ~TS_PASSWORD; m_Password = str; return true; } //------------------------------------------------------------------------------ // Sets the channel parent. bool TSChannel::SetParent(wxUint32 const parent) { m_Parent = parent; return true; } //------------------------------------------------------------------------------ // Sets the channel codec. bool TSChannel::SetCodec(wxUint16 const codec) { m_Codec = codec; return true; } //------------------------------------------------------------------------------ // Sets the channel order. bool TSChannel::SetOrder(wxUint16 const order) { m_Order = order; return true; } //------------------------------------------------------------------------------ // Sets the channel flags. bool TSChannel::SetFlags(wxString const &str) { wxUint16 flags = 1; if(str.Find(wxChar('R')) != wxNOT_FOUND) flags &= ~TS_UNREGISTRED; else flags |= TS_UNREGISTRED; if(str.Find(wxChar('M')) != wxNOT_FOUND) flags |= TS_MODERATE; else flags &= ~TS_MODERATE; if(str.Find(wxChar('S')) != wxNOT_FOUND) flags |= TS_HIERARCHICAL; else flags &= ~TS_HIERARCHICAL; if(str.Find(wxChar('D')) != wxNOT_FOUND) flags |= TS_DEFAULT; else flags &= ~TS_DEFAULT; if(str.Find(wxChar('P')) != wxNOT_FOUND || m_Password.Length() != 0) flags |= TS_PASSWORD; else flags &= ~TS_PASSWORD; m_Flags = flags; return true; } //------------------------------------------------------------------------------ // Sets the channel flags. bool TSChannel::SetFlags(wxUint16 const flags) { m_Flags = flags; return true; } //------------------------------------------------------------------------------ // Sets the channels maximum users count. bool TSChannel::SetMaxUsers(wxUint16 const users) { m_MaxUsers = users; return true; } //------------------------------------------------------------------------------ // Sets the channels users count. bool TSChannel::SetUsers(wxUint16 const users) { m_Users = users; return true; } //------------------------------------------------------------------------------ // Dumps object. void TSChannel::Dump(wxOutputStream &ostrm) const { wxTextOutputStream out(ostrm); out << _T("Object: TSChannel (") << wxString::Format(_T("0x%X"), this) << _T(")") << endl; out << _T("-wxUint32 m_Id: ") << wxString::Format(_T("0x%X"), m_Id) << endl; out << _T("-wxString m_Name: ") << m_Name << endl; out << _T("-wxString m_Topic: ") << m_Topic << endl; out << _T("-wxString m_Description: ") << m_Description << endl; out << _T("-wxString m_Password: ") << m_Password << endl; out << _T("-wxUint32 m_Parent: ") << wxString::Format(_T("0x%X"), m_Parent) << endl; out << _T("-wxUint16 m_Codec: ") << wxString::Format(_T("0x%X"), m_Codec) << endl; out << _T("-wxUint16 m_Order: ") << wxString::Format(_T("0x%X"), m_Order) << endl; out << _T("-wxUint16 m_Flags: ") << wxString::Format(_T("0x%X"), m_Flags) << endl; out << _T("-wxUint16 m_MaxUsers: ") << wxString::Format(_T("0x%X"), m_MaxUsers) << endl; out << _T("-wxUint16 m_Users: ") << wxString::Format(_T("0x%X"), m_Users) << endl; out << _T("-wxString m_LastError: ") << m_LastError << endl; }