@@ -17,7 +17,6 @@ use mas_config::{
1717use mas_data_model:: { Device , TokenType , Ulid , UpstreamOAuthProvider , User } ;
1818use mas_email:: Address ;
1919use mas_matrix:: HomeserverConnection ;
20- use mas_matrix_synapse:: SynapseConnection ;
2120use mas_storage:: {
2221 Clock , RepositoryAccess , SystemClock ,
2322 compat:: { CompatAccessTokenRepository , CompatSessionFilter , CompatSessionRepository } ,
@@ -33,7 +32,10 @@ use rand::{RngCore, SeedableRng};
3332use sqlx:: { Acquire , types:: Uuid } ;
3433use tracing:: { error, info, info_span, warn} ;
3534
36- use crate :: util:: { database_connection_from_config, password_manager_from_config} ;
35+ use crate :: util:: {
36+ database_connection_from_config, homeserver_connection_from_config,
37+ password_manager_from_config,
38+ } ;
3739
3840const USER_ATTRIBUTES_HEADING : & str = "User attributes" ;
3941
@@ -491,12 +493,7 @@ impl Options {
491493 let matrix_config = MatrixConfig :: extract ( figment) ?;
492494
493495 let password_manager = password_manager_from_config ( & password_config) . await ?;
494- let homeserver = SynapseConnection :: new (
495- matrix_config. homeserver ,
496- matrix_config. endpoint ,
497- matrix_config. secret ,
498- http_client,
499- ) ;
496+ let homeserver = homeserver_connection_from_config ( & matrix_config, http_client) ;
500497 let mut conn = database_connection_from_config ( & database_config) . await ?;
501498 let txn = conn. begin ( ) . await ?;
502499 let mut repo = PgRepository :: from_conn ( txn) ;
@@ -746,7 +743,7 @@ impl std::fmt::Display for HumanReadable<&UpstreamOAuthProvider> {
746743async fn check_and_normalize_username < ' a > (
747744 localpart_or_mxid : & ' a str ,
748745 repo : & mut dyn RepositoryAccess < Error = DatabaseError > ,
749- homeserver : & SynapseConnection ,
746+ homeserver : & dyn HomeserverConnection ,
750747) -> anyhow:: Result < & ' a str > {
751748 // XXX: this is a very basic MXID to localpart conversion
752749 // Strip any leading '@'
@@ -828,7 +825,7 @@ impl UserCreationRequest<'_> {
828825 }
829826
830827 /// Show the user creation request in a human-readable format
831- fn show ( & self , term : & Term , homeserver : & SynapseConnection ) -> std:: io:: Result < ( ) > {
828+ fn show ( & self , term : & Term , homeserver : & dyn HomeserverConnection ) -> std:: io:: Result < ( ) > {
832829 let value_style = Style :: new ( ) . green ( ) ;
833830 let key_style = Style :: new ( ) . bold ( ) ;
834831 let warning_style = Style :: new ( ) . italic ( ) . red ( ) . bright ( ) ;
0 commit comments