diff options
Diffstat (limited to 'tschannel.h')
| -rw-r--r-- | tschannel.h | 371 |
1 files changed, 371 insertions, 0 deletions
diff --git a/tschannel.h b/tschannel.h new file mode 100644 index 0000000..a1b3855 --- /dev/null +++ b/tschannel.h | |||
| @@ -0,0 +1,371 @@ | |||
| 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 | #ifndef TSCHANNEL_H | ||
| 20 | #define TSCHANNEL_H | ||
| 21 | |||
| 22 | #include "tsheaders.h" | ||
| 23 | |||
| 24 | // Libraries | ||
| 25 | #include <wx/wx.h> | ||
| 26 | |||
| 27 | //------------------------------------------------------------------------------ | ||
| 28 | //! Channel flags | ||
| 29 | //! Unregistered: | ||
| 30 | #define TS_UNREGISTRED 1 | ||
| 31 | //! Moderated: | ||
| 32 | #define TS_MODERATE 2 | ||
| 33 | //! Password: | ||
| 34 | #define TS_PASSWORD 4 | ||
| 35 | //! Hierarchical aka Subchannels: | ||
| 36 | #define TS_HIERARCHICAL 8 | ||
| 37 | //! Default: | ||
| 38 | #define TS_DEFAULT 16 | ||
| 39 | |||
| 40 | //------------------------------------------------------------------------------ | ||
| 41 | //! Channel Codecs | ||
| 42 | //! CELP 5.2 | ||
| 43 | #define TS_CELP_5_2 0 | ||
| 44 | //! CELP 6.3 | ||
| 45 | #define TS_CELP_6_3 1 | ||
| 46 | //! GSM 14.8 | ||
| 47 | #define TS_GSM_14_8 2 | ||
| 48 | //! GSM 16.4 | ||
| 49 | #define TS_GSM_16_4 3 | ||
| 50 | //! Windows CELP 5.2 | ||
| 51 | #define TS_WINDOWS_CELP_5_2 4 | ||
| 52 | //! Speex 3.4 | ||
| 53 | #define TS_SPEEX_3_4 5 | ||
| 54 | //! Speex 5.2 | ||
| 55 | #define TS_SPEEX_5_2 6 | ||
| 56 | //! Speex 7.2 | ||
| 57 | #define TS_SPEEX_7_2 7 | ||
| 58 | //! Speex 9.3 | ||
| 59 | #define TS_SPEEX_9_3 8 | ||
| 60 | //! Speex 12.3 | ||
| 61 | #define TS_SPEEX_12_3 9 | ||
| 62 | //! Speex 16.3 | ||
| 63 | #define TS_SPEEX_16_3 10 | ||
| 64 | //! Speex 19.5 | ||
| 65 | #define TS_SPEEX_19_5 11 | ||
| 66 | //! Speex 25.9 | ||
| 67 | #define TS_SPEEX_25_9 12 | ||
| 68 | |||
| 69 | //!no parent channel | ||
| 70 | #define TS_NO_PARENT 0xffffffff | ||
| 71 | |||
| 72 | //! TeamSpeak channel. | ||
| 73 | /*! TSChanel is used to hold all channel informations. | ||
| 74 | * After calling TSClient::Connect(), you can read | ||
| 75 | * out all the channel attributes. These stepps are | ||
| 76 | * necessary to connect to a server and read all information | ||
| 77 | * out. | ||
| 78 | * - Create a TSServer object,edit and link it to the TSClient object | ||
| 79 | * (For more information see TSClient) | ||
| 80 | * - Call TSClient::Connect() | ||
| 81 | * - Call TSClient::GetChannel() or GetChannels() | ||
| 82 | * - Now the class is filled up with the player information | ||
| 83 | */ | ||
| 84 | class TSChannel : public wxObject | ||
| 85 | { | ||
| 86 | DECLARE_CLASS(TSChannel) | ||
| 87 | public: | ||
| 88 | |||
| 89 | /*! Default CTor, Initializes the object. | ||
| 90 | */ | ||
| 91 | TSChannel(); | ||
| 92 | |||
| 93 | /*! Default DTor. | ||
| 94 | */ | ||
| 95 | ~TSChannel(); | ||
| 96 | |||
| 97 | /*! Sets the channel Id. | ||
| 98 | * \param id channel Id. | ||
| 99 | * \return Returns false if fails, check GetLastError for details. | ||
| 100 | * \sa GetLastError() | ||
| 101 | */ | ||
| 102 | bool SetId(wxUint32 const id); | ||
| 103 | |||
| 104 | /*! Sets the channel name. | ||
| 105 | * \param str Channel name. | ||
| 106 | * \return Returns false if fails, check GetLastError for details. | ||
| 107 | * \sa GetLastError() | ||
| 108 | */ | ||
| 109 | bool SetName(wxString const &str); | ||
| 110 | |||
| 111 | /*! Sets the channel topic. | ||
| 112 | * \param str Channel topic. | ||
| 113 | * \return Returns false if fails, check GetLastError for details. | ||
| 114 | * \sa GetLastError() | ||
| 115 | */ | ||
| 116 | bool SetTopic(wxString const &str); | ||
| 117 | |||
| 118 | /*! Sets the channel description. | ||
| 119 | * \param str Channel description. | ||
| 120 | * \return Returns false if fails, check GetLastError for details. | ||
| 121 | * \sa GetLastError() | ||
| 122 | */ | ||
| 123 | bool SetDescription(wxString const &str); | ||
| 124 | |||
| 125 | /*! Sets the channel password. | ||
| 126 | * \param str Channel password. | ||
| 127 | * \return Returns false if fails, check GetLastError for details. | ||
| 128 | * \sa GetLastError() | ||
| 129 | */ | ||
| 130 | bool SetPassword(wxString const &str); | ||
| 131 | |||
| 132 | /*! Sets the channel parent. | ||
| 133 | * \param parent Channel parent. | ||
| 134 | * \return Returns false if fails, check GetLastError for details. | ||
| 135 | * \sa GetLastError() | ||
| 136 | */ | ||
| 137 | bool SetParent(wxUint32 const parent); | ||
| 138 | |||
| 139 | /*! Sets the channel codec. | ||
| 140 | * - CELP 5.2: 0 | ||
| 141 | * - CELP 6.3: 1 | ||
| 142 | * - GSM 14.8: 2 | ||
| 143 | * - GSM 16.4: 3 | ||
| 144 | * - Windows CELP 5.2: 4 | ||
| 145 | * - Speex 3.4: 5 | ||
| 146 | * - Speex 5.2: 6 | ||
| 147 | * - Speex 7.2: 7 | ||
| 148 | * - Speex 9.3: 8 | ||
| 149 | * - Speex 12.3: 9 | ||
| 150 | * - Speex 16.3: 10 | ||
| 151 | * - Speex 19.5: 11 | ||
| 152 | * - Speex 25.9: 12 | ||
| 153 | * \param codec Channel codec. | ||
| 154 | * \return Returns false if fails, check GetLastError for details. | ||
| 155 | * \sa GetLastError() | ||
| 156 | */ | ||
| 157 | bool SetCodec(wxUint16 const codec); | ||
| 158 | |||
| 159 | /*! Sets the channel order. | ||
| 160 | * \param order Channel order. | ||
| 161 | * \return Returns false if fails, check GetLastError for details. | ||
| 162 | * \sa GetLastError() | ||
| 163 | */ | ||
| 164 | bool SetOrder(wxUint16 const order); | ||
| 165 | |||
| 166 | /*! Sets the channel flags. | ||
| 167 | * - Unregistered: 1 | ||
| 168 | * - Moderated: 2 | ||
| 169 | * - Password: 4 | ||
| 170 | * - Hierarchical: 8 | ||
| 171 | * - Default: 16 | ||
| 172 | * \param flags Channel flags. | ||
| 173 | * \return Returns false if fails, check GetLastError for details. | ||
| 174 | * \sa GetLastError() | ||
| 175 | */ | ||
| 176 | bool SetFlags(wxUint16 const flags); | ||
| 177 | |||
| 178 | /*! Sets the channel flags. | ||
| 179 | * - Registered: R | ||
| 180 | * - Moderated: M | ||
| 181 | * - Password: P | ||
| 182 | * - Hierarchical: S | ||
| 183 | * - Default: D | ||
| 184 | * \param flags Channel flags. | ||
| 185 | * \return Returns false if fails, check GetLastError for details. | ||
| 186 | * \sa GetLastError() | ||
| 187 | */ | ||
| 188 | bool SetFlags(wxString const &str); | ||
| 189 | |||
| 190 | /*! Sets the channels maximum users count. | ||
| 191 | * \param users Channel maximum users count. | ||
| 192 | * \return Returns false if fails, check GetLastError for details. | ||
| 193 | * \sa GetLastError() | ||
| 194 | */ | ||
| 195 | bool SetMaxUsers(wxUint16 const users); | ||
| 196 | |||
| 197 | /*! Sets the channels users count. | ||
| 198 | * \param users Channel maximum users count. | ||
| 199 | * \return Returns false if fails, check GetLastError for details. | ||
| 200 | * \sa GetLastError() | ||
| 201 | */ | ||
| 202 | bool SetUsers(wxUint16 const users); | ||
| 203 | |||
| 204 | /*! Gets the channel id. | ||
| 205 | * \return Channel Id. | ||
| 206 | */ | ||
| 207 | wxUint32 GetId() const | ||
| 208 | { | ||
| 209 | return m_Id; | ||
| 210 | } | ||
| 211 | |||
| 212 | /*! Gets the channel name. | ||
| 213 | * \return Channel name. | ||
| 214 | */ | ||
| 215 | wxString const &GetName() const | ||
| 216 | { | ||
| 217 | return m_Name; | ||
| 218 | } | ||
| 219 | |||
| 220 | /*! Gets the channel topic. | ||
| 221 | * \return Channel topic. | ||
| 222 | */ | ||
| 223 | wxString const &GetTopic() const | ||
| 224 | { | ||
| 225 | return m_Topic; | ||
| 226 | } | ||
| 227 | |||
| 228 | /*! Gets the channel description. | ||
| 229 | * \return Channel description. | ||
| 230 | */ | ||
| 231 | wxString const &GetDescription() const | ||
| 232 | { | ||
| 233 | return m_Description; | ||
| 234 | } | ||
| 235 | |||
| 236 | /*! Gets the channel password. | ||
| 237 | * \return Channel password. | ||
| 238 | */ | ||
| 239 | wxString const &GetPassword() const | ||
| 240 | { | ||
| 241 | return m_Password; | ||
| 242 | } | ||
| 243 | |||
| 244 | /*! Gets the channel parent. | ||
| 245 | * \return Channel parent. | ||
| 246 | */ | ||
| 247 | wxUint32 GetParent() const | ||
| 248 | { | ||
| 249 | return m_Parent; | ||
| 250 | } | ||
| 251 | |||
| 252 | /*! Gets the channel codec. | ||
| 253 | * - CELP 5.2: 0 | ||
| 254 | * - CELP 6.3: 1 | ||
| 255 | * - GSM 14.8: 2 | ||
| 256 | * - GSM 16.4: 3 | ||
| 257 | * - Windows CELP 5.2: 4 | ||
| 258 | * - Speex 3.4: 5 | ||
| 259 | * - Speex 5.2: 6 | ||
| 260 | * - Speex 7.2: 7 | ||
| 261 | * - Speex 9.3: 8 | ||
| 262 | * - Speex 12.3: 9 | ||
| 263 | * - Speex 16.3: 10 | ||
| 264 | * - Speex 19.5: 11 | ||
| 265 | * - Speex 25.9: 12 | ||
| 266 | * \return Channel codec. | ||
| 267 | */ | ||
| 268 | wxUint16 GetCodec() const | ||
| 269 | { | ||
| 270 | return m_Codec; | ||
| 271 | } | ||
| 272 | |||
| 273 | /*! Gets the channel order. | ||
| 274 | * \return Channel order. | ||
| 275 | */ | ||
| 276 | wxUint16 GetOrder() const | ||
| 277 | { | ||
| 278 | return m_Order; | ||
| 279 | } | ||
| 280 | |||
| 281 | /*! Gets the channel flags. | ||
| 282 | * - Unregistered: 1 | ||
| 283 | * - Moderated: 2 | ||
| 284 | * - Password: 4 | ||
| 285 | * - Hierarchical: 8 | ||
| 286 | * - Default: 16 | ||
| 287 | * \return Channel flags. | ||
| 288 | */ | ||
| 289 | wxUint16 GetFlags() const | ||
| 290 | { | ||
| 291 | return m_Flags; | ||
| 292 | } | ||
| 293 | |||
| 294 | /*! Gets the channel flags. | ||
| 295 | * - Unregistered: 1 | ||
| 296 | * - Moderated: 2 | ||
| 297 | * - Password: 4 | ||
| 298 | * - Hierarchical: 8 | ||
| 299 | * - Default: 16 | ||
| 300 | * \return Channel flags. | ||
| 301 | */ | ||
| 302 | wxString const GetFlagsString() const | ||
| 303 | { | ||
| 304 | wxString str; | ||
| 305 | if((m_Flags &TS_MODERATE)) | ||
| 306 | str += _T("M"); | ||
| 307 | if((m_Flags &TS_DEFAULT)) | ||
| 308 | str += _T("D"); | ||
| 309 | if((m_Flags &TS_HIERARCHICAL)) | ||
| 310 | str += _T("S"); | ||
| 311 | if((m_Flags &TS_PASSWORD)) | ||
| 312 | str += _T("P"); | ||
| 313 | if(!(m_Flags &TS_UNREGISTRED)) | ||
| 314 | str += _T("R"); | ||
| 315 | return str; | ||
| 316 | } | ||
| 317 | /*! Gets the channel max users. | ||
| 318 | * \return Channel max users. | ||
| 319 | */ | ||
| 320 | wxUint16 GetMaxUsers() const | ||
| 321 | { | ||
| 322 | return m_MaxUsers; | ||
| 323 | } | ||
| 324 | |||
| 325 | /*! Gets the channel user count. | ||
| 326 | * \return Channel user count. | ||
| 327 | */ | ||
| 328 | wxUint16 GetUsers() const | ||
| 329 | { | ||
| 330 | return m_Users; | ||
| 331 | } | ||
| 332 | |||
| 333 | /*! Gets the LastError message, call this method | ||
| 334 | * to get more information for an error. | ||
| 335 | * \return LastError message. | ||
| 336 | */ | ||
| 337 | wxString const &GetLastError() const | ||
| 338 | { | ||
| 339 | return m_LastError; | ||
| 340 | } | ||
| 341 | |||
| 342 | /*! Dumps object. | ||
| 343 | * \param ostrm Stream to write. | ||
| 344 | */ | ||
| 345 | void Dump(wxOutputStream &ostrm) const; | ||
| 346 | |||
| 347 | |||
| 348 | private: | ||
| 349 | |||
| 350 | //Sets the LastError message. | ||
| 351 | void SetLastError(wxString const &str) | ||
| 352 | { | ||
| 353 | m_LastError = str; | ||
| 354 | } | ||
| 355 | |||
| 356 | //members | ||
| 357 | wxUint32 m_Id; | ||
| 358 | wxString m_Name; | ||
| 359 | wxString m_Topic; | ||
| 360 | wxString m_Description; | ||
| 361 | wxString m_Password; | ||
| 362 | wxUint32 m_Parent; | ||
| 363 | wxUint16 m_Codec; | ||
| 364 | wxUint16 m_Order; | ||
| 365 | wxUint16 m_Flags; | ||
| 366 | wxUint16 m_MaxUsers; | ||
| 367 | wxUint16 m_Users; | ||
| 368 | wxString m_LastError; | ||
| 369 | }; | ||
| 370 | |||
| 371 | #endif | ||
