Remove use of ChatId::is_unset

The ChatId::is_unset method is something we need to get rid of to
clean up the type.  This removes one use-case in generating QR codes
for securejoin.
This commit is contained in:
Floris Bruynooghe
2021-02-07 18:37:45 +01:00
parent d3b66cf724
commit 61964707d3
3 changed files with 76 additions and 37 deletions

View File

@@ -1875,9 +1875,14 @@ pub unsafe extern "C" fn dc_get_securejoin_qr(
return "".strdup();
}
let ctx = &*context;
let chat_id = if chat_id == 0 {
None
} else {
Some(ChatId::new(chat_id))
};
block_on(async move {
securejoin::dc_get_securejoin_qr(&ctx, ChatId::new(chat_id))
securejoin::dc_get_securejoin_qr(&ctx, chat_id)
.await
.unwrap_or_else(|| "".to_string())
.strdup()