mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-15 17:35:37 +02:00
Chat: new settings to prevent spam
Added the following chat coreside features * Chat messages length limit * Message rate limiting * Message rate kicking Note: * handleChat now takes RemotePlayer pointer instead of u16 to remove useless lookups
This commit is contained in:
16
src/player.h
16
src/player.h
@@ -439,7 +439,11 @@ private:
|
||||
Mutex m_mutex;
|
||||
};
|
||||
|
||||
|
||||
enum RemotePlayerChatResult {
|
||||
RPLAYER_CHATRESULT_OK,
|
||||
RPLAYER_CHATRESULT_FLOODING,
|
||||
RPLAYER_CHATRESULT_KICK,
|
||||
};
|
||||
/*
|
||||
Player on the server
|
||||
*/
|
||||
@@ -457,8 +461,18 @@ public:
|
||||
{ m_sao = sao; }
|
||||
void setPosition(const v3f &position);
|
||||
|
||||
const RemotePlayerChatResult canSendChatMessage();
|
||||
|
||||
private:
|
||||
PlayerSAO *m_sao;
|
||||
|
||||
static bool m_setting_cache_loaded;
|
||||
static float m_setting_chat_message_limit_per_10sec;
|
||||
static u16 m_setting_chat_message_limit_trigger_kick;
|
||||
|
||||
u32 m_last_chat_message_sent;
|
||||
float m_chat_message_allowance;
|
||||
u16 m_message_rate_overhead;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user