Fixed the channel descriptions
This commit is contained in:
@@ -1672,7 +1672,7 @@ CommandResult ConnectedClient::handleCommandChannelCreate(Command &cmd) {
|
||||
|
||||
if(old_default_channel) {
|
||||
//TODO: Reminder: client channel tree must be at least read locked here!
|
||||
client->notifyChannelEdited(old_default_channel, {"channel_flag_default"}, this);
|
||||
client->notifyChannelEdited(old_default_channel, {property::CHANNEL_FLAG_DEFAULT}, self_lock, false);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -2079,6 +2079,7 @@ CommandResult ConnectedClient::handleCommandChannelEdit(Command &cmd) {
|
||||
return {findError("channel_name_inuse"), to_string(named_channel->channelId())};
|
||||
}
|
||||
|
||||
auto self_ref = this->ref();
|
||||
shared_ptr<BasicChannel> old_default_channel;
|
||||
deque<shared_ptr<BasicChannel>> child_channel_updated;
|
||||
for(const std::shared_ptr<property::PropertyDescription>& key : keys) {
|
||||
@@ -2110,7 +2111,7 @@ CommandResult ConnectedClient::handleCommandChannelEdit(Command &cmd) {
|
||||
cl->notifyChannelMoved(action.second->channel(), action.second->previous_channel, this->ref());
|
||||
break;
|
||||
case ClientChannelView::REORDER:
|
||||
cl->notifyChannelEdited(action.second->channel(), {"channel_order"}, this);
|
||||
cl->notifyChannelEdited(action.second->channel(), {property::CHANNEL_ORDER}, self_ref, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2147,10 +2148,11 @@ CommandResult ConnectedClient::handleCommandChannelEdit(Command &cmd) {
|
||||
|
||||
if(this->server && !updated_channels.empty()) {
|
||||
std::reverse(updated_channels.begin(), updated_channels.end());
|
||||
auto this_ref = this->ref();
|
||||
this->server->forEachClient([&](const shared_ptr<ConnectedClient>& client) {
|
||||
unique_lock client_channel_lock(client->channel_lock);
|
||||
for(const auto& channel : updated_channels) {
|
||||
client->notifyChannelEdited(channel, {"channel_flag_permanent", "channel_flag_semi_permanent"}, this);
|
||||
client->notifyChannelEdited(channel, {property::CHANNEL_FLAG_PERMANENT, property::CHANNEL_FLAG_SEMI_PERMANENT}, this_ref, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2192,21 +2194,22 @@ CommandResult ConnectedClient::handleCommandChannelEdit(Command &cmd) {
|
||||
channel->properties()[key] = cmd[key->name].string();
|
||||
}
|
||||
if(this->server) {
|
||||
vector<string> key_vector;
|
||||
vector<property::ChannelProperties> key_vector;
|
||||
key_vector.reserve(keys.size());
|
||||
for(const auto& key : keys)
|
||||
key_vector.push_back(key->name);
|
||||
key_vector.push_back((property::ChannelProperties) key->property_index);
|
||||
|
||||
auto self_rev = this->ref();
|
||||
this->server->forEachClient([&](const shared_ptr<ConnectedClient>& client) {
|
||||
unique_lock client_channel_lock(client->channel_lock);
|
||||
|
||||
for(const auto& channel : child_channel_updated)
|
||||
client->notifyChannelEdited(channel, {"channel_flag_permanent", "channel_flag_semi_permanent"}, this);
|
||||
client->notifyChannelEdited(channel, {property::CHANNEL_FLAG_PERMANENT, property::CHANNEL_FLAG_SEMI_PERMANENT}, self_rev, false);
|
||||
|
||||
client->notifyChannelEdited(channel, key_vector, this);
|
||||
client->notifyChannelEdited(channel, key_vector, self_rev, false);
|
||||
|
||||
if(old_default_channel) /* clients need to have one or more defualt channels... */
|
||||
client->notifyChannelEdited(old_default_channel, {"channel_flag_default"}, this);
|
||||
client->notifyChannelEdited(old_default_channel, {property::CHANNEL_FLAG_DEFAULT}, self_rev, false);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2305,10 +2308,11 @@ CommandResult ConnectedClient::handleCommandChannelMove(Command &cmd) {
|
||||
}
|
||||
|
||||
if(this->server) {
|
||||
auto self_rev = this->ref();
|
||||
this->server->forEachClient([&](const shared_ptr<ConnectedClient>& client) {
|
||||
unique_lock channel_lock(client->channel_lock);
|
||||
for(const auto& type_update : channel_type_updates)
|
||||
client->notifyChannelEdited(type_update, {"channel_flag_permanent", "channel_flag_semi_permanent"}, this);
|
||||
client->notifyChannelEdited(type_update, {property::CHANNEL_FLAG_PERMANENT, property::CHANNEL_FLAG_SEMI_PERMANENT}, self_rev, false);
|
||||
|
||||
auto actions = client->channels->change_order(l_channel, l_parent, l_order);
|
||||
std::deque<ChannelId> deletions;
|
||||
@@ -2326,7 +2330,7 @@ CommandResult ConnectedClient::handleCommandChannelMove(Command &cmd) {
|
||||
client->notifyChannelMoved(action.second->channel(), action.second->previous_channel, _this.lock());
|
||||
break;
|
||||
case ClientChannelView::REORDER:
|
||||
client->notifyChannelEdited(action.second->channel(), vector<string>{"channel_order"}, _this.lock().get());
|
||||
client->notifyChannelEdited(action.second->channel(), {property::CHANNEL_ORDER}, self_rev, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2462,11 +2466,13 @@ CommandResult ConnectedClient::handleCommandChannelAddPerm(Command &cmd) {
|
||||
update_channel_properties |= channel->permission_require_property_update(permType);
|
||||
|
||||
if (permType == permission::i_icon_id) {
|
||||
if(this->server)
|
||||
if(this->server) {
|
||||
auto self_ref = this->ref();
|
||||
this->server->forEachClient([&](std::shared_ptr<ConnectedClient> cl) {
|
||||
shared_lock client_channel_lock(cl->channel_lock);
|
||||
cl->notifyChannelEdited(channel, {"channel_icon_id"}, this);
|
||||
cl->notifyChannelEdited(channel, {property::CHANNEL_ICON_ID}, self_ref, false);
|
||||
});
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -2476,15 +2482,10 @@ CommandResult ConnectedClient::handleCommandChannelAddPerm(Command &cmd) {
|
||||
if(update_channel_properties) {
|
||||
auto updates = channel->update_properties_from_permissions();
|
||||
if(!updates.empty() && this->server){
|
||||
vector<string> keys;
|
||||
keys.reserve(updates.size());
|
||||
|
||||
for(auto& property : updates)
|
||||
keys.push_back(property::info(property)->name);
|
||||
|
||||
auto self_ref = this->ref();
|
||||
this->server->forEachClient([&](std::shared_ptr<ConnectedClient> cl) {
|
||||
shared_lock client_channel_lock(cl->channel_lock);
|
||||
cl->notifyChannelEdited(channel, keys, this);
|
||||
cl->notifyChannelEdited(channel, updates, self_ref, false);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -2554,15 +2555,10 @@ CommandResult ConnectedClient::handleCommandChannelDelPerm(Command &cmd) {
|
||||
if(update_channel_properties) {
|
||||
auto updates = channel->update_properties_from_permissions();
|
||||
if(!updates.empty() && this->server){
|
||||
vector<string> keys;
|
||||
keys.reserve(updates.size());
|
||||
|
||||
for(auto& property : updates)
|
||||
keys.push_back(property::info(property)->name);
|
||||
|
||||
auto self_ref = this->ref();
|
||||
this->server->forEachClient([&](std::shared_ptr<ConnectedClient> cl) {
|
||||
shared_lock client_channel_lock(cl->channel_lock);
|
||||
cl->notifyChannelEdited(channel, keys, this);
|
||||
cl->notifyChannelEdited(channel, updates, self_ref, false);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user