From 310a2c101b32a5e71a616027b6a1b788a341bc02 Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 5 Mar 2013 17:39:48 +0100 Subject: initial GPLv2 release --- tschannel.h | 371 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 371 insertions(+) create mode 100644 tschannel.h (limited to 'tschannel.h') diff --git a/tschannel.h b/tschannel.h new file mode 100644 index 0000000..a1b3855 --- /dev/null +++ b/tschannel.h @@ -0,0 +1,371 @@ +/* + * 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 TSCHANNEL_H +#define TSCHANNEL_H + +#include "tsheaders.h" + +// Libraries +#include + +//------------------------------------------------------------------------------ +//! Channel flags +//! Unregistered: +#define TS_UNREGISTRED 1 +//! Moderated: +#define TS_MODERATE 2 +//! Password: +#define TS_PASSWORD 4 +//! Hierarchical aka Subchannels: +#define TS_HIERARCHICAL 8 +//! Default: +#define TS_DEFAULT 16 + +//------------------------------------------------------------------------------ +//! Channel Codecs +//! CELP 5.2 +#define TS_CELP_5_2 0 +//! CELP 6.3 +#define TS_CELP_6_3 1 +//! GSM 14.8 +#define TS_GSM_14_8 2 +//! GSM 16.4 +#define TS_GSM_16_4 3 +//! Windows CELP 5.2 +#define TS_WINDOWS_CELP_5_2 4 +//! Speex 3.4 +#define TS_SPEEX_3_4 5 +//! Speex 5.2 +#define TS_SPEEX_5_2 6 +//! Speex 7.2 +#define TS_SPEEX_7_2 7 +//! Speex 9.3 +#define TS_SPEEX_9_3 8 +//! Speex 12.3 +#define TS_SPEEX_12_3 9 +//! Speex 16.3 +#define TS_SPEEX_16_3 10 +//! Speex 19.5 +#define TS_SPEEX_19_5 11 +//! Speex 25.9 +#define TS_SPEEX_25_9 12 + +//!no parent channel +#define TS_NO_PARENT 0xffffffff + +//! TeamSpeak channel. +/*! TSChanel is used to hold all channel informations. + * After calling TSClient::Connect(), you can read + * out all the channel 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::GetChannel() or GetChannels() + * - Now the class is filled up with the player information + */ +class TSChannel : public wxObject +{ + DECLARE_CLASS(TSChannel) + public: + + /*! Default CTor, Initializes the object. + */ + TSChannel(); + + /*! Default DTor. + */ + ~TSChannel(); + + /*! Sets the channel Id. + * \param id channel Id. + * \return Returns false if fails, check GetLastError for details. + * \sa GetLastError() + */ + bool SetId(wxUint32 const id); + + /*! Sets the channel name. + * \param str Channel name. + * \return Returns false if fails, check GetLastError for details. + * \sa GetLastError() + */ + bool SetName(wxString const &str); + + /*! Sets the channel topic. + * \param str Channel topic. + * \return Returns false if fails, check GetLastError for details. + * \sa GetLastError() + */ + bool SetTopic(wxString const &str); + + /*! Sets the channel description. + * \param str Channel description. + * \return Returns false if fails, check GetLastError for details. + * \sa GetLastError() + */ + bool SetDescription(wxString const &str); + + /*! Sets the channel password. + * \param str Channel password. + * \return Returns false if fails, check GetLastError for details. + * \sa GetLastError() + */ + bool SetPassword(wxString const &str); + + /*! Sets the channel parent. + * \param parent Channel parent. + * \return Returns false if fails, check GetLastError for details. + * \sa GetLastError() + */ + bool SetParent(wxUint32 const parent); + + /*! Sets the channel codec. + * - CELP 5.2: 0 + * - CELP 6.3: 1 + * - GSM 14.8: 2 + * - GSM 16.4: 3 + * - Windows CELP 5.2: 4 + * - Speex 3.4: 5 + * - Speex 5.2: 6 + * - Speex 7.2: 7 + * - Speex 9.3: 8 + * - Speex 12.3: 9 + * - Speex 16.3: 10 + * - Speex 19.5: 11 + * - Speex 25.9: 12 + * \param codec Channel codec. + * \return Returns false if fails, check GetLastError for details. + * \sa GetLastError() + */ + bool SetCodec(wxUint16 const codec); + + /*! Sets the channel order. + * \param order Channel order. + * \return Returns false if fails, check GetLastError for details. + * \sa GetLastError() + */ + bool SetOrder(wxUint16 const order); + + /*! Sets the channel flags. + * - Unregistered: 1 + * - Moderated: 2 + * - Password: 4 + * - Hierarchical: 8 + * - Default: 16 + * \param flags Channel flags. + * \return Returns false if fails, check GetLastError for details. + * \sa GetLastError() + */ + bool SetFlags(wxUint16 const flags); + + /*! Sets the channel flags. + * - Registered: R + * - Moderated: M + * - Password: P + * - Hierarchical: S + * - Default: D + * \param flags Channel flags. + * \return Returns false if fails, check GetLastError for details. + * \sa GetLastError() + */ + bool SetFlags(wxString const &str); + + /*! Sets the channels maximum users count. + * \param users Channel maximum users count. + * \return Returns false if fails, check GetLastError for details. + * \sa GetLastError() + */ + bool SetMaxUsers(wxUint16 const users); + + /*! Sets the channels users count. + * \param users Channel maximum users count. + * \return Returns false if fails, check GetLastError for details. + * \sa GetLastError() + */ + bool SetUsers(wxUint16 const users); + + /*! Gets the channel id. + * \return Channel Id. + */ + wxUint32 GetId() const + { + return m_Id; + } + + /*! Gets the channel name. + * \return Channel name. + */ + wxString const &GetName() const + { + return m_Name; + } + + /*! Gets the channel topic. + * \return Channel topic. + */ + wxString const &GetTopic() const + { + return m_Topic; + } + + /*! Gets the channel description. + * \return Channel description. + */ + wxString const &GetDescription() const + { + return m_Description; + } + + /*! Gets the channel password. + * \return Channel password. + */ + wxString const &GetPassword() const + { + return m_Password; + } + + /*! Gets the channel parent. + * \return Channel parent. + */ + wxUint32 GetParent() const + { + return m_Parent; + } + + /*! Gets the channel codec. + * - CELP 5.2: 0 + * - CELP 6.3: 1 + * - GSM 14.8: 2 + * - GSM 16.4: 3 + * - Windows CELP 5.2: 4 + * - Speex 3.4: 5 + * - Speex 5.2: 6 + * - Speex 7.2: 7 + * - Speex 9.3: 8 + * - Speex 12.3: 9 + * - Speex 16.3: 10 + * - Speex 19.5: 11 + * - Speex 25.9: 12 + * \return Channel codec. + */ + wxUint16 GetCodec() const + { + return m_Codec; + } + + /*! Gets the channel order. + * \return Channel order. + */ + wxUint16 GetOrder() const + { + return m_Order; + } + + /*! Gets the channel flags. + * - Unregistered: 1 + * - Moderated: 2 + * - Password: 4 + * - Hierarchical: 8 + * - Default: 16 + * \return Channel flags. + */ + wxUint16 GetFlags() const + { + return m_Flags; + } + + /*! Gets the channel flags. + * - Unregistered: 1 + * - Moderated: 2 + * - Password: 4 + * - Hierarchical: 8 + * - Default: 16 + * \return Channel flags. + */ + wxString const GetFlagsString() const + { + wxString str; + if((m_Flags &TS_MODERATE)) + str += _T("M"); + if((m_Flags &TS_DEFAULT)) + str += _T("D"); + if((m_Flags &TS_HIERARCHICAL)) + str += _T("S"); + if((m_Flags &TS_PASSWORD)) + str += _T("P"); + if(!(m_Flags &TS_UNREGISTRED)) + str += _T("R"); + return str; + } + /*! Gets the channel max users. + * \return Channel max users. + */ + wxUint16 GetMaxUsers() const + { + return m_MaxUsers; + } + + /*! Gets the channel user count. + * \return Channel user count. + */ + wxUint16 GetUsers() const + { + return m_Users; + } + + /*! Gets the LastError message, call this method + * to get more information for an error. + * \return LastError message. + */ + wxString const &GetLastError() const + { + return m_LastError; + } + + /*! Dumps object. + * \param ostrm Stream to write. + */ + void Dump(wxOutputStream &ostrm) const; + + + private: + + //Sets the LastError message. + void SetLastError(wxString const &str) + { + m_LastError = str; + } + + //members + wxUint32 m_Id; + wxString m_Name; + wxString m_Topic; + wxString m_Description; + wxString m_Password; + wxUint32 m_Parent; + wxUint16 m_Codec; + wxUint16 m_Order; + wxUint16 m_Flags; + wxUint16 m_MaxUsers; + wxUint16 m_Users; + wxString m_LastError; +}; + +#endif -- cgit v1.2.3