summaryrefslogtreecommitdiff
path: root/src/network/core/tcp_admin.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-10-17 17:40:18 +0000
committerrubidium <rubidium@openttd.org>2010-10-17 17:40:18 +0000
commitd9602f4ef936b79c1d1ee785477323618e46f9cf (patch)
tree1420d0f86e4559de83ab250a109d2c7f7bca5f53 /src/network/core/tcp_admin.h
parent459514afe4f550a08d98958745d6cd8311c53fdd (diff)
downloadopenttd-d9602f4ef936b79c1d1ee785477323618e46f9cf.tar.xz
(svn r20973) -Add: chat sending and receiving support for remote admins (dihedral)
Diffstat (limited to 'src/network/core/tcp_admin.h')
-rw-r--r--src/network/core/tcp_admin.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/network/core/tcp_admin.h b/src/network/core/tcp_admin.h
index 15f3ba0a7..e73d0202e 100644
--- a/src/network/core/tcp_admin.h
+++ b/src/network/core/tcp_admin.h
@@ -30,6 +30,7 @@ enum PacketAdminType {
ADMIN_PACKET_ADMIN_QUIT, ///< The admin tells the server that it is quitting.
ADMIN_PACKET_ADMIN_UPDATE_FREQUENCY, ///< The admin tells the server the update frequency of a particular piece of information.
ADMIN_PACKET_ADMIN_POLL, ///< The admin explicitly polls for a piece of information.
+ ADMIN_PACKET_ADMIN_CHAT, ///< The admin sends a chat message to be distributed.
ADMIN_PACKET_SERVER_FULL = 100, ///< The server tells the admin it cannot accept the admin.
ADMIN_PACKET_SERVER_BANNED, ///< The server tells the admin it is banned.
@@ -51,6 +52,7 @@ enum PacketAdminType {
ADMIN_PACKET_SERVER_COMPANY_REMOVE, ///< The server tells the admin that a company was removed.
ADMIN_PACKET_SERVER_COMPANY_ECONOMY, ///< The server gives the admin some economy related company information.
ADMIN_PACKET_SERVER_COMPANY_STATS, ///< The server gives the admin some statistics about a company.
+ ADMIN_PACKET_SERVER_CHAT, ///< The server received a chat message and relays it.
INVALID_ADMIN_PACKET = 0xFF, ///< An invalid marker for admin packets.
};
@@ -69,6 +71,7 @@ enum AdminUpdateType {
ADMIN_UPDATE_COMPANY_INFO, ///< Updates about the generic information of companies.
ADMIN_UPDATE_COMPANY_ECONOMY, ///< Updates about the economy of companies.
ADMIN_UPDATE_COMPANY_STATS, ///< Updates about the statistics of companies.
+ ADMIN_UPDATE_CHAT, ///< The admin would like to have chat messages.
ADMIN_UPDATE_END ///< Must ALWAYS be on the end of this list!! (period)
};
@@ -131,6 +134,15 @@ protected:
DECLARE_ADMIN_RECEIVE_COMMAND(ADMIN_PACKET_ADMIN_POLL);
/**
+ * Send chat as the server:
+ * uint8 Action such as NETWORK_ACTION_CHAT_CLIENT (see #NetworkAction).
+ * uint8 Destination type such as DESTTYPE_BROADCAST (see #DestType).
+ * uint32 ID of the destination such as company or client id.
+ * string Message.
+ */
+ DECLARE_ADMIN_RECEIVE_COMMAND(ADMIN_PACKET_ADMIN_CHAT);
+
+ /**
* The server is full (connection gets closed).
*/
DECLARE_ADMIN_RECEIVE_COMMAND(ADMIN_PACKET_SERVER_FULL);
@@ -294,6 +306,16 @@ protected:
*/
DECLARE_ADMIN_RECEIVE_COMMAND(ADMIN_PACKET_SERVER_COMPANY_STATS);
+ /**
+ * Send chat from the game into the admin network:
+ * uint8 Action such as NETWORK_ACTION_CHAT_CLIENT (see #NetworkAction).
+ * uint8 Destination type such as DESTTYPE_BROADCAST (see #DestType).
+ * uint32 ID of the client who sent this message.
+ * string Message.
+ * uint64 Money (only when it is a 'give money' action).
+ */
+ DECLARE_ADMIN_RECEIVE_COMMAND(ADMIN_PACKET_SERVER_CHAT);
+
NetworkRecvStatus HandlePacket(Packet *p);
public:
NetworkRecvStatus CloseConnection(bool error = true);