Some issue fixes
This commit is contained in:
@@ -541,6 +541,10 @@ command_result ConnectedClient::handleCommandSendTextMessage(Command &cmd) {
|
||||
channel = this->currentChannel;
|
||||
channel_id = this->currentChannel->channelId();
|
||||
}
|
||||
|
||||
if(!permission::v2::permission_granted(1, this->calculate_permission(permission::b_client_channel_textmessage_send, channel_id), false)) \
|
||||
return command_result{permission::b_client_channel_textmessage_send};
|
||||
|
||||
if(channel == this->currentChannel) {
|
||||
channel_tree_read_lock.unlock(); //Method may creates a music bot which modifies the channel tree
|
||||
if(this->handleTextMessage(ChatMessageMode::TEXTMODE_CHANNEL, cmd["msg"], nullptr))
|
||||
@@ -548,16 +552,13 @@ command_result ConnectedClient::handleCommandSendTextMessage(Command &cmd) {
|
||||
channel_tree_read_lock.lock();
|
||||
}
|
||||
|
||||
if(!permission::v2::permission_granted(1, this->calculate_permission(permission::b_client_channel_textmessage_send, channel_id), false)) \
|
||||
return command_result{permission::b_client_channel_textmessage_send};
|
||||
|
||||
bool conversation_private = channel->properties()[property::CHANNEL_FLAG_CONVERSATION_PRIVATE].as<bool>();
|
||||
if(channel != this->currentChannel) {
|
||||
if(conversation_private)
|
||||
return command_result{error::conversation_is_private};
|
||||
|
||||
if(!this->calculate_and_get_join_state(channel))
|
||||
return command_result{permission::b_client_channel_textmessage_send}; /* You're not allowed to send messages :) */
|
||||
if(auto fail_perm{this->calculate_and_get_join_state(channel)}; fail_perm != permission::ok)
|
||||
return command_result{fail_perm}; /* You're not allowed to send messages :) */
|
||||
}
|
||||
|
||||
this->server->send_text_message(channel, this->ref(), cmd["msg"].string());
|
||||
@@ -2502,7 +2503,7 @@ command_result ConnectedClient::handleCommandConversationMessageDelete(ts::Comma
|
||||
if (!permission::v2::permission_granted(1, this->calculate_permission(permission::b_channel_conversation_message_delete, 1, channel->channelId())))
|
||||
return command_result{permission::b_channel_conversation_message_delete};
|
||||
|
||||
if(auto error_perm = this->calculate_and_get_join_state(channel); error_perm != permission::b_client_is_sticky)
|
||||
if(auto error_perm = this->calculate_and_get_join_state(channel); error_perm && error_perm != permission::b_client_is_sticky)
|
||||
return command_result{error_perm};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ command_result ConnectedClient::handleCommandMusicBotCreate(Command& cmd) {
|
||||
if(!channel) {
|
||||
if(cmd[0].has("cid")) return command_result{error::channel_invalid_id};
|
||||
} else {
|
||||
if(!this->calculate_and_get_join_state(channel))
|
||||
if(this->calculate_and_get_join_state(channel) != permission::ok)
|
||||
channel = nullptr;
|
||||
}
|
||||
if(!channel)
|
||||
|
||||
Reference in New Issue
Block a user