cargo fmt

This commit is contained in:
holger krekel
2019-08-17 00:44:13 +02:00
parent ff1f286882
commit 5ea2da4245

View File

@@ -201,9 +201,8 @@ pub unsafe fn dc_check_qr(context: &Context, qr: *const libc::c_char) -> *mut dc
addr = temp;
if !may_be_valid_addr(as_str(addr)) {
(*qr_parsed).state = 400i32;
(*qr_parsed).text1 = dc_strdup(
b"Bad e-mail address.\x00" as *const u8 as *const libc::c_char,
);
(*qr_parsed).text1 =
dc_strdup(b"Bad e-mail address.\x00" as *const u8 as *const libc::c_char);
ok_to_continue = false;
}
}
@@ -211,18 +210,14 @@ pub unsafe fn dc_check_qr(context: &Context, qr: *const libc::c_char) -> *mut dc
if ok_to_continue && !fingerprint.is_null() && strlen(fingerprint) != 40 {
(*qr_parsed).state = 400i32;
(*qr_parsed).text1 = dc_strdup(
b"Bad fingerprint length in QR code.\x00" as *const u8
as *const libc::c_char,
b"Bad fingerprint length in QR code.\x00" as *const u8 as *const libc::c_char,
);
ok_to_continue = false;
}
if ok_to_continue {
if !fingerprint.is_null() {
let peerstate = Peerstate::from_fingerprint(
context,
&context.sql,
as_str(fingerprint),
);
let peerstate =
Peerstate::from_fingerprint(context, &context.sql, as_str(fingerprint));
if addr.is_null() || invitenumber.is_null() || auth.is_null() {
if let Some(peerstate) = peerstate {
(*qr_parsed).state = 210i32;
@@ -231,12 +226,8 @@ pub unsafe fn dc_check_qr(context: &Context, qr: *const libc::c_char) -> *mut dc
.as_ref()
.map(|s| s.as_str())
.unwrap_or_else(|| "");
(*qr_parsed).id = Contact::add_or_lookup(
context,
"",
addr,
Origin::UnhandledQrScan,
)
(*qr_parsed).id =
Contact::add_or_lookup(context, "", addr, Origin::UnhandledQrScan)
.map(|(id, _)| id)
.unwrap_or_default();
dc_create_or_lookup_nchat_by_contact_id(
@@ -247,13 +238,11 @@ pub unsafe fn dc_check_qr(context: &Context, qr: *const libc::c_char) -> *mut dc
0 as *mut libc::c_int,
);
device_msg = dc_mprintf(
b"%s verified.\x00" as *const u8
as *const libc::c_char,
b"%s verified.\x00" as *const u8 as *const libc::c_char,
peerstate.addr,
)
} else {
(*qr_parsed).text1 =
dc_format_fingerprint_c(fingerprint);
(*qr_parsed).text1 = dc_format_fingerprint_c(fingerprint);
(*qr_parsed).state = 230i32
}
} else {
@@ -286,14 +275,10 @@ pub unsafe fn dc_check_qr(context: &Context, qr: *const libc::c_char) -> *mut dc
)
.map(|(id, _)| id)
.unwrap_or_default();
} else if strstr(
qr,
b"http://\x00" as *const u8 as *const libc::c_char,
) == qr as *mut libc::c_char
|| strstr(
qr,
b"https://\x00" as *const u8 as *const libc::c_char,
) == qr as *mut libc::c_char
} else if strstr(qr, b"http://\x00" as *const u8 as *const libc::c_char)
== qr as *mut libc::c_char
|| strstr(qr, b"https://\x00" as *const u8 as *const libc::c_char)
== qr as *mut libc::c_char
{
(*qr_parsed).state = 332i32;
(*qr_parsed).text1 = dc_strdup(qr)