mirror of
https://github.com/azahar-emu/azahar
synced 2025-11-06 23:19:57 +01:00
network: Removed enable_citra_mods room option
Moderator status is now determined solely by the user's moderator flag
This commit is contained in:
parent
650cf43cd8
commit
d94654ea10
@ -144,8 +144,8 @@ void HostRoomWindow::Host() {
|
|||||||
bool created = room->Create(ui->room_name->text().toStdString(),
|
bool created = room->Create(ui->room_name->text().toStdString(),
|
||||||
ui->room_description->toPlainText().toStdString(), "",
|
ui->room_description->toPlainText().toStdString(), "",
|
||||||
static_cast<u16>(port), password, ui->max_player->value(),
|
static_cast<u16>(port), password, ui->max_player->value(),
|
||||||
ui->username->text().toStdString(),, game_name.toStdString(),
|
ui->username->text().toStdString(), game_name.toStdString(),
|
||||||
game_id, CreateVerifyBackend(is_public), ban_list, true);
|
game_id, CreateVerifyBackend(is_public), ban_list);
|
||||||
if (!created) {
|
if (!created) {
|
||||||
NetworkMessage::ErrorManager::ShowError(
|
NetworkMessage::ErrorManager::ShowError(
|
||||||
NetworkMessage::ErrorManager::COULD_NOT_CREATE_ROOM);
|
NetworkMessage::ErrorManager::COULD_NOT_CREATE_ROOM);
|
||||||
|
|||||||
@ -183,7 +183,6 @@ void LaunchRoom(int argc, char** argv, bool called_by_option) {
|
|||||||
u64 preferred_game_id = 0;
|
u64 preferred_game_id = 0;
|
||||||
u16 port = Network::DefaultRoomPort;
|
u16 port = Network::DefaultRoomPort;
|
||||||
u32 max_members = 16;
|
u32 max_members = 16;
|
||||||
bool enable_citra_mods = false;
|
|
||||||
|
|
||||||
static struct option long_options[] = {
|
static struct option long_options[] = {
|
||||||
{"room-name", required_argument, 0, 'n'},
|
{"room-name", required_argument, 0, 'n'},
|
||||||
@ -250,9 +249,6 @@ void LaunchRoom(int argc, char** argv, bool called_by_option) {
|
|||||||
case 'l':
|
case 'l':
|
||||||
log_file.assign(optarg);
|
log_file.assign(optarg);
|
||||||
break;
|
break;
|
||||||
case 'e':
|
|
||||||
enable_citra_mods = true;
|
|
||||||
break;
|
|
||||||
case 'h':
|
case 'h':
|
||||||
PrintHelp(argv[0]);
|
PrintHelp(argv[0]);
|
||||||
exit(0);
|
exit(0);
|
||||||
@ -324,10 +320,6 @@ void LaunchRoom(int argc, char** argv, bool called_by_option) {
|
|||||||
NetSettings::values.citra_token = token;
|
NetSettings::values.citra_token = token;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!announce && enable_citra_mods) {
|
|
||||||
enable_citra_mods = false;
|
|
||||||
std::cout << "Can not enable Citra Moderators for private rooms\n\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
InitializeLogging(log_file);
|
InitializeLogging(log_file);
|
||||||
|
|
||||||
@ -354,8 +346,7 @@ void LaunchRoom(int argc, char** argv, bool called_by_option) {
|
|||||||
Network::Init();
|
Network::Init();
|
||||||
if (std::shared_ptr<Network::Room> room = Network::GetRoom().lock()) {
|
if (std::shared_ptr<Network::Room> room = Network::GetRoom().lock()) {
|
||||||
if (!room->Create(room_name, room_description, "", port, password, max_members, username,
|
if (!room->Create(room_name, room_description, "", port, password, max_members, username,
|
||||||
preferred_game, preferred_game_id, std::move(verify_backend), ban_list,
|
preferred_game, preferred_game_id, std::move(verify_backend), ban_list)) {
|
||||||
enable_citra_mods)) {
|
|
||||||
std::cout << "Failed to create room: \n\n";
|
std::cout << "Failed to create room: \n\n";
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -373,13 +373,11 @@ void Room::RoomImpl::HandleJoinRequest(const ENetEvent* event) {
|
|||||||
}
|
}
|
||||||
member.user_data = verify_backend->LoadUserData(uid, token);
|
member.user_data = verify_backend->LoadUserData(uid, token);
|
||||||
|
|
||||||
|
|
||||||
if (nickname == room_information.host_username) {
|
if (nickname == room_information.host_username) {
|
||||||
member.user_data.moderator = true;
|
member.user_data.moderator = true;
|
||||||
LOG_INFO(Network, "User {} is a moderator", std::string(room_information.host_username));
|
LOG_INFO(Network, "User {} is a moderator", std::string(room_information.host_username));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string ip;
|
std::string ip;
|
||||||
{
|
{
|
||||||
std::lock_guard lock(ban_list_mutex);
|
std::lock_guard lock(ban_list_mutex);
|
||||||
@ -605,8 +603,7 @@ bool Room::RoomImpl::HasModPermission(const ENetPeer* client) const {
|
|||||||
if (sending_member == members.end()) {
|
if (sending_member == members.end()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (room_information.enable_citra_mods &&
|
if (sending_member->user_data.moderator) { // Community moderator
|
||||||
sending_member->user_data.moderator) { // Community moderator
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1020,7 +1017,7 @@ bool Room::Create(const std::string& name, const std::string& description,
|
|||||||
const u32 max_connections, const std::string& host_username,
|
const u32 max_connections, const std::string& host_username,
|
||||||
const std::string& preferred_game, u64 preferred_game_id,
|
const std::string& preferred_game, u64 preferred_game_id,
|
||||||
std::unique_ptr<VerifyUser::Backend> verify_backend,
|
std::unique_ptr<VerifyUser::Backend> verify_backend,
|
||||||
const Room::BanList& ban_list, bool enable_citra_mods) {
|
const Room::BanList& ban_list) {
|
||||||
ENetAddress address;
|
ENetAddress address;
|
||||||
address.host = ENET_HOST_ANY;
|
address.host = ENET_HOST_ANY;
|
||||||
if (!server_address.empty()) {
|
if (!server_address.empty()) {
|
||||||
@ -1043,7 +1040,6 @@ bool Room::Create(const std::string& name, const std::string& description,
|
|||||||
room_impl->room_information.preferred_game = preferred_game;
|
room_impl->room_information.preferred_game = preferred_game;
|
||||||
room_impl->room_information.preferred_game_id = preferred_game_id;
|
room_impl->room_information.preferred_game_id = preferred_game_id;
|
||||||
room_impl->room_information.host_username = host_username;
|
room_impl->room_information.host_username = host_username;
|
||||||
room_impl->room_information.enable_citra_mods = enable_citra_mods;
|
|
||||||
room_impl->password = password;
|
room_impl->password = password;
|
||||||
room_impl->verify_backend = std::move(verify_backend);
|
room_impl->verify_backend = std::move(verify_backend);
|
||||||
room_impl->username_ban_list = ban_list.first;
|
room_impl->username_ban_list = ban_list.first;
|
||||||
|
|||||||
@ -32,7 +32,6 @@ struct RoomInformation {
|
|||||||
std::string preferred_game; ///< Game to advertise that you want to play
|
std::string preferred_game; ///< Game to advertise that you want to play
|
||||||
u64 preferred_game_id; ///< Title ID for the advertised game
|
u64 preferred_game_id; ///< Title ID for the advertised game
|
||||||
std::string host_username; ///< Forum username of the host
|
std::string host_username; ///< Forum username of the host
|
||||||
bool enable_citra_mods; ///< Allow Citra Moderators to moderate on this room
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GameInfo {
|
struct GameInfo {
|
||||||
@ -148,7 +147,7 @@ public:
|
|||||||
const std::string& host_username = "", const std::string& preferred_game = "",
|
const std::string& host_username = "", const std::string& preferred_game = "",
|
||||||
u64 preferred_game_id = 0,
|
u64 preferred_game_id = 0,
|
||||||
std::unique_ptr<VerifyUser::Backend> verify_backend = nullptr,
|
std::unique_ptr<VerifyUser::Backend> verify_backend = nullptr,
|
||||||
const BanList& ban_list = {}, bool enable_citra_mods = false);
|
const BanList& ban_list = {});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the verification GUID of the room.
|
* Sets the verification GUID of the room.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user