Fixed a client disconnect bug

This commit is contained in:
WolverinDEV 2021-05-19 11:42:09 +02:00
parent 616149d5dd
commit b155bf8d5f
2 changed files with 11 additions and 0 deletions

View File

@ -125,6 +125,16 @@ void BasicChannel::setChannelType(ChannelType::ChannelType type) {
properties()[property::CHANNEL_FLAG_SEMI_PERMANENT] = type == ChannelType::semipermanent; properties()[property::CHANNEL_FLAG_SEMI_PERMANENT] = type == ChannelType::semipermanent;
} }
void BasicChannel::updateChannelType(std::vector<property::ChannelProperties> &properties, ChannelType::ChannelType type) {
if(this->properties()[property::CHANNEL_FLAG_PERMANENT].update_value(type == ChannelType::permanent)) {
properties.push_back(property::CHANNEL_FLAG_PERMANENT);
}
if(this->properties()[property::CHANNEL_FLAG_SEMI_PERMANENT].update_value(type == ChannelType::semipermanent)) {
properties.push_back(property::CHANNEL_FLAG_SEMI_PERMANENT);
}
}
bool BasicChannel::verify_password(const std::optional<std::string> &password, bool password_hashed) { bool BasicChannel::verify_password(const std::optional<std::string> &password, bool password_hashed) {
if(!this->properties()[property::CHANNEL_FLAG_PASSWORD].as_unchecked<bool>()) { if(!this->properties()[property::CHANNEL_FLAG_PASSWORD].as_unchecked<bool>()) {
return true; return true;

View File

@ -51,6 +51,7 @@ namespace ts {
ChannelType::ChannelType channelType(); ChannelType::ChannelType channelType();
void setChannelType(ChannelType::ChannelType); void setChannelType(ChannelType::ChannelType);
void updateChannelType(std::vector<property::ChannelProperties>& /* updates */, ChannelType::ChannelType /* target type */);
[[nodiscard]] bool verify_password(const std::optional<std::string>&, bool /* password already hashed */); [[nodiscard]] bool verify_password(const std::optional<std::string>&, bool /* password already hashed */);