From 660fe3317fe4d466af155cb83e195f23dc8d7bbe Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Wed, 20 Jan 2021 17:44:44 +0100 Subject: [PATCH] Some minor changes --- git-teaspeak | 2 +- server/src/client/command_handler/misc.cpp | 10 +++++++--- server/src/client/query/QueryClient.cpp | 15 +++++++++------ 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/git-teaspeak b/git-teaspeak index 499bd8d..cc69652 160000 --- a/git-teaspeak +++ b/git-teaspeak @@ -1 +1 @@ -Subproject commit 499bd8dde6bf8e0f0bdff4dc3ecd589f614a1a1e +Subproject commit cc696524f42ae16a2b288378e580322085b80402 diff --git a/server/src/client/command_handler/misc.cpp b/server/src/client/command_handler/misc.cpp index 8953ad4..bd86924 100644 --- a/server/src/client/command_handler/misc.cpp +++ b/server/src/client/command_handler/misc.cpp @@ -595,11 +595,15 @@ command_result ConnectedClient::handleCommandSendTextMessage(Command &cmd) { target->notifyTextMessage(ChatMessageMode::TEXTMODE_PRIVATE, _this.lock(), target->getClientId(), 0, timestamp, cmd["msg"].string()); this->notifyTextMessage(ChatMessageMode::TEXTMODE_PRIVATE, _this.lock(), target->getClientId(), 0, timestamp, cmd["msg"].string()); } else if (cmd["targetmode"] == ChatMessageMode::TEXTMODE_CHANNEL) { - if(!cmd[0].has("cid")) { - cmd["cid"] = 0; + if(cmd[0].has("cid")) { + cmd["target"] = cmd["cid"].string(); } - RESOLVE_CHANNEL_R(cmd["cid"], false); + if(!cmd[0].has("target")) { + cmd["target"] = 0; + } + + RESOLVE_CHANNEL_R(cmd["target"], false); auto channel = l_channel ? dynamic_pointer_cast(l_channel->entry) : nullptr; if(!channel) { CMD_REQ_CHANNEL; diff --git a/server/src/client/query/QueryClient.cpp b/server/src/client/query/QueryClient.cpp index 607dddf..b7095c9 100644 --- a/server/src/client/query/QueryClient.cpp +++ b/server/src/client/query/QueryClient.cpp @@ -84,7 +84,14 @@ void QueryClient::postInitialize() { writeMessage(config::query::motd); assert(this->handle); - if(this->handle->ip_blacklist) { + + if(this->handle->ip_whitelist) { + this->whitelisted = this->handle->ip_whitelist->contains(this->remote_address); + } else { + this->whitelisted = false; + } + + if(!this->whitelisted && this->handle->ip_blacklist) { assert(this->handle->ip_blacklist); if(this->handle->ip_blacklist->contains(this->remote_address)) { Command cmd("error"); @@ -96,12 +103,8 @@ void QueryClient::postInitialize() { this->disconnect("blacklisted"); return;; } - if(this->handle->ip_whitelist) - this->whitelisted = this->handle->ip_whitelist->contains(this->remote_address); - else - this->whitelisted = false; - debugMessage(LOG_QUERY, "Got new query client from {}. Whitelisted: {}", this->getLoggingPeerIp(), this->whitelisted); } + debugMessage(LOG_QUERY, "Got new query client from {}. Whitelisted: {}", this->getLoggingPeerIp(), this->whitelisted); if(!this->whitelisted) { threads::MutexLock lock(this->handle->loginLock);