@@ -2790,40 +2790,41 @@ std::wstring Server::handleChat(const std::string &name, const std::wstring &wna
2790
2790
RollbackScopeActor rollback_scope (m_rollback,
2791
2791
std::string (" player:" ) + name);
2792
2792
2793
- // Line to send
2794
- std::wstring line;
2795
- // Whether to send line to the player that sent the message, or to all players
2796
- bool broadcast_line = true ;
2797
-
2798
- // Run script hook
2799
- bool ate = m_script->on_chat_message (name,
2800
- wide_to_utf8 (wmessage));
2801
- // If script ate the message, don't proceed
2802
- if (ate)
2803
- return L" " ;
2804
-
2805
2793
if (player) {
2806
2794
switch (player->canSendChatMessage ()) {
2807
2795
case RPLAYER_CHATRESULT_FLOODING: {
2808
2796
std::wstringstream ws;
2809
2797
ws << L" You cannot send more messages. You are limited to "
2810
- << g_settings->getFloat (" chat_message_limit_per_10sec" )
2811
- << L" messages per 10 seconds." ;
2798
+ << g_settings->getFloat (" chat_message_limit_per_10sec" )
2799
+ << L" messages per 10 seconds." ;
2812
2800
return ws.str ();
2813
2801
}
2814
2802
case RPLAYER_CHATRESULT_KICK:
2815
- DenyAccess_Legacy (player->peer_id , L" You have been kicked due to message flooding." );
2803
+ DenyAccess_Legacy (player->peer_id ,
2804
+ L" You have been kicked due to message flooding." );
2816
2805
return L" " ;
2817
- case RPLAYER_CHATRESULT_OK: break ;
2818
- default : FATAL_ERROR (" Unhandled chat filtering result found." );
2806
+ case RPLAYER_CHATRESULT_OK:
2807
+ break ;
2808
+ default :
2809
+ FATAL_ERROR (" Unhandled chat filtering result found." );
2819
2810
}
2820
2811
}
2821
2812
2822
- if (m_max_chatmessage_length > 0 && wmessage.length () > m_max_chatmessage_length) {
2813
+ if (m_max_chatmessage_length > 0
2814
+ && wmessage.length () > m_max_chatmessage_length) {
2823
2815
return L" Your message exceed the maximum chat message limit set on the server. "
2824
- L" It was refused. Send a shorter message" ;
2816
+ L" It was refused. Send a shorter message" ;
2825
2817
}
2826
2818
2819
+ // Run script hook, exit if script ate the chat message
2820
+ if (m_script->on_chat_message (name, wide_to_utf8 (wmessage)))
2821
+ return L" " ;
2822
+
2823
+ // Line to send
2824
+ std::wstring line;
2825
+ // Whether to send line to the player that sent the message, or to all players
2826
+ bool broadcast_line = true ;
2827
+
2827
2828
// Commands are implemented in Lua, so only catch invalid
2828
2829
// commands that were not "eaten" and send an error back
2829
2830
if (wmessage[0 ] == L' /' ) {
0 commit comments