From 8dbcfde31412ce5d2ae5b01e780344e81962ccf7 Mon Sep 17 00:00:00 2001 From: Ryan Stecker <ryan@stecker.email> Date: Thu, 15 Jan 2015 13:32:54 -0600 Subject: [PATCH 1/2] Revert "Use BfRead tag in umsg hook typedef, rather than a generic Handle." This reverts commit 89119880b5423e612bc8136bd1a25d2c9d025e0f. --- plugins/include/usermessages.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/include/usermessages.inc b/plugins/include/usermessages.inc index 2e90ed1a..d2bbfedb 100644 --- a/plugins/include/usermessages.inc +++ b/plugins/include/usermessages.inc @@ -163,7 +163,7 @@ native EndMessage(); * blocks the message from being sent, and Plugin_Continue * resumes normal functionality. */ -typedef MsgHook = function Action (UserMsg msg_id, BfRead msg, const int[] players, int playersNum, bool reliable, bool init); +typedef MsgHook = function Action (UserMsg msg_id, Handle msg, const int[] players, int playersNum, bool reliable, bool init); /** * Called when a message hook has completed. From 2516654d2ecfab336a141846e49e89f4e184aab8 Mon Sep 17 00:00:00 2001 From: Ryan Stecker <ryan@stecker.email> Date: Thu, 15 Jan 2015 13:40:21 -0600 Subject: [PATCH 2/2] Use BfRead or Protobuf tags in umsg hook callbacks, rather than a generic Handle. --- plugins/include/usermessages.inc | 46 +++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/plugins/include/usermessages.inc b/plugins/include/usermessages.inc index d2bbfedb..7445c0b9 100644 --- a/plugins/include/usermessages.inc +++ b/plugins/include/usermessages.inc @@ -151,19 +151,39 @@ native Handle:StartMessageEx(UserMsg:msg, clients[], numClients, flags=0); native EndMessage(); /** - * Called when a message is hooked - * - * @param msg_id Message index. - * @param msg Handle to the input bit buffer or protobuf. - * @param players Array containing player indexes. - * @param playersNum Number of players in the array. - * @param reliable True if message is reliable, false otherwise. - * @param init True if message is an initmsg, false otherwise. - * @return Ignored for normal hooks. For intercept hooks, Plugin_Handled - * blocks the message from being sent, and Plugin_Continue - * resumes normal functionality. - */ -typedef MsgHook = function Action (UserMsg msg_id, Handle msg, const int[] players, int playersNum, bool reliable, bool init); + * Hook function types for user messages. +*/ +typeset MsgHook +{ + /** + * Called when a bit buffer based usermessage is hooked + * + * @param msg_id Message index. + * @param msg Handle to the input bit buffer. + * @param players Array containing player indexes. + * @param playersNum Number of players in the array. + * @param reliable True if message is reliable, false otherwise. + * @param init True if message is an initmsg, false otherwise. + * @return Ignored for normal hooks. For intercept hooks, Plugin_Handled + * blocks the message from being sent, and Plugin_Continue + * resumes normal functionality. + */ + function Action (UserMsg msg_id, BfRead msg, const int[] players, int playersNum, bool reliable, bool init); + /** + * Called when a protobuf based usermessage is hooked + * + * @param msg_id Message index. + * @param msg Handle to the input protobuf. + * @param players Array containing player indexes. + * @param playersNum Number of players in the array. + * @param reliable True if message is reliable, false otherwise. + * @param init True if message is an initmsg, false otherwise. + * @return Ignored for normal hooks. For intercept hooks, Plugin_Handled + * blocks the message from being sent, and Plugin_Continue + * resumes normal functionality. + */ + function Action (UserMsg msg_id, Protobuf msg, const int[] players, int playersNum, bool reliable, bool init); +}; /** * Called when a message hook has completed.