|
1 /* |
|
2 * Hedgewars, a worms-like game |
|
3 * Copyright (c) 2006 Igor Ulyanov <iulyanov@gmail.com> |
|
4 * |
|
5 * This program is free software; you can redistribute it and/or modify |
|
6 * it under the terms of the GNU General Public License as published by |
|
7 * the Free Software Foundation; version 2 of the License |
|
8 * |
|
9 * This program is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 * GNU General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU General Public License |
|
15 * along with this program; if not, write to the Free Software |
|
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 */ |
|
18 |
|
19 #ifndef _HET_CONNECTEDCLIENT_INCLUDED |
|
20 #define _HET_CONNECTEDCLIENT_INCLUDED |
|
21 |
|
22 #include <QObject> |
|
23 #include <QList> |
|
24 #include <QMap> |
|
25 |
|
26 class HWNetServer; |
|
27 class QTcpSocket; |
|
28 class QTcpServer; |
|
29 |
|
30 class HWConnectedClient : public QObject |
|
31 { |
|
32 Q_OBJECT |
|
33 |
|
34 friend class HWNetServer; |
|
35 |
|
36 private: |
|
37 HWConnectedClient(HWNetServer* hwserver, QTcpSocket* client); |
|
38 ~HWConnectedClient(); |
|
39 QString getClientNick() const; |
|
40 |
|
41 QList<QStringList> getTeamNames() const; |
|
42 class NoTeamNameException{}; |
|
43 bool isReady() const; |
|
44 |
|
45 QString getHedgehogsDescription() const; |
|
46 |
|
47 bool readyToStart; |
|
48 QList<QStringList> m_teamsCfg; // TeamName - hhs |
|
49 class ShouldDisconnectException {}; |
|
50 |
|
51 QString client_nick; |
|
52 void ParseLine(const QByteArray & line); |
|
53 unsigned int removeTeam(const QString& tname); // returns netID |
|
54 |
|
55 HWNetServer* m_hwserver; |
|
56 QTcpSocket* m_client; |
|
57 |
|
58 void RawSendNet(const QString & buf); |
|
59 void RawSendNet(const QByteArray & buf); |
|
60 |
|
61 //QByteArray readbuffer; |
|
62 |
|
63 signals: |
|
64 void HWClientDisconnected(HWConnectedClient* client); |
|
65 |
|
66 private slots: |
|
67 void ClientRead(); |
|
68 void ClientDisconnect(); |
|
69 }; |
|
70 |
|
71 #endif // _HET_CONNECTEDCLIENT_INCLUDED |