fix: cannot compare options

This commit is contained in:
əlemi 2024-02-19 02:10:01 +01:00
parent 69a14793a1
commit e6b3f41540
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -39,7 +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 username = username.unwrap_or_else(|| ".mumble-stats-api".to_string());
let mut channel = ControlChannel::new(host, port).await?;
let version = proto::Version {
version_v1: None,
@ -49,7 +49,7 @@ impl Session {
os_version: None,
};
let authenticate = proto::Authenticate {
username: username.clone(),
username: Some(username.clone()),
password,
tokens: Vec::new(),
celt_versions: Vec::new(),
@ -72,7 +72,7 @@ impl Session {
// Ok(tcp::proto::Packet::ChannelState(channel)) => tracing::info!("discovered channel: {:?}", channel.name),
proto::Packet::ServerSync(_sync) => break Ok(users),
proto::Packet::UserState(user) => {
if user.name != username {
if user.name.as_ref().is_some_and(|n| n != &username) {
users.push(user.into());
}
},