diff --git a/deltachat-ffi/deltachat.h b/deltachat-ffi/deltachat.h index 7180c5abc..a6828b129 100644 --- a/deltachat-ffi/deltachat.h +++ b/deltachat-ffi/deltachat.h @@ -2412,7 +2412,7 @@ void dc_str_unref (char* str); * The account manager takes an directory * where all context-databases are placed in. * To add a context to the account manager, - * use dc_accounts_add_account(), dc_accounts_import_account or dc_accounts_migrate_account(). + * use dc_accounts_add_account() or dc_accounts_migrate_account(). * All account information are persisted. * To remove a context from the account manager, * use dc_accounts_remove_account(). @@ -2457,21 +2457,6 @@ void dc_accounts_unref (dc_accounts_t* accounts); uint32_t dc_accounts_add_account (dc_accounts_t* accounts); -/** - * Import a tarfile-backup to the account manager. - * On success, a new account is added to the account-manager, - * with all the data provided by the backup-file. - * Moreover, the newly created account will be the selected one. - * - * @memberof dc_accounts_t - * @param accounts Account manager as created by dc_accounts_new(). - * @param tarfile Backup as created by dc_imex(). - * @return Account-id, use dc_accounts_get_account() to get the context object. - * On errors, 0 is returned. - */ -uint32_t dc_accounts_import_account (dc_accounts_t* accounts, const char* tarfile); - - /** * Migrate independent accounts into accounts managed by the account manager. * This will _move_ the database-file and all blob-files to the directory managed diff --git a/deltachat-ffi/src/lib.rs b/deltachat-ffi/src/lib.rs index 09e34851a..01b7da575 100644 --- a/deltachat-ffi/src/lib.rs +++ b/deltachat-ffi/src/lib.rs @@ -3799,23 +3799,6 @@ pub unsafe extern "C" fn dc_accounts_get_all(accounts: *mut dc_accounts_t) -> *m Box::into_raw(Box::new(array)) } -#[no_mangle] -pub unsafe extern "C" fn dc_accounts_import_account( - accounts: *mut dc_accounts_t, - file: *const libc::c_char, -) -> u32 { - if accounts.is_null() || file.is_null() { - eprintln!("ignoring careless call to dc_accounts_import_account()"); - return 0; - } - - let accounts = &*accounts; - let file = to_string_lossy(file); - block_on(accounts.import_account(async_std::path::PathBuf::from(file))) - .map(|_| 1) - .unwrap_or_else(|_| 0) -} - #[no_mangle] pub unsafe extern "C" fn dc_accounts_start_io(accounts: *mut dc_accounts_t) { if accounts.is_null() { diff --git a/src/accounts.rs b/src/accounts.rs index 7e9ebc1c3..67427b971 100644 --- a/src/accounts.rs +++ b/src/accounts.rs @@ -179,25 +179,6 @@ impl Accounts { self.accounts.read().await.keys().copied().collect() } - /// Import a backup using a new account and selects it. - pub async fn import_account(&self, file: PathBuf) -> Result { - let old_id = self.config.get_selected_account().await; - - let id = self.add_account().await?; - let ctx = self.get_account(id).await.expect("just added"); - - match crate::imex::imex(&ctx, crate::imex::ImexMode::ImportBackup, &file).await { - Ok(_) => Ok(id), - Err(err) => { - // remove temp account - self.remove_account(id).await?; - // set selection back - self.select_account(old_id).await?; - Err(err) - } - } - } - pub async fn start_io(&self) { let accounts = &*self.accounts.read().await; for account in accounts.values() {