|
|
|
@ -14,7 +14,7 @@ use crate::{User, UserStatus}; |
|
|
|
* SERVER RESPONSE *
|
|
|
|
*=================*/
|
|
|
|
|
|
|
|
#[derive(Debug, Eq, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
|
|
pub enum ServerResponse {
|
|
|
|
ConnectToPeerResponse(ConnectToPeerResponse),
|
|
|
|
FileSearchResponse(FileSearchResponse),
|
|
|
|
@ -287,7 +287,7 @@ impl ValueDecode for ServerResponse { |
|
|
|
* CONNECT TO PEER *
|
|
|
|
*=================*/
|
|
|
|
|
|
|
|
#[derive(Debug, Eq, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
|
|
pub struct ConnectToPeerResponse {
|
|
|
|
pub user_name: String,
|
|
|
|
pub connection_type: String,
|
|
|
|
@ -361,7 +361,7 @@ impl ValueDecode for ConnectToPeerResponse { |
|
|
|
* FILE SEARCH *
|
|
|
|
*=============*/
|
|
|
|
|
|
|
|
#[derive(Debug, Eq, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
|
|
pub struct FileSearchResponse {
|
|
|
|
pub user_name: String,
|
|
|
|
pub ticket: u32,
|
|
|
|
@ -417,7 +417,7 @@ impl ValueDecode for FileSearchResponse { |
|
|
|
* LOGIN *
|
|
|
|
*=======*/
|
|
|
|
|
|
|
|
#[derive(Debug, Eq, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
|
|
pub enum LoginResponse {
|
|
|
|
LoginOk {
|
|
|
|
motd: String,
|
|
|
|
@ -513,7 +513,7 @@ impl ValueDecode for LoginResponse { |
|
|
|
* PARENT MIN SPEED *
|
|
|
|
*==================*/
|
|
|
|
|
|
|
|
#[derive(Debug, Eq, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
|
|
pub struct ParentMinSpeedResponse {
|
|
|
|
pub value: u32,
|
|
|
|
}
|
|
|
|
@ -551,7 +551,7 @@ impl ValueDecode for ParentMinSpeedResponse { |
|
|
|
* PARENT SPEED RATIO *
|
|
|
|
*====================*/
|
|
|
|
|
|
|
|
#[derive(Debug, Eq, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
|
|
pub struct ParentSpeedRatioResponse {
|
|
|
|
pub value: u32,
|
|
|
|
}
|
|
|
|
@ -589,7 +589,7 @@ impl ValueDecode for ParentSpeedRatioResponse { |
|
|
|
* PEER ADDRESS *
|
|
|
|
*==============*/
|
|
|
|
|
|
|
|
#[derive(Debug, Eq, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
|
|
pub struct PeerAddressResponse {
|
|
|
|
user_name: String,
|
|
|
|
ip: net::Ipv4Addr,
|
|
|
|
@ -644,7 +644,7 @@ impl ValueDecode for PeerAddressResponse { |
|
|
|
* PRIVILEGED USERS *
|
|
|
|
*==================*/
|
|
|
|
|
|
|
|
#[derive(Debug, Eq, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
|
|
pub struct PrivilegedUsersResponse {
|
|
|
|
pub users: Vec<String>,
|
|
|
|
}
|
|
|
|
@ -682,7 +682,7 @@ impl ValueDecode for PrivilegedUsersResponse { |
|
|
|
* ROOM JOIN *
|
|
|
|
*===========*/
|
|
|
|
|
|
|
|
#[derive(Debug, Eq, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
|
|
pub struct RoomJoinResponse {
|
|
|
|
pub room_name: String,
|
|
|
|
pub users: Vec<User>,
|
|
|
|
@ -793,7 +793,7 @@ impl RoomJoinResponse { |
|
|
|
// This struct is defined to enable decoding a vector of such values for
|
|
|
|
// `RoomJoinResponse`, but its data is inlined in the `User` struct.
|
|
|
|
// For details about individual fields, see said `User` struct.
|
|
|
|
#[derive(Debug, Eq, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
|
|
struct UserInfo {
|
|
|
|
average_speed: u32,
|
|
|
|
num_downloads: u32,
|
|
|
|
@ -963,7 +963,7 @@ impl ValueDecode for RoomJoinResponse { |
|
|
|
* ROOM LEAVE *
|
|
|
|
*============*/
|
|
|
|
|
|
|
|
#[derive(Debug, Eq, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
|
|
pub struct RoomLeaveResponse {
|
|
|
|
pub room_name: String,
|
|
|
|
}
|
|
|
|
@ -1002,7 +1002,7 @@ impl ValueDecode for RoomLeaveResponse { |
|
|
|
* ROOM LIST *
|
|
|
|
*===========*/
|
|
|
|
|
|
|
|
#[derive(Debug, Eq, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
|
|
pub struct RoomListResponse {
|
|
|
|
pub rooms: Vec<(String, u32)>,
|
|
|
|
pub owned_private_rooms: Vec<(String, u32)>,
|
|
|
|
@ -1150,7 +1150,7 @@ impl ValueDecode for RoomListResponse { |
|
|
|
* ROOM MESSAGE *
|
|
|
|
*==============*/
|
|
|
|
|
|
|
|
#[derive(Debug, Eq, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
|
|
pub struct RoomMessageResponse {
|
|
|
|
pub room_name: String,
|
|
|
|
pub user_name: String,
|
|
|
|
@ -1204,7 +1204,7 @@ impl ValueDecode for RoomMessageResponse { |
|
|
|
* ROOM TICKERS *
|
|
|
|
*==============*/
|
|
|
|
|
|
|
|
#[derive(Debug, Eq, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
|
|
pub struct RoomTickersResponse {
|
|
|
|
pub room_name: String,
|
|
|
|
pub tickers: Vec<(String, String)>,
|
|
|
|
@ -1254,7 +1254,7 @@ impl ValueDecode for RoomTickersResponse { |
|
|
|
* ROOM USER JOINED *
|
|
|
|
*==================*/
|
|
|
|
|
|
|
|
#[derive(Debug, Eq, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
|
|
pub struct RoomUserJoinedResponse {
|
|
|
|
pub room_name: String,
|
|
|
|
pub user: User,
|
|
|
|
@ -1332,7 +1332,7 @@ impl ValueDecode for RoomUserJoinedResponse { |
|
|
|
* ROOM USER LEFT *
|
|
|
|
*================*/
|
|
|
|
|
|
|
|
#[derive(Debug, Eq, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
|
|
pub struct RoomUserLeftResponse {
|
|
|
|
pub room_name: String,
|
|
|
|
pub user_name: String,
|
|
|
|
@ -1380,7 +1380,7 @@ impl ValueDecode for RoomUserLeftResponse { |
|
|
|
* USER INFO *
|
|
|
|
*===========*/
|
|
|
|
|
|
|
|
#[derive(Debug, Eq, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
|
|
pub struct UserInfoResponse {
|
|
|
|
pub user_name: String,
|
|
|
|
pub average_speed: usize,
|
|
|
|
@ -1500,7 +1500,7 @@ impl ValueDecode for UserStatusResponse { |
|
|
|
* WISHLIST INTERVAL *
|
|
|
|
*===================*/
|
|
|
|
|
|
|
|
#[derive(Debug, Eq, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
|
|
pub struct WishlistIntervalResponse {
|
|
|
|
pub seconds: u32,
|
|
|
|
}
|
|
|
|
|