summaryrefslogtreecommitdiffstats
path: root/tsserver.h
blob: dc3b1fde14918d3078e68fd93fce9501c0329314 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
/*
 * 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 TSSERVER_H
#define TSSERVER_H

// Libraries
#include <wx/wx.h>

//------------------------------------------------------------------------------
// Server flags
#define TS_SERVER_CLAN    5
#define TS_SERVER_PUBLIC  6

//! TeamSpeak server.
/*! TSServer is used to hold all server informations.
 *  After calling TSClient::Connect(), you can read
 *  out all the servers 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::GetServer()
 *  - Now the class is filled up with the server information
 */
class TSServer : public wxObject
{
  DECLARE_CLASS(TSServer)
  public:
   /*! Default CTor, Initializes the object.
    */
    TSServer();

   /*! Default DTor.
    */
    ~TSServer();

   /*! Sets the server message.
    *  \param str Server message string.
    *  \return Returns false if fails, check GetLastError for details.
    *  \sa GetLastError()
    */
    bool SetServerMessage(wxString const &str);

   /*! Sets the welcome message.
    *  \param str Welcome message string.
    *  \return Returns false if fails, check GetLastError for details.
    *  \sa GetLastError()
    */
    bool SetWelcomeMessage(wxString const &str);

   /*! Sets the platform string.
    *  \param str Platform string.
    *  \return Returns false if fails, check GetLastError for details.
    *  \sa GetLastError()
    */
    bool SetPlatform(wxString const &str);

   /*! Sets the server message.
    *  \param str Server message string.
    *  \return Returns false if fails, check GetLastError for details.
    *  \sa GetLastError()
    */
    bool SetVersionNumber(wxString const &str);

   /*! Sets the host address, bindes the client to an address.
    *  You can use either an IP or an URL.
    *  \param str Host address string.
    *  \return Returns false if fails, check GetLastError for details.
    *  \sa GetLastError()
    */
    bool SetHostAddress(wxString const &str);

   /*! Sets the server address.
    *  You can use either an IP or an URL.
    *  \param str Server address string.
    *  \return Returns false if fails, check GetLastError for details.
    *  \sa GetLastError()
    */
    bool SetServerAddress(wxString const &str);

   /*! Sets the server Id.
    *  \param id Server Id.
    *  \return Returns false if fails, check GetLastError for details.
    *  \sa GetLastError()
    */
    bool SetId(wxUint32 const &id);

   /*! Sets the connection port.
    *  \param port Connection port.
    *  \return Returns false if fails, check GetLastError for details.
    *  \sa GetLastError()
    */
    bool SetPort(wxUint16 const &port);

   /*! Sets the server type
    *  \param type Server type.
    *  \return Returns false if fails, check GetLastError for details.
    *  \sa GetLastError()
    */
    bool SetServerType(wxUint16 const &type);

   /*! Gets the server Id.
    *  \return server Id.
    */
    wxUint32 GetId() const
    {
      return m_Id;
    }

   /*! Gets the server port.
    *  \return server port.
    */
    wxUint16 GetPort() const
    {
      return m_Port;
    }

   /*! Gets the server type.
    *  \return server type.
    */
    wxUint32 GetType() const
    {
      return m_Type;
    }

   /*! Gets the server version number.
    *  \return server version number.
    */
    wxString const &GetVersionNumber() const
    {
      return m_VersionNumber;
    }

   /*! Gets the server welcome message.
    *  \return server welcome message.
    */
    wxString const &GetWelcomeMessage() const
    {
      return m_WelcomeMessage;
    }

   /*! Gets the server server message.
    *  \return server server message.
    */
    wxString const &GetServerMessage() const
    {
      return m_ServerMessage;
    }

   /*! Gets the server platform.
    *  \return server platform.
    */
    wxString const &GetPlatform() const
    {
      return m_Platform;
    }

   /*! Gets the server ISPLinkURL.
    *  \return server ISPLinkURL.
    */
    wxString const &GetISPLinkURL() const
    {
      return m_ISPLinkURL;
    }

   /*! Gets the server address.
    *  \return server address.
    */
    wxString const &GetServerAddress() const
    {
      return m_ServerAddress;
    }

   /*! Gets the host address.
    *  \return host address.
    */
    wxString const &GetHostAddress() const
    {
      return m_HostAddress;
    }

   /*! Gets the server type.
    *  \return server type.
    */
    wxUint16 const &GetServerType() const
    {
      return m_ServerType;
    }

   /*! 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;
    wxString m_VersionNumber;
    wxString m_WelcomeMessage;
    wxString m_ServerMessage;
    wxString m_Platform;
    wxUint32 m_Type;
    wxString m_ISPLinkURL;
    wxString m_ServerAddress;
    wxString m_HostAddress;
    wxString m_LastError;
    wxUint16 m_Port;
    wxUint16 m_ServerType;
};

#endif