Added two new commands

This commit is contained in:
WolverinDEV
2019-09-14 14:22:16 +02:00
parent c8a6449a45
commit 9cb069db5a
13 changed files with 390 additions and 259 deletions
+2 -2
View File
@@ -159,7 +159,7 @@ bool QueryClient::closeConnection(const std::chrono::system_clock::time_point& f
unique_lock channel_lock(this->server->channel_tree_lock);
this->server->unregisterClient(_this.lock(), "disconnected", channel_lock);
}
this->server->groups->disableCache(_this.lock());
this->server->groups->disableCache(this->getClientDatabaseId());
this->server = nullptr;
}
@@ -234,7 +234,7 @@ void QueryClient::disconnectFinal() {
unique_lock channel_lock(this->server->channel_tree_lock);
this->server->unregisterClient(_this.lock(), "disconnected", channel_lock);
}
this->server->groups->disableCache(_this.lock());
this->server->groups->disableCache(this->getClientDatabaseId());
this->server = nullptr;
}
+12 -12
View File
@@ -177,8 +177,8 @@ CommandResult QueryClient::handleCommandLogin(Command& cmd) {
this->server->client_move(this->ref(), nullptr, nullptr, "", ViewReasonId::VREASON_USER_ACTION, false, tree_lock);
this->server->unregisterClient(_this.lock(), "login", tree_lock);
}
this->server->groups->disableCache(_this.lock());
} else serverInstance->getGroupManager()->disableCache(_this.lock());
this->server->groups->disableCache(this->getClientDatabaseId());
} else serverInstance->getGroupManager()->disableCache(this->getClientDatabaseId());
logMessage(LOG_QUERY, "Got new authenticated client. Username: {}, Unique-ID: {}, Bounded Server: {}", account->username, account->unique_id, account->bound_server);
@@ -198,7 +198,7 @@ CommandResult QueryClient::handleCommandLogin(Command& cmd) {
DatabaseHelper::assignDatabaseId(this->sql, static_cast<ServerId>(target_server ? target_server->getServerId() : 0), _this.lock());
if(target_server) {
target_server->groups->enableCache(_this.lock());
target_server->groups->enableCache(this->getClientDatabaseId());
target_server->registerClient(_this.lock());
{
@@ -221,7 +221,7 @@ CommandResult QueryClient::handleCommandLogin(Command& cmd) {
else
this->update_cached_permissions();
} else {
serverInstance->getGroupManager()->enableCache(_this.lock());
serverInstance->getGroupManager()->enableCache(this->getClientDatabaseId());
this->update_cached_permissions();
}
@@ -245,15 +245,15 @@ CommandResult QueryClient::handleCommandLogout(Command &) {
this->server->client_move(this->ref(), nullptr, nullptr, "", ViewReasonId::VREASON_USER_ACTION, false, tree_lock);
this->server->unregisterClient(_this.lock(), "logout", tree_lock);
}
this->server->groups->disableCache(_this.lock());
} else serverInstance->getGroupManager()->disableCache(_this.lock());
this->server->groups->disableCache(this->getClientDatabaseId());
} else serverInstance->getGroupManager()->disableCache(this->getClientDatabaseId());
this->properties()[property::CLIENT_UNIQUE_IDENTIFIER] = "UnknownQuery"; //TODO load from table
this->properties()[property::CLIENT_NICKNAME] = string() + "ServerQuery#" + this->getLoggingPeerIp() + "/" + to_string(ntohs(this->getPeerPort()));
DatabaseHelper::assignDatabaseId(this->sql, static_cast<ServerId>(this->server ? this->server->getServerId() : 0), _this.lock());
if(this->server){
this->server->groups->enableCache(_this.lock());
this->server->groups->enableCache(this->getClientDatabaseId());
this->server->registerClient(this->ref());
{
@@ -274,7 +274,7 @@ CommandResult QueryClient::handleCommandLogout(Command &) {
this->update_cached_permissions();
}
} else {
serverInstance->getGroupManager()->enableCache(_this.lock());
serverInstance->getGroupManager()->enableCache(this->getClientDatabaseId());
this->update_cached_permissions();
}
@@ -322,10 +322,10 @@ CommandResult QueryClient::handleCommandServerSelect(Command &cmd) {
this->server->client_move(this->ref(), nullptr, nullptr, "", ViewReasonId::VREASON_USER_ACTION, false, tree_lock);
this->server->unregisterClient(_this.lock(), "server switch", tree_lock);
}
server_locked->groups->disableCache(_this.lock());
server_locked->groups->disableCache(this->getClientDatabaseId());
this->channels->reset();
} else
serverInstance->getGroupManager()->disableCache(_this.lock());
serverInstance->getGroupManager()->disableCache(this->getClientDatabaseId());
}
this->resetEventMask();
@@ -341,7 +341,7 @@ CommandResult QueryClient::handleCommandServerSelect(Command &cmd) {
DatabaseHelper::assignDatabaseId(this->sql, static_cast<ServerId>(this->server ? this->server->getServerId() : 0), _this.lock());
if(this->server) {
this->server->groups->enableCache(_this.lock());
this->server->groups->enableCache(this->getClientDatabaseId());
this->server->registerClient(_this.lock());
{
@@ -359,7 +359,7 @@ CommandResult QueryClient::handleCommandServerSelect(Command &cmd) {
else
this->update_cached_permissions();
} else {
serverInstance->getGroupManager()->enableCache(_this.lock());
serverInstance->getGroupManager()->enableCache(this->getClientDatabaseId());
this->update_cached_permissions();
}
this->updateChannelClientProperties(true, true);