mirror of
https://git.alemi.dev/mumble-stats-api.git
synced 2024-11-14 04:29:19 +01:00
fix: exclude self from user list
This commit is contained in:
parent
838ad5b544
commit
5cb7ca5193
1 changed files with 7 additions and 2 deletions
|
@ -39,6 +39,7 @@ impl Session {
|
|||
}
|
||||
|
||||
pub async fn users(host: &str, port: Option<u16>, username: Option<String>, password: Option<String>) -> std::io::Result<Vec<crate::model::User>> {
|
||||
let username = Some(username.unwrap_or_else(|| ".mumble-stats-api".to_string()));
|
||||
let mut channel = ControlChannel::new(host, port).await?;
|
||||
let version = proto::Version {
|
||||
version_v1: None,
|
||||
|
@ -48,7 +49,7 @@ impl Session {
|
|||
os_version: None,
|
||||
};
|
||||
let authenticate = proto::Authenticate {
|
||||
username: Some(username.unwrap_or_else(|| ".mumble-stats-api".to_string())),
|
||||
username: username.clone(),
|
||||
password,
|
||||
tokens: Vec::new(),
|
||||
celt_versions: Vec::new(),
|
||||
|
@ -69,8 +70,12 @@ impl Session {
|
|||
match channel.recv().await? {
|
||||
// Ok(tcp::proto::Packet::TextMessage(msg)) => tracing::info!("{}", msg.message),
|
||||
// Ok(tcp::proto::Packet::ChannelState(channel)) => tracing::info!("discovered channel: {:?}", channel.name),
|
||||
proto::Packet::UserState(user) => users.push(user.into()),
|
||||
proto::Packet::ServerSync(_sync) => break Ok(users),
|
||||
proto::Packet::UserState(user) => {
|
||||
if user.name != username {
|
||||
users.push(user.into());
|
||||
}
|
||||
},
|
||||
pkt => tracing::debug!("ignoring packet {:#?}", pkt),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue