summaryrefslogtreecommitdiff
path: root/src/player.h
diff options
context:
space:
mode:
authorLoic Blot <loic.blot@unix-experience.fr>2016-10-04 18:17:12 +0200
committerLoic Blot <loic.blot@unix-experience.fr>2016-10-05 00:13:37 +0200
commitd4c76258e37337ea585cf24d8e05b50a30fa307d (patch)
tree6936b8f843171843008743e1341fe431222eec82 /src/player.h
parent1079aeaa13a94c67c1e0a0bd1c461e14841a1eec (diff)
downloadminetest-d4c76258e37337ea585cf24d8e05b50a30fa307d.tar.gz
minetest-d4c76258e37337ea585cf24d8e05b50a30fa307d.tar.bz2
minetest-d4c76258e37337ea585cf24d8e05b50a30fa307d.zip
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
Diffstat (limited to 'src/player.h')
-rw-r--r--src/player.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/player.h b/src/player.h
index eab00bb04..f38effa9d 100644
--- a/src/player.h
+++ b/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