@@ -22,9 +22,7 @@ use tokio::sync::RwLock;
2222
2323use crate :: chat:: { self , ChatId , ChatIdBlocked } ;
2424use crate :: config:: Config ;
25- use crate :: constants:: {
26- Blocked , Chattype , ShowEmails , DC_FETCH_EXISTING_MSGS_COUNT , DC_FOLDERS_CONFIGURED_VERSION ,
27- } ;
25+ use crate :: constants:: { self , Blocked , Chattype , ShowEmails , DC_FETCH_EXISTING_MSGS_COUNT } ;
2826use crate :: contact:: { normalize_name, Contact , ContactAddress , ContactId , Modifier , Origin } ;
2927use crate :: context:: Context ;
3028use crate :: events:: EventType ;
@@ -1767,11 +1765,17 @@ impl Imap {
17671765 context : & Context ,
17681766 create_mvbox : bool ,
17691767 ) -> Result < ( ) > {
1770- let folders_configured = context. sql . get_raw_config_int ( "folders_configured" ) . await ?;
1771- if folders_configured. unwrap_or_default ( ) >= DC_FOLDERS_CONFIGURED_VERSION {
1768+ let folders_configured = context
1769+ . sql
1770+ . get_raw_config_int ( constants:: DC_FOLDERS_CONFIGURED_KEY )
1771+ . await ?;
1772+ if folders_configured. unwrap_or_default ( ) >= constants:: DC_FOLDERS_CONFIGURED_VERSION {
17721773 return Ok ( ( ) ) ;
17731774 }
1774-
1775+ if let Err ( err) = self . connect ( context) . await {
1776+ self . connectivity . set_err ( context, & err) . await ;
1777+ return Err ( err) ;
1778+ }
17751779 self . configure_folders ( context, create_mvbox) . await
17761780 }
17771781
@@ -1893,7 +1897,10 @@ impl Imap {
18931897 }
18941898 context
18951899 . sql
1896- . set_raw_config_int ( "folders_configured" , DC_FOLDERS_CONFIGURED_VERSION )
1900+ . set_raw_config_int (
1901+ constants:: DC_FOLDERS_CONFIGURED_KEY ,
1902+ constants:: DC_FOLDERS_CONFIGURED_VERSION ,
1903+ )
18971904 . await ?;
18981905
18991906 info ! ( context, "FINISHED configuring IMAP-folders." ) ;
0 commit comments