mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2025-03-13 09:12:27 +01:00
Merge 0bcdc7b4220df640e1eb937ac7a9fab1f8e03b29 into 42d77cd720eb42845c2afb77c6d7157e02c8c325
This commit is contained in:
commit
4077cc5a64
@ -459,12 +459,15 @@ void ChatRoom::PopupContextMenu(const QPoint& menu_location) {
|
||||
});
|
||||
}
|
||||
|
||||
if (has_mod_perms && nickname != cur_nickname) { // You can't kick or ban yourself
|
||||
if (nickname != cur_nickname) { // You can't kick or ban yourself
|
||||
context_menu.addSeparator();
|
||||
|
||||
QAction* kick_action = context_menu.addAction(tr("Kick"));
|
||||
QAction* ban_action = context_menu.addAction(tr("Ban"));
|
||||
|
||||
kick_action->setEnabled(has_mod_perms);
|
||||
ban_action->setEnabled(has_mod_perms);
|
||||
|
||||
connect(kick_action, &QAction::triggered, [this, nickname] {
|
||||
QMessageBox::StandardButton result =
|
||||
QMessageBox::question(this, tr("Kick Player"),
|
||||
|
@ -47,8 +47,6 @@ ClientRoomWindow::ClientRoomWindow(QWidget* parent)
|
||||
ModerationDialog dialog(this);
|
||||
dialog.exec();
|
||||
});
|
||||
ui->moderation->setDefault(false);
|
||||
ui->moderation->setAutoDefault(false);
|
||||
connect(ui->chat, &ChatRoom::UserPinged, this, &ClientRoomWindow::ShowNotification);
|
||||
UpdateView();
|
||||
}
|
||||
@ -57,9 +55,7 @@ ClientRoomWindow::~ClientRoomWindow() = default;
|
||||
|
||||
void ClientRoomWindow::SetModPerms(bool is_mod) {
|
||||
ui->chat->SetModPerms(is_mod);
|
||||
ui->moderation->setVisible(is_mod);
|
||||
ui->moderation->setDefault(false);
|
||||
ui->moderation->setAutoDefault(false);
|
||||
ui->moderation->setEnabled(is_mod);
|
||||
}
|
||||
|
||||
void ClientRoomWindow::RetranslateUi() {
|
||||
|
@ -47,7 +47,7 @@
|
||||
<string>Moderation...</string>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -144,7 +144,7 @@ void HostRoomWindow::Host() {
|
||||
bool created = room->Create(ui->room_name->text().toStdString(),
|
||||
ui->room_description->toPlainText().toStdString(), "",
|
||||
static_cast<u16>(port), password, ui->max_player->value(),
|
||||
NetSettings::values.citra_username, game_name.toStdString(),
|
||||
ui->username->text().toStdString(), game_name.toStdString(),
|
||||
game_id, CreateVerifyBackend(is_public), ban_list);
|
||||
if (!created) {
|
||||
NetworkMessage::ErrorManager::ShowError(
|
||||
|
@ -178,7 +178,6 @@ int main(int argc, char** argv) {
|
||||
u64 preferred_game_id = 0;
|
||||
u16 port = Network::DefaultRoomPort;
|
||||
u32 max_members = 16;
|
||||
bool enable_citra_mods = false;
|
||||
|
||||
static struct option long_options[] = {
|
||||
{"room-name", required_argument, 0, 'n'},
|
||||
@ -243,9 +242,6 @@ int main(int argc, char** argv) {
|
||||
case 'l':
|
||||
log_file.assign(optarg);
|
||||
break;
|
||||
case 'e':
|
||||
enable_citra_mods = true;
|
||||
break;
|
||||
case 'h':
|
||||
PrintHelp(argv[0]);
|
||||
return 0;
|
||||
@ -317,10 +313,6 @@ int main(int argc, char** argv) {
|
||||
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);
|
||||
|
||||
@ -347,8 +339,7 @@ int main(int argc, char** argv) {
|
||||
Network::Init();
|
||||
if (std::shared_ptr<Network::Room> room = Network::GetRoom().lock()) {
|
||||
if (!room->Create(room_name, room_description, "", port, password, max_members, username,
|
||||
preferred_game, preferred_game_id, std::move(verify_backend), ban_list,
|
||||
enable_citra_mods)) {
|
||||
preferred_game, preferred_game_id, std::move(verify_backend), ban_list)) {
|
||||
std::cout << "Failed to create room: \n\n";
|
||||
return -1;
|
||||
}
|
||||
|
@ -371,8 +371,15 @@ void Room::RoomImpl::HandleJoinRequest(const ENetEvent* event) {
|
||||
std::lock_guard lock(verify_UID_mutex);
|
||||
uid = verify_UID;
|
||||
}
|
||||
|
||||
if (verify_backend != nullptr)
|
||||
member.user_data = verify_backend->LoadUserData(uid, token);
|
||||
|
||||
if (nickname == room_information.host_username) {
|
||||
member.user_data.moderator = true;
|
||||
LOG_INFO(Network, "User {} is a moderator", std::string(room_information.host_username));
|
||||
}
|
||||
|
||||
std::string ip;
|
||||
{
|
||||
std::lock_guard lock(ban_list_mutex);
|
||||
@ -598,8 +605,7 @@ bool Room::RoomImpl::HasModPermission(const ENetPeer* client) const {
|
||||
if (sending_member == members.end()) {
|
||||
return false;
|
||||
}
|
||||
if (room_information.enable_citra_mods &&
|
||||
sending_member->user_data.moderator) { // Community moderator
|
||||
if (sending_member->user_data.moderator) { // Community moderator
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1013,7 +1019,7 @@ bool Room::Create(const std::string& name, const std::string& description,
|
||||
const u32 max_connections, const std::string& host_username,
|
||||
const std::string& preferred_game, u64 preferred_game_id,
|
||||
std::unique_ptr<VerifyUser::Backend> verify_backend,
|
||||
const Room::BanList& ban_list, bool enable_citra_mods) {
|
||||
const Room::BanList& ban_list) {
|
||||
ENetAddress address;
|
||||
address.host = ENET_HOST_ANY;
|
||||
if (!server_address.empty()) {
|
||||
@ -1036,7 +1042,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_id = preferred_game_id;
|
||||
room_impl->room_information.host_username = host_username;
|
||||
room_impl->room_information.enable_citra_mods = enable_citra_mods;
|
||||
room_impl->password = password;
|
||||
room_impl->verify_backend = std::move(verify_backend);
|
||||
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
|
||||
u64 preferred_game_id; ///< Title ID for the advertised game
|
||||
std::string host_username; ///< Forum username of the host
|
||||
bool enable_citra_mods; ///< Allow Citra Moderators to moderate on this room
|
||||
};
|
||||
|
||||
struct GameInfo {
|
||||
@ -148,7 +147,7 @@ public:
|
||||
const std::string& host_username = "", const std::string& preferred_game = "",
|
||||
u64 preferred_game_id = 0,
|
||||
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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user