@@ -36,7 +36,6 @@ use crate::login_param::{
36
36
use crate :: message:: Message ;
37
37
use crate :: oauth2:: get_oauth2_addr;
38
38
use crate :: provider:: { Protocol , Provider , Socket , UsernamePattern } ;
39
- use crate :: qr:: set_account_from_qr;
40
39
use crate :: smtp:: Smtp ;
41
40
use crate :: sync:: Sync :: * ;
42
41
use crate :: tools:: time;
@@ -160,8 +159,19 @@ impl Context {
160
159
pub async fn add_transport_from_qr ( & self , qr : & str ) -> Result < ( ) > {
161
160
self . stop_io ( ) . await ;
162
161
162
+ // This code first sets the deprecated Config::Addr, Config::MailPw, etc.
163
+ // and then calls configure(), which loads them again.
164
+ // At some point, we will remove configure()
165
+ // and then simplify the code
166
+ // to directly create an EnteredLoginParam.
163
167
let result = async move {
164
- set_account_from_qr ( self , qr) . await ?;
168
+ match crate :: qr:: check_qr ( self , qr) . await ? {
169
+ crate :: qr:: Qr :: Account { .. } => crate :: qr:: set_account_from_qr ( self , qr) . await ?,
170
+ crate :: qr:: Qr :: Login { address, options } => {
171
+ crate :: qr:: configure_from_login_qr ( self , & address, options) . await ?
172
+ }
173
+ _ => bail ! ( "QR code does not contain account" ) ,
174
+ }
165
175
self . configure ( ) . await ?;
166
176
Ok ( ( ) )
167
177
}
0 commit comments