From 310a2c101b32a5e71a616027b6a1b788a341bc02 Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 5 Mar 2013 17:39:48 +0100 Subject: initial GPLv2 release --- tsplayer.h | 339 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 339 insertions(+) create mode 100644 tsplayer.h (limited to 'tsplayer.h') diff --git a/tsplayer.h b/tsplayer.h new file mode 100644 index 0000000..84daa9b --- /dev/null +++ b/tsplayer.h @@ -0,0 +1,339 @@ +/* + * 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 TSPLAYER_H +#define TSPLAYER_H + +#include "tsheaders.h" + +//Libraries +#include +#include + +//------------------------------------------------------------------------------ +// Player flags +//! Channel Commander +#define TS_CHANNEL_COMMANDER 1 +//! Voice Request +#define TS_VOICE_REQUEST 2 +//! Doesnt Accept Whispers +#define TS_DOESNT_ACCEPT_WHISPER 4 +//! Away +#define TS_AWAY 8 +//! Microphone Muted +#define TS_MICROPHONE_MUTED 16 +//! Sound Muted +#define TS_SOUND_MUTED 32 +//! Recording +#define TS_RECORDING 64 + +//------------------------------------------------------------------------------ +//! Player privileges +//! SA server admin +#define TS_SERVER_ADMIN 1 +//! Allow Registration +#define TS_ALLOW_REGISTRATION 2 +//! Registered +#define TS_REGISTERED 4 +//! Internal Use +#define TS_INTERNAL_USE 8 +//! Stickey +#define TS_STICKY 16 + +//------------------------------------------------------------------------------ +//! Channel privileges +//! Channel Admin +#define TS_CHANNEL_ADMIN 1 +//! Operator +#define TS_OPERATOR 2 +//! Voice +#define TS_VOICE 4 +//! Auto Operator +#define TS_AUTO_OPERATOR 8 +//! Auto Voice +#define TS_AUTO_VOICE 16 + +//------------------------------------------------------------------------------ +//! Anonymous login +//! +#define ANONYMOUS_YES 1 +//! +#define ANONYMOUS_NO 2 + +//------------------------------------------------------------------------------ +//! Server assingns nickname +//! +#define SAN_YES 1 +//! +#define SAN_NO 0 + +//! TeamSpeak player. +/*! TSPlayer is used to hold all player informations. + * After calling TSClient::Connect(), you can read + * out all the player 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::GetPlayer() or GetPlayers() + * - Now the class is filled up with the player information + */ +class TSPlayer : public wxObject +{ + DECLARE_CLASS(TSPlayer) + public: + /*! Default CTor, Initializes the object. + */ + TSPlayer(); + + /*! Default DTor. + */ + ~TSPlayer(); + + /*! Sets the player Id. + * \param id Player Id. + * \return Returns false if fails, check GetLastError for details. + * \sa GetLastError() + */ + bool SetId(wxUint32 const id); + + /*! Sets the player channel Id. + * \param id Player channel Id. + * \return Returns false if fails, check GetLastError for details. + * \sa GetLastError() + */ + bool SetChannelId(wxUint32 const id); + + /*! Sets the player flags. + * \param flags Player flags. + * \return Returns false if fails, check GetLastError for details. + * \sa GetLastError() + */ + bool SetFlags(wxUint16 const flags); + + /*! Sets the player privileges. + * \param privs Player privileges. + * \return Returns false if fails, check GetLastError for details. + * \sa GetLastError() + */ + bool SetPrivileges(wxUint16 const privs); + + /*! Sets the channel privileges. + * \param privs Channel privileges. + * \return Returns false if fails, check GetLastError for details. + * \sa GetLastError() + */ + bool SetChannelPrivileges(wxUint16 const privs); + + /*! Sets the player nickname. + * \param str Player nickname. + * \return Returns false if fails, check GetLastError for details. + * \sa GetLastError() + */ + bool SetNickname(wxString const &str); + + /*! Sets the login name. + * If called with an empty string, Anonymous login is enabled, + * which is also default. Else Anonymous login is disabled. + * \param str Login name. + * \return Returns false if fails, check GetLastError for details. + * \sa GetLastError() + */ + bool SetLoginName(wxString const &str); + + /*! Sets the login password. + * \param str Login password. + * \return Returns false if fails, check GetLastError for details. + * \sa GetLastError() + */ + bool SetLoginPassword(wxString const &str); + + /*! Sets the default channel. + * \param str Default channel. + * \return Returns false if fails, check GetLastError for details. + * \sa GetLastError() + */ + bool SetDefaultChannel(wxString const &str); + + /*! Sets the default subchannel. + * \param str Default subchannel. + * \return Returns false if fails, check GetLastError for details. + * \sa GetLastError() + */ + bool SetDefaultSubchannel(wxString const &str); + + /*! Sets the default channel password. + * \param str Default channel password. + * \return Returns false if fails, check GetLastError for details. + * \sa GetLastError() + */ + bool SetDefaultChannelPassword(wxString const &str); + + /*! Should the server assing a nickname. + * - no: 0 + * - yes: 1 + * \param assing Server assing a nickname. + * \return Returns false if fails, check GetLastError for details. + * \sa GetLastError() + */ + bool SetServerAssingnsNickname(wxUint8 const assing); + + /*! Gets the player Id. + * \return Player Id. + */ + wxUint32 GetId() const + { + return m_Id; + } + + /*! Gets the player flags. + * \return Player flags. + */ + wxUint32 GetFlags() const + { + return m_Flags; + } + + /*! Gets the player privileges. + * \return Player privileges. + */ + wxUint32 GetPrivileges() const + { + return m_Privileges; + } + + /*! Gets the channel Id. + * \return Channel Id. + */ + wxUint32 GetChannelId() const + { + return m_ChannelId; + } + + /*! Gets the channel privileges. + * \return Channel privileges. + */ + wxUint32 GetChannelPrivileges() const + { + return m_ChannelPrivileges; + } + + /*! Gets the player nickname. + * \return Player nickname. + */ + wxString const &GetNickname() const + { + return m_Nickname; + } + + /*! Gets the player login name. + * \return Player login name. + */ + wxString const &GetLoginName() const + { + return m_LoginName; + } + + /*! Gets the player login password. + * \return Player login password. + */ + wxString const &GetLoginPassword() const + { + return m_LoginPassword; + } + + /*! Gets the player default channel. + * \return Player default channel. + */ + wxString const &GetDefaultChannel() const + { + return m_DefaultChannel; + } + + /*! Gets the player default sub channel. + * \return Player default sub channel. + */ + wxString const &GetDefaultSubchannel() const + { + return m_DefaultSubchannel; + } + + /*! Gets the player default channel password. + * \return Player default channel password. + */ + wxString const &GetDefaultChannelPassword() const + { + return m_DefaultChannelPassword; + } + + /*! Gets the player server assingns nickname status. + * \return Player ServerAssingnsNickname. + */ + wxUint8 GetServerAssingnsNickname() const + { + return m_ServerAssingnsNickname; + } + + /*! Gets the player anonymous login status. + * \return Player default channel password. + */ + wxUint8 GetAnonymous() const + { + return m_Anonymous; + } + + /*! Dumps object. + * \param ostrm Stream to write. + */ + void Dump(wxOutputStream &ostrm) const; + + /*! Gets the LastError message, call this method + * to get more information for an error. + * \return LastError message. + */ + wxString const &GetLastError() const + { + return m_LastError; + } + + private: + //Sets the LastError message. + void SetLastError(wxString const &str) + { + m_LastError = str; + } + + //members + wxUint32 m_Id; + wxUint16 m_Flags; + wxUint16 m_Privileges; + wxUint32 m_ChannelId; + wxUint16 m_ChannelPrivileges; + wxString m_Nickname; + wxString m_LoginName; + wxString m_LoginPassword; + wxString m_DefaultChannel; + wxString m_DefaultSubchannel; + wxString m_DefaultChannelPassword; + wxString m_LastError; + wxUint8 m_Anonymous; + wxUint8 m_ServerAssingnsNickname; +}; + +#endif -- cgit v1.2.3