mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 01:16:31 +03:00
Remove last C string from prepare_msg_raw()
This commit is contained in:
23
src/chat.rs
23
src/chat.rs
@@ -247,7 +247,6 @@ impl<'a> Chat<'a> {
|
|||||||
let mut do_guarantee_e2ee: libc::c_int;
|
let mut do_guarantee_e2ee: libc::c_int;
|
||||||
let e2ee_enabled: libc::c_int;
|
let e2ee_enabled: libc::c_int;
|
||||||
let mut OK_TO_CONTINUE = true;
|
let mut OK_TO_CONTINUE = true;
|
||||||
let mut new_rfc724_mid = ptr::null_mut();
|
|
||||||
let mut new_references = "".into();
|
let mut new_references = "".into();
|
||||||
let mut new_in_reply_to = "".into();
|
let mut new_in_reply_to = "".into();
|
||||||
let mut msg_id = 0;
|
let mut msg_id = 0;
|
||||||
@@ -270,15 +269,13 @@ impl<'a> Chat<'a> {
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
if let Some(from) = context.sql.get_config(context, "configured_addr") {
|
if let Some(from) = context.sql.get_config(context, "configured_addr") {
|
||||||
let from_c = CString::yolo(from);
|
let new_rfc724_mid = {
|
||||||
new_rfc724_mid = dc_create_outgoing_rfc724_mid(
|
let grpid = match self.typ {
|
||||||
if self.typ == Chattype::Group || self.typ == Chattype::VerifiedGroup {
|
Chattype::Group | Chattype::VerifiedGroup => Some(self.grpid.as_str()),
|
||||||
self.grpid.strdup()
|
_ => None,
|
||||||
} else {
|
};
|
||||||
ptr::null_mut()
|
dc_create_outgoing_rfc724_mid_safe(grpid, &from)
|
||||||
},
|
};
|
||||||
from_c.as_ptr(),
|
|
||||||
);
|
|
||||||
|
|
||||||
if self.typ == Chattype::Single {
|
if self.typ == Chattype::Single {
|
||||||
if let Some(id) = context.sql.query_row_col(
|
if let Some(id) = context.sql.query_row_col(
|
||||||
@@ -438,7 +435,7 @@ impl<'a> Chat<'a> {
|
|||||||
&context.sql,
|
&context.sql,
|
||||||
"INSERT INTO msgs (rfc724_mid, chat_id, from_id, to_id, timestamp, type, state, txt, param, hidden, mime_in_reply_to, mime_references, location_id) VALUES (?,?,?,?,?, ?,?,?,?,?, ?,?,?);",
|
"INSERT INTO msgs (rfc724_mid, chat_id, from_id, to_id, timestamp, type, state, txt, param, hidden, mime_in_reply_to, mime_references, location_id) VALUES (?,?,?,?,?, ?,?,?,?,?, ?,?,?);",
|
||||||
params![
|
params![
|
||||||
as_str(new_rfc724_mid),
|
new_rfc724_mid,
|
||||||
self.id as i32,
|
self.id as i32,
|
||||||
1i32,
|
1i32,
|
||||||
to_id as i32,
|
to_id as i32,
|
||||||
@@ -458,7 +455,7 @@ impl<'a> Chat<'a> {
|
|||||||
&context.sql,
|
&context.sql,
|
||||||
"msgs",
|
"msgs",
|
||||||
"rfc724_mid",
|
"rfc724_mid",
|
||||||
as_str(new_rfc724_mid),
|
new_rfc724_mid,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
error!(
|
error!(
|
||||||
@@ -474,8 +471,6 @@ impl<'a> Chat<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free(new_rfc724_mid as *mut libc::c_void);
|
|
||||||
|
|
||||||
Ok(msg_id)
|
Ok(msg_id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user