mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-27 17:28:41 +00: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:
parent
1079aeaa13
commit
d4c76258e3
8 changed files with 125 additions and 11 deletions
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue