summaryrefslogtreecommitdiff
path: root/src/client.h
diff options
context:
space:
mode:
authorPierre-Adrien Langrognet <upsilon@langg.net>2017-05-21 23:06:51 +0200
committerLoïc Blot <nerzhul@users.noreply.github.com>2017-05-21 23:06:51 +0200
commit39f4a2f607d44738d60db84eba4b30e3d7450204 (patch)
tree63a72301d3c53917b99fe0607f48219372f85b6f /src/client.h
parentec490abf5889e06c88887e17f1746043de3b10fe (diff)
downloadminetest-39f4a2f607d44738d60db84eba4b30e3d7450204.tar.gz
minetest-39f4a2f607d44738d60db84eba4b30e3d7450204.tar.bz2
minetest-39f4a2f607d44738d60db84eba4b30e3d7450204.zip
[CSM] Add send_chat_message and run_server_chatcommand API functions (#5747)
* [CSM] Add send_chat_message and run_server_chatcommand API functions * Add client-side chat message rate limiting * Limit out chat queue size * [CSM] Add minetest.clear_out_chat_queue API function and .clear_chat_queue chatcommand * Last fixes/cleanups before merge
Diffstat (limited to 'src/client.h')
-rw-r--r--src/client.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/client.h b/src/client.h
index cc0d4699d..b4145c76f 100644
--- a/src/client.h
+++ b/src/client.h
@@ -38,6 +38,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "tileanimation.h"
#include "mesh_generator_thread.h"
+#define CLIENT_CHAT_MESSAGE_LIMIT_PER_10S 10.0f
+
struct MeshMakeData;
class MapBlockMesh;
class IWritableTextureSource;
@@ -360,6 +362,7 @@ public:
const StringMap &fields);
void sendInventoryAction(InventoryAction *a);
void sendChatMessage(const std::wstring &message);
+ void clearOutChatQueue();
void sendChangePassword(const std::string &oldpassword,
const std::string &newpassword);
void sendDamage(u8 damage);
@@ -565,6 +568,8 @@ private:
inline std::string getPlayerName()
{ return m_env.getLocalPlayer()->getName(); }
+ bool canSendChatMessage() const;
+
float m_packetcounter_timer;
float m_connection_reinit_timer;
float m_avg_rtt_timer;
@@ -612,6 +617,9 @@ private:
//s32 m_daynight_i;
//u32 m_daynight_ratio;
std::queue<std::wstring> m_chat_queue;
+ std::queue<std::wstring> m_out_chat_queue;
+ u32 m_last_chat_message_sent;
+ float m_chat_message_allowance;
// The authentication methods we can use to enter sudo mode (=change password)
u32 m_sudo_auth_methods;