pure cargo fmt

This commit is contained in:
holger krekel
2019-07-25 18:30:26 +02:00
parent 9a9b49f8f0
commit 2cf227571a

View File

@@ -533,7 +533,9 @@ unsafe fn prepare_msg_raw(
OK_TO_CONTINUE = false; OK_TO_CONTINUE = false;
} }
} else { } else {
if (*chat).type_0 == DC_CHAT_TYPE_GROUP || (*chat).type_0 == DC_CHAT_TYPE_VERIFIED_GROUP { if (*chat).type_0 == DC_CHAT_TYPE_GROUP
|| (*chat).type_0 == DC_CHAT_TYPE_VERIFIED_GROUP
{
if dc_param_get_int((*chat).param, DC_PARAM_UNPROMOTED as i32, 0) == 1 { if dc_param_get_int((*chat).param, DC_PARAM_UNPROMOTED as i32, 0) == 1 {
dc_param_set( dc_param_set(
(*chat).param, (*chat).param,
@@ -603,8 +605,7 @@ unsafe fn prepare_msg_raw(
if 0 != can_encrypt { if 0 != can_encrypt {
if 0 != all_mutual { if 0 != all_mutual {
do_guarantee_e2ee = 1; do_guarantee_e2ee = 1;
} else if 0 } else if 0 != last_msg_in_chat_encrypted(context, &context.sql, (*chat).id)
!= last_msg_in_chat_encrypted(context, &context.sql, (*chat).id)
{ {
do_guarantee_e2ee = 1; do_guarantee_e2ee = 1;
} }
@@ -745,7 +746,6 @@ unsafe fn prepare_msg_raw(
(*chat).id, (*chat).id,
); );
} }
} }
} }
} }
@@ -1033,7 +1033,11 @@ unsafe fn set_draft_raw(context: &Context, chat_id: uint32_t, msg: *mut dc_msg_t
"INSERT INTO msgs (chat_id, from_id, timestamp, type, state, txt, param, hidden) \ "INSERT INTO msgs (chat_id, from_id, timestamp, type, state, txt, param, hidden) \
VALUES (?,?,?, ?,?,?,?,?);", VALUES (?,?,?, ?,?,?,?,?);",
params![ params![
chat_id as i32, 1, time(), (*msg).type_0, DC_STATE_OUT_DRAFT, chat_id as i32,
1,
time(),
(*msg).type_0,
DC_STATE_OUT_DRAFT,
if !(*msg).text.is_null() { if !(*msg).text.is_null() {
as_str((*msg).text) as_str((*msg).text)
} else { } else {
@@ -1041,11 +1045,12 @@ unsafe fn set_draft_raw(context: &Context, chat_id: uint32_t, msg: *mut dc_msg_t
}, },
to_string((*(*msg).param).packed), to_string((*(*msg).param).packed),
1, 1,
] ],
).is_ok() { )
.is_ok()
{
sth_changed = 1; sth_changed = 1;
} }
} }
} }
free(pathNfilename as *mut libc::c_void); free(pathNfilename as *mut libc::c_void);
@@ -1615,8 +1620,7 @@ pub unsafe fn dc_add_contact_to_chat_ex(
} }
} }
if OK_TO_CONTINUE { if OK_TO_CONTINUE {
if 0 == dc_add_to_chat_contacts_table(context, chat_id, contact_id) if 0 == dc_add_to_chat_contacts_table(context, chat_id, contact_id) {
{
OK_TO_CONTINUE = false; OK_TO_CONTINUE = false;
} }
} }
@@ -1632,11 +1636,7 @@ pub unsafe fn dc_add_contact_to_chat_ex(
1 as uint32_t, 1 as uint32_t,
); );
dc_param_set_int((*msg).param, DC_PARAM_CMD as i32, 4); dc_param_set_int((*msg).param, DC_PARAM_CMD as i32, 4);
dc_param_set( dc_param_set((*msg).param, DC_PARAM_CMD_ARG as i32, (*contact).addr);
(*msg).param,
DC_PARAM_CMD_ARG as i32,
(*contact).addr,
);
dc_param_set_int((*msg).param, DC_PARAM_CMD_ARG2 as i32, flags); dc_param_set_int((*msg).param, DC_PARAM_CMD_ARG2 as i32, flags);
(*msg).id = dc_send_msg(context, chat_id, msg); (*msg).id = dc_send_msg(context, chat_id, msg);
context.call_cb( context.call_cb(
@@ -1645,11 +1645,7 @@ pub unsafe fn dc_add_contact_to_chat_ex(
(*msg).id as uintptr_t, (*msg).id as uintptr_t,
); );
} }
context.call_cb( context.call_cb(Event::MSGS_CHANGED, chat_id as uintptr_t, 0 as uintptr_t);
Event::MSGS_CHANGED,
chat_id as uintptr_t,
0 as uintptr_t,
);
success = 1; success = 1;
} }
} }
@@ -1921,8 +1917,7 @@ pub unsafe fn dc_set_chat_profile_image(
if OK_TO_CONTINUE { if OK_TO_CONTINUE {
dc_param_set((*chat).param, DC_PARAM_PROFILE_IMAGE as i32, new_image_rel); dc_param_set((*chat).param, DC_PARAM_PROFILE_IMAGE as i32, new_image_rel);
if !(0 == dc_chat_update_param(chat)) { if !(0 == dc_chat_update_param(chat)) {
if dc_param_get_int((*chat).param, DC_PARAM_UNPROMOTED as i32, 0i32) if dc_param_get_int((*chat).param, DC_PARAM_UNPROMOTED as i32, 0i32) == 0i32
== 0i32
{ {
dc_param_set_int((*msg).param, DC_PARAM_CMD as i32, 3i32); dc_param_set_int((*msg).param, DC_PARAM_CMD as i32, 3i32);
dc_param_set((*msg).param, DC_PARAM_CMD_ARG as i32, new_image_rel); dc_param_set((*msg).param, DC_PARAM_CMD_ARG as i32, new_image_rel);