From dcd55275b58cd6c238141abc907aece9b47b3ebd Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Sun, 28 Jul 2019 18:30:40 +0200 Subject: [PATCH] Some small changes --- server/src/client/ConnectedClientCommandHandler.cpp | 9 ++++++++- shared | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/server/src/client/ConnectedClientCommandHandler.cpp b/server/src/client/ConnectedClientCommandHandler.cpp index 1df4f19..f0e5bde 100644 --- a/server/src/client/ConnectedClientCommandHandler.cpp +++ b/server/src/client/ConnectedClientCommandHandler.cpp @@ -3251,7 +3251,6 @@ CommandResult ConnectedClient::handleCommandSendTextMessage(Command &cmd) { target->notifyTextMessage(ChatMessageMode::TEXTMODE_PRIVATE, _this.lock(), target->getClientId(), 0, cmd["msg"].string()); this->notifyTextMessage(ChatMessageMode::TEXTMODE_PRIVATE, _this.lock(), target->getClientId(), 0, cmd["msg"].string()); } else if (cmd["targetmode"] == ChatMessageMode::TEXTMODE_CHANNEL) { - CACHED_PERM_CHECK(permission::b_client_channel_textmessage_send, 1, false); if(!cmd[0].has("cid")) cmd["cid"] = 0; RESOLVE_CHANNEL_R(cmd["cid"], false); @@ -3265,6 +3264,13 @@ CommandResult ConnectedClient::handleCommandSendTextMessage(Command &cmd) { return CommandResult::Success; } + if(!this->permissionGranted(permission::PERMTEST_ORDERED, permission::b_client_channel_textmessage_send, 1, channel, false)) + return CommandResultPermissionError{permission::b_client_channel_textmessage_send}; + if(channel != this->currentChannel) { + if(!this->calculate_and_get_join_state(channel)) + return CommandResultPermissionError{permission::unknown}; /* You're not allowed to send messages :) */ + } + auto message = cmd["msg"].string(); auto _this = this->_this.lock(); auto client_id = this->getClientId(); @@ -3401,6 +3407,7 @@ CommandResult ConnectedClient::handleCommandFTGetFileList(Command &cmd) { this->sendCommand(fileListFinished); } else { this->sendCommand(fileList); + this->sendCommand(fileListFinished); } return CommandResult::Success; } else { diff --git a/shared b/shared index 9f2181c..290b915 160000 --- a/shared +++ b/shared @@ -1 +1 @@ -Subproject commit 9f2181c18b4579de2957347c3b788f81a4de987a +Subproject commit 290b915074eb27e33901a0a7bd6808220a6e60eb