remove closure

Co-authored-by: @Jikstra
This commit is contained in:
Simon Laux
2019-09-07 13:23:54 +02:00
committed by holger krekel
parent 0a8b187f80
commit 7563a5abe0

View File

@@ -1653,13 +1653,16 @@ pub unsafe fn set_chat_profile_image(
) -> Result<(), Error> {
ensure!(chat_id > DC_CHAT_ID_LAST_SPECIAL, "Invalid chat ID");
let mut success = false;
let mut chat = Chat::load_from_db(context, chat_id)?;
let mut msg = dc_msg_new_untyped(context);
let mut new_image_rel = None;
let new_image_rel;
macro_rules! returnError{
() => {
bail!("Failed to set profile image");
};
}
(|| {
if real_group_exists(context, chat_id) {
if !(is_contact_in_chat(context, chat_id, 1i32 as u32) == 1i32) {
log_event!(
@@ -1669,12 +1672,12 @@ pub unsafe fn set_chat_profile_image(
"Cannot set chat profile image; self not in group.",
);
/* we should respect this - whatever we send to the group, it gets discarded anyway! */
return;
returnError!();
}
if !new_image.as_ref().is_empty() {
let mut img = new_image.as_ref().to_string();
if !dc_make_rel_and_copy(context, &mut img) {
return;
returnError!();
}
new_image_rel = Some(img);
} else {
@@ -1713,16 +1716,10 @@ pub unsafe fn set_chat_profile_image(
chat_id as uintptr_t,
0i32 as uintptr_t,
);
success = true;
return Ok(());
}
}
})();
if !success {
bail!("Failed to set profile image");
}
Ok(())
returnError!()
}
pub unsafe fn forward_msgs(