Fixed some too long messages

This commit is contained in:
WolverinDEV
2020-07-30 11:50:31 +02:00
parent 3f700e79d3
commit 1e0c9eabe3
4 changed files with 17 additions and 4 deletions
+9 -2
View File
@@ -323,8 +323,12 @@ command_result ConnectedClient::handleCommandClientPoke(Command &cmd) {
return command_result{permission::i_client_poke_max_clients};
}
auto message = cmd["msg"].string();
if(count_characters(message) > 100)
return command_result{error::parameter_invalid_size, "msg"};
for(auto& client : clients)
client->notifyClientPoke(_this.lock(), cmd["msg"]);
client->notifyClientPoke(_this.lock(), message);
return command_result{std::forward<command_result_bulk>(result)};
}
@@ -697,10 +701,13 @@ command_result ConnectedClient::handleCommandClientEdit(Command &cmd, const std:
} else if(info == property::CLIENT_AWAY_MESSAGE) {
if(!self) continue;
if(cmd["client_away_message"].string().length() > 256)
if(cmd["client_away_message"].string().length() > ts::kMaxAfkMessageLength)
return command_result{error::parameter_invalid};
} else if(!self) { /* dont edit random properties of other clients. For us self its allowed to edit the rest without permissions */
continue;
} else if(info == property::CLIENT_TALK_REQUEST_MSG) {
if(cmd["client_talk_request_msg"].string().length() > ts::kMaxRequestTalkPowerMessageLength)
return command_result{error::parameter_invalid};
}
keys.emplace_back(&info, key);