@@ -53,7 +53,7 @@ pub async fn get_oauth2_url(
5353 addr : & str ,
5454 redirect_uri : & str ,
5555) -> Result < Option < String > > {
56- if let Some ( oauth2) = Oauth2 :: from_address ( context , addr) . await {
56+ if let Some ( oauth2) = Oauth2 :: from_address ( addr) {
5757 context
5858 . sql
5959 . set_raw_config ( "oauth2_pending_redirect_uri" , Some ( redirect_uri) )
@@ -73,7 +73,7 @@ pub(crate) async fn get_oauth2_access_token(
7373 code : & str ,
7474 regenerate : bool ,
7575) -> Result < Option < String > > {
76- if let Some ( oauth2) = Oauth2 :: from_address ( context , addr) . await {
76+ if let Some ( oauth2) = Oauth2 :: from_address ( addr) {
7777 let lock = context. oauth2_mutex . lock ( ) . await ;
7878
7979 // read generated token
@@ -221,7 +221,7 @@ pub(crate) async fn get_oauth2_addr(
221221 addr : & str ,
222222 code : & str ,
223223) -> Result < Option < String > > {
224- let oauth2 = match Oauth2 :: from_address ( context , addr) . await {
224+ let oauth2 = match Oauth2 :: from_address ( addr) {
225225 Some ( o) => o,
226226 None => return Ok ( None ) ,
227227 } ;
@@ -256,15 +256,13 @@ pub(crate) async fn get_oauth2_addr(
256256}
257257
258258impl Oauth2 {
259- async fn from_address ( context : & Context , addr : & str ) -> Option < Self > {
259+ fn from_address ( addr : & str ) -> Option < Self > {
260260 let addr_normalized = normalize_addr ( addr) ;
261- let skip_mx = true ;
262261 if let Some ( domain) = addr_normalized
263262 . find ( '@' )
264263 . map ( |index| addr_normalized. split_at ( index + 1 ) . 1 )
265264 {
266- if let Some ( oauth2_authorizer) = provider:: get_provider_info ( context, domain, skip_mx)
267- . await
265+ if let Some ( oauth2_authorizer) = provider:: get_provider_info ( domain)
268266 . and_then ( |provider| provider. oauth2_authorizer . as_ref ( ) )
269267 {
270268 return Some ( match oauth2_authorizer {
@@ -354,21 +352,16 @@ mod tests {
354352
355353 #[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
356354 async fn test_oauth_from_address ( ) {
357- let t = TestContext :: new ( ) . await ;
358-
359355 // Delta Chat does not have working Gmail client ID anymore.
360- assert_eq ! ( Oauth2 :: from_address( & t , "hello@gmail.com" ) . await , None ) ;
361- assert_eq ! ( Oauth2 :: from_address( & t , "hello@googlemail.com" ) . await , None ) ;
356+ assert_eq ! ( Oauth2 :: from_address( "hello@gmail.com" ) , None ) ;
357+ assert_eq ! ( Oauth2 :: from_address( "hello@googlemail.com" ) , None ) ;
362358
363359 assert_eq ! (
364- Oauth2 :: from_address( & t, "hello@yandex.com" ) . await ,
365- Some ( OAUTH2_YANDEX )
366- ) ;
367- assert_eq ! (
368- Oauth2 :: from_address( & t, "hello@yandex.ru" ) . await ,
360+ Oauth2 :: from_address( "hello@yandex.com" ) ,
369361 Some ( OAUTH2_YANDEX )
370362 ) ;
371- assert_eq ! ( Oauth2 :: from_address( & t, "hello@web.de" ) . await , None ) ;
363+ assert_eq ! ( Oauth2 :: from_address( "hello@yandex.ru" ) , Some ( OAUTH2_YANDEX ) ) ;
364+ assert_eq ! ( Oauth2 :: from_address( "hello@web.de" ) , None ) ;
372365 }
373366
374367 #[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
0 commit comments