refactor!(matrix): move options into a table

This commit is contained in:
2025-03-20 18:13:56 -04:00
parent 228b3e3e54
commit 685f0a9cca
4 changed files with 29 additions and 32 deletions

View File

@@ -278,15 +278,10 @@ async fn lua_init(client: Client, state: &State, globals: &Table) -> Result<()>
#[cfg(feature = "matrix")]
fn matrix_init(client: &Client, state: State) {
let globals = state.lua.globals();
if let Ok(homeserver_url) = globals.get::<String>("MatrixHomeserverUrl")
&& let Ok(username) = globals.get::<String>("MatrixUsername")
&& let Ok(password) = globals.get::<String>("MatrixPassword")
{
if let Ok(options) = globals.get::<Table>("MatrixOptions") {
let name = client.username();
tokio::spawn(async move {
if let Err(error) =
matrix::login(homeserver_url, username, &password, state, globals, name).await
{
if let Err(error) = matrix::login(state, options, globals, name).await {
error!("failed to log into matrix account: {error:?}");
}
});