Added messages
This commit is contained in:
parent
124844b9d4
commit
1a4a6721a1
@ -1 +1 @@
|
||||
Subproject commit d9aa18444b8f1322862d8c74123ab6d72b270592
|
||||
Subproject commit 46fd2354c3a900b7c8fe2712854bc4b332a0d10e
|
@ -52,8 +52,16 @@ bool config::server::badges::allow_overwolf;
|
||||
bool config::server::authentication::name;
|
||||
|
||||
bool config::server::clients::teamspeak;
|
||||
std::string config::server::clients::extra_welcome_message_teamspeak;
|
||||
config::server::clients::WelcomeMessageType config::server::clients::extra_welcome_message_type_teamspeak;
|
||||
|
||||
bool config::server::clients::teaweb;
|
||||
std::string config::server::clients::extra_welcome_message_teaweb;
|
||||
config::server::clients::WelcomeMessageType config::server::clients::extra_welcome_message_type_teaweb;
|
||||
|
||||
bool config::server::clients::teaspeak;
|
||||
std::string config::server::clients::extra_welcome_message_teaspeak;
|
||||
config::server::clients::WelcomeMessageType config::server::clients::extra_welcome_message_type_teaspeak;
|
||||
|
||||
uint16_t config::voice::default_voice_port;
|
||||
size_t config::voice::DefaultPuzzlePrecomputeSize;
|
||||
@ -1317,13 +1325,57 @@ std::deque<std::shared_ptr<EntryBinding>> config::create_bindings() {
|
||||
}
|
||||
}
|
||||
{
|
||||
using WelcomeMessageType = config::server::clients::WelcomeMessageType;
|
||||
BIND_GROUP(clients);
|
||||
|
||||
/* TeamSpeak */
|
||||
{
|
||||
CREATE_BINDING("teamspeak", FLAG_RELOADABLE);
|
||||
BIND_BOOL(config::server::clients::teamspeak, true);
|
||||
ADD_DESCRIPTION("Allow/disallow the TeamSpeak 3 client to join the server.");
|
||||
ADD_NOTE_RELOADABLE();
|
||||
}
|
||||
{
|
||||
CREATE_BINDING("teamspeak_message", FLAG_RELOADABLE);
|
||||
BIND_STRING(config::server::clients::extra_welcome_message_teamspeak, "");
|
||||
ADD_DESCRIPTION("Add an extra welcome message for TeamSpeak client users");
|
||||
ADD_NOTE_RELOADABLE();
|
||||
}
|
||||
{
|
||||
CREATE_BINDING("teamspeak_message_type", FLAG_RELOADABLE);
|
||||
BIND_INTEGRAL(config::server::clients::extra_welcome_message_type_teamspeak, WelcomeMessageType::WELCOME_MESSAGE_TYPE_NONE, WelcomeMessageType::WELCOME_MESSAGE_TYPE_MIN, WelcomeMessageType::WELCOME_MESSAGE_TYPE_MAX);
|
||||
ADD_DESCRIPTION("The welcome message type modes");
|
||||
ADD_DESCRIPTION(std::to_string(WelcomeMessageType::WELCOME_MESSAGE_TYPE_NONE) + " - None, do nothing");
|
||||
ADD_DESCRIPTION(std::to_string(WelcomeMessageType::WELCOME_MESSAGE_TYPE_CHAT) + " - Message, sends this message before the server welcome message");
|
||||
ADD_DESCRIPTION(std::to_string(WelcomeMessageType::WELCOME_MESSAGE_TYPE_POKE) + " - Message, pokes the client with the message when he enters the server");
|
||||
ADD_NOTE_RELOADABLE();
|
||||
}
|
||||
|
||||
/* TeaSpeak */
|
||||
{
|
||||
CREATE_BINDING("teaspeak", FLAG_RELOADABLE);
|
||||
BIND_BOOL(config::server::clients::teaspeak, true);
|
||||
ADD_DESCRIPTION("Allow/disallow the TeaSpeak - Client to join the server.");
|
||||
ADD_NOTE_RELOADABLE();
|
||||
}
|
||||
{
|
||||
CREATE_BINDING("teaspeak_message", FLAG_RELOADABLE);
|
||||
BIND_STRING(config::server::clients::extra_welcome_message_teaspeak, "");
|
||||
ADD_DESCRIPTION("Add an extra welcome message for the TeaSpeak - Client users");
|
||||
ADD_NOTE_RELOADABLE();
|
||||
}
|
||||
{
|
||||
CREATE_BINDING("teaspeak_message_type", FLAG_RELOADABLE);
|
||||
BIND_INTEGRAL(config::server::clients::extra_welcome_message_type_teaspeak, WelcomeMessageType::WELCOME_MESSAGE_TYPE_NONE, WelcomeMessageType::WELCOME_MESSAGE_TYPE_MIN, WelcomeMessageType::WELCOME_MESSAGE_TYPE_MAX);
|
||||
ADD_DESCRIPTION("The welcome message type modes");
|
||||
ADD_DESCRIPTION(std::to_string(WelcomeMessageType::WELCOME_MESSAGE_TYPE_NONE) + " - None, do nothing");
|
||||
ADD_DESCRIPTION(std::to_string(WelcomeMessageType::WELCOME_MESSAGE_TYPE_CHAT) + " - Message, sends this message before the server welcome message");
|
||||
ADD_DESCRIPTION(std::to_string(WelcomeMessageType::WELCOME_MESSAGE_TYPE_POKE) + " - Message, pokes the client with the message when he enters the server");
|
||||
ADD_NOTE_RELOADABLE();
|
||||
}
|
||||
|
||||
|
||||
/* TeaWeb */
|
||||
{
|
||||
CREATE_BINDING("teaweb", FLAG_RELOADABLE);
|
||||
BIND_BOOL(config::server::clients::teaweb, true);
|
||||
@ -1331,9 +1383,18 @@ std::deque<std::shared_ptr<EntryBinding>> config::create_bindings() {
|
||||
ADD_NOTE_RELOADABLE();
|
||||
}
|
||||
{
|
||||
CREATE_BINDING("teaspeak", FLAG_RELOADABLE);
|
||||
BIND_BOOL(config::server::clients::teaspeak, true);
|
||||
ADD_DESCRIPTION("Allow/disallow the TeaSpeak - Client to join the server.");
|
||||
CREATE_BINDING("teaweb_message", FLAG_RELOADABLE);
|
||||
BIND_STRING(config::server::clients::extra_welcome_message_teaweb, "");
|
||||
ADD_DESCRIPTION("Add an extra welcome message for the TeaSpeak - Web client users");
|
||||
ADD_NOTE_RELOADABLE();
|
||||
}
|
||||
{
|
||||
CREATE_BINDING("teaweb_message_type", FLAG_RELOADABLE);
|
||||
BIND_INTEGRAL(config::server::clients::extra_welcome_message_type_teaweb, WelcomeMessageType::WELCOME_MESSAGE_TYPE_NONE, WelcomeMessageType::WELCOME_MESSAGE_TYPE_MIN, WelcomeMessageType::WELCOME_MESSAGE_TYPE_MAX);
|
||||
ADD_DESCRIPTION("The welcome message type modes");
|
||||
ADD_DESCRIPTION(std::to_string(WelcomeMessageType::WELCOME_MESSAGE_TYPE_NONE) + " - None, do nothing");
|
||||
ADD_DESCRIPTION(std::to_string(WelcomeMessageType::WELCOME_MESSAGE_TYPE_CHAT) + " - Message, sends this message before the server welcome message");
|
||||
ADD_DESCRIPTION(std::to_string(WelcomeMessageType::WELCOME_MESSAGE_TYPE_POKE) + " - Message, pokes the client with the message when he enters the server");
|
||||
ADD_NOTE_RELOADABLE();
|
||||
}
|
||||
}
|
||||
|
@ -86,9 +86,25 @@ namespace ts::config {
|
||||
}
|
||||
|
||||
namespace clients {
|
||||
enum WelcomeMessageType {
|
||||
WELCOME_MESSAGE_TYPE_MIN,
|
||||
WELCOME_MESSAGE_TYPE_NONE = WELCOME_MESSAGE_TYPE_MIN,
|
||||
WELCOME_MESSAGE_TYPE_CHAT,
|
||||
WELCOME_MESSAGE_TYPE_POKE,
|
||||
WELCOME_MESSAGE_TYPE_MAX
|
||||
};
|
||||
|
||||
extern bool teamspeak;
|
||||
extern std::string extra_welcome_message_teamspeak;
|
||||
extern WelcomeMessageType extra_welcome_message_type_teamspeak;
|
||||
|
||||
extern bool teaspeak;
|
||||
extern std::string extra_welcome_message_teaspeak;
|
||||
extern WelcomeMessageType extra_welcome_message_type_teaspeak;
|
||||
|
||||
extern bool teaweb;
|
||||
extern std::string extra_welcome_message_teaweb;
|
||||
extern WelcomeMessageType extra_welcome_message_type_teaweb;
|
||||
}
|
||||
|
||||
extern ssize_t max_virtual_server;
|
||||
|
@ -761,6 +761,27 @@ void SpeakingClient::processJoin() {
|
||||
this->connectTimestamp = chrono::system_clock::now();
|
||||
this->idleTimestamp = chrono::system_clock::now();
|
||||
|
||||
TIMING_STEP(timings, "welcome msg");
|
||||
{
|
||||
std::string message{};
|
||||
config::server::clients::WelcomeMessageType type{config::server::clients::WELCOME_MESSAGE_TYPE_NONE};
|
||||
if(this->getType() == ClientType::CLIENT_TEASPEAK) {
|
||||
message = config::server::clients::extra_welcome_message_teaspeak;
|
||||
type = config::server::clients::extra_welcome_message_type_teaspeak;
|
||||
} else if(this->getType() == ClientType::CLIENT_TEAMSPEAK) {
|
||||
message = config::server::clients::extra_welcome_message_teamspeak;
|
||||
type = config::server::clients::extra_welcome_message_type_teamspeak;
|
||||
} else if(this->getType() == ClientType::CLIENT_WEB) {
|
||||
message = config::server::clients::extra_welcome_message_teaweb;
|
||||
type = config::server::clients::extra_welcome_message_type_teaweb;
|
||||
}
|
||||
|
||||
if(type == config::server::clients::WELCOME_MESSAGE_TYPE_POKE) {
|
||||
this->notifyClientPoke(this->server->serverRoot, message);
|
||||
} else if(type == config::server::clients::WELCOME_MESSAGE_TYPE_CHAT) {
|
||||
this->notifyTextMessage(ChatMessageMode::TEXTMODE_SERVER, this->server->serverRoot, 0, 0, std::chrono::system_clock::now(), message);
|
||||
}
|
||||
}
|
||||
debugMessage(this->getServerId(), "{} Client join timings: {}", CLIENT_STR_LOG_PREFIX, TIMING_FINISH(timings));
|
||||
}
|
||||
|
||||
|
@ -120,6 +120,7 @@ namespace ts {
|
||||
bool client_init = false;
|
||||
bool new_protocol = false;
|
||||
bool protocol_encrypted = false;
|
||||
bool is_teaspeak_client = false;
|
||||
|
||||
uint32_t client_time = 0;
|
||||
std::string alpha;
|
||||
|
Loading…
Reference in New Issue
Block a user