diff --git a/server/src/client/ConnectedClientNotifyHandler.cpp b/server/src/client/ConnectedClientNotifyHandler.cpp index ef152d4..3c930c4 100644 --- a/server/src/client/ConnectedClientNotifyHandler.cpp +++ b/server/src/client/ConnectedClientNotifyHandler.cpp @@ -120,9 +120,9 @@ bool ConnectedClient::notifyGroupPermList(const std::shared_ptr& group, b result.put_unchecked(index, "permid", (uint16_t) (get<0>(permission_data) | PERM_ID_GRANT)); } - result.put_unchecked(index, "permvalue", permission.values.value); - result.put_unchecked(index, "permnegated", permission.flags.negate); - result.put_unchecked(index, "permskip", permission.flags.skip); + result.put_unchecked(index, "permvalue", permission.values.grant); + result.put_unchecked(index, "permnegated", 0); + result.put_unchecked(index, "permskip", 0); index++; } diff --git a/server/src/client/command_handler/misc.cpp b/server/src/client/command_handler/misc.cpp index 3b0cfd6..27cbb74 100644 --- a/server/src/client/command_handler/misc.cpp +++ b/server/src/client/command_handler/misc.cpp @@ -262,13 +262,12 @@ command_result ConnectedClient::handleCommandGetConnectionInfo(Command &cmd) { ConnectedLockedClient client{this->server->find_client_by_id(cmd["clid"].as())}; if (!client) return command_result{error::client_invalid_id}; - bool send_temp; + bool send_temp{false}; auto info = client->request_connection_info(_this.lock(), send_temp); - if (info) { + if (info || send_temp) { this->notifyConnectionInfo(client.client, info); - } else if(send_temp) { + } else return command_result{error::no_cached_connection_info}; - } return command_result{error::ok}; } diff --git a/server/src/client/command_handler/music.cpp b/server/src/client/command_handler/music.cpp index f096128..412e82d 100644 --- a/server/src/client/command_handler/music.cpp +++ b/server/src/client/command_handler/music.cpp @@ -236,14 +236,15 @@ command_result ConnectedClient::handleCommandMusicBotPlayerInfo(Command& cmd) { result["bot_id"] = bot->getClientDatabaseId(); result["player_state"] =(int) bot->player_state(); - if(bot->current_player()) { - result["player_buffered_index"] = bot->current_player()->bufferedUntil().count(); - result["player_replay_index"] = bot->current_player()->currentIndex().count(); - result["player_max_index"] = bot->current_player()->length().count(); - result["player_seekable"] = bot->current_player()->seek_supported(); + auto player = bot->current_player(); + if(player) { + result["player_buffered_index"] = player->bufferedUntil().count(); + result["player_replay_index"] = player->currentIndex().count(); + result["player_max_index"] = player->length().count(); + result["player_seekable"] = player->seek_supported(); - result["player_title"] = bot->current_player()->songTitle(); - result["player_description"] = bot->current_player()->songDescription(); + result["player_title"] = player->songTitle(); + result["player_description"] = player->songDescription(); } else { result["player_buffered_index"] = 0; result["player_replay_index"] = 0; @@ -270,6 +271,7 @@ command_result ConnectedClient::handleCommandMusicBotPlayerAction(Command& cmd) if(!bot) return command_result{error::music_invalid_id}; ACTION_REQUIRES_PERMISSION(permission::i_client_music_play_power, bot->calculate_permission(permission::i_client_music_needed_play_power, bot->getChannelId()), this->getChannelId()); + auto player = bot->current_player(); if(cmd["action"] == 0) { bot->stopMusic(); } else if(cmd["action"] == 1) { @@ -281,11 +283,11 @@ command_result ConnectedClient::handleCommandMusicBotPlayerAction(Command& cmd) } else if(cmd["action"] == 4) { bot->rewindSong(); } else if(cmd["action"] == 5) { - if(!bot->current_player()) return command_result{error::music_no_player}; - bot->current_player()->forward(::music::PlayerUnits(cmd["units"].as())); + if(!player) return command_result{error::music_no_player}; + player->forward(::music::PlayerUnits(cmd["units"].as())); } else if(cmd["action"] == 6) { - if(!bot->current_player()) return command_result{error::music_no_player}; - bot->current_player()->rewind(::music::PlayerUnits(cmd["units"].as())); + if(!player) return command_result{error::music_no_player}; + player->rewind(::music::PlayerUnits(cmd["units"].as())); } else return command_result{error::music_invalid_action}; return command_result{error::ok};