mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 01:16:31 +03:00
cargo fmt
This commit is contained in:
@@ -1324,7 +1324,9 @@ pub unsafe extern "C" fn dc_get_securejoin_qr(
|
|||||||
}
|
}
|
||||||
|
|
||||||
let context = &*context;
|
let context = &*context;
|
||||||
dc_securejoin::dc_get_securejoin_qr(context, chat_id).unwrap_or("").strdup()
|
dc_securejoin::dc_get_securejoin_qr(context, chat_id)
|
||||||
|
.unwrap_or("")
|
||||||
|
.strdup()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ extern crate lazy_static;
|
|||||||
extern crate rusqlite;
|
extern crate rusqlite;
|
||||||
|
|
||||||
use std::borrow::Cow::{self, Borrowed, Owned};
|
use std::borrow::Cow::{self, Borrowed, Owned};
|
||||||
|
use std::io::{self, Write};
|
||||||
|
use std::process::Command;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::sync::atomic::{AtomicBool, Ordering};
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
use std::sync::{Arc, Mutex, RwLock};
|
use std::sync::{Arc, Mutex, RwLock};
|
||||||
use std::process::Command;
|
|
||||||
use std::io::{self, Write};
|
|
||||||
|
|
||||||
use deltachat::config;
|
use deltachat::config;
|
||||||
use deltachat::configure::*;
|
use deltachat::configure::*;
|
||||||
@@ -518,7 +518,9 @@ unsafe fn handle_cmd(line: &str, ctx: Arc<RwLock<Context>>) -> Result<ExitResult
|
|||||||
}
|
}
|
||||||
"getqr" | "getbadqr" => {
|
"getqr" | "getbadqr" => {
|
||||||
start_threads(ctx.clone());
|
start_threads(ctx.clone());
|
||||||
if let Some(mut qr) = dc_get_securejoin_qr(&ctx.read().unwrap(), arg1.parse().unwrap_or_default()) {
|
if let Some(mut qr) =
|
||||||
|
dc_get_securejoin_qr(&ctx.read().unwrap(), arg1.parse().unwrap_or_default())
|
||||||
|
{
|
||||||
if !qr.is_empty() {
|
if !qr.is_empty() {
|
||||||
if arg0 == "getbadqr" && qr.len() > 40 {
|
if arg0 == "getbadqr" && qr.len() > 40 {
|
||||||
qr.replace_range(12..22, "0000000000")
|
qr.replace_range(12..22, "0000000000")
|
||||||
|
|||||||
@@ -22,13 +22,9 @@ use crate::stock::StockMessage;
|
|||||||
use crate::types::*;
|
use crate::types::*;
|
||||||
use crate::x::*;
|
use crate::x::*;
|
||||||
|
|
||||||
pub const NON_ALPHANUMERIC_WITHOUT_DOT: &AsciiSet = &NON_ALPHANUMERIC
|
pub const NON_ALPHANUMERIC_WITHOUT_DOT: &AsciiSet = &NON_ALPHANUMERIC.remove(b'.');
|
||||||
.remove(b'.');
|
|
||||||
|
|
||||||
pub unsafe fn dc_get_securejoin_qr(
|
pub unsafe fn dc_get_securejoin_qr(context: &Context, group_chat_id: uint32_t) -> Option<String> {
|
||||||
context: &Context,
|
|
||||||
group_chat_id: uint32_t,
|
|
||||||
) -> Option<String> {
|
|
||||||
/* =========================================================
|
/* =========================================================
|
||||||
==== Alice - the inviter side ====
|
==== Alice - the inviter side ====
|
||||||
==== Step 1 in "Setup verified contact" protocol ====
|
==== Step 1 in "Setup verified contact" protocol ====
|
||||||
@@ -61,7 +57,6 @@ pub unsafe fn dc_get_securejoin_qr(
|
|||||||
});
|
});
|
||||||
let self_addr = context.sql.get_config(context, "configured_addr");
|
let self_addr = context.sql.get_config(context, "configured_addr");
|
||||||
|
|
||||||
|
|
||||||
if self_addr.is_none() {
|
if self_addr.is_none() {
|
||||||
error!(context, 0, "Not configured, cannot generate QR code.",);
|
error!(context, 0, "Not configured, cannot generate QR code.",);
|
||||||
return cleanup(fingerprint, qr);
|
return cleanup(fingerprint, qr);
|
||||||
@@ -79,8 +74,10 @@ pub unsafe fn dc_get_securejoin_qr(
|
|||||||
return cleanup(fingerprint, qr);
|
return cleanup(fingerprint, qr);
|
||||||
}
|
}
|
||||||
|
|
||||||
let self_addr_urlencoded = utf8_percent_encode(&self_addr, NON_ALPHANUMERIC_WITHOUT_DOT).to_string();
|
let self_addr_urlencoded =
|
||||||
let self_name_urlencoded = utf8_percent_encode(&self_name, NON_ALPHANUMERIC_WITHOUT_DOT).to_string();
|
utf8_percent_encode(&self_addr, NON_ALPHANUMERIC_WITHOUT_DOT).to_string();
|
||||||
|
let self_name_urlencoded =
|
||||||
|
utf8_percent_encode(&self_name, NON_ALPHANUMERIC_WITHOUT_DOT).to_string();
|
||||||
|
|
||||||
qr = if 0 != group_chat_id {
|
qr = if 0 != group_chat_id {
|
||||||
if let Ok(chat) = Chat::load_from_db(context, group_chat_id) {
|
if let Ok(chat) = Chat::load_from_db(context, group_chat_id) {
|
||||||
|
|||||||
Reference in New Issue
Block a user