network, web_service: Add Verification backend and use new lobby API

Added verify_backend to load user_data for members. and removed method to generate UID as this is now done server-side.

Added GetUsername function and a "token" param to room_member.
Also added a username to ChatEntry, so that the username can be shown (along with nicknames) in the chat dialog.
This commit is contained in:
zhupengfei 2018-10-27 15:35:01 +08:00
parent 5f0e189238
commit 1a8841f96e
No known key found for this signature in database
GPG key ID: DD129E108BD09378
12 changed files with 262 additions and 45 deletions

View file

@ -9,6 +9,7 @@
#include <string>
#include <vector>
#include "common/common_types.h"
#include "network/verify_user.h"
namespace Network {
@ -27,7 +28,6 @@ struct RoomInformation {
std::string name; ///< Name of the server
std::string description; ///< Server description
u32 member_slots; ///< Maximum number of members in this room
std::string uid; ///< The unique ID of the room
u16 port; ///< The port of this room
std::string preferred_game; ///< Game to advertise that you want to play
u64 preferred_game_id; ///< Title ID for the advertised game
@ -72,9 +72,12 @@ public:
};
struct Member {
std::string nickname; ///< The nickname of the member.
GameInfo game_info; ///< The current game of the member
MacAddress mac_address; ///< The assigned mac address of the member.
std::string nickname; ///< The nickname of the member.
std::string username; ///< The web services username of the member. Can be empty.
std::string display_name; ///< The web services display name of the member. Can be empty.
std::string avatar_url; ///< Url to the member's avatar. Can be empty.
GameInfo game_info; ///< The current game of the member
MacAddress mac_address; ///< The assigned mac address of the member.
};
Room();
@ -90,6 +93,11 @@ public:
*/
const RoomInformation& GetRoomInformation() const;
/**
* Gets the verify UID of this room.
*/
std::string GetVerifyUID() const;
/**
* Gets a list of the mbmers connected to the room.
*/
@ -108,7 +116,13 @@ public:
const std::string& server = "", u16 server_port = DefaultRoomPort,
const std::string& password = "",
const u32 max_connections = MaxConcurrentConnections,
const std::string& preferred_game = "", u64 preferred_game_id = 0);
const std::string& preferred_game = "", u64 preferred_game_id = 0,
std::unique_ptr<VerifyUser::Backend> verify_backend = nullptr);
/**
* Sets the verification GUID of the room.
*/
void SetVerifyUID(const std::string& uid);
/**
* Destroys the socket