mirror of
https://github.com/chatmail/core.git
synced 2026-05-20 15:26:30 +03:00
Use DC_PARAM_* constants everywhere
Also document each type they store. This makes existing code a little more readable and gives some hints towards refactoring this.
This commit is contained in:
127
src/dc_chat.rs
127
src/dc_chat.rs
@@ -164,7 +164,7 @@ pub fn dc_chat_load_from_db(chat: *mut Chat, chat_id: u32) -> bool {
|
|||||||
(*chat).name = dc_stock_str((*chat).context, 41);
|
(*chat).name = dc_stock_str((*chat).context, 41);
|
||||||
},
|
},
|
||||||
_ => {
|
_ => {
|
||||||
if 0 != unsafe { dc_param_exists((*chat).param, 'K' as i32) } {
|
if 0 != unsafe { dc_param_exists((*chat).param, DC_PARAM_SELFTALK as i32) } {
|
||||||
unsafe {
|
unsafe {
|
||||||
free((*chat).name as *mut libc::c_void);
|
free((*chat).name as *mut libc::c_void);
|
||||||
(*chat).name = dc_stock_str((*chat).context, 2);
|
(*chat).name = dc_stock_str((*chat).context, 2);
|
||||||
@@ -379,7 +379,7 @@ unsafe fn prepare_msg_common<'a>(
|
|||||||
|| (*msg).type_0 == 50i32
|
|| (*msg).type_0 == 50i32
|
||||||
|| (*msg).type_0 == 60i32
|
|| (*msg).type_0 == 60i32
|
||||||
{
|
{
|
||||||
pathNfilename = dc_param_get((*msg).param, 'f' as i32, 0 as *const libc::c_char);
|
pathNfilename = dc_param_get((*msg).param, DC_PARAM_FILE as i32, 0 as *const libc::c_char);
|
||||||
if pathNfilename.is_null() {
|
if pathNfilename.is_null() {
|
||||||
error!(
|
error!(
|
||||||
context,
|
context,
|
||||||
@@ -394,24 +394,24 @@ unsafe fn prepare_msg_common<'a>(
|
|||||||
} else if 0 == dc_make_rel_and_copy(context, &mut pathNfilename) {
|
} else if 0 == dc_make_rel_and_copy(context, &mut pathNfilename) {
|
||||||
current_block = 2171833246886114521;
|
current_block = 2171833246886114521;
|
||||||
} else {
|
} else {
|
||||||
dc_param_set((*msg).param, 'f' as i32, pathNfilename);
|
dc_param_set((*msg).param, DC_PARAM_FILE as i32, pathNfilename);
|
||||||
if (*msg).type_0 == 60i32 || (*msg).type_0 == 20i32 {
|
if (*msg).type_0 == 60i32 || (*msg).type_0 == 20i32 {
|
||||||
let mut better_type: libc::c_int = 0i32;
|
let mut better_type: libc::c_int = 0i32;
|
||||||
let mut better_mime: *mut libc::c_char = 0 as *mut libc::c_char;
|
let mut better_mime: *mut libc::c_char = 0 as *mut libc::c_char;
|
||||||
dc_msg_guess_msgtype_from_suffix(pathNfilename, &mut better_type, &mut better_mime);
|
dc_msg_guess_msgtype_from_suffix(pathNfilename, &mut better_type, &mut better_mime);
|
||||||
if 0 != better_type {
|
if 0 != better_type {
|
||||||
(*msg).type_0 = better_type;
|
(*msg).type_0 = better_type;
|
||||||
dc_param_set((*msg).param, 'm' as i32, better_mime);
|
dc_param_set((*msg).param, DC_PARAM_MIMETYPE as i32, better_mime);
|
||||||
}
|
}
|
||||||
free(better_mime as *mut libc::c_void);
|
free(better_mime as *mut libc::c_void);
|
||||||
} else if 0 == dc_param_exists((*msg).param, 'm' as i32) {
|
} else if 0 == dc_param_exists((*msg).param, DC_PARAM_MIMETYPE as i32) {
|
||||||
let mut better_mime_0: *mut libc::c_char = 0 as *mut libc::c_char;
|
let mut better_mime_0: *mut libc::c_char = 0 as *mut libc::c_char;
|
||||||
dc_msg_guess_msgtype_from_suffix(
|
dc_msg_guess_msgtype_from_suffix(
|
||||||
pathNfilename,
|
pathNfilename,
|
||||||
0 as *mut libc::c_int,
|
0 as *mut libc::c_int,
|
||||||
&mut better_mime_0,
|
&mut better_mime_0,
|
||||||
);
|
);
|
||||||
dc_param_set((*msg).param, 'm' as i32, better_mime_0);
|
dc_param_set((*msg).param, DC_PARAM_MIMETYPE as i32, better_mime_0);
|
||||||
free(better_mime_0 as *mut libc::c_void);
|
free(better_mime_0 as *mut libc::c_void);
|
||||||
}
|
}
|
||||||
info!(
|
info!(
|
||||||
@@ -519,8 +519,12 @@ unsafe fn prepare_msg_raw(
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (*chat).type_0 == 120 || (*chat).type_0 == 130 {
|
if (*chat).type_0 == 120 || (*chat).type_0 == 130 {
|
||||||
if dc_param_get_int((*chat).param, 'U' as i32, 0) == 1 {
|
if dc_param_get_int((*chat).param, DC_PARAM_UNPROMOTED as i32, 0) == 1 {
|
||||||
dc_param_set((*chat).param, 'U' as i32, 0 as *const libc::c_char);
|
dc_param_set(
|
||||||
|
(*chat).param,
|
||||||
|
DC_PARAM_UNPROMOTED as i32,
|
||||||
|
0 as *const libc::c_char,
|
||||||
|
);
|
||||||
dc_chat_update_param(chat);
|
dc_chat_update_param(chat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -538,7 +542,9 @@ unsafe fn prepare_msg_raw(
|
|||||||
.sql
|
.sql
|
||||||
.get_config_int(context, "e2ee_enabled")
|
.get_config_int(context, "e2ee_enabled")
|
||||||
.unwrap_or_else(|| 1);
|
.unwrap_or_else(|| 1);
|
||||||
if 0 != e2ee_enabled && dc_param_get_int((*msg).param, 'u' as i32, 0) == 0 {
|
if 0 != e2ee_enabled
|
||||||
|
&& dc_param_get_int((*msg).param, DC_PARAM_FORCE_PLAINTEXT as i32, 0) == 0
|
||||||
|
{
|
||||||
let mut can_encrypt = 1;
|
let mut can_encrypt = 1;
|
||||||
let mut all_mutual = 1;
|
let mut all_mutual = 1;
|
||||||
|
|
||||||
@@ -593,9 +599,13 @@ unsafe fn prepare_msg_raw(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if 0 != do_guarantee_e2ee {
|
if 0 != do_guarantee_e2ee {
|
||||||
dc_param_set_int((*msg).param, 'c' as i32, 1);
|
dc_param_set_int((*msg).param, DC_PARAM_GUARANTEE_E2EE as i32, 1);
|
||||||
}
|
}
|
||||||
dc_param_set((*msg).param, 'e' as i32, 0 as *const libc::c_char);
|
dc_param_set(
|
||||||
|
(*msg).param,
|
||||||
|
DC_PARAM_ERRONEOUS_E2EE as i32,
|
||||||
|
0 as *const libc::c_char,
|
||||||
|
);
|
||||||
if 0 == dc_chat_is_self_talk(chat)
|
if 0 == dc_chat_is_self_talk(chat)
|
||||||
&& 0 != get_parent_mime_headers(
|
&& 0 != get_parent_mime_headers(
|
||||||
chat,
|
chat,
|
||||||
@@ -798,7 +808,7 @@ pub unsafe fn dc_chat_is_self_talk(chat: *const Chat) -> libc::c_int {
|
|||||||
if chat.is_null() || (*chat).magic != 0xc4a7c4a7u32 {
|
if chat.is_null() || (*chat).magic != 0xc4a7c4a7u32 {
|
||||||
return 0i32;
|
return 0i32;
|
||||||
}
|
}
|
||||||
dc_param_exists((*chat).param, 'K' as i32)
|
dc_param_exists((*chat).param, DC_PARAM_SELFTALK as i32)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
@@ -825,7 +835,7 @@ unsafe fn last_msg_in_chat_encrypted(
|
|||||||
let packed_c = to_cstring(packed);
|
let packed_c = to_cstring(packed);
|
||||||
dc_param_set_packed(msg_param, packed_c.as_ptr());
|
dc_param_set_packed(msg_param, packed_c.as_ptr());
|
||||||
|
|
||||||
if 0 != dc_param_exists(msg_param, 'c' as i32) {
|
if 0 != dc_param_exists(msg_param, DC_PARAM_GUARANTEE_E2EE as i32) {
|
||||||
last_is_encrypted = 1;
|
last_is_encrypted = 1;
|
||||||
}
|
}
|
||||||
dc_param_unref(msg_param);
|
dc_param_unref(msg_param);
|
||||||
@@ -903,7 +913,11 @@ pub unsafe fn dc_send_msg<'a>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if 0 == chat_id {
|
if 0 == chat_id {
|
||||||
let forwards = dc_param_get((*msg).param, 'P' as i32, 0 as *const libc::c_char);
|
let forwards = dc_param_get(
|
||||||
|
(*msg).param,
|
||||||
|
DC_PARAM_PREP_FORWARDS as i32,
|
||||||
|
0 as *const libc::c_char,
|
||||||
|
);
|
||||||
if !forwards.is_null() {
|
if !forwards.is_null() {
|
||||||
let mut p = forwards;
|
let mut p = forwards;
|
||||||
while 0 != *p {
|
while 0 != *p {
|
||||||
@@ -919,7 +933,11 @@ pub unsafe fn dc_send_msg<'a>(
|
|||||||
dc_msg_unref(copy);
|
dc_msg_unref(copy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dc_param_set((*msg).param, 'P' as i32, 0 as *const libc::c_char);
|
dc_param_set(
|
||||||
|
(*msg).param,
|
||||||
|
DC_PARAM_PREP_FORWARDS as i32,
|
||||||
|
0 as *const libc::c_char,
|
||||||
|
);
|
||||||
dc_msg_save_param_to_disk(msg);
|
dc_msg_save_param_to_disk(msg);
|
||||||
}
|
}
|
||||||
free(forwards as *mut libc::c_void);
|
free(forwards as *mut libc::c_void);
|
||||||
@@ -979,7 +997,8 @@ unsafe fn set_draft_raw(context: &Context, chat_id: uint32_t, msg: *mut dc_msg_t
|
|||||||
|| (*msg).type_0 == 50i32
|
|| (*msg).type_0 == 50i32
|
||||||
|| (*msg).type_0 == 60i32
|
|| (*msg).type_0 == 60i32
|
||||||
{
|
{
|
||||||
pathNfilename = dc_param_get((*msg).param, 'f' as i32, 0 as *const libc::c_char);
|
pathNfilename =
|
||||||
|
dc_param_get((*msg).param, DC_PARAM_FILE as i32, 0 as *const libc::c_char);
|
||||||
if pathNfilename.is_null() {
|
if pathNfilename.is_null() {
|
||||||
current_block = 14513523936503887211;
|
current_block = 14513523936503887211;
|
||||||
} else if 0 != dc_msg_is_increation(msg)
|
} else if 0 != dc_msg_is_increation(msg)
|
||||||
@@ -989,7 +1008,7 @@ unsafe fn set_draft_raw(context: &Context, chat_id: uint32_t, msg: *mut dc_msg_t
|
|||||||
} else if 0 == dc_make_rel_and_copy(context, &mut pathNfilename) {
|
} else if 0 == dc_make_rel_and_copy(context, &mut pathNfilename) {
|
||||||
current_block = 14513523936503887211;
|
current_block = 14513523936503887211;
|
||||||
} else {
|
} else {
|
||||||
dc_param_set((*msg).param, 'f' as i32, pathNfilename);
|
dc_param_set((*msg).param, DC_PARAM_FILE as i32, pathNfilename);
|
||||||
current_block = 4495394744059808450;
|
current_block = 4495394744059808450;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1551,8 +1570,14 @@ pub unsafe fn dc_add_contact_to_chat_ex(
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
/* we shoud respect this - whatever we send to the group, it gets discarded anyway! */
|
/* we shoud respect this - whatever we send to the group, it gets discarded anyway! */
|
||||||
if 0 != flags & 0x1 && dc_param_get_int((*chat).param, 'U' as i32, 0) == 1 {
|
if 0 != flags & 0x1
|
||||||
dc_param_set((*chat).param, 'U' as i32, 0 as *const libc::c_char);
|
&& dc_param_get_int((*chat).param, DC_PARAM_UNPROMOTED as i32, 0) == 1
|
||||||
|
{
|
||||||
|
dc_param_set(
|
||||||
|
(*chat).param,
|
||||||
|
DC_PARAM_UNPROMOTED as i32,
|
||||||
|
0 as *const libc::c_char,
|
||||||
|
);
|
||||||
dc_chat_update_param(chat);
|
dc_chat_update_param(chat);
|
||||||
}
|
}
|
||||||
let self_addr = context
|
let self_addr = context
|
||||||
@@ -1600,7 +1625,7 @@ pub unsafe fn dc_add_contact_to_chat_ex(
|
|||||||
match current_block {
|
match current_block {
|
||||||
12326129973959287090 => {}
|
12326129973959287090 => {}
|
||||||
_ => {
|
_ => {
|
||||||
if dc_param_get_int((*chat).param, 'U' as i32, 0) == 0 {
|
if dc_param_get_int((*chat).param, DC_PARAM_UNPROMOTED as i32, 0) == 0 {
|
||||||
(*msg).type_0 = 10;
|
(*msg).type_0 = 10;
|
||||||
(*msg).text = dc_stock_system_msg(
|
(*msg).text = dc_stock_system_msg(
|
||||||
context,
|
context,
|
||||||
@@ -1609,9 +1634,13 @@ pub unsafe fn dc_add_contact_to_chat_ex(
|
|||||||
0 as *const libc::c_char,
|
0 as *const libc::c_char,
|
||||||
1 as uint32_t,
|
1 as uint32_t,
|
||||||
);
|
);
|
||||||
dc_param_set_int((*msg).param, 'S' as i32, 4);
|
dc_param_set_int((*msg).param, DC_PARAM_CMD as i32, 4);
|
||||||
dc_param_set((*msg).param, 'E' as i32, (*contact).addr);
|
dc_param_set(
|
||||||
dc_param_set_int((*msg).param, 'F' as i32, flags);
|
(*msg).param,
|
||||||
|
DC_PARAM_CMD_ARG as i32,
|
||||||
|
(*contact).addr,
|
||||||
|
);
|
||||||
|
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(
|
||||||
Event::MSGS_CHANGED,
|
Event::MSGS_CHANGED,
|
||||||
@@ -1712,7 +1741,7 @@ pub unsafe fn dc_remove_contact_from_chat(
|
|||||||
} else {
|
} else {
|
||||||
/* we shoud respect this - whatever we send to the group, it gets discarded anyway! */
|
/* we shoud respect this - whatever we send to the group, it gets discarded anyway! */
|
||||||
if !contact.is_null() {
|
if !contact.is_null() {
|
||||||
if dc_param_get_int((*chat).param, 'U' as i32, 0) == 0 {
|
if dc_param_get_int((*chat).param, DC_PARAM_UNPROMOTED as i32, 0) == 0 {
|
||||||
(*msg).type_0 = 10;
|
(*msg).type_0 = 10;
|
||||||
if (*contact).id == 1 as libc::c_uint {
|
if (*contact).id == 1 as libc::c_uint {
|
||||||
dc_set_group_explicitly_left(context, (*chat).grpid);
|
dc_set_group_explicitly_left(context, (*chat).grpid);
|
||||||
@@ -1732,8 +1761,8 @@ pub unsafe fn dc_remove_contact_from_chat(
|
|||||||
1 as uint32_t,
|
1 as uint32_t,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
dc_param_set_int((*msg).param, 'S' as i32, 5);
|
dc_param_set_int((*msg).param, DC_PARAM_CMD as i32, 5);
|
||||||
dc_param_set((*msg).param, 'E' as i32, (*contact).addr);
|
dc_param_set((*msg).param, DC_PARAM_CMD_ARG as i32, (*contact).addr);
|
||||||
(*msg).id = dc_send_msg(context, chat_id, msg);
|
(*msg).id = dc_send_msg(context, chat_id, msg);
|
||||||
context.call_cb(
|
context.call_cb(
|
||||||
Event::MSGS_CHANGED,
|
Event::MSGS_CHANGED,
|
||||||
@@ -1825,7 +1854,7 @@ pub unsafe fn dc_set_chat_name(
|
|||||||
)
|
)
|
||||||
.is_ok()
|
.is_ok()
|
||||||
{
|
{
|
||||||
if dc_param_get_int((*chat).param, 'U' as i32, 0i32) == 0i32 {
|
if dc_param_get_int((*chat).param, DC_PARAM_UNPROMOTED as i32, 0i32) == 0i32 {
|
||||||
(*msg).type_0 = 10i32;
|
(*msg).type_0 = 10i32;
|
||||||
(*msg).text = dc_stock_system_msg(
|
(*msg).text = dc_stock_system_msg(
|
||||||
context,
|
context,
|
||||||
@@ -1834,8 +1863,8 @@ pub unsafe fn dc_set_chat_name(
|
|||||||
new_name,
|
new_name,
|
||||||
1i32 as uint32_t,
|
1i32 as uint32_t,
|
||||||
);
|
);
|
||||||
dc_param_set_int((*msg).param, 'S' as i32, 2i32);
|
dc_param_set_int((*msg).param, DC_PARAM_CMD as i32, 2i32);
|
||||||
dc_param_set((*msg).param, 'E' as i32, (*chat).name);
|
dc_param_set((*msg).param, DC_PARAM_CMD_ARG as i32, (*chat).name);
|
||||||
(*msg).id = dc_send_msg(context, chat_id, msg);
|
(*msg).id = dc_send_msg(context, chat_id, msg);
|
||||||
context.call_cb(
|
context.call_cb(
|
||||||
Event::MSGS_CHANGED,
|
Event::MSGS_CHANGED,
|
||||||
@@ -1895,11 +1924,13 @@ pub unsafe fn dc_set_chat_profile_image(
|
|||||||
match current_block {
|
match current_block {
|
||||||
14766584022300871387 => {}
|
14766584022300871387 => {}
|
||||||
_ => {
|
_ => {
|
||||||
dc_param_set((*chat).param, 'i' 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, 'U' as i32, 0i32) == 0i32 {
|
if dc_param_get_int((*chat).param, DC_PARAM_UNPROMOTED as i32, 0i32)
|
||||||
dc_param_set_int((*msg).param, 'S' as i32, 3i32);
|
== 0i32
|
||||||
dc_param_set((*msg).param, 'E' as i32, new_image_rel);
|
{
|
||||||
|
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);
|
||||||
(*msg).type_0 = 10i32;
|
(*msg).type_0 = 10i32;
|
||||||
(*msg).text = dc_stock_system_msg(
|
(*msg).text = dc_stock_system_msg(
|
||||||
context,
|
context,
|
||||||
@@ -1979,11 +2010,19 @@ pub unsafe fn dc_forward_msgs(
|
|||||||
}
|
}
|
||||||
dc_param_set_packed(original_param, (*(*msg).param).packed);
|
dc_param_set_packed(original_param, (*(*msg).param).packed);
|
||||||
if (*msg).from_id != 1i32 as libc::c_uint {
|
if (*msg).from_id != 1i32 as libc::c_uint {
|
||||||
dc_param_set_int((*msg).param, 'a' as i32, 1i32);
|
dc_param_set_int((*msg).param, DC_PARAM_FORWARDED as i32, 1i32);
|
||||||
}
|
}
|
||||||
dc_param_set((*msg).param, 'c' as i32, 0 as *const libc::c_char);
|
dc_param_set(
|
||||||
dc_param_set((*msg).param, 'u' as i32, 0 as *const libc::c_char);
|
(*msg).param,
|
||||||
dc_param_set((*msg).param, 'S' as i32, 0 as *const libc::c_char);
|
DC_PARAM_GUARANTEE_E2EE as i32,
|
||||||
|
0 as *const libc::c_char,
|
||||||
|
);
|
||||||
|
dc_param_set(
|
||||||
|
(*msg).param,
|
||||||
|
DC_PARAM_FORCE_PLAINTEXT as i32,
|
||||||
|
0 as *const libc::c_char,
|
||||||
|
);
|
||||||
|
dc_param_set((*msg).param, DC_PARAM_CMD as i32, 0 as *const libc::c_char);
|
||||||
let new_msg_id: uint32_t;
|
let new_msg_id: uint32_t;
|
||||||
if (*msg).state == 18i32 {
|
if (*msg).state == 18i32 {
|
||||||
let fresh9 = curr_timestamp;
|
let fresh9 = curr_timestamp;
|
||||||
@@ -1994,7 +2033,7 @@ pub unsafe fn dc_forward_msgs(
|
|||||||
(*msg).id = src_msg_id as uint32_t;
|
(*msg).id = src_msg_id as uint32_t;
|
||||||
let old_fwd: *mut libc::c_char = dc_param_get(
|
let old_fwd: *mut libc::c_char = dc_param_get(
|
||||||
(*msg).param,
|
(*msg).param,
|
||||||
'P' as i32,
|
DC_PARAM_PREP_FORWARDS as i32,
|
||||||
b"\x00" as *const u8 as *const libc::c_char,
|
b"\x00" as *const u8 as *const libc::c_char,
|
||||||
);
|
);
|
||||||
let new_fwd: *mut libc::c_char = dc_mprintf(
|
let new_fwd: *mut libc::c_char = dc_mprintf(
|
||||||
@@ -2002,7 +2041,7 @@ pub unsafe fn dc_forward_msgs(
|
|||||||
old_fwd,
|
old_fwd,
|
||||||
new_msg_id,
|
new_msg_id,
|
||||||
);
|
);
|
||||||
dc_param_set((*msg).param, 'P' as i32, new_fwd);
|
dc_param_set((*msg).param, DC_PARAM_PREP_FORWARDS as i32, new_fwd);
|
||||||
dc_msg_save_param_to_disk(msg);
|
dc_msg_save_param_to_disk(msg);
|
||||||
free(new_fwd as *mut libc::c_void);
|
free(new_fwd as *mut libc::c_void);
|
||||||
free(old_fwd as *mut libc::c_void);
|
free(old_fwd as *mut libc::c_void);
|
||||||
@@ -2079,7 +2118,7 @@ pub unsafe fn dc_chat_get_subtitle(chat: *const Chat) -> *mut libc::c_char {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let mut ret: *mut libc::c_char = std::ptr::null_mut();
|
let mut ret: *mut libc::c_char = std::ptr::null_mut();
|
||||||
if (*chat).type_0 == 100 && 0 != dc_param_exists((*chat).param, 'K' as i32) {
|
if (*chat).type_0 == 100 && 0 != dc_param_exists((*chat).param, DC_PARAM_SELFTALK as i32) {
|
||||||
ret = dc_stock_str((*chat).context, 50)
|
ret = dc_stock_str((*chat).context, 50)
|
||||||
} else if (*chat).type_0 == 100 {
|
} else if (*chat).type_0 == 100 {
|
||||||
let ret_raw: String = (*chat)
|
let ret_raw: String = (*chat)
|
||||||
@@ -2128,7 +2167,11 @@ pub unsafe fn dc_chat_get_profile_image(chat: *const Chat) -> *mut libc::c_char
|
|||||||
let mut contacts: *mut dc_array_t = 0 as *mut dc_array_t;
|
let mut contacts: *mut dc_array_t = 0 as *mut dc_array_t;
|
||||||
let mut contact: *mut dc_contact_t = 0 as *mut dc_contact_t;
|
let mut contact: *mut dc_contact_t = 0 as *mut dc_contact_t;
|
||||||
if !(chat.is_null() || (*chat).magic != 0xc4a7c4a7u32) {
|
if !(chat.is_null() || (*chat).magic != 0xc4a7c4a7u32) {
|
||||||
image_rel = dc_param_get((*chat).param, 'i' as i32, 0 as *const libc::c_char);
|
image_rel = dc_param_get(
|
||||||
|
(*chat).param,
|
||||||
|
DC_PARAM_PROFILE_IMAGE as i32,
|
||||||
|
0 as *const libc::c_char,
|
||||||
|
);
|
||||||
if !image_rel.is_null() && 0 != *image_rel.offset(0isize) as libc::c_int {
|
if !image_rel.is_null() && 0 != *image_rel.offset(0isize) as libc::c_int {
|
||||||
image_abs = dc_get_abs_path((*chat).context, image_rel)
|
image_abs = dc_get_abs_path((*chat).context, image_rel)
|
||||||
} else if (*chat).type_0 == 100i32 {
|
} else if (*chat).type_0 == 100i32 {
|
||||||
@@ -2188,7 +2231,7 @@ pub unsafe fn dc_chat_is_unpromoted(chat: *const Chat) -> libc::c_int {
|
|||||||
if chat.is_null() || (*chat).magic != 0xc4a7c4a7u32 {
|
if chat.is_null() || (*chat).magic != 0xc4a7c4a7u32 {
|
||||||
return 0i32;
|
return 0i32;
|
||||||
}
|
}
|
||||||
dc_param_get_int((*chat).param, 'U' as i32, 0i32)
|
dc_param_get_int((*chat).param, DC_PARAM_UNPROMOTED as i32, 0i32)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO should return bool /rtn
|
// TODO should return bool /rtn
|
||||||
|
|||||||
@@ -34,9 +34,9 @@ pub unsafe fn dc_imex(
|
|||||||
param2: *const libc::c_char,
|
param2: *const libc::c_char,
|
||||||
) {
|
) {
|
||||||
let param: *mut dc_param_t = dc_param_new();
|
let param: *mut dc_param_t = dc_param_new();
|
||||||
dc_param_set_int(param, 'S' as i32, what);
|
dc_param_set_int(param, DC_PARAM_CMD as i32, what);
|
||||||
dc_param_set(param, 'E' as i32, param1);
|
dc_param_set(param, DC_PARAM_CMD_ARG as i32, param1);
|
||||||
dc_param_set(param, 'F' as i32, param2);
|
dc_param_set(param, DC_PARAM_CMD_ARG2 as i32, param2);
|
||||||
dc_job_kill_action(context, 910i32);
|
dc_job_kill_action(context, 910i32);
|
||||||
dc_job_add(context, 910i32, 0i32, (*param).packed, 0i32);
|
dc_job_add(context, 910i32, 0i32, (*param).packed, 0i32);
|
||||||
dc_param_unref(param);
|
dc_param_unref(param);
|
||||||
@@ -143,15 +143,15 @@ pub unsafe fn dc_initiate_key_transfer(context: &Context) -> *mut libc::c_char {
|
|||||||
if !(chat_id == 0i32 as libc::c_uint) {
|
if !(chat_id == 0i32 as libc::c_uint) {
|
||||||
msg = dc_msg_new_untyped(context);
|
msg = dc_msg_new_untyped(context);
|
||||||
(*msg).type_0 = 60i32;
|
(*msg).type_0 = 60i32;
|
||||||
dc_param_set((*msg).param, 'f' as i32, setup_file_name);
|
dc_param_set((*msg).param, DC_PARAM_FILE as i32, setup_file_name);
|
||||||
dc_param_set(
|
dc_param_set(
|
||||||
(*msg).param,
|
(*msg).param,
|
||||||
'm' as i32,
|
DC_PARAM_MIMETYPE as i32,
|
||||||
b"application/autocrypt-setup\x00" as *const u8
|
b"application/autocrypt-setup\x00" as *const u8
|
||||||
as *const libc::c_char,
|
as *const libc::c_char,
|
||||||
);
|
);
|
||||||
dc_param_set_int((*msg).param, 'S' as i32, 6i32);
|
dc_param_set_int((*msg).param, DC_PARAM_CMD as i32, 6);
|
||||||
dc_param_set_int((*msg).param, 'u' as i32, 2i32);
|
dc_param_set_int((*msg).param, DC_PARAM_FORCE_PLAINTEXT as i32, 2);
|
||||||
if !context
|
if !context
|
||||||
.running_state
|
.running_state
|
||||||
.clone()
|
.clone()
|
||||||
@@ -551,9 +551,17 @@ pub unsafe fn dc_job_do_DC_JOB_IMEX_IMAP(context: &Context, job: *mut dc_job_t)
|
|||||||
let mut param2: *mut libc::c_char = 0 as *mut libc::c_char;
|
let mut param2: *mut libc::c_char = 0 as *mut libc::c_char;
|
||||||
if !(0 == dc_alloc_ongoing(context)) {
|
if !(0 == dc_alloc_ongoing(context)) {
|
||||||
ongoing_allocated_here = 1i32;
|
ongoing_allocated_here = 1i32;
|
||||||
what = dc_param_get_int((*job).param, 'S' as i32, 0i32);
|
what = dc_param_get_int((*job).param, DC_PARAM_CMD as i32, 0);
|
||||||
param1 = dc_param_get((*job).param, 'E' as i32, 0 as *const libc::c_char);
|
param1 = dc_param_get(
|
||||||
param2 = dc_param_get((*job).param, 'F' as i32, 0 as *const libc::c_char);
|
(*job).param,
|
||||||
|
DC_PARAM_CMD_ARG as i32,
|
||||||
|
0 as *const libc::c_char,
|
||||||
|
);
|
||||||
|
param2 = dc_param_get(
|
||||||
|
(*job).param,
|
||||||
|
DC_PARAM_CMD_ARG2 as i32,
|
||||||
|
0 as *const libc::c_char,
|
||||||
|
);
|
||||||
if param1.is_null() {
|
if param1.is_null() {
|
||||||
error!(context, 0, "No Import/export dir/file given.",);
|
error!(context, 0, "No Import/export dir/file given.",);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -296,11 +296,15 @@ unsafe fn dc_job_do_DC_JOB_SEND(context: &Context, job: &mut dc_job_t) {
|
|||||||
}
|
}
|
||||||
match current_block {
|
match current_block {
|
||||||
13109137661213826276 => {
|
13109137661213826276 => {
|
||||||
filename = dc_param_get(job.param, 'f' as i32, 0 as *const libc::c_char);
|
filename = dc_param_get(job.param, DC_PARAM_FILE as i32, 0 as *const libc::c_char);
|
||||||
if filename.is_null() {
|
if filename.is_null() {
|
||||||
warn!(context, 0, "Missing file name for job {}", job.job_id,);
|
warn!(context, 0, "Missing file name for job {}", job.job_id,);
|
||||||
} else if !(0 == dc_read_file(context, filename, &mut buf, &mut buf_bytes)) {
|
} else if !(0 == dc_read_file(context, filename, &mut buf, &mut buf_bytes)) {
|
||||||
recipients = dc_param_get(job.param, 'R' as i32, 0 as *const libc::c_char);
|
recipients = dc_param_get(
|
||||||
|
job.param,
|
||||||
|
DC_PARAM_RECIPIENTS as i32,
|
||||||
|
0 as *const libc::c_char,
|
||||||
|
);
|
||||||
if recipients.is_null() {
|
if recipients.is_null() {
|
||||||
warn!(context, 0, "Missing recipients for job {}", job.job_id,);
|
warn!(context, 0, "Missing recipients for job {}", job.job_id,);
|
||||||
} else {
|
} else {
|
||||||
@@ -493,8 +497,12 @@ fn connect_to_inbox(context: &Context, inbox: &Imap) -> libc::c_int {
|
|||||||
|
|
||||||
unsafe fn dc_job_do_DC_JOB_MARKSEEN_MDN_ON_IMAP(context: &Context, job: &mut dc_job_t) {
|
unsafe fn dc_job_do_DC_JOB_MARKSEEN_MDN_ON_IMAP(context: &Context, job: &mut dc_job_t) {
|
||||||
let current_block: u64;
|
let current_block: u64;
|
||||||
let folder: *mut libc::c_char = dc_param_get(job.param, 'Z' as i32, 0 as *const libc::c_char);
|
let folder: *mut libc::c_char = dc_param_get(
|
||||||
let uid: uint32_t = dc_param_get_int(job.param, 'z' as i32, 0i32) as uint32_t;
|
job.param,
|
||||||
|
DC_PARAM_SERVER_FOLDER as i32,
|
||||||
|
0 as *const libc::c_char,
|
||||||
|
);
|
||||||
|
let uid: uint32_t = dc_param_get_int(job.param, DC_PARAM_SERVER_UID as i32, 0) as uint32_t;
|
||||||
let mut dest_uid: uint32_t = 0i32 as uint32_t;
|
let mut dest_uid: uint32_t = 0i32 as uint32_t;
|
||||||
let inbox = context.inbox.read().unwrap();
|
let inbox = context.inbox.read().unwrap();
|
||||||
|
|
||||||
@@ -515,7 +523,7 @@ unsafe fn dc_job_do_DC_JOB_MARKSEEN_MDN_ON_IMAP(context: &Context, job: &mut dc_
|
|||||||
if inbox.set_seen(context, folder, uid) as libc::c_uint == 0i32 as libc::c_uint {
|
if inbox.set_seen(context, folder, uid) as libc::c_uint == 0i32 as libc::c_uint {
|
||||||
dc_job_try_again_later(job, 3i32, 0 as *const libc::c_char);
|
dc_job_try_again_later(job, 3i32, 0 as *const libc::c_char);
|
||||||
}
|
}
|
||||||
if 0 != dc_param_get_int(job.param, 'M' as i32, 0i32) {
|
if 0 != dc_param_get_int(job.param, DC_PARAM_ALSO_MOVE as i32, 0i32) {
|
||||||
if context
|
if context
|
||||||
.sql
|
.sql
|
||||||
.get_config_int(context, "folders_configured")
|
.get_config_int(context, "folders_configured")
|
||||||
@@ -568,8 +576,12 @@ unsafe fn dc_job_do_DC_JOB_MARKSEEN_MSG_ON_IMAP(context: &Context, job: &mut dc_
|
|||||||
dc_job_try_again_later(job, 3i32, 0 as *const libc::c_char);
|
dc_job_try_again_later(job, 3i32, 0 as *const libc::c_char);
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
if 0 != dc_param_get_int((*msg).param, 'r' as i32, 0i32)
|
if 0 != dc_param_get_int(
|
||||||
&& 0 != context
|
(*msg).param,
|
||||||
|
DC_PARAM_WANTS_MDN as i32,
|
||||||
|
0i32,
|
||||||
|
) && 0
|
||||||
|
!= context
|
||||||
.sql
|
.sql
|
||||||
.get_config_int(context, "mdns_enabled")
|
.get_config_int(context, "mdns_enabled")
|
||||||
.unwrap_or_else(|| 1)
|
.unwrap_or_else(|| 1)
|
||||||
@@ -622,7 +634,7 @@ unsafe fn dc_job_do_DC_JOB_MARKSEEN_MSG_ON_IMAP(context: &Context, job: &mut dc_
|
|||||||
dc_job_try_again_later(job, 3i32, 0 as *const libc::c_char);
|
dc_job_try_again_later(job, 3i32, 0 as *const libc::c_char);
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
if 0 != dc_param_get_int((*msg).param, 'r' as i32, 0i32)
|
if 0 != dc_param_get_int((*msg).param, DC_PARAM_WANTS_MDN as i32, 0)
|
||||||
&& 0 != context
|
&& 0 != context
|
||||||
.sql
|
.sql
|
||||||
.get_config_int(context, "mdns_enabled")
|
.get_config_int(context, "mdns_enabled")
|
||||||
@@ -760,8 +772,8 @@ unsafe fn dc_add_smtp_job(
|
|||||||
(*mimefactory).recipients_addr,
|
(*mimefactory).recipients_addr,
|
||||||
b"\x1e\x00" as *const u8 as *const libc::c_char,
|
b"\x1e\x00" as *const u8 as *const libc::c_char,
|
||||||
);
|
);
|
||||||
dc_param_set(param, 'f' as i32, pathNfilename);
|
dc_param_set(param, DC_PARAM_FILE as i32, pathNfilename);
|
||||||
dc_param_set(param, 'R' as i32, recipients);
|
dc_param_set(param, DC_PARAM_RECIPIENTS as i32, recipients);
|
||||||
dc_job_add(
|
dc_job_add(
|
||||||
context,
|
context,
|
||||||
action,
|
action,
|
||||||
@@ -1161,19 +1173,19 @@ pub unsafe fn dc_job_send_msg(context: &Context, msg_id: uint32_t) -> libc::c_in
|
|||||||
{
|
{
|
||||||
let pathNfilename = dc_param_get(
|
let pathNfilename = dc_param_get(
|
||||||
(*mimefactory.msg).param,
|
(*mimefactory.msg).param,
|
||||||
'f' as i32,
|
DC_PARAM_FILE as i32,
|
||||||
0 as *const libc::c_char,
|
0 as *const libc::c_char,
|
||||||
);
|
);
|
||||||
if !pathNfilename.is_null() {
|
if !pathNfilename.is_null() {
|
||||||
if ((*mimefactory.msg).type_0 == 20i32 || (*mimefactory.msg).type_0 == 21i32)
|
if ((*mimefactory.msg).type_0 == 20i32 || (*mimefactory.msg).type_0 == 21i32)
|
||||||
&& 0 == dc_param_exists((*mimefactory.msg).param, 'w' as i32)
|
&& 0 == dc_param_exists((*mimefactory.msg).param, DC_PARAM_WIDTH as i32)
|
||||||
{
|
{
|
||||||
let mut buf: *mut libc::c_uchar = 0 as *mut libc::c_uchar;
|
let mut buf: *mut libc::c_uchar = 0 as *mut libc::c_uchar;
|
||||||
let mut buf_bytes: size_t = 0;
|
let mut buf_bytes: size_t = 0;
|
||||||
let mut w: uint32_t = 0;
|
let mut w: uint32_t = 0;
|
||||||
let mut h: uint32_t = 0;
|
let mut h: uint32_t = 0;
|
||||||
dc_param_set_int((*mimefactory.msg).param, 'w' as i32, 0i32);
|
dc_param_set_int((*mimefactory.msg).param, DC_PARAM_WIDTH as i32, 0);
|
||||||
dc_param_set_int((*mimefactory.msg).param, 'h' as i32, 0i32);
|
dc_param_set_int((*mimefactory.msg).param, DC_PARAM_HEIGHT as i32, 0);
|
||||||
if 0 != dc_read_file(
|
if 0 != dc_read_file(
|
||||||
context,
|
context,
|
||||||
pathNfilename,
|
pathNfilename,
|
||||||
@@ -1186,8 +1198,16 @@ pub unsafe fn dc_job_send_msg(context: &Context, msg_id: uint32_t) -> libc::c_in
|
|||||||
&mut w,
|
&mut w,
|
||||||
&mut h,
|
&mut h,
|
||||||
) {
|
) {
|
||||||
dc_param_set_int((*mimefactory.msg).param, 'w' as i32, w as int32_t);
|
dc_param_set_int(
|
||||||
dc_param_set_int((*mimefactory.msg).param, 'h' as i32, h as int32_t);
|
(*mimefactory.msg).param,
|
||||||
|
DC_PARAM_WIDTH as i32,
|
||||||
|
w as int32_t,
|
||||||
|
);
|
||||||
|
dc_param_set_int(
|
||||||
|
(*mimefactory.msg).param,
|
||||||
|
DC_PARAM_HEIGHT as i32,
|
||||||
|
h as int32_t,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(buf as *mut libc::c_void);
|
free(buf as *mut libc::c_void);
|
||||||
@@ -1199,7 +1219,7 @@ pub unsafe fn dc_job_send_msg(context: &Context, msg_id: uint32_t) -> libc::c_in
|
|||||||
/* create message */
|
/* create message */
|
||||||
if 0 == dc_mimefactory_render(&mut mimefactory) {
|
if 0 == dc_mimefactory_render(&mut mimefactory) {
|
||||||
dc_set_msg_failed(context, msg_id, mimefactory.error);
|
dc_set_msg_failed(context, msg_id, mimefactory.error);
|
||||||
} else if 0 != dc_param_get_int((*mimefactory.msg).param, 'c' as i32, 0)
|
} else if 0 != dc_param_get_int((*mimefactory.msg).param, DC_PARAM_GUARANTEE_E2EE as i32, 0)
|
||||||
&& 0 == mimefactory.out_encrypted
|
&& 0 == mimefactory.out_encrypted
|
||||||
{
|
{
|
||||||
warn!(
|
warn!(
|
||||||
@@ -1207,7 +1227,7 @@ pub unsafe fn dc_job_send_msg(context: &Context, msg_id: uint32_t) -> libc::c_in
|
|||||||
0,
|
0,
|
||||||
"e2e encryption unavailable {} - {}",
|
"e2e encryption unavailable {} - {}",
|
||||||
msg_id,
|
msg_id,
|
||||||
dc_param_get_int((*mimefactory.msg).param, 'c' as i32, 0),
|
dc_param_get_int((*mimefactory.msg).param, DC_PARAM_GUARANTEE_E2EE as i32, 0),
|
||||||
);
|
);
|
||||||
dc_set_msg_failed(
|
dc_set_msg_failed(
|
||||||
context,
|
context,
|
||||||
@@ -1245,9 +1265,10 @@ pub unsafe fn dc_job_send_msg(context: &Context, msg_id: uint32_t) -> libc::c_in
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if 0 != mimefactory.out_encrypted
|
if 0 != mimefactory.out_encrypted
|
||||||
&& dc_param_get_int((*mimefactory.msg).param, 'c' as i32, 0i32) == 0i32
|
&& dc_param_get_int((*mimefactory.msg).param, DC_PARAM_GUARANTEE_E2EE as i32, 0)
|
||||||
|
== 0
|
||||||
{
|
{
|
||||||
dc_param_set_int((*mimefactory.msg).param, 'c' as i32, 1i32);
|
dc_param_set_int((*mimefactory.msg).param, DC_PARAM_GUARANTEE_E2EE as i32, 1);
|
||||||
dc_msg_save_param_to_disk(mimefactory.msg);
|
dc_msg_save_param_to_disk(mimefactory.msg);
|
||||||
}
|
}
|
||||||
dc_add_to_keyhistory(
|
dc_add_to_keyhistory(
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ pub unsafe fn dc_send_locations_to_chat(
|
|||||||
0 as *const libc::c_char,
|
0 as *const libc::c_char,
|
||||||
0,
|
0,
|
||||||
);
|
);
|
||||||
dc_param_set_int((*msg).param, 'S' as i32, 8i32);
|
dc_param_set_int((*msg).param, DC_PARAM_CMD as i32, 8);
|
||||||
dc_send_msg(context, chat_id, msg);
|
dc_send_msg(context, chat_id, msg);
|
||||||
} else if 0 == seconds && is_sending_locations_before {
|
} else if 0 == seconds && is_sending_locations_before {
|
||||||
stock_str = dc_stock_system_msg(
|
stock_str = dc_stock_system_msg(
|
||||||
@@ -688,7 +688,7 @@ pub unsafe fn dc_job_do_DC_JOB_MAYBE_SEND_LOCATIONS(context: &Context, _job: *mu
|
|||||||
// and dc_set_location() is typically called periodically, this is ok)
|
// and dc_set_location() is typically called periodically, this is ok)
|
||||||
let mut msg = dc_msg_new(context, 10);
|
let mut msg = dc_msg_new(context, 10);
|
||||||
(*msg).hidden = 1;
|
(*msg).hidden = 1;
|
||||||
dc_param_set_int((*msg).param, 'S' as i32, 9);
|
dc_param_set_int((*msg).param, DC_PARAM_CMD as i32, 9);
|
||||||
dc_send_msg(context, chat_id as u32, msg);
|
dc_send_msg(context, chat_id as u32, msg);
|
||||||
dc_msg_unref(msg);
|
dc_msg_unref(msg);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -187,11 +187,11 @@ pub unsafe fn dc_mimefactory_load_msg(
|
|||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let command = dc_param_get_int((*(*factory).msg).param, 'S' as i32, 0);
|
let command = dc_param_get_int((*(*factory).msg).param, DC_PARAM_CMD as i32, 0);
|
||||||
if command == 5 {
|
if command == 5 {
|
||||||
let email_to_remove_c = dc_param_get(
|
let email_to_remove_c = dc_param_get(
|
||||||
(*(*factory).msg).param,
|
(*(*factory).msg).param,
|
||||||
'E' as i32,
|
DC_PARAM_CMD_ARG as i32,
|
||||||
0 as *const libc::c_char,
|
0 as *const libc::c_char,
|
||||||
);
|
);
|
||||||
let email_to_remove = to_string(email_to_remove_c);
|
let email_to_remove = to_string(email_to_remove_c);
|
||||||
@@ -551,9 +551,11 @@ pub unsafe fn dc_mimefactory_render(mut factory: *mut dc_mimefactory_t) -> libc:
|
|||||||
e2ee_guaranteed = 1;
|
e2ee_guaranteed = 1;
|
||||||
min_verified = 2
|
min_verified = 2
|
||||||
} else {
|
} else {
|
||||||
force_plaintext = dc_param_get_int((*(*factory).msg).param, 'u' as i32, 0);
|
force_plaintext =
|
||||||
|
dc_param_get_int((*(*factory).msg).param, DC_PARAM_FORCE_PLAINTEXT as i32, 0);
|
||||||
if force_plaintext == 0 {
|
if force_plaintext == 0 {
|
||||||
e2ee_guaranteed = dc_param_get_int((*(*factory).msg).param, 'c' as i32, 0)
|
e2ee_guaranteed =
|
||||||
|
dc_param_get_int((*(*factory).msg).param, DC_PARAM_GUARANTEE_E2EE as i32, 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (*chat).gossiped_timestamp == 0
|
if (*chat).gossiped_timestamp == 0
|
||||||
@@ -562,7 +564,7 @@ pub unsafe fn dc_mimefactory_render(mut factory: *mut dc_mimefactory_t) -> libc:
|
|||||||
do_gossip = 1
|
do_gossip = 1
|
||||||
}
|
}
|
||||||
/* build header etc. */
|
/* build header etc. */
|
||||||
let command: libc::c_int = dc_param_get_int((*msg).param, 'S' as i32, 0);
|
let command: libc::c_int = dc_param_get_int((*msg).param, DC_PARAM_CMD as i32, 0);
|
||||||
if (*chat).type_0 == DC_CHAT_TYPE_GROUP as libc::c_int
|
if (*chat).type_0 == DC_CHAT_TYPE_GROUP as libc::c_int
|
||||||
|| (*chat).type_0 == DC_CHAT_TYPE_VERIFIED_GROUP as libc::c_int
|
|| (*chat).type_0 == DC_CHAT_TYPE_VERIFIED_GROUP as libc::c_int
|
||||||
{
|
{
|
||||||
@@ -581,8 +583,11 @@ pub unsafe fn dc_mimefactory_render(mut factory: *mut dc_mimefactory_t) -> libc:
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
if command == 5 {
|
if command == 5 {
|
||||||
let email_to_remove: *mut libc::c_char =
|
let email_to_remove: *mut libc::c_char = dc_param_get(
|
||||||
dc_param_get((*msg).param, 'E' as i32, 0 as *const libc::c_char);
|
(*msg).param,
|
||||||
|
DC_PARAM_CMD_ARG as i32,
|
||||||
|
0 as *const libc::c_char,
|
||||||
|
);
|
||||||
if !email_to_remove.is_null() {
|
if !email_to_remove.is_null() {
|
||||||
mailimf_fields_add(
|
mailimf_fields_add(
|
||||||
imf_fields,
|
imf_fields,
|
||||||
@@ -597,8 +602,11 @@ pub unsafe fn dc_mimefactory_render(mut factory: *mut dc_mimefactory_t) -> libc:
|
|||||||
}
|
}
|
||||||
} else if command == 4 {
|
} else if command == 4 {
|
||||||
do_gossip = 1;
|
do_gossip = 1;
|
||||||
let email_to_add: *mut libc::c_char =
|
let email_to_add: *mut libc::c_char = dc_param_get(
|
||||||
dc_param_get((*msg).param, 'E' as i32, 0 as *const libc::c_char);
|
(*msg).param,
|
||||||
|
DC_PARAM_CMD_ARG as i32,
|
||||||
|
0 as *const libc::c_char,
|
||||||
|
);
|
||||||
if !email_to_add.is_null() {
|
if !email_to_add.is_null() {
|
||||||
mailimf_fields_add(
|
mailimf_fields_add(
|
||||||
imf_fields,
|
imf_fields,
|
||||||
@@ -610,9 +618,13 @@ pub unsafe fn dc_mimefactory_render(mut factory: *mut dc_mimefactory_t) -> libc:
|
|||||||
email_to_add,
|
email_to_add,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
grpimage = dc_param_get((*chat).param, 'i' as i32, 0 as *const libc::c_char)
|
grpimage = dc_param_get(
|
||||||
|
(*chat).param,
|
||||||
|
DC_PARAM_PROFILE_IMAGE as i32,
|
||||||
|
0 as *const libc::c_char,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
if 0 != dc_param_get_int((*msg).param, 'F' as i32, 0) & 0x1 {
|
if 0 != dc_param_get_int((*msg).param, DC_PARAM_CMD_ARG2 as i32, 0) & 0x1 {
|
||||||
info!(
|
info!(
|
||||||
(*msg).context,
|
(*msg).context,
|
||||||
0,
|
0,
|
||||||
@@ -636,13 +648,17 @@ pub unsafe fn dc_mimefactory_render(mut factory: *mut dc_mimefactory_t) -> libc:
|
|||||||
),
|
),
|
||||||
dc_param_get(
|
dc_param_get(
|
||||||
(*msg).param,
|
(*msg).param,
|
||||||
'E' as i32,
|
DC_PARAM_CMD_ARG as i32,
|
||||||
b"\x00" as *const u8 as *const libc::c_char,
|
b"\x00" as *const u8 as *const libc::c_char,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else if command == 3 {
|
} else if command == 3 {
|
||||||
grpimage = dc_param_get((*msg).param, 'E' as i32, 0 as *const libc::c_char);
|
grpimage = dc_param_get(
|
||||||
|
(*msg).param,
|
||||||
|
DC_PARAM_CMD_ARG as i32,
|
||||||
|
0 as *const libc::c_char,
|
||||||
|
);
|
||||||
if grpimage.is_null() {
|
if grpimage.is_null() {
|
||||||
mailimf_fields_add(
|
mailimf_fields_add(
|
||||||
imf_fields,
|
imf_fields,
|
||||||
@@ -676,8 +692,11 @@ pub unsafe fn dc_mimefactory_render(mut factory: *mut dc_mimefactory_t) -> libc:
|
|||||||
placeholdertext = dc_stock_str((*factory).context, 43)
|
placeholdertext = dc_stock_str((*factory).context, 43)
|
||||||
}
|
}
|
||||||
if command == 7 {
|
if command == 7 {
|
||||||
let step: *mut libc::c_char =
|
let step: *mut libc::c_char = dc_param_get(
|
||||||
dc_param_get((*msg).param, 'E' as i32, 0 as *const libc::c_char);
|
(*msg).param,
|
||||||
|
DC_PARAM_CMD_ARG as i32,
|
||||||
|
0 as *const libc::c_char,
|
||||||
|
);
|
||||||
if !step.is_null() {
|
if !step.is_null() {
|
||||||
info!(
|
info!(
|
||||||
(*msg).context,
|
(*msg).context,
|
||||||
@@ -692,8 +711,11 @@ pub unsafe fn dc_mimefactory_render(mut factory: *mut dc_mimefactory_t) -> libc:
|
|||||||
step,
|
step,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
let param2: *mut libc::c_char =
|
let param2: *mut libc::c_char = dc_param_get(
|
||||||
dc_param_get((*msg).param, 'F' as i32, 0 as *const libc::c_char);
|
(*msg).param,
|
||||||
|
DC_PARAM_CMD_ARG2 as i32,
|
||||||
|
0 as *const libc::c_char,
|
||||||
|
);
|
||||||
if !param2.is_null() {
|
if !param2.is_null() {
|
||||||
mailimf_fields_add(
|
mailimf_fields_add(
|
||||||
imf_fields,
|
imf_fields,
|
||||||
@@ -721,8 +743,11 @@ pub unsafe fn dc_mimefactory_render(mut factory: *mut dc_mimefactory_t) -> libc:
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
let fingerprint: *mut libc::c_char =
|
let fingerprint: *mut libc::c_char = dc_param_get(
|
||||||
dc_param_get((*msg).param, 'G' as i32, 0 as *const libc::c_char);
|
(*msg).param,
|
||||||
|
DC_PARAM_CMD_ARG3 as i32,
|
||||||
|
0 as *const libc::c_char,
|
||||||
|
);
|
||||||
if !fingerprint.is_null() {
|
if !fingerprint.is_null() {
|
||||||
mailimf_fields_add(
|
mailimf_fields_add(
|
||||||
imf_fields,
|
imf_fields,
|
||||||
@@ -735,8 +760,11 @@ pub unsafe fn dc_mimefactory_render(mut factory: *mut dc_mimefactory_t) -> libc:
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
let grpid: *mut libc::c_char =
|
let grpid: *mut libc::c_char = dc_param_get(
|
||||||
dc_param_get((*msg).param, 'H' as i32, 0 as *const libc::c_char);
|
(*msg).param,
|
||||||
|
DC_PARAM_CMD_ARG4 as i32,
|
||||||
|
0 as *const libc::c_char,
|
||||||
|
);
|
||||||
if !grpid.is_null() {
|
if !grpid.is_null() {
|
||||||
mailimf_fields_add(
|
mailimf_fields_add(
|
||||||
imf_fields,
|
imf_fields,
|
||||||
@@ -753,7 +781,7 @@ pub unsafe fn dc_mimefactory_render(mut factory: *mut dc_mimefactory_t) -> libc:
|
|||||||
if !grpimage.is_null() {
|
if !grpimage.is_null() {
|
||||||
let mut meta: *mut dc_msg_t = dc_msg_new_untyped((*factory).context);
|
let mut meta: *mut dc_msg_t = dc_msg_new_untyped((*factory).context);
|
||||||
(*meta).type_0 = DC_MSG_IMAGE as libc::c_int;
|
(*meta).type_0 = DC_MSG_IMAGE as libc::c_int;
|
||||||
dc_param_set((*meta).param, 'f' as i32, grpimage);
|
dc_param_set((*meta).param, DC_PARAM_FILE as i32, grpimage);
|
||||||
let mut filename_as_sent: *mut libc::c_char = 0 as *mut libc::c_char;
|
let mut filename_as_sent: *mut libc::c_char = 0 as *mut libc::c_char;
|
||||||
meta_part = build_body_file(
|
meta_part = build_body_file(
|
||||||
meta,
|
meta,
|
||||||
@@ -784,7 +812,8 @@ pub unsafe fn dc_mimefactory_render(mut factory: *mut dc_mimefactory_t) -> libc:
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
let duration_ms: libc::c_int = dc_param_get_int((*msg).param, 'd' as i32, 0);
|
let duration_ms: libc::c_int =
|
||||||
|
dc_param_get_int((*msg).param, DC_PARAM_DURATION as i32, 0);
|
||||||
if duration_ms > 0 {
|
if duration_ms > 0 {
|
||||||
mailimf_fields_add(
|
mailimf_fields_add(
|
||||||
imf_fields,
|
imf_fields,
|
||||||
@@ -798,7 +827,7 @@ pub unsafe fn dc_mimefactory_render(mut factory: *mut dc_mimefactory_t) -> libc:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
afwd_email = dc_param_exists((*msg).param, 'a' as i32);
|
afwd_email = dc_param_exists((*msg).param, DC_PARAM_FORWARDED as i32);
|
||||||
let mut fwdhint: *mut libc::c_char = 0 as *mut libc::c_char;
|
let mut fwdhint: *mut libc::c_char = 0 as *mut libc::c_char;
|
||||||
if 0 != afwd_email {
|
if 0 != afwd_email {
|
||||||
fwdhint = dc_strdup(
|
fwdhint = dc_strdup(
|
||||||
@@ -980,7 +1009,7 @@ pub unsafe fn dc_mimefactory_render(mut factory: *mut dc_mimefactory_t) -> libc:
|
|||||||
mailmime_add_part(message, multipart);
|
mailmime_add_part(message, multipart);
|
||||||
let p1: *mut libc::c_char;
|
let p1: *mut libc::c_char;
|
||||||
let p2: *mut libc::c_char;
|
let p2: *mut libc::c_char;
|
||||||
if 0 != dc_param_get_int((*(*factory).msg).param, 'c' as i32, 0) {
|
if 0 != dc_param_get_int((*(*factory).msg).param, DC_PARAM_GUARANTEE_E2EE as i32, 0) {
|
||||||
p1 = dc_stock_str((*factory).context, 24)
|
p1 = dc_stock_str((*factory).context, 24)
|
||||||
} else {
|
} else {
|
||||||
p1 = dc_msg_get_summarytext((*factory).msg, 32)
|
p1 = dc_msg_get_summarytext((*factory).msg, 32)
|
||||||
@@ -1106,7 +1135,7 @@ unsafe fn get_subject(
|
|||||||
} else {
|
} else {
|
||||||
b"\x00" as *const u8 as *const libc::c_char
|
b"\x00" as *const u8 as *const libc::c_char
|
||||||
};
|
};
|
||||||
if dc_param_get_int((*msg).param, 'S' as i32, 0) == 6 {
|
if dc_param_get_int((*msg).param, DC_PARAM_CMD as i32, 0) == 6 {
|
||||||
ret = dc_stock_str(context, 42)
|
ret = dc_stock_str(context, 42)
|
||||||
} else if (*chat).type_0 == DC_CHAT_TYPE_GROUP as libc::c_int
|
} else if (*chat).type_0 == DC_CHAT_TYPE_GROUP as libc::c_int
|
||||||
|| (*chat).type_0 == DC_CHAT_TYPE_VERIFIED_GROUP as libc::c_int
|
|| (*chat).type_0 == DC_CHAT_TYPE_VERIFIED_GROUP as libc::c_int
|
||||||
@@ -1167,9 +1196,12 @@ unsafe fn build_body_file(
|
|||||||
let mut mime_sub: *mut mailmime = 0 as *mut mailmime;
|
let mut mime_sub: *mut mailmime = 0 as *mut mailmime;
|
||||||
let content: *mut mailmime_content;
|
let content: *mut mailmime_content;
|
||||||
let pathNfilename: *mut libc::c_char =
|
let pathNfilename: *mut libc::c_char =
|
||||||
dc_param_get((*msg).param, 'f' as i32, 0 as *const libc::c_char);
|
dc_param_get((*msg).param, DC_PARAM_FILE as i32, 0 as *const libc::c_char);
|
||||||
let mut mimetype: *mut libc::c_char =
|
let mut mimetype: *mut libc::c_char = dc_param_get(
|
||||||
dc_param_get((*msg).param, 'm' as i32, 0 as *const libc::c_char);
|
(*msg).param,
|
||||||
|
DC_PARAM_MIMETYPE as i32,
|
||||||
|
0 as *const libc::c_char,
|
||||||
|
);
|
||||||
let suffix: *mut libc::c_char = dc_get_filesuffix_lc(pathNfilename);
|
let suffix: *mut libc::c_char = dc_get_filesuffix_lc(pathNfilename);
|
||||||
let mut filename_to_send: *mut libc::c_char = 0 as *mut libc::c_char;
|
let mut filename_to_send: *mut libc::c_char = 0 as *mut libc::c_char;
|
||||||
let mut filename_encoded: *mut libc::c_char = 0 as *mut libc::c_char;
|
let mut filename_encoded: *mut libc::c_char = 0 as *mut libc::c_char;
|
||||||
@@ -1328,7 +1360,7 @@ unsafe fn build_body_file(
|
|||||||
unsafe fn is_file_size_okay(msg: *const dc_msg_t) -> libc::c_int {
|
unsafe fn is_file_size_okay(msg: *const dc_msg_t) -> libc::c_int {
|
||||||
let mut file_size_okay: libc::c_int = 1;
|
let mut file_size_okay: libc::c_int = 1;
|
||||||
let pathNfilename: *mut libc::c_char =
|
let pathNfilename: *mut libc::c_char =
|
||||||
dc_param_get((*msg).param, 'f' as i32, 0 as *const libc::c_char);
|
dc_param_get((*msg).param, DC_PARAM_FILE as i32, 0 as *const libc::c_char);
|
||||||
let bytes: uint64_t = dc_get_filebytes((*msg).context, pathNfilename);
|
let bytes: uint64_t = dc_get_filebytes((*msg).context, pathNfilename);
|
||||||
if bytes > (49 * 1024 * 1024 / 4 * 3) as libc::c_ulonglong {
|
if bytes > (49 * 1024 * 1024 / 4 * 3) as libc::c_ulonglong {
|
||||||
file_size_okay = 0;
|
file_size_okay = 0;
|
||||||
|
|||||||
@@ -323,7 +323,7 @@ pub unsafe fn dc_mimeparser_parse(
|
|||||||
while i_1 < icnt_0 {
|
while i_1 < icnt_0 {
|
||||||
let part_2: *mut dc_mimepart_t =
|
let part_2: *mut dc_mimepart_t =
|
||||||
carray_get((*mimeparser).parts, i_1 as libc::c_uint) as *mut dc_mimepart_t;
|
carray_get((*mimeparser).parts, i_1 as libc::c_uint) as *mut dc_mimepart_t;
|
||||||
dc_param_set_int((*part_2).param, 'a' as i32, 1i32);
|
dc_param_set_int((*part_2).param, DC_PARAM_FORWARDED as i32, 1);
|
||||||
i_1 += 1
|
i_1 += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -348,7 +348,7 @@ pub unsafe fn dc_mimeparser_parse(
|
|||||||
if !field_0.is_null() {
|
if !field_0.is_null() {
|
||||||
let duration_ms: libc::c_int = dc_atoi_null_is_0((*field_0).fld_value);
|
let duration_ms: libc::c_int = dc_atoi_null_is_0((*field_0).fld_value);
|
||||||
if duration_ms > 0i32 && duration_ms < 24i32 * 60i32 * 60i32 * 1000i32 {
|
if duration_ms > 0i32 && duration_ms < 24i32 * 60i32 * 60i32 * 1000i32 {
|
||||||
dc_param_set_int((*part_3).param, 'd' as i32, duration_ms);
|
dc_param_set_int((*part_3).param, DC_PARAM_DURATION as i32, duration_ms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -385,7 +385,11 @@ pub unsafe fn dc_mimeparser_parse(
|
|||||||
let part_4: *mut dc_mimepart_t =
|
let part_4: *mut dc_mimepart_t =
|
||||||
dc_mimeparser_get_last_nonmeta(mimeparser);
|
dc_mimeparser_get_last_nonmeta(mimeparser);
|
||||||
if !part_4.is_null() {
|
if !part_4.is_null() {
|
||||||
dc_param_set_int((*part_4).param, 'r' as i32, 1i32);
|
dc_param_set_int(
|
||||||
|
(*part_4).param,
|
||||||
|
DC_PARAM_WANTS_MDN as i32,
|
||||||
|
1,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(from_addr as *mut libc::c_void);
|
free(from_addr as *mut libc::c_void);
|
||||||
@@ -1486,8 +1490,8 @@ unsafe fn do_add_single_file_part(
|
|||||||
(*part).type_0 = msg_type;
|
(*part).type_0 = msg_type;
|
||||||
(*part).int_mimetype = mime_type;
|
(*part).int_mimetype = mime_type;
|
||||||
(*part).bytes = decoded_data_bytes as libc::c_int;
|
(*part).bytes = decoded_data_bytes as libc::c_int;
|
||||||
dc_param_set((*part).param, 'f' as i32, pathNfilename);
|
dc_param_set((*part).param, DC_PARAM_FILE as i32, pathNfilename);
|
||||||
dc_param_set((*part).param, 'm' as i32, raw_mime);
|
dc_param_set((*part).param, DC_PARAM_MIMETYPE as i32, raw_mime);
|
||||||
if mime_type == 80i32 {
|
if mime_type == 80i32 {
|
||||||
let mut w: uint32_t = 0i32 as uint32_t;
|
let mut w: uint32_t = 0i32 as uint32_t;
|
||||||
let mut h: uint32_t = 0i32 as uint32_t;
|
let mut h: uint32_t = 0i32 as uint32_t;
|
||||||
@@ -1497,8 +1501,8 @@ unsafe fn do_add_single_file_part(
|
|||||||
&mut w,
|
&mut w,
|
||||||
&mut h,
|
&mut h,
|
||||||
) {
|
) {
|
||||||
dc_param_set_int((*part).param, 'w' as i32, w as int32_t);
|
dc_param_set_int((*part).param, DC_PARAM_WIDTH as i32, w as int32_t);
|
||||||
dc_param_set_int((*part).param, 'h' as i32, h as int32_t);
|
dc_param_set_int((*part).param, DC_PARAM_HEIGHT as i32, h as int32_t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
do_add_single_part(parser, part);
|
do_add_single_part(parser, part);
|
||||||
@@ -1511,9 +1515,9 @@ unsafe fn do_add_single_file_part(
|
|||||||
|
|
||||||
unsafe fn do_add_single_part(parser: &dc_mimeparser_t, part: *mut dc_mimepart_t) {
|
unsafe fn do_add_single_part(parser: &dc_mimeparser_t, part: *mut dc_mimepart_t) {
|
||||||
if 0 != (*parser).e2ee_helper.encrypted && (*parser).e2ee_helper.signatures.len() > 0 {
|
if 0 != (*parser).e2ee_helper.encrypted && (*parser).e2ee_helper.signatures.len() > 0 {
|
||||||
dc_param_set_int((*part).param, 'c' as i32, 1i32);
|
dc_param_set_int((*part).param, DC_PARAM_GUARANTEE_E2EE as i32, 1);
|
||||||
} else if 0 != (*parser).e2ee_helper.encrypted {
|
} else if 0 != (*parser).e2ee_helper.encrypted {
|
||||||
dc_param_set_int((*part).param, 'e' as i32, 0x2i32);
|
dc_param_set_int((*part).param, DC_PARAM_ERRONEOUS_E2EE as i32, 0x2);
|
||||||
}
|
}
|
||||||
carray_add(
|
carray_add(
|
||||||
(*parser).parts,
|
(*parser).parts,
|
||||||
|
|||||||
@@ -142,18 +142,22 @@ pub unsafe fn dc_get_msg_info(context: &Context, msg_id: u32) -> *mut libc::c_ch
|
|||||||
ret += ", Location sent";
|
ret += ", Location sent";
|
||||||
}
|
}
|
||||||
|
|
||||||
let e2ee_errors = dc_param_get_int((*msg).param, 'e' as i32, 0);
|
let e2ee_errors = dc_param_get_int((*msg).param, DC_PARAM_ERRONEOUS_E2EE as i32, 0);
|
||||||
|
|
||||||
if 0 != e2ee_errors {
|
if 0 != e2ee_errors {
|
||||||
if 0 != e2ee_errors & 0x2 {
|
if 0 != e2ee_errors & 0x2 {
|
||||||
ret += ", Encrypted, no valid signature";
|
ret += ", Encrypted, no valid signature";
|
||||||
}
|
}
|
||||||
} else if 0 != dc_param_get_int((*msg).param, 'c' as i32, 0) {
|
} else if 0 != dc_param_get_int((*msg).param, DC_PARAM_GUARANTEE_E2EE as i32, 0) {
|
||||||
ret += ", Encrypted";
|
ret += ", Encrypted";
|
||||||
}
|
}
|
||||||
|
|
||||||
ret += "\n";
|
ret += "\n";
|
||||||
p = dc_param_get((*msg).param, 'L' as i32, 0 as *const libc::c_char);
|
p = dc_param_get(
|
||||||
|
(*msg).param,
|
||||||
|
DC_PARAM_ERROR as i32,
|
||||||
|
0 as *const libc::c_char,
|
||||||
|
);
|
||||||
if !p.is_null() {
|
if !p.is_null() {
|
||||||
ret += &format!("Error: {}", as_str(p));
|
ret += &format!("Error: {}", as_str(p));
|
||||||
free(p as *mut libc::c_void);
|
free(p as *mut libc::c_void);
|
||||||
@@ -184,12 +188,12 @@ pub unsafe fn dc_get_msg_info(context: &Context, msg_id: u32) -> *mut libc::c_ch
|
|||||||
ret += &format!("Mimetype: {}\n", as_str(p));
|
ret += &format!("Mimetype: {}\n", as_str(p));
|
||||||
free(p as *mut libc::c_void);
|
free(p as *mut libc::c_void);
|
||||||
}
|
}
|
||||||
let w = dc_param_get_int((*msg).param, 'w' as i32, 0);
|
let w = dc_param_get_int((*msg).param, DC_PARAM_WIDTH as i32, 0);
|
||||||
let h = dc_param_get_int((*msg).param, 'h' as i32, 0);
|
let h = dc_param_get_int((*msg).param, DC_PARAM_HEIGHT as i32, 0);
|
||||||
if w != 0 || h != 0 {
|
if w != 0 || h != 0 {
|
||||||
ret += &format!("Dimension: {} x {}\n", w, h,);
|
ret += &format!("Dimension: {} x {}\n", w, h,);
|
||||||
}
|
}
|
||||||
let duration = dc_param_get_int((*msg).param, 'd' as i32, 0);
|
let duration = dc_param_get_int((*msg).param, DC_PARAM_DURATION as i32, 0);
|
||||||
if duration != 0 {
|
if duration != 0 {
|
||||||
ret += &format!("Duration: {} ms\n", duration,);
|
ret += &format!("Duration: {} ms\n", duration,);
|
||||||
}
|
}
|
||||||
@@ -269,9 +273,13 @@ pub unsafe fn dc_msg_get_filemime(msg: *const dc_msg_t) -> *mut libc::c_char {
|
|||||||
let mut ret: *mut libc::c_char = 0 as *mut libc::c_char;
|
let mut ret: *mut libc::c_char = 0 as *mut libc::c_char;
|
||||||
let mut file: *mut libc::c_char = 0 as *mut libc::c_char;
|
let mut file: *mut libc::c_char = 0 as *mut libc::c_char;
|
||||||
if !(msg.is_null() || (*msg).magic != 0x11561156i32 as libc::c_uint) {
|
if !(msg.is_null() || (*msg).magic != 0x11561156i32 as libc::c_uint) {
|
||||||
ret = dc_param_get((*msg).param, 'm' as i32, 0 as *const libc::c_char);
|
ret = dc_param_get(
|
||||||
|
(*msg).param,
|
||||||
|
DC_PARAM_MIMETYPE as i32,
|
||||||
|
0 as *const libc::c_char,
|
||||||
|
);
|
||||||
if ret.is_null() {
|
if ret.is_null() {
|
||||||
file = dc_param_get((*msg).param, 'f' as i32, 0 as *const libc::c_char);
|
file = dc_param_get((*msg).param, DC_PARAM_FILE as i32, 0 as *const libc::c_char);
|
||||||
if !file.is_null() {
|
if !file.is_null() {
|
||||||
dc_msg_guess_msgtype_from_suffix(file, 0 as *mut libc::c_int, &mut ret);
|
dc_msg_guess_msgtype_from_suffix(file, 0 as *mut libc::c_int, &mut ret);
|
||||||
if ret.is_null() {
|
if ret.is_null() {
|
||||||
@@ -348,7 +356,7 @@ pub unsafe fn dc_msg_get_file(msg: *const dc_msg_t) -> *mut libc::c_char {
|
|||||||
let mut file_rel: *mut libc::c_char = 0 as *mut libc::c_char;
|
let mut file_rel: *mut libc::c_char = 0 as *mut libc::c_char;
|
||||||
let mut file_abs: *mut libc::c_char = 0 as *mut libc::c_char;
|
let mut file_abs: *mut libc::c_char = 0 as *mut libc::c_char;
|
||||||
if !(msg.is_null() || (*msg).magic != 0x11561156i32 as libc::c_uint) {
|
if !(msg.is_null() || (*msg).magic != 0x11561156i32 as libc::c_uint) {
|
||||||
file_rel = dc_param_get((*msg).param, 'f' as i32, 0 as *const libc::c_char);
|
file_rel = dc_param_get((*msg).param, DC_PARAM_FILE as i32, 0 as *const libc::c_char);
|
||||||
if !file_rel.is_null() {
|
if !file_rel.is_null() {
|
||||||
file_abs = dc_get_abs_path((*msg).context, file_rel)
|
file_abs = dc_get_abs_path((*msg).context, file_rel)
|
||||||
}
|
}
|
||||||
@@ -696,7 +704,7 @@ pub unsafe fn dc_msg_get_filename(msg: *const dc_msg_t) -> *mut libc::c_char {
|
|||||||
let mut ret: *mut libc::c_char = 0 as *mut libc::c_char;
|
let mut ret: *mut libc::c_char = 0 as *mut libc::c_char;
|
||||||
let mut pathNfilename: *mut libc::c_char = 0 as *mut libc::c_char;
|
let mut pathNfilename: *mut libc::c_char = 0 as *mut libc::c_char;
|
||||||
if !(msg.is_null() || (*msg).magic != 0x11561156i32 as libc::c_uint) {
|
if !(msg.is_null() || (*msg).magic != 0x11561156i32 as libc::c_uint) {
|
||||||
pathNfilename = dc_param_get((*msg).param, 'f' as i32, 0 as *const libc::c_char);
|
pathNfilename = dc_param_get((*msg).param, DC_PARAM_FILE as i32, 0 as *const libc::c_char);
|
||||||
if !pathNfilename.is_null() {
|
if !pathNfilename.is_null() {
|
||||||
ret = dc_get_filename(pathNfilename)
|
ret = dc_get_filename(pathNfilename)
|
||||||
}
|
}
|
||||||
@@ -713,7 +721,7 @@ pub unsafe fn dc_msg_get_filebytes(msg: *const dc_msg_t) -> uint64_t {
|
|||||||
let mut ret: uint64_t = 0i32 as uint64_t;
|
let mut ret: uint64_t = 0i32 as uint64_t;
|
||||||
let mut file: *mut libc::c_char = 0 as *mut libc::c_char;
|
let mut file: *mut libc::c_char = 0 as *mut libc::c_char;
|
||||||
if !(msg.is_null() || (*msg).magic != 0x11561156i32 as libc::c_uint) {
|
if !(msg.is_null() || (*msg).magic != 0x11561156i32 as libc::c_uint) {
|
||||||
file = dc_param_get((*msg).param, 'f' as i32, 0 as *const libc::c_char);
|
file = dc_param_get((*msg).param, DC_PARAM_FILE as i32, 0 as *const libc::c_char);
|
||||||
if !file.is_null() {
|
if !file.is_null() {
|
||||||
ret = dc_get_filebytes((*msg).context, file)
|
ret = dc_get_filebytes((*msg).context, file)
|
||||||
}
|
}
|
||||||
@@ -728,7 +736,7 @@ pub unsafe fn dc_msg_get_width(msg: *const dc_msg_t) -> libc::c_int {
|
|||||||
return 0i32;
|
return 0i32;
|
||||||
}
|
}
|
||||||
|
|
||||||
dc_param_get_int((*msg).param, 'w' as i32, 0i32)
|
dc_param_get_int((*msg).param, DC_PARAM_WIDTH as i32, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn dc_msg_get_height(msg: *const dc_msg_t) -> libc::c_int {
|
pub unsafe fn dc_msg_get_height(msg: *const dc_msg_t) -> libc::c_int {
|
||||||
@@ -736,7 +744,7 @@ pub unsafe fn dc_msg_get_height(msg: *const dc_msg_t) -> libc::c_int {
|
|||||||
return 0i32;
|
return 0i32;
|
||||||
}
|
}
|
||||||
|
|
||||||
dc_param_get_int((*msg).param, 'h' as i32, 0i32)
|
dc_param_get_int((*msg).param, DC_PARAM_HEIGHT as i32, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn dc_msg_get_duration(msg: *const dc_msg_t) -> libc::c_int {
|
pub unsafe fn dc_msg_get_duration(msg: *const dc_msg_t) -> libc::c_int {
|
||||||
@@ -744,7 +752,7 @@ pub unsafe fn dc_msg_get_duration(msg: *const dc_msg_t) -> libc::c_int {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
dc_param_get_int((*msg).param, 'd' as i32, 0i32)
|
dc_param_get_int((*msg).param, DC_PARAM_DURATION as i32, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO should return bool /rtn
|
// TODO should return bool /rtn
|
||||||
@@ -752,7 +760,7 @@ pub unsafe fn dc_msg_get_showpadlock(msg: *const dc_msg_t) -> libc::c_int {
|
|||||||
if msg.is_null() || (*msg).magic != 0x11561156i32 as libc::c_uint {
|
if msg.is_null() || (*msg).magic != 0x11561156i32 as libc::c_uint {
|
||||||
return 0i32;
|
return 0i32;
|
||||||
}
|
}
|
||||||
if dc_param_get_int((*msg).param, 'c' as i32, 0i32) != 0i32 {
|
if dc_param_get_int((*msg).param, DC_PARAM_GUARANTEE_E2EE as i32, 0) != 0i32 {
|
||||||
return 1i32;
|
return 1i32;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -835,13 +843,13 @@ pub unsafe fn dc_msg_get_summarytext_by_raw(
|
|||||||
50 => prefix = dc_stock_str(context, 10i32),
|
50 => prefix = dc_stock_str(context, 10i32),
|
||||||
41 => prefix = dc_stock_str(context, 7i32),
|
41 => prefix = dc_stock_str(context, 7i32),
|
||||||
40 | 60 => {
|
40 | 60 => {
|
||||||
if dc_param_get_int(param, 'S' as i32, 0i32) == 6i32 {
|
if dc_param_get_int(param, DC_PARAM_CMD as i32, 0) == 6i32 {
|
||||||
prefix = dc_stock_str(context, 42i32);
|
prefix = dc_stock_str(context, 42i32);
|
||||||
append_text = 0i32
|
append_text = 0i32
|
||||||
} else {
|
} else {
|
||||||
pathNfilename = dc_param_get(
|
pathNfilename = dc_param_get(
|
||||||
param,
|
param,
|
||||||
'f' as i32,
|
DC_PARAM_FILE as i32,
|
||||||
b"ErrFilename\x00" as *const u8 as *const libc::c_char,
|
b"ErrFilename\x00" as *const u8 as *const libc::c_char,
|
||||||
);
|
);
|
||||||
value = dc_get_filename(pathNfilename);
|
value = dc_get_filename(pathNfilename);
|
||||||
@@ -861,7 +869,7 @@ pub unsafe fn dc_msg_get_summarytext_by_raw(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
if dc_param_get_int(param, 'S' as i32, 0i32) == 9i32 {
|
if dc_param_get_int(param, DC_PARAM_CMD as i32, 0) == 9i32 {
|
||||||
prefix = dc_stock_str(context, 66i32);
|
prefix = dc_stock_str(context, 66i32);
|
||||||
append_text = 0i32
|
append_text = 0i32
|
||||||
}
|
}
|
||||||
@@ -925,7 +933,7 @@ pub unsafe fn dc_msg_is_forwarded(msg: *const dc_msg_t) -> libc::c_int {
|
|||||||
if msg.is_null() || (*msg).magic != 0x11561156i32 as libc::c_uint {
|
if msg.is_null() || (*msg).magic != 0x11561156i32 as libc::c_uint {
|
||||||
return 0i32;
|
return 0i32;
|
||||||
}
|
}
|
||||||
return if 0 != dc_param_get_int((*msg).param, 'a' as i32, 0i32) {
|
return if 0 != dc_param_get_int((*msg).param, DC_PARAM_FORWARDED as i32, 0) {
|
||||||
1i32
|
1i32
|
||||||
} else {
|
} else {
|
||||||
0i32
|
0i32
|
||||||
@@ -937,7 +945,7 @@ pub unsafe fn dc_msg_is_info(msg: *const dc_msg_t) -> libc::c_int {
|
|||||||
if msg.is_null() || (*msg).magic != 0x11561156i32 as libc::c_uint {
|
if msg.is_null() || (*msg).magic != 0x11561156i32 as libc::c_uint {
|
||||||
return 0i32;
|
return 0i32;
|
||||||
}
|
}
|
||||||
let cmd: libc::c_int = dc_param_get_int((*msg).param, 'S' as i32, 0i32);
|
let cmd: libc::c_int = dc_param_get_int((*msg).param, DC_PARAM_CMD as i32, 0);
|
||||||
if (*msg).from_id == 2i32 as libc::c_uint
|
if (*msg).from_id == 2i32 as libc::c_uint
|
||||||
|| (*msg).to_id == 2i32 as libc::c_uint
|
|| (*msg).to_id == 2i32 as libc::c_uint
|
||||||
|| 0 != cmd && cmd != 6i32
|
|| 0 != cmd && cmd != 6i32
|
||||||
@@ -971,7 +979,7 @@ pub unsafe fn dc_msg_is_setupmessage(msg: *const dc_msg_t) -> bool {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if dc_param_get_int((*msg).param, 'S' as i32, 0) == 6 {
|
if dc_param_get_int((*msg).param, DC_PARAM_CMD as i32, 0) == 6 {
|
||||||
true
|
true
|
||||||
} else {
|
} else {
|
||||||
true
|
true
|
||||||
@@ -1045,23 +1053,23 @@ pub unsafe fn dc_msg_set_file(
|
|||||||
if msg.is_null() || (*msg).magic != 0x11561156i32 as libc::c_uint {
|
if msg.is_null() || (*msg).magic != 0x11561156i32 as libc::c_uint {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dc_param_set((*msg).param, 'f' as i32, file);
|
dc_param_set((*msg).param, DC_PARAM_FILE as i32, file);
|
||||||
dc_param_set((*msg).param, 'm' as i32, filemime);
|
dc_param_set((*msg).param, DC_PARAM_MIMETYPE as i32, filemime);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn dc_msg_set_dimension(msg: *mut dc_msg_t, width: libc::c_int, height: libc::c_int) {
|
pub unsafe fn dc_msg_set_dimension(msg: *mut dc_msg_t, width: libc::c_int, height: libc::c_int) {
|
||||||
if msg.is_null() || (*msg).magic != 0x11561156i32 as libc::c_uint {
|
if msg.is_null() || (*msg).magic != 0x11561156i32 as libc::c_uint {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dc_param_set_int((*msg).param, 'w' as i32, width);
|
dc_param_set_int((*msg).param, DC_PARAM_WIDTH as i32, width);
|
||||||
dc_param_set_int((*msg).param, 'h' as i32, height);
|
dc_param_set_int((*msg).param, DC_PARAM_HEIGHT as i32, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn dc_msg_set_duration(msg: *mut dc_msg_t, duration: libc::c_int) {
|
pub unsafe fn dc_msg_set_duration(msg: *mut dc_msg_t, duration: libc::c_int) {
|
||||||
if msg.is_null() || (*msg).magic != 0x11561156i32 as libc::c_uint {
|
if msg.is_null() || (*msg).magic != 0x11561156i32 as libc::c_uint {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dc_param_set_int((*msg).param, 'd' as i32, duration);
|
dc_param_set_int((*msg).param, DC_PARAM_DURATION as i32, duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn dc_msg_latefiling_mediasize(
|
pub unsafe fn dc_msg_latefiling_mediasize(
|
||||||
@@ -1072,11 +1080,11 @@ pub unsafe fn dc_msg_latefiling_mediasize(
|
|||||||
) {
|
) {
|
||||||
if !(msg.is_null() || (*msg).magic != 0x11561156i32 as libc::c_uint) {
|
if !(msg.is_null() || (*msg).magic != 0x11561156i32 as libc::c_uint) {
|
||||||
if width > 0i32 && height > 0i32 {
|
if width > 0i32 && height > 0i32 {
|
||||||
dc_param_set_int((*msg).param, 'w' as i32, width);
|
dc_param_set_int((*msg).param, DC_PARAM_WIDTH as i32, width);
|
||||||
dc_param_set_int((*msg).param, 'h' as i32, height);
|
dc_param_set_int((*msg).param, DC_PARAM_HEIGHT as i32, height);
|
||||||
}
|
}
|
||||||
if duration > 0i32 {
|
if duration > 0i32 {
|
||||||
dc_param_set_int((*msg).param, 'd' as i32, duration);
|
dc_param_set_int((*msg).param, DC_PARAM_DURATION as i32, duration);
|
||||||
}
|
}
|
||||||
dc_msg_save_param_to_disk(msg);
|
dc_msg_save_param_to_disk(msg);
|
||||||
};
|
};
|
||||||
@@ -1173,7 +1181,7 @@ pub unsafe fn dc_set_msg_failed(context: &Context, msg_id: uint32_t, error: *con
|
|||||||
(*msg).state = 24
|
(*msg).state = 24
|
||||||
}
|
}
|
||||||
if !error.is_null() {
|
if !error.is_null() {
|
||||||
dc_param_set((*msg).param, 'L' as i32, error);
|
dc_param_set((*msg).param, DC_PARAM_ERROR as i32, error);
|
||||||
error!(context, 0, "{}", as_str(error),);
|
error!(context, 0, "{}", as_str(error),);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,59 +3,61 @@ use crate::types::*;
|
|||||||
use crate::x::*;
|
use crate::x::*;
|
||||||
|
|
||||||
/// for msgs and jobs
|
/// for msgs and jobs
|
||||||
pub const DC_PARAM_FILE: char = 'f';
|
pub const DC_PARAM_FILE: char = 'f'; // string
|
||||||
/// for msgs
|
/// for msgs
|
||||||
pub const DC_PARAM_WIDTH: char = 'w';
|
pub const DC_PARAM_WIDTH: char = 'w'; // int
|
||||||
/// for msgs
|
/// for msgs
|
||||||
pub const DC_PARAM_HEIGHT: char = 'h';
|
pub const DC_PARAM_HEIGHT: char = 'h'; // int
|
||||||
/// for msgs
|
/// for msgs
|
||||||
pub const DC_PARAM_DURATION: char = 'd';
|
pub const DC_PARAM_DURATION: char = 'd'; // int
|
||||||
/// for msgs
|
/// for msgs
|
||||||
pub const DC_PARAM_MIMETYPE: char = 'm';
|
pub const DC_PARAM_MIMETYPE: char = 'm'; // string
|
||||||
/// for msgs: incoming: message is encryoted, outgoing: guarantee E2EE or the message is not send
|
/// for msgs: incoming: message is encryoted, outgoing: guarantee E2EE or the message is not send
|
||||||
pub const DC_PARAM_GUARANTEE_E2EE: char = 'c';
|
pub const DC_PARAM_GUARANTEE_E2EE: char = 'c'; // int (bool?)
|
||||||
/// for msgs: decrypted with validation errors or without mutual set, if neither 'c' nor 'e' are preset, the messages is only transport encrypted
|
/// for msgs: decrypted with validation errors or without mutual set, if neither 'c' nor 'e' are preset, the messages is only transport encrypted
|
||||||
pub const DC_PARAM_ERRONEOUS_E2EE: char = 'e';
|
pub const DC_PARAM_ERRONEOUS_E2EE: char = 'e'; // int
|
||||||
/// for msgs: force unencrypted message, either DC_FP_ADD_AUTOCRYPT_HEADER (1), DC_FP_NO_AUTOCRYPT_HEADER (2) or 0
|
/// for msgs: force unencrypted message, either DC_FP_ADD_AUTOCRYPT_HEADER (1), DC_FP_NO_AUTOCRYPT_HEADER (2) or 0
|
||||||
pub const DC_PARAM_FORCE_PLAINTEXT: char = 'u';
|
pub const DC_PARAM_FORCE_PLAINTEXT: char = 'u'; // int (bool?)
|
||||||
/// for msgs: an incoming message which requestes a MDN (aka read receipt)
|
/// for msgs: an incoming message which requestes a MDN (aka read receipt)
|
||||||
pub const DC_PARAM_WANTS_MDN: char = 'r';
|
pub const DC_PARAM_WANTS_MDN: char = 'r'; // int (bool?)
|
||||||
/// for msgs
|
/// for msgs
|
||||||
pub const DC_PARAM_FORWARDED: char = 'a';
|
pub const DC_PARAM_FORWARDED: char = 'a'; // int (bool?)
|
||||||
/// for msgs
|
/// for msgs
|
||||||
pub const DC_PARAM_CMD: char = 'S';
|
pub const DC_PARAM_CMD: char = 'S'; // int
|
||||||
/// for msgs
|
/// for msgs
|
||||||
pub const DC_PARAM_CMD_ARG: char = 'E';
|
pub const DC_PARAM_CMD_ARG: char = 'E'; // string
|
||||||
/// for msgs
|
/// for msgs
|
||||||
pub const DC_PARAM_CMD_ARG2: char = 'F';
|
pub const DC_PARAM_CMD_ARG2: char = 'F'; // string
|
||||||
/// for msgs
|
/// for msgs
|
||||||
pub const DC_PARAM_CMD_ARG3: char = 'G';
|
pub const DC_PARAM_CMD_ARG3: char = 'G'; // string
|
||||||
/// for msgs
|
/// for msgs
|
||||||
pub const DC_PARAM_CMD_ARG4: char = 'H';
|
pub const DC_PARAM_CMD_ARG4: char = 'H'; // string
|
||||||
/// for msgs
|
/// for msgs
|
||||||
pub const DC_PARAM_ERROR: char = 'L';
|
pub const DC_PARAM_ERROR: char = 'L'; // string
|
||||||
/// for msgs in PREPARING: space-separated list of message IDs of forwarded copies
|
/// for msgs in PREPARING: space-separated list of message IDs of forwarded copies
|
||||||
pub const DC_PARAM_PREP_FORWARDS: char = 'P';
|
pub const DC_PARAM_PREP_FORWARDS: char = 'P'; // string
|
||||||
/// for msgs
|
/// for msgs
|
||||||
pub const DC_PARAM_SET_LATITUDE: char = 'l';
|
pub const DC_PARAM_SET_LATITUDE: char = 'l'; // float
|
||||||
/// for msgs
|
/// for msgs
|
||||||
pub const DC_PARAM_SET_LONGITUDE: char = 'n';
|
pub const DC_PARAM_SET_LONGITUDE: char = 'n'; // float
|
||||||
|
|
||||||
/// for jobs
|
/// for jobs
|
||||||
pub const DC_PARAM_SERVER_FOLDER: char = 'Z';
|
pub const DC_PARAM_SERVER_FOLDER: char = 'Z'; // string
|
||||||
/// for jobs
|
/// for jobs
|
||||||
pub const DC_PARAM_SERVER_UID: char = 'z';
|
pub const DC_PARAM_SERVER_UID: char = 'z'; // int
|
||||||
/// for jobs
|
/// for jobs
|
||||||
pub const DC_PARAM_ALSO_MOVE: char = 'M';
|
pub const DC_PARAM_ALSO_MOVE: char = 'M'; // int (bool?)
|
||||||
/// for jobs: space-separated list of message recipients
|
/// for jobs: space-separated list of message recipients
|
||||||
pub const DC_PARAM_RECIPIENTS: char = 'R';
|
pub const DC_PARAM_RECIPIENTS: char = 'R'; // stringap
|
||||||
/// for groups
|
/// for groups
|
||||||
pub const DC_PARAM_UNPROMOTED: char = 'U';
|
pub const DC_PARAM_UNPROMOTED: char = 'U'; // int (bool?)
|
||||||
/// for groups and contacts
|
/// for groups and contacts
|
||||||
pub const DC_PARAM_PROFILE_IMAGE: char = 'i';
|
pub const DC_PARAM_PROFILE_IMAGE: char = 'i'; // string (bytes?)
|
||||||
/// for chats
|
/// for chats
|
||||||
pub const DC_PARAM_SELFTALK: char = 'K';
|
pub const DC_PARAM_SELFTALK: char = 'K';
|
||||||
|
|
||||||
|
// missing: 's', 'x', 'g'
|
||||||
|
|
||||||
// values for DC_PARAM_FORCE_PLAINTEXT
|
// values for DC_PARAM_FORCE_PLAINTEXT
|
||||||
pub const DC_FP_ADD_AUTOCRYPT_HEADER: u8 = 1;
|
pub const DC_FP_ADD_AUTOCRYPT_HEADER: u8 = 1;
|
||||||
pub const DC_FP_NO_AUTOCRYPT_HEADER: u8 = 2;
|
pub const DC_FP_NO_AUTOCRYPT_HEADER: u8 = 2;
|
||||||
|
|||||||
15
src/dc_qr.rs
15
src/dc_qr.rs
@@ -56,16 +56,23 @@ pub unsafe fn dc_check_qr(context: &Context, qr: *const libc::c_char) -> *mut dc
|
|||||||
fragment = fragment.offset(1isize);
|
fragment = fragment.offset(1isize);
|
||||||
let param: *mut dc_param_t = dc_param_new();
|
let param: *mut dc_param_t = dc_param_new();
|
||||||
dc_param_set_urlencoded(param, fragment);
|
dc_param_set_urlencoded(param, fragment);
|
||||||
addr = dc_param_get(param, 'a' as i32, 0 as *const libc::c_char);
|
addr = dc_param_get(param, DC_PARAM_FORWARDED as i32, 0 as *const libc::c_char);
|
||||||
if !addr.is_null() {
|
if !addr.is_null() {
|
||||||
let mut urlencoded: *mut libc::c_char =
|
let mut urlencoded: *mut libc::c_char = dc_param_get(
|
||||||
dc_param_get(param, 'n' as i32, 0 as *const libc::c_char);
|
param,
|
||||||
|
DC_PARAM_SET_LONGITUDE as i32,
|
||||||
|
0 as *const libc::c_char,
|
||||||
|
);
|
||||||
if !urlencoded.is_null() {
|
if !urlencoded.is_null() {
|
||||||
name = dc_urldecode(urlencoded);
|
name = dc_urldecode(urlencoded);
|
||||||
dc_normalize_name(name);
|
dc_normalize_name(name);
|
||||||
free(urlencoded as *mut libc::c_void);
|
free(urlencoded as *mut libc::c_void);
|
||||||
}
|
}
|
||||||
invitenumber = dc_param_get(param, 'i' as i32, 0 as *const libc::c_char);
|
invitenumber = dc_param_get(
|
||||||
|
param,
|
||||||
|
DC_PARAM_PROFILE_IMAGE as i32,
|
||||||
|
0 as *const libc::c_char,
|
||||||
|
);
|
||||||
auth = dc_param_get(param, 's' as i32, 0 as *const libc::c_char);
|
auth = dc_param_get(param, 's' as i32, 0 as *const libc::c_char);
|
||||||
grpid = dc_param_get(param, 'x' as i32, 0 as *const libc::c_char);
|
grpid = dc_param_get(param, 'x' as i32, 0 as *const libc::c_char);
|
||||||
if !grpid.is_null() {
|
if !grpid.is_null() {
|
||||||
|
|||||||
@@ -741,17 +741,21 @@ pub unsafe fn dc_receive_imf(
|
|||||||
let param = dc_param_new();
|
let param = dc_param_new();
|
||||||
dc_param_set(
|
dc_param_set(
|
||||||
param,
|
param,
|
||||||
'Z' as i32,
|
DC_PARAM_SERVER_FOLDER as i32,
|
||||||
to_cstring(server_folder.as_ref()).as_ptr(),
|
to_cstring(server_folder.as_ref()).as_ptr(),
|
||||||
);
|
);
|
||||||
dc_param_set_int(param, 'z' as i32, server_uid as i32);
|
dc_param_set_int(
|
||||||
|
param,
|
||||||
|
DC_PARAM_SERVER_UID as i32,
|
||||||
|
server_uid as i32,
|
||||||
|
);
|
||||||
if 0 != mime_parser.is_send_by_messenger
|
if 0 != mime_parser.is_send_by_messenger
|
||||||
&& 0 != context
|
&& 0 != context
|
||||||
.sql
|
.sql
|
||||||
.get_config_int(context, "mvbox_move")
|
.get_config_int(context, "mvbox_move")
|
||||||
.unwrap_or_else(|| 1)
|
.unwrap_or_else(|| 1)
|
||||||
{
|
{
|
||||||
dc_param_set_int(param, 'M' as i32, 1);
|
dc_param_set_int(param, DC_PARAM_ALSO_MOVE as i32, 1);
|
||||||
}
|
}
|
||||||
dc_job_add(context, 120, 0, (*param).packed, 0);
|
dc_job_add(context, 120, 0, (*param).packed, 0);
|
||||||
dc_param_unref(param);
|
dc_param_unref(param);
|
||||||
@@ -1210,7 +1214,7 @@ unsafe fn create_or_lookup_group(
|
|||||||
if (*part).type_0 == 20 {
|
if (*part).type_0 == 20 {
|
||||||
grpimage = dc_param_get(
|
grpimage = dc_param_get(
|
||||||
(*part).param,
|
(*part).param,
|
||||||
'f' as i32,
|
DC_PARAM_FILE as i32,
|
||||||
0 as *const libc::c_char,
|
0 as *const libc::c_char,
|
||||||
);
|
);
|
||||||
ok = 1
|
ok = 1
|
||||||
@@ -1231,7 +1235,11 @@ unsafe fn create_or_lookup_group(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
dc_chat_load_from_db(chat, chat_id);
|
dc_chat_load_from_db(chat, chat_id);
|
||||||
dc_param_set((*chat).param, 'i' as i32, grpimage);
|
dc_param_set(
|
||||||
|
(*chat).param,
|
||||||
|
DC_PARAM_PROFILE_IMAGE as i32,
|
||||||
|
grpimage,
|
||||||
|
);
|
||||||
dc_chat_update_param(chat);
|
dc_chat_update_param(chat);
|
||||||
dc_chat_unref(chat);
|
dc_chat_unref(chat);
|
||||||
free(grpimage as *mut libc::c_void);
|
free(grpimage as *mut libc::c_void);
|
||||||
|
|||||||
@@ -267,23 +267,23 @@ unsafe fn send_handshake_msg(
|
|||||||
step,
|
step,
|
||||||
);
|
);
|
||||||
(*msg).hidden = 1i32;
|
(*msg).hidden = 1i32;
|
||||||
dc_param_set_int((*msg).param, 'S' as i32, 7i32);
|
dc_param_set_int((*msg).param, DC_PARAM_CMD as i32, 7);
|
||||||
dc_param_set((*msg).param, 'E' as i32, step);
|
dc_param_set((*msg).param, DC_PARAM_CMD_ARG as i32, step);
|
||||||
if !param2.is_null() {
|
if !param2.is_null() {
|
||||||
dc_param_set((*msg).param, 'F' as i32, param2);
|
dc_param_set((*msg).param, DC_PARAM_CMD_ARG2 as i32, param2);
|
||||||
}
|
}
|
||||||
if !fingerprint.is_null() {
|
if !fingerprint.is_null() {
|
||||||
dc_param_set((*msg).param, 'G' as i32, fingerprint);
|
dc_param_set((*msg).param, DC_PARAM_CMD_ARG3 as i32, fingerprint);
|
||||||
}
|
}
|
||||||
if !grpid.is_null() {
|
if !grpid.is_null() {
|
||||||
dc_param_set((*msg).param, 'H' as i32, grpid);
|
dc_param_set((*msg).param, DC_PARAM_CMD_ARG4 as i32, grpid);
|
||||||
}
|
}
|
||||||
if strcmp(step, b"vg-request\x00" as *const u8 as *const libc::c_char) == 0i32
|
if strcmp(step, b"vg-request\x00" as *const u8 as *const libc::c_char) == 0i32
|
||||||
|| strcmp(step, b"vc-request\x00" as *const u8 as *const libc::c_char) == 0i32
|
|| strcmp(step, b"vc-request\x00" as *const u8 as *const libc::c_char) == 0i32
|
||||||
{
|
{
|
||||||
dc_param_set_int((*msg).param, 'u' as i32, 1i32);
|
dc_param_set_int((*msg).param, DC_PARAM_FORCE_PLAINTEXT as i32, 1);
|
||||||
} else {
|
} else {
|
||||||
dc_param_set_int((*msg).param, 'c' as i32, 1i32);
|
dc_param_set_int((*msg).param, DC_PARAM_GUARANTEE_E2EE as i32, 1);
|
||||||
}
|
}
|
||||||
dc_send_msg(context, contact_chat_id, msg);
|
dc_send_msg(context, contact_chat_id, msg);
|
||||||
dc_msg_unref(msg);
|
dc_msg_unref(msg);
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ impl Sql {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Execute a query which is expected to return one row.
|
||||||
pub fn query_row<T, P, F>(&self, sql: impl AsRef<str>, params: P, f: F) -> Result<T>
|
pub fn query_row<T, P, F>(&self, sql: impl AsRef<str>, params: P, f: F) -> Result<T>
|
||||||
where
|
where
|
||||||
P: IntoIterator,
|
P: IntoIterator,
|
||||||
|
|||||||
Reference in New Issue
Block a user