From bd7ff3e4e0eb81b8710ee87325d43c7e045814eb Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Thu, 24 Sep 2020 22:57:10 +0200 Subject: [PATCH] Some updates --- git-teaspeak | 2 +- server/src/client/SpeakingClient.cpp | 9 +++++++++ server/src/client/command_handler/client.cpp | 11 +++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/git-teaspeak b/git-teaspeak index a1530bc..807c4ac 160000 --- a/git-teaspeak +++ b/git-teaspeak @@ -1 +1 @@ -Subproject commit a1530bc0ffa4566d4d601ada07a33fd8ea9f7078 +Subproject commit 807c4ac88d8523a1aad2572b012046b112020df6 diff --git a/server/src/client/SpeakingClient.cpp b/server/src/client/SpeakingClient.cpp index e72cbb0..dc861b8 100644 --- a/server/src/client/SpeakingClient.cpp +++ b/server/src/client/SpeakingClient.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include "src/channel/ClientChannelView.h" #include "SpeakingClient.h" #include "src/InstanceHandler.h" @@ -536,6 +537,14 @@ command_result SpeakingClient::handleCommandClientInit(Command& cmd) { } else if(key == "client_away_message") { if(cmd["client_away_message"].string().length() > ts::config::server::limits::afk_message_length) return command_result{error::parameter_invalid_size, "client_away_message"}; + } else if(key == "client_nickname_phonetic") { + auto name = cmd["client_away_message"].string(); + if (count_characters(name) < 3) return command_result{error::parameter_invalid, "client_nickname_phonetic"}; + if (count_characters(name) > 30) return command_result{error::parameter_invalid, "client_nickname_phonetic"}; + } else if(key == "client_nickname") { + auto name = cmd["client_nickname"].string(); + if (count_characters(name) < 3) return command_result{error::parameter_invalid, "client_nickname"}; + if (count_characters(name) > 30) return command_result{error::parameter_invalid, "client_nickname"}; } const auto &info = property::find(key); diff --git a/server/src/client/command_handler/client.cpp b/server/src/client/command_handler/client.cpp index f24089d..f182bb6 100644 --- a/server/src/client/command_handler/client.cpp +++ b/server/src/client/command_handler/client.cpp @@ -543,6 +543,17 @@ command_result ConnectedClient::handleCommandClientEdit(Command &cmd, const std: continue; } } + } else if(info == property::CLIENT_NICKNAME_PHONETIC) { + if(!self) { + if(client->getType() != ClientType::CLIENT_MUSIC) return command_result{error::client_invalid_type}; + if(client->properties()[property::CLIENT_OWNER] != this->getClientDatabaseId()) { + ACTION_REQUIRES_PERMISSION(permission::i_client_music_rename_power, client->calculate_permission(permission::i_client_music_needed_rename_power, client->getChannelId()), client->getChannelId()); + } + } + + string name = cmd["client_nickname_phonetic"].string(); + if (count_characters(name) < 3) return command_result{error::parameter_invalid, "Invalid name length. A minimum of 3 characters is required!"}; + if (count_characters(name) > 30) return command_result{error::parameter_invalid, "Invalid name length. A maximum of 30 characters is allowed!"}; } else if(info == property::CLIENT_PLAYER_VOLUME) { if(client->getType() != ClientType::CLIENT_MUSIC) return command_result{error::client_invalid_type}; if(client->properties()[property::CLIENT_OWNER] != this->getClientDatabaseId()) {