diff --git a/deltachat-ffi/src/lib.rs b/deltachat-ffi/src/lib.rs index 5839050ee..3b2446982 100644 --- a/deltachat-ffi/src/lib.rs +++ b/deltachat-ffi/src/lib.rs @@ -25,9 +25,7 @@ use std::time::{Duration, SystemTime}; use libc::uintptr_t; use num_traits::{FromPrimitive, ToPrimitive}; -use deltachat::chat::ArchiveState; -use deltachat::chat::ChatId; -use deltachat::chat::MuteDuration; +use deltachat::chat::{ArchiveState, ChatId, MuteDuration}; use deltachat::constants::DC_MSG_ID_LAST_SPECIAL; use deltachat::contact::Contact; use deltachat::context::Context; diff --git a/examples/repl/cmdline.rs b/examples/repl/cmdline.rs index 11aaa3fe0..f231bf9fe 100644 --- a/examples/repl/cmdline.rs +++ b/examples/repl/cmdline.rs @@ -521,7 +521,7 @@ pub fn dc_cmdline(context: &Context, line: &str) -> Result<(), failure::Error> { match chat.get_id().get_archive_state(context) { ArchiveState::Normal => "", ArchiveState::Archived => "📦", - ArchiveState::Pinned => "📌" + ArchiveState::Pinned => "📌", }, ); let lot = chatlist.get_summary(context, i, Some(&chat)); @@ -859,9 +859,7 @@ pub fn dc_cmdline(context: &Context, line: &str) -> Result<(), failure::Error> { "archive" => ArchiveState::Archived, "unarchive" | "unpin" => ArchiveState::Normal, "pin" => ArchiveState::Pinned, - _ => { - panic!("Unexpected command (This should never happen)") - } + _ => panic!("Unexpected command (This should never happen)"), }, )?; } diff --git a/src/chat.rs b/src/chat.rs index e8e1611f3..75c087bba 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -148,17 +148,17 @@ impl ChatId { self ); - let mut send_event = false; - - if new_archive_state == ArchiveState::Archived { + let send_event = if new_archive_state == ArchiveState::Archived { sql::execute( context, &context.sql, "UPDATE msgs SET state=? WHERE chat_id=? AND state=?;", params![MessageState::InNoticed, self, MessageState::InFresh], )?; - send_event = true; - } + true + } else { + false + }; sql::execute( context, diff --git a/src/chatlist.rs b/src/chatlist.rs index 6cb0d1165..0cabb6b5f 100644 --- a/src/chatlist.rs +++ b/src/chatlist.rs @@ -202,9 +202,9 @@ impl Chatlist { AND (hidden=0 OR state=?)) WHERE c.id>9 AND c.blocked=0 - AND c.archived=0 + AND NOT c.archived=1 GROUP BY c.id - ORDER BY IFNULL(m.timestamp,c.created_timestamp) DESC, m.id DESC;", + ORDER BY c.archived=2 DESC, IFNULL(m.timestamp,c.created_timestamp) DESC, m.id DESC;", params![MessageState::OutDraft], process_row, process_rows,