Some minor changes

This commit is contained in:
WolverinDEV 2021-01-20 17:44:44 +01:00
parent e75b2342e2
commit 660fe3317f
3 changed files with 17 additions and 10 deletions

@ -1 +1 @@
Subproject commit 499bd8dde6bf8e0f0bdff4dc3ecd589f614a1a1e Subproject commit cc696524f42ae16a2b288378e580322085b80402

View File

@ -595,11 +595,15 @@ command_result ConnectedClient::handleCommandSendTextMessage(Command &cmd) {
target->notifyTextMessage(ChatMessageMode::TEXTMODE_PRIVATE, _this.lock(), target->getClientId(), 0, timestamp, cmd["msg"].string()); 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()); this->notifyTextMessage(ChatMessageMode::TEXTMODE_PRIVATE, _this.lock(), target->getClientId(), 0, timestamp, cmd["msg"].string());
} else if (cmd["targetmode"] == ChatMessageMode::TEXTMODE_CHANNEL) { } else if (cmd["targetmode"] == ChatMessageMode::TEXTMODE_CHANNEL) {
if(!cmd[0].has("cid")) { if(cmd[0].has("cid")) {
cmd["cid"] = 0; 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<BasicChannel>(l_channel->entry) : nullptr; auto channel = l_channel ? dynamic_pointer_cast<BasicChannel>(l_channel->entry) : nullptr;
if(!channel) { if(!channel) {
CMD_REQ_CHANNEL; CMD_REQ_CHANNEL;

View File

@ -84,7 +84,14 @@ void QueryClient::postInitialize() {
writeMessage(config::query::motd); writeMessage(config::query::motd);
assert(this->handle); 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); assert(this->handle->ip_blacklist);
if(this->handle->ip_blacklist->contains(this->remote_address)) { if(this->handle->ip_blacklist->contains(this->remote_address)) {
Command cmd("error"); Command cmd("error");
@ -96,12 +103,8 @@ void QueryClient::postInitialize() {
this->disconnect("blacklisted"); this->disconnect("blacklisted");
return;; 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) { if(!this->whitelisted) {
threads::MutexLock lock(this->handle->loginLock); threads::MutexLock lock(this->handle->loginLock);