Some updates

This commit is contained in:
WolverinDEV 2020-09-24 22:57:10 +02:00
parent f5d5766644
commit bd7ff3e4e0
3 changed files with 21 additions and 1 deletions

@ -1 +1 @@
Subproject commit a1530bc0ffa4566d4d601ada07a33fd8ea9f7078
Subproject commit 807c4ac88d8523a1aad2572b012046b112020df6

View File

@ -6,6 +6,7 @@
#include <regex>
#include <src/build.h>
#include <Properties.h>
#include <src/client/command_handler/helpers.h>
#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<property::ClientProperties>(key);

View File

@ -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()) {