mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 04:46:29 +03:00
remove unneccessary check of is_special() + cleanups
This commit is contained in:
@@ -1386,8 +1386,7 @@ pub unsafe extern "C" fn dc_get_msg(context: *mut dc_context_t, msg_id: u32) ->
|
|||||||
// C-core API returns empty messages, do the same
|
// C-core API returns empty messages, do the same
|
||||||
warn!(
|
warn!(
|
||||||
ctx,
|
ctx,
|
||||||
"dc_get_msg called with special msg_id={}, returning empty msg",
|
"dc_get_msg called with special msg_id={}, returning empty msg", msg_id
|
||||||
msg_id
|
|
||||||
);
|
);
|
||||||
message::Message::default()
|
message::Message::default()
|
||||||
} else {
|
} else {
|
||||||
@@ -3035,4 +3034,3 @@ fn convert_and_prune_message_ids(msg_ids: *const u32, msg_cnt: libc::c_int) -> V
|
|||||||
|
|
||||||
msg_ids
|
msg_ids
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -294,8 +294,7 @@ impl Chatlist {
|
|||||||
let lastmsg_id = self.ids[index].1;
|
let lastmsg_id = self.ids[index].1;
|
||||||
let mut lastcontact = None;
|
let mut lastcontact = None;
|
||||||
|
|
||||||
let lastmsg = if !lastmsg_id.is_special() {
|
let lastmsg = if let Ok(lastmsg) = Message::load_from_db(context, lastmsg_id) {
|
||||||
if let Ok(lastmsg) = Message::load_from_db(context, lastmsg_id) {
|
|
||||||
if lastmsg.from_id != 1
|
if lastmsg.from_id != 1
|
||||||
&& (chat.typ == Chattype::Group || chat.typ == Chattype::VerifiedGroup)
|
&& (chat.typ == Chattype::Group || chat.typ == Chattype::VerifiedGroup)
|
||||||
{
|
{
|
||||||
@@ -305,9 +304,6 @@ impl Chatlist {
|
|||||||
Some(lastmsg)
|
Some(lastmsg)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if chat.id == DC_CHAT_ID_ARCHIVED_LINK {
|
if chat.id == DC_CHAT_ID_ARCHIVED_LINK {
|
||||||
|
|||||||
@@ -231,11 +231,7 @@ pub fn create_setup_code(_context: &Context) -> String {
|
|||||||
pub fn continue_key_transfer(context: &Context, msg_id: MsgId, setup_code: &str) -> Result<()> {
|
pub fn continue_key_transfer(context: &Context, msg_id: MsgId, setup_code: &str) -> Result<()> {
|
||||||
ensure!(!msg_id.is_special(), "wrong id");
|
ensure!(!msg_id.is_special(), "wrong id");
|
||||||
|
|
||||||
let msg = Message::load_from_db(context, msg_id);
|
let msg = Message::load_from_db(context, msg_id)?;
|
||||||
if msg.is_err() {
|
|
||||||
bail!("Message is no Autocrypt Setup Message.");
|
|
||||||
}
|
|
||||||
let msg = msg.unwrap_or_default();
|
|
||||||
ensure!(
|
ensure!(
|
||||||
msg.is_setupmessage(),
|
msg.is_setupmessage(),
|
||||||
"Message is no Autocrypt Setup Message."
|
"Message is no Autocrypt Setup Message."
|
||||||
|
|||||||
Reference in New Issue
Block a user