Skip to content

Commit 061b275

Browse files
committed
docs: set_config_from_qr() configures context for "DCACCOUNT:" and "DCLOGIN:" QRs (#7450)
Also remove "you can now call 'configure'" from the REPL output, probably users of the REPL tool can read the code documentation to know when 'configure' should be run.
1 parent 5925f72 commit 061b275

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

deltachat-ffi/deltachat.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -575,11 +575,10 @@ int dc_set_stock_translation(dc_context_t* context, uint32_t stock_i
575575

576576
/**
577577
* Set configuration values from a QR code.
578-
* Before this function is called, dc_check_qr() should confirm the type of the
579-
* QR code is DC_QR_ACCOUNT or DC_QR_LOGIN.
578+
* Before this function is called, dc_check_qr() should be used to get the QR code type.
580579
*
581-
* Internally, the function will call dc_set_config() with the appropriate keys,
582-
* e.g. `addr` and `mail_pw` for DC_QR_ACCOUNT and DC_QR_LOGIN.
580+
* DC_QR_ACCOUNT and DC_QR_LOGIN QR codes configure the context, but I/O mustn't be started for such
581+
* QR codes.
583582
*
584583
* @memberof dc_context_t
585584
* @param context The context object.

deltachat-jsonrpc/src/api.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -416,11 +416,11 @@ impl CommandApi {
416416
Ok(())
417417
}
418418

419-
/// Set configuration values from a QR code. (technically from the URI that is stored in the qrcode)
420-
/// Before this function is called, `checkQr()` should confirm the type of the
421-
/// QR code is `account` or `webrtcInstance`.
419+
/// Set configuration values from a QR code (technically from the URI stored in it).
420+
/// Before this function is called, `check_qr()` should be used to get the QR code type.
422421
///
423-
/// Internally, the function will call dc_set_config() with the appropriate keys,
422+
/// "DCACCOUNT:" and "DCLOGIN:" QR codes configure the account, but I/O mustn't be started for
423+
/// such QR codes, consider using [`Self::add_transport_from_qr`] which also restarts I/O.
424424
async fn set_config_from_qr(&self, account_id: u32, qr_content: String) -> Result<()> {
425425
let ctx = self.get_context(account_id).await?;
426426
qr::set_config_from_qr(&ctx, &qr_content).await

deltachat-repl/src/cmdline.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1231,7 +1231,7 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
12311231
"setqr" => {
12321232
ensure!(!arg1.is_empty(), "Argument <qr-content> missing.");
12331233
match set_config_from_qr(&context, arg1).await {
1234-
Ok(()) => println!("Config set from QR code, you can now call 'configure'"),
1234+
Ok(()) => eprintln!("Config set from the QR code."),
12351235
Err(err) => eprintln!("Cannot set config from QR code: {err:?}"),
12361236
}
12371237
}

src/qr.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,8 @@ pub(crate) async fn login_param_from_account_qr(
834834
}
835835

836836
/// Sets configuration values from a QR code.
837+
/// "DCACCOUNT:" and "DCLOGIN:" QR codes configure `context`, but I/O mustn't be started for such QR
838+
/// codes, consider using [`Context::add_transport_from_qr`] which also restarts I/O.
837839
pub async fn set_config_from_qr(context: &Context, qr: &str) -> Result<()> {
838840
match check_qr(context, qr).await? {
839841
Qr::Account { .. } => {

0 commit comments

Comments
 (0)