Updated beta1

This commit is contained in:
WolverinDEV 2020-02-01 22:40:23 +01:00
parent 73ed3a23c6
commit a42c0869bf
3 changed files with 19 additions and 18 deletions

View File

@ -120,9 +120,9 @@ bool ConnectedClient::notifyGroupPermList(const std::shared_ptr<Group>& group, b
result.put_unchecked(index, "permid", (uint16_t) (get<0>(permission_data) | PERM_ID_GRANT)); 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, "permvalue", permission.values.grant);
result.put_unchecked(index, "permnegated", permission.flags.negate); result.put_unchecked(index, "permnegated", 0);
result.put_unchecked(index, "permskip", permission.flags.skip); result.put_unchecked(index, "permskip", 0);
index++; index++;
} }

View File

@ -262,13 +262,12 @@ command_result ConnectedClient::handleCommandGetConnectionInfo(Command &cmd) {
ConnectedLockedClient client{this->server->find_client_by_id(cmd["clid"].as<ClientId>())}; ConnectedLockedClient client{this->server->find_client_by_id(cmd["clid"].as<ClientId>())};
if (!client) return command_result{error::client_invalid_id}; 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); auto info = client->request_connection_info(_this.lock(), send_temp);
if (info) { if (info || send_temp) {
this->notifyConnectionInfo(client.client, info); this->notifyConnectionInfo(client.client, info);
} else if(send_temp) { } else
return command_result{error::no_cached_connection_info}; return command_result{error::no_cached_connection_info};
}
return command_result{error::ok}; return command_result{error::ok};
} }

View File

@ -236,14 +236,15 @@ command_result ConnectedClient::handleCommandMusicBotPlayerInfo(Command& cmd) {
result["bot_id"] = bot->getClientDatabaseId(); result["bot_id"] = bot->getClientDatabaseId();
result["player_state"] =(int) bot->player_state(); result["player_state"] =(int) bot->player_state();
if(bot->current_player()) { auto player = bot->current_player();
result["player_buffered_index"] = bot->current_player()->bufferedUntil().count(); if(player) {
result["player_replay_index"] = bot->current_player()->currentIndex().count(); result["player_buffered_index"] = player->bufferedUntil().count();
result["player_max_index"] = bot->current_player()->length().count(); result["player_replay_index"] = player->currentIndex().count();
result["player_seekable"] = bot->current_player()->seek_supported(); result["player_max_index"] = player->length().count();
result["player_seekable"] = player->seek_supported();
result["player_title"] = bot->current_player()->songTitle(); result["player_title"] = player->songTitle();
result["player_description"] = bot->current_player()->songDescription(); result["player_description"] = player->songDescription();
} else { } else {
result["player_buffered_index"] = 0; result["player_buffered_index"] = 0;
result["player_replay_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}; 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()); 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) { if(cmd["action"] == 0) {
bot->stopMusic(); bot->stopMusic();
} else if(cmd["action"] == 1) { } else if(cmd["action"] == 1) {
@ -281,11 +283,11 @@ command_result ConnectedClient::handleCommandMusicBotPlayerAction(Command& cmd)
} else if(cmd["action"] == 4) { } else if(cmd["action"] == 4) {
bot->rewindSong(); bot->rewindSong();
} else if(cmd["action"] == 5) { } else if(cmd["action"] == 5) {
if(!bot->current_player()) return command_result{error::music_no_player}; if(!player) return command_result{error::music_no_player};
bot->current_player()->forward(::music::PlayerUnits(cmd["units"].as<int64_t>())); player->forward(::music::PlayerUnits(cmd["units"].as<int64_t>()));
} else if(cmd["action"] == 6) { } else if(cmd["action"] == 6) {
if(!bot->current_player()) return command_result{error::music_no_player}; if(!player) return command_result{error::music_no_player};
bot->current_player()->rewind(::music::PlayerUnits(cmd["units"].as<int64_t>())); player->rewind(::music::PlayerUnits(cmd["units"].as<int64_t>()));
} else return command_result{error::music_invalid_action}; } else return command_result{error::music_invalid_action};
return command_result{error::ok}; return command_result{error::ok};