1 /*****************************************************************************
2  * PokerTH - The open source texas holdem engine                             *
3  * Copyright (C) 2006-2012 Felix Hammer, Florian Thauer, Lothar May          *
4  *                                                                           *
5  * This program is free software: you can redistribute it and/or modify      *
6  * it under the terms of the GNU Affero General Public License as            *
7  * published by the Free Software Foundation, either version 3 of the        *
8  * License, or (at your option) any later version.                           *
9  *                                                                           *
10  * This program is distributed in the hope that it will be useful,           *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of            *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             *
13  * GNU Affero General Public License for more details.                       *
14  *                                                                           *
15  * You should have received a copy of the GNU Affero General Public License  *
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.     *
17  *                                                                           *
18  *                                                                           *
19  * Additional permission under GNU AGPL version 3 section 7                  *
20  *                                                                           *
21  * If you modify this program, or any covered work, by linking or            *
22  * combining it with the OpenSSL project's OpenSSL library (or a             *
23  * modified version of that library), containing parts covered by the        *
24  * terms of the OpenSSL or SSLeay licenses, the authors of PokerTH           *
25  * (Felix Hammer, Florian Thauer, Lothar May) grant you additional           *
26  * permission to convey the resulting work.                                  *
27  * Corresponding Source for a non-source form of such a combination          *
28  * shall include the source code for the parts of OpenSSL used as well       *
29  * as that of the covered work.                                              *
30  *****************************************************************************/
31 /* Callback interface for network client gui. */
32 
33 #ifndef _CLIENTCALLBACK_H_
34 #define _CLIENTCALLBACK_H_
35 
36 #include <boost/shared_ptr.hpp>
37 #include <string>
38 
39 #include <game_defs.h>
40 #include <gamedata.h>
41 #include <serverdata.h>
42 
43 class Game;
44 
45 class ClientCallback
46 {
47 public:
48 	virtual ~ClientCallback();
49 
50 	virtual void SignalNetClientConnect(int actionID) = 0;
51 	virtual void SignalNetClientGameInfo(int actionID) = 0;
52 	virtual void SignalNetClientError(int errorID, int osErrorID) = 0;
53 	virtual void SignalNetClientNotification(int notificationId) = 0;
54 	virtual void SignalNetClientStatsUpdate(const ServerStats &stats) = 0;
55 	virtual void SignalNetClientPingUpdate(unsigned minPing, unsigned avgPing, unsigned maxPing) = 0;
56 	virtual void SignalNetClientShowTimeoutDialog(NetTimeoutReason reason, unsigned remainingSec) = 0;
57 	virtual void SignalNetClientRemovedFromGame(int notificationId) = 0;
58 
59 	virtual void SignalNetClientGameListNew(unsigned gameId) = 0;
60 	virtual void SignalNetClientGameListRemove(unsigned gameId) = 0;
61 	virtual void SignalNetClientGameListUpdateMode(unsigned gameId, GameMode mode) = 0;
62 	virtual void SignalNetClientGameListUpdateAdmin(unsigned gameId, unsigned adminPlayerId) = 0;
63 	virtual void SignalNetClientGameListPlayerJoined(unsigned gameId, unsigned playerId) = 0;
64 	virtual void SignalNetClientGameListPlayerLeft(unsigned gameId, unsigned playerId) = 0;
65 	virtual void SignalNetClientGameListSpectatorJoined(unsigned gameId, unsigned playerId) = 0;
66 	virtual void SignalNetClientGameListSpectatorLeft(unsigned gameId, unsigned playerId) = 0;
67 
68 	virtual void SignalNetClientGameStart(boost::shared_ptr<Game> game) = 0;
69 	virtual void SignalNetClientSelfJoined(unsigned playerId, const std::string &playerName, bool isGameAdmin) = 0;
70 	virtual void SignalNetClientPlayerJoined(unsigned playerId, const std::string &playerName, bool isGameAdmin) = 0;
71 	virtual void SignalNetClientPlayerChanged(unsigned playerId, const std::string &newPlayerName) = 0;
72 	virtual void SignalNetClientPlayerLeft(unsigned playerId, const std::string &playerName, int removeReason) = 0;
73 	virtual void SignalNetClientSpectatorJoined(unsigned playerId, const std::string &playerName) = 0;
74 	virtual void SignalNetClientSpectatorLeft(unsigned playerId, const std::string &playerName, int removeReason) = 0;
75 	virtual void SignalNetClientNewGameAdmin(unsigned playerId, const std::string &playerName) = 0;
76 
77 	virtual void SignalNetClientGameChatMsg(const std::string &playerName, const std::string &msg) = 0;
78 	virtual void SignalNetClientLobbyChatMsg(const std::string &playerName, const std::string &msg) = 0;
79 	virtual void SignalNetClientPrivateChatMsg(const std::string &playerName, const std::string &msg) = 0;
80 	virtual void SignalNetClientMsgBox(const std::string &msg) = 0;
81 	virtual void SignalNetClientMsgBox(unsigned msgId) = 0;
82 	virtual void SignalNetClientWaitDialog() = 0;
83 
84 	virtual void SignalNetClientServerListAdd(unsigned serverId) = 0;
85 	virtual void SignalNetClientServerListClear() = 0;
86 	virtual void SignalNetClientServerListShow() = 0;
87 
88 	virtual void SignalNetClientLoginShow() = 0;
89 	virtual void SignalNetClientRejoinPossible(unsigned gameId) = 0;
90 	virtual void SignalNetClientPostRiverShowCards(unsigned playerId) = 0;
91 
92 	virtual void SignalLobbyPlayerJoined(unsigned playerId, const std::string &nickName) = 0;
93 	virtual void SignalLobbyPlayerKicked(const std::string &nickName, const std::string &byWhom, const std::string &reason) = 0;
94 	virtual void SignalLobbyPlayerLeft(unsigned playerId) = 0;
95 
96 	virtual void SignalSelfGameInvitation(unsigned gameId, unsigned playerIdFrom) = 0;
97 	virtual void SignalPlayerGameInvitation(unsigned gameId, unsigned playerIdWho, unsigned playerIdFrom) = 0;
98 	virtual void SignalRejectedGameInvitation(unsigned gameId, unsigned playerIdWho, DenyGameInvitationReason reason) = 0;
99 };
100 
101 #endif
102