diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2022-07-26 00:31:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-26 00:31:45 +0200 |
commit | 1e67d2b59f6dfd561768db3fb9a8e0c6a16ec9f2 (patch) | |
tree | 999411f1ca76390654d1034c6d0bd2c47c3f101c /src/web_service/announce_room_json.h | |
parent | Merge pull request #8564 from lat9nq/dinner-fork (diff) | |
parent | network: Address review comments (diff) | |
download | yuzu-1e67d2b59f6dfd561768db3fb9a8e0c6a16ec9f2.tar yuzu-1e67d2b59f6dfd561768db3fb9a8e0c6a16ec9f2.tar.gz yuzu-1e67d2b59f6dfd561768db3fb9a8e0c6a16ec9f2.tar.bz2 yuzu-1e67d2b59f6dfd561768db3fb9a8e0c6a16ec9f2.tar.lz yuzu-1e67d2b59f6dfd561768db3fb9a8e0c6a16ec9f2.tar.xz yuzu-1e67d2b59f6dfd561768db3fb9a8e0c6a16ec9f2.tar.zst yuzu-1e67d2b59f6dfd561768db3fb9a8e0c6a16ec9f2.zip |
Diffstat (limited to 'src/web_service/announce_room_json.h')
-rw-r--r-- | src/web_service/announce_room_json.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/web_service/announce_room_json.h b/src/web_service/announce_room_json.h new file mode 100644 index 000000000..32c08858d --- /dev/null +++ b/src/web_service/announce_room_json.h @@ -0,0 +1,41 @@ +// SPDX-FileCopyrightText: Copyright 2017 Citra Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include <functional> +#include <string> +#include "common/announce_multiplayer_room.h" +#include "web_service/web_backend.h" + +namespace WebService { + +/** + * Implementation of AnnounceMultiplayerRoom::Backend that (de)serializes room information into/from + * JSON, and submits/gets it to/from the yuzu web service + */ +class RoomJson : public AnnounceMultiplayerRoom::Backend { +public: + RoomJson(const std::string& host_, const std::string& username_, const std::string& token_) + : client(host_, username_, token_), host(host_), username(username_), token(token_) {} + ~RoomJson() = default; + void SetRoomInformation(const std::string& name, const std::string& description, const u16 port, + const u32 max_player, const u32 net_version, const bool has_password, + const AnnounceMultiplayerRoom::GameInfo& preferred_game) override; + void AddPlayer(const AnnounceMultiplayerRoom::Member& member) override; + WebResult Update() override; + WebResult Register() override; + void ClearPlayers() override; + AnnounceMultiplayerRoom::RoomList GetRoomList() override; + void Delete() override; + +private: + AnnounceMultiplayerRoom::Room room; + Client client; + std::string host; + std::string username; + std::string token; + std::string room_id; +}; + +} // namespace WebService |