diff options
| author | Gustav Sörnäs <gustav@sornas.net> | 2021-06-15 13:41:45 +0200 |
|---|---|---|
| committer | Gustav Sörnäs <gustav@sornas.net> | 2021-06-15 13:41:45 +0200 |
| commit | 14ecdfe2365682e37df99569747b96943ec55426 (patch) | |
| tree | 890567622f67a4824c497a13453b6af3ebd33742 | |
| parent | f03d0d1d8def80c905a59c2bba9722d21a95ffae (diff) | |
| download | mum-14ecdfe2365682e37df99569747b96943ec55426.tar.gz | |
doc mumlib state
| -rw-r--r-- | mumlib/src/command.rs | 21 | ||||
| -rw-r--r-- | mumlib/src/state.rs | 12 |
2 files changed, 28 insertions, 5 deletions
diff --git a/mumlib/src/command.rs b/mumlib/src/command.rs index 79343cf..9d98a38 100644 --- a/mumlib/src/command.rs +++ b/mumlib/src/command.rs @@ -89,16 +89,18 @@ pub enum Command { /// Set the outgoing audio volume (i.e. from you to the server). No response. InputVolumeSet(f32), - /// Response: [CommandResponse::MuteStatus]. Toggles if None. + /// Response: [CommandResponse::MuteStatus]. Toggles mute state if None. MuteOther(String, Option<bool>), - /// Response: [CommandResponse::MuteStatus]. Toggles if None. + /// Response: [CommandResponse::MuteStatus]. Toggles mute state if None. MuteSelf(Option<bool>), /// Set the master incoming audio volume (i.e. from the server to you). /// No response. OutputVolumeSet(f32), + /// Request a list of past messages. Blocks while waiting for more messages + /// if block is true. Response: multiple [CommandResponse::PastMessage]. PastMessages { block: bool, }, @@ -107,20 +109,29 @@ pub enum Command { /// mumd-instance. Ping, + /// Send a message to some [MessageTarget]. SendMessage { + /// The message to send. message: String, + /// The target(s) to send the message to. targets: MessageTarget, }, + /// Connect to the specified server. Response: [CommandResponse::ServerConnect]. ServerConnect { + /// The URL or IP-adress to connect to. host: String, + /// The port to connect to. port: u16, + /// The username to connect with. username: String, + /// The server password, if applicable. Not sent if None. password: Option<String>, + /// Whether to accept an invalid server certificate or not. accept_invalid_cert: bool, }, - /// No response. + /// Disconnect from the currently connected server. No response. ServerDisconnect, /// Send a server status request via UDP (e.g. not requiring a TCP connection). @@ -130,10 +141,10 @@ pub enum Command { port: u16, }, - /// Response: [CommandResponse::Status]. + /// Request the status of the current server. Response: [CommandResponse::Status]. Status, - /// No response. + /// The the volume of the specified user. No response. UserVolumeSet(String, f32), } diff --git a/mumlib/src/state.rs b/mumlib/src/state.rs index 182a8fc..a5262e0 100644 --- a/mumlib/src/state.rs +++ b/mumlib/src/state.rs @@ -1,26 +1,38 @@ use serde::{Deserialize, Serialize}; use std::fmt; +/// The state of the currently connected Mumble server. #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Server { + /// State of the currently connected channel. pub channels: Channel, + /// The welcome text we received when we connected. pub welcome_text: Option<String>, + /// Our username. pub username: String, + /// The host (ip:port) of the server. pub host: String, } +/// A representation of a channel in a Mumble server. #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Channel { + /// The description of the channel, if set. pub description: Option<String>, + /// The maximum number of allowed users in this channel. pub max_users: u32, + /// The name of this channel. pub name: String, + /// Any children this channel has. pub children: Vec<Channel>, + /// This channel's connected users. pub users: Vec<User>, links: Vec<Vec<usize>>, //to represent several walks through the tree to find channels its linked to } impl Channel { + /// Create a new Channel representation. pub fn new( name: String, description: Option<String>, |
