Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions deltachat-ffi/deltachat.h
Original file line number Diff line number Diff line change
Expand Up @@ -575,11 +575,10 @@ int dc_set_stock_translation(dc_context_t* context, uint32_t stock_i

/**
* Set configuration values from a QR code.
* Before this function is called, dc_check_qr() should confirm the type of the
* QR code is DC_QR_ACCOUNT or DC_QR_LOGIN.
* Before this function is called, dc_check_qr() should be used to get the QR code type.
*
* Internally, the function will call dc_set_config() with the appropriate keys,
* e.g. `addr` and `mail_pw` for DC_QR_ACCOUNT and DC_QR_LOGIN.
* DC_QR_ACCOUNT and DC_QR_LOGIN QR codes configure the context, but I/O mustn't be started for such
* QR codes.
*
* @memberof dc_context_t
* @param context The context object.
Expand Down
8 changes: 4 additions & 4 deletions deltachat-jsonrpc/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,11 +416,11 @@ impl CommandApi {
Ok(())
}

/// Set configuration values from a QR code. (technically from the URI that is stored in the qrcode)
/// Before this function is called, `checkQr()` should confirm the type of the
/// QR code is `account` or `webrtcInstance`.
/// Set configuration values from a QR code (technically from the URI stored in it).
/// Before this function is called, `check_qr()` should be used to get the QR code type.
///
/// Internally, the function will call dc_set_config() with the appropriate keys,
/// "DCACCOUNT:" and "DCLOGIN:" QR codes configure the account, but I/O mustn't be started for
/// such QR codes, consider using [`Self::add_transport_from_qr`] which also restarts I/O.
async fn set_config_from_qr(&self, account_id: u32, qr_content: String) -> Result<()> {
let ctx = self.get_context(account_id).await?;
qr::set_config_from_qr(&ctx, &qr_content).await
Expand Down
2 changes: 1 addition & 1 deletion deltachat-repl/src/cmdline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1231,7 +1231,7 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
"setqr" => {
ensure!(!arg1.is_empty(), "Argument <qr-content> missing.");
match set_config_from_qr(&context, arg1).await {
Ok(()) => println!("Config set from QR code, you can now call 'configure'"),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is actually a program output, but rather a log, so decided to move it to stderr

Ok(()) => eprintln!("Config set from the QR code."),
Err(err) => eprintln!("Cannot set config from QR code: {err:?}"),
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/qr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,8 @@ pub(crate) async fn login_param_from_account_qr(
}

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