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

@ -35,7 +35,9 @@ struct WifiPacket {
/// Represents a chat message.
struct ChatEntry {
std::string nickname; ///< Nickname of the client who sent this message.
std::string message; ///< Body of the message.
/// Web services username of the client who sent this message, can be empty.
std::string username;
std::string message; ///< Body of the message.
};
/**
@ -64,7 +66,10 @@ public:
};
struct MemberInformation {
std::string nickname; ///< Nickname of the member.
std::string nickname; ///< 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; ///< Name of the game they're currently playing, or empty if they're
/// not playing anything.
MacAddress mac_address; ///< MAC address associated with this member.
@ -100,6 +105,11 @@ public:
*/
const std::string& GetNickname() const;
/**
* Returns the username of the RoomMember.
*/
const std::string& GetUsername() const;
/**
* Returns the MAC address of the RoomMember.
*/
@ -123,7 +133,7 @@ public:
void Join(const std::string& nickname, const std::string& console_id_hash,
const char* server_addr = "127.0.0.1", const u16 server_port = DefaultRoomPort,
const u16 client_port = 0, const MacAddress& preferred_mac = NoPreferredMac,
const std::string& password = "");
const std::string& password = "", const std::string& token = "");
/**
* Sends a WiFi packet to the room.