Fixed icon id calculation

This commit is contained in:
WolverinDEV 2019-07-17 22:17:38 +02:00
parent 5715acbcb2
commit 23324f2046

View File

@ -129,8 +129,19 @@ void ConnectedClient::updateChannelClientProperties(bool lock_channel_tree, bool
}
}
auto icon_permission = this->calculate_permission_value(permission::i_icon_id, -1);
IconId iconId = icon_permission.has_value ? icon_permission.value : 0;
IconId iconId = 0;
{
permission::v2::PermissionFlaggedValue value{0, false};
auto permission_flags = this->clientPermissions->permission_flags(permission::i_icon_id);
if(permission_flags.channel_specific && this->currentChannel) {
auto val = this->clientPermissions->channel_permission(permission::i_icon_id, this->currentChannel->channelId());
value = {val.values.value, val.flags.value_set};
}
if(!value.has_value)
value = this->clientPermissions->permission_value_flagged(permission::i_icon_id);
if(value.has_value)
iconId = value.value;
}
logTrace(this->getServerId(), "[CLIENT] Updating client icon from " + to_string(this->properties()[property::CLIENT_ICON_ID].as<IconId>()) + " to " + to_string(iconId));
if(this->properties()[property::CLIENT_ICON_ID].as<IconId>() != iconId){
if(server_ref && iconId != 0) {