Fixed some bugs

This commit is contained in:
WolverinDEV
2019-10-20 12:09:28 +02:00
parent 0c6fd1f864
commit 0bedf6c42a
21 changed files with 147 additions and 86 deletions
+6 -3
View File
@@ -760,17 +760,20 @@ void SpeakingClient::tick(const std::chrono::system_clock::time_point &time) {
this->updateSpeak(true, time);
if(this->state == ConnectionState::CONNECTED) {
if(this->max_idle_time != permNotGranted)
if(this->idleTimestamp.time_since_epoch().count() > 0 && this->max_idle_time > 0 && duration_cast<seconds>(time - this->idleTimestamp).count() > this->max_idle_time) {
if(this->max_idle_time.has_value) {
auto max_idle = this->max_idle_time.value;
if(max_idle > 0 && this->idleTimestamp.time_since_epoch().count() > 0 && duration_cast<seconds>(time - this->idleTimestamp).count() > max_idle) {
this->server->notify_client_kick(this->ref(), this->server->getServerRoot(), ts::config::messages::idle_time_exceeded, nullptr);
this->closeConnection(system_clock::now() + seconds(1));
}
}
}
}
void SpeakingClient::updateChannelClientProperties(bool channel_lock, bool notify) {
ConnectedClient::updateChannelClientProperties(channel_lock, notify);
this->max_idle_time = this->permissionValue(permission::PERMTEST_ORDERED, permission::i_client_max_idletime, this->currentChannel);
this->max_idle_time = this->permissionValueFlagged(permission::i_client_max_idletime, this->currentChannel);
}
CommandResult SpeakingClient::handleCommand(Command &command) {