Updated the channel edit and create functions

This commit is contained in:
WolverinDEV 2020-12-01 10:07:37 +01:00
parent 706cecb66c
commit a21a28fede
5 changed files with 1000 additions and 544 deletions

View File

@ -90,6 +90,7 @@ std::shared_ptr<BasicChannel> ServerChannelTree::createChannel(ChannelId parentI
std::shared_ptr<BasicChannel> channel = BasicChannelTree::createChannel(parentId, orderId, name); std::shared_ptr<BasicChannel> channel = BasicChannelTree::createChannel(parentId, orderId, name);
if(!channel) return channel; if(!channel) return channel;
/* TODO: Speed up (skip the database query) */
auto properties = serverInstance->databaseHelper()->loadChannelProperties(this->server_ref.lock(), channel->channelId()); auto properties = serverInstance->databaseHelper()->loadChannelProperties(this->server_ref.lock(), channel->channelId());
for(const auto& prop : channel->properties().list_properties()) { for(const auto& prop : channel->properties().list_properties()) {
if(prop.isModified()) { //Copy the already set properties if(prop.isModified()) { //Copy the already set properties

View File

@ -195,12 +195,15 @@ void ConnectedClient::updateChannelClientProperties(bool lock_channel_tree, bool
if(this->currentChannel) { if(this->currentChannel) {
deque<ChannelId> deleted; deque<ChannelId> deleted;
for(const auto& update_entry : this->channels->update_channel_path(server_ref->channelTree->tree_head(), server_ref->channelTree->find_linked_entry(this->currentChannel->channelId()))) { for(const auto& update_entry : this->channels->update_channel_path(server_ref->channelTree->tree_head(), server_ref->channelTree->find_linked_entry(this->currentChannel->channelId()))) {
if(update_entry.first) if(update_entry.first) {
this->notifyChannelShow(update_entry.second->channel(), update_entry.second->previous_channel); this->notifyChannelShow(update_entry.second->channel(), update_entry.second->previous_channel);
else deleted.push_back(update_entry.second->channelId()); } else {
deleted.push_back(update_entry.second->channelId());
}
} }
if(!deleted.empty()) if(!deleted.empty()) {
this->notifyChannelHide(deleted, false); /* we've locked the tree before */ this->notifyChannelHide(deleted, false); /* we've locked the tree before */
}
} }
} }
} }

View File

@ -640,6 +640,13 @@ namespace ts {
const std::shared_ptr<ConnectedClient>& /* sender target */ const std::shared_ptr<ConnectedClient>& /* sender target */
); );
/* Function to execute the channel edit. We're not checking for any permissions */
ts::command_result execute_channel_edit(
ChannelId& /* channel id */,
const std::map<property::ChannelProperties, std::string>& /* values */,
bool /* is channel create */
);
inline std::string notify_response_command(const std::string_view& notify) { inline std::string notify_response_command(const std::string_view& notify) {
if(this->getExternalType() == ClientType::CLIENT_TEAMSPEAK) if(this->getExternalType() == ClientType::CLIENT_TEAMSPEAK)
return std::string(notify); return std::string(notify);

File diff suppressed because it is too large Load Diff

2
shared

@ -1 +1 @@
Subproject commit 2cc8a42ce7639efa2cdf6eb30a2a02f099ce1154 Subproject commit 5b74992beb5f4523485c8a4b6749c7dd6bbf282a