diff --git a/deltachat-ffi/deltachat.h b/deltachat-ffi/deltachat.h index c7d949679..b4b363eb7 100644 --- a/deltachat-ffi/deltachat.h +++ b/deltachat-ffi/deltachat.h @@ -1525,20 +1525,6 @@ void dc_marknoticed_contact (dc_context_t* context, uint32_t co void dc_markseen_msgs (dc_context_t* context, const uint32_t* msg_ids, int msg_cnt); -/** - * Star/unstar messages by setting the last parameter to 0 (unstar) or 1 (star). - * Starred messages are collected in a virtual chat that can be shown using - * dc_get_chat_msgs() using the chat_id DC_CHAT_ID_STARRED. - * - * @memberof dc_context_t - * @param context The context object. - * @param msg_ids An array of uint32_t message IDs defining the messages to star or unstar - * @param msg_cnt The number of IDs in msg_ids - * @param star 0=unstar the messages in msg_ids, 1=star them - */ -void dc_star_msgs (dc_context_t* context, const uint32_t* msg_ids, int msg_cnt, int star); - - /** * Get a single message object of the type dc_msg_t. * For a list of messages in a chat, see dc_get_chat_msgs() @@ -2775,8 +2761,6 @@ char* dc_chat_get_info_json (dc_context_t* context, size_t chat #define DC_CHAT_ID_DEADDROP 1 // virtual chat showing all messages belonging to chats flagged with chats.blocked=2 #define DC_CHAT_ID_TRASH 3 // messages that should be deleted get this chat_id; the messages are deleted from the working thread later then. This is also needed as rfc724_mid should be preset as long as the message is not deleted on the server (otherwise it is downloaded again) -#define DC_CHAT_ID_MSGS_IN_CREATION 4 // a message is just in creation but not yet assigned to a chat (eg. we may need the message ID to set up blobs; this avoids unready message to be sent and shown) -#define DC_CHAT_ID_STARRED 5 // virtual chat showing all messages flagged with msgs.starred=2 #define DC_CHAT_ID_ARCHIVED_LINK 6 // only an indicator in a chatlist #define DC_CHAT_ID_ALLDONE_HINT 7 // only an indicator in a chatlist #define DC_CHAT_ID_LAST_SPECIAL 9 // larger chat IDs are "real" chats, their messages are "real" messages. @@ -2803,7 +2787,6 @@ void dc_chat_unref (dc_chat_t* chat); * * Special IDs: * - DC_CHAT_ID_DEADDROP (1) - Virtual chat containing messages which senders are not confirmed by the user. - * - DC_CHAT_ID_STARRED (5) - Virtual chat containing all starred messages- * - DC_CHAT_ID_ARCHIVED_LINK (6) - A link at the end of the chatlist, if present the UI should show the button "Archived chats"- * * "Normal" chat IDs are larger than these special IDs (larger than DC_CHAT_ID_LAST_SPECIAL). @@ -3439,21 +3422,6 @@ int dc_msg_has_location (const dc_msg_t* msg); int dc_msg_is_sent (const dc_msg_t* msg); -/** - * Check if a message is starred. Starred messages are "favorites" marked by the user - * with a "star" or something like that. Starred messages can typically be shown - * easily and are not deleted automatically. - * - * To star one or more messages, use dc_star_msgs(), to get a list of starred messages, - * use dc_get_chat_msgs() using DC_CHAT_ID_STARRED as the chat_id. - * - * @memberof dc_msg_t - * @param msg The message object. - * @return 1=message is starred, 0=message not starred. - */ -int dc_msg_is_starred (const dc_msg_t* msg); - - /** * Check if the message is a forwarded message. * @@ -4880,7 +4848,6 @@ void dc_event_unref(dc_event_t* event); #define DC_STR_CONTACT_NOT_VERIFIED 36 #define DC_STR_CONTACT_SETUP_CHANGED 37 #define DC_STR_ARCHIVEDCHATS 40 -#define DC_STR_STARREDMSGS 41 #define DC_STR_AC_SETUP_MSG_SUBJECT 42 #define DC_STR_AC_SETUP_MSG_BODY 43 #define DC_STR_CANNOT_LOGIN 60 diff --git a/deltachat-ffi/src/lib.rs b/deltachat-ffi/src/lib.rs index 6686c2f83..8a785be31 100644 --- a/deltachat-ffi/src/lib.rs +++ b/deltachat-ffi/src/lib.rs @@ -1464,23 +1464,6 @@ pub unsafe extern "C" fn dc_markseen_msgs( block_on(message::markseen_msgs(&ctx, msg_ids)); } -#[no_mangle] -pub unsafe extern "C" fn dc_star_msgs( - context: *mut dc_context_t, - msg_ids: *const u32, - msg_cnt: libc::c_int, - star: libc::c_int, -) { - if context.is_null() || msg_ids.is_null() || msg_cnt <= 0 { - eprintln!("ignoring careless call to dc_star_msgs()"); - return; - } - let msg_ids = convert_and_prune_message_ids(msg_ids, msg_cnt); - let ctx = &*context; - - block_on(message::star_msgs(&ctx, msg_ids, star == 1)); -} - #[no_mangle] pub unsafe extern "C" fn dc_get_msg(context: *mut dc_context_t, msg_id: u32) -> *mut dc_msg_t { if context.is_null() { @@ -2814,16 +2797,6 @@ pub unsafe extern "C" fn dc_msg_is_sent(msg: *mut dc_msg_t) -> libc::c_int { ffi_msg.message.is_sent().into() } -#[no_mangle] -pub unsafe extern "C" fn dc_msg_is_starred(msg: *mut dc_msg_t) -> libc::c_int { - if msg.is_null() { - eprintln!("ignoring careless call to dc_msg_is_starred()"); - return 0; - } - let ffi_msg = &*msg; - ffi_msg.message.is_starred().into() -} - #[no_mangle] pub unsafe extern "C" fn dc_msg_is_forwarded(msg: *mut dc_msg_t) -> libc::c_int { if msg.is_null() { diff --git a/examples/repl/cmdline.rs b/examples/repl/cmdline.rs index 3c4457a94..b4f172e22 100644 --- a/examples/repl/cmdline.rs +++ b/examples/repl/cmdline.rs @@ -185,7 +185,7 @@ async fn log_msg(context: &Context, prefix: impl AsRef, msg: &Message) { let temp2 = dc_timestamp_to_str(msg.get_timestamp()); let msgtext = msg.get_text(); println!( - "{}{}{}{}: {} (Contact#{}): {} {}{}{}{}{}{} [{}]", + "{}{}{}{}: {} (Contact#{}): {} {}{}{}{}{} [{}]", prefix.as_ref(), msg.get_id(), if msg.get_showpadlock() { "🔒" } else { "" }, @@ -193,7 +193,6 @@ async fn log_msg(context: &Context, prefix: impl AsRef, msg: &Message) { &contact_name, contact_id, msgtext.unwrap_or_default(), - if msg.is_starred() { "★" } else { "" }, if msg.get_from_id() == 1 as libc::c_uint { "" } else if msg.get_state() == MessageState::InSeen { @@ -387,8 +386,6 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu listfresh\n\ forward \n\ markseen \n\ - star \n\ - unstar \n\ delmsg \n\ ===========================Contact commands==\n\ listcontacts []\n\ @@ -948,12 +945,6 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu msg_ids[0] = MsgId::new(arg1.parse()?); message::markseen_msgs(&context, msg_ids).await; } - "star" | "unstar" => { - ensure!(!arg1.is_empty(), "Argument missing."); - let mut msg_ids = vec![MsgId::new(0); 1]; - msg_ids[0] = MsgId::new(arg1.parse()?); - message::star_msgs(&context, msg_ids, arg0 == "star").await; - } "delmsg" => { ensure!(!arg1.is_empty(), "Argument missing."); let mut ids = [MsgId::new(0); 1]; diff --git a/src/chat.rs b/src/chat.rs index 3b22fea55..9fcafe206 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -92,13 +92,6 @@ impl ChatId { self.0 == DC_CHAT_ID_TRASH } - // DC_CHAT_ID_MSGS_IN_CREATION seems unused? - - /// Virtual chat showing all starred messages. - pub fn is_starred(self) -> bool { - self.0 == DC_CHAT_ID_STARRED - } - /// Chat ID signifying there are **any** number of archived chats. /// /// This chat ID can be returned in a [Chatlist] and signals to @@ -508,8 +501,6 @@ impl std::fmt::Display for ChatId { write!(f, "Chat#Deadrop") } else if self.is_trash() { write!(f, "Chat#Trash") - } else if self.is_starred() { - write!(f, "Chat#Starred") } else if self.is_archived_link() { write!(f, "Chat#ArchivedLink") } else if self.is_alldone_hint() { @@ -610,8 +601,6 @@ impl Chat { let tempname = context.stock_str(StockMessage::ArchivedChats).await; let cnt = dc_get_archived_cnt(context).await; chat.name = format!("{} ({})", tempname, cnt); - } else if chat.id.is_starred() { - chat.name = context.stock_str(StockMessage::StarredMsgs).await.into(); } else { if chat.typ == Chattype::Single { let contacts = get_chat_contacts(context, chat.id).await; @@ -1731,23 +1720,6 @@ pub async fn get_chat_msgs( process_rows, ) .await - } else if chat_id.is_starred() { - context - .sql - .query_map( - "SELECT m.id AS id, m.timestamp AS timestamp - FROM msgs m - LEFT JOIN contacts ct - ON m.from_id=ct.id - WHERE m.starred=1 - AND m.hidden=0 - AND ct.blocked=0 - ORDER BY m.timestamp,m.id;", - paramsv![], - process_row, - process_rows, - ) - .await } else { context .sql diff --git a/src/constants.rs b/src/constants.rs index 58ec42715..3c0eb2a33 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -118,10 +118,6 @@ pub const DC_OUTDATED_WARNING_DAYS: i64 = 365; pub const DC_CHAT_ID_DEADDROP: u32 = 1; /// messages that should be deleted get this chat_id; the messages are deleted from the working thread later then. This is also needed as rfc724_mid should be preset as long as the message is not deleted on the server (otherwise it is downloaded again) pub const DC_CHAT_ID_TRASH: u32 = 3; -/// a message is just in creation but not yet assigned to a chat (eg. we may need the message ID to set up blobs; this avoids unready message to be sent and shown) -pub const DC_CHAT_ID_MSGS_IN_CREATION: u32 = 4; -/// virtual chat showing all messages flagged with msgs.starred=2 -pub const DC_CHAT_ID_STARRED: u32 = 5; /// only an indicator in a chatlist pub const DC_CHAT_ID_ARCHIVED_LINK: u32 = 6; /// only an indicator in a chatlist diff --git a/src/message.rs b/src/message.rs index 2f09781b9..ece67c5d9 100644 --- a/src/message.rs +++ b/src/message.rs @@ -263,7 +263,6 @@ pub struct Message { pub(crate) server_folder: Option, pub(crate) server_uid: u32, pub(crate) is_dc_message: MessengerMessage, - pub(crate) starred: bool, pub(crate) chat_blocked: Blocked, pub(crate) location_id: u32, pub(crate) error: String, @@ -307,7 +306,6 @@ impl Message { " m.msgrmsg AS msgrmsg,", " m.txt AS txt,", " m.param AS param,", - " m.starred AS starred,", " m.hidden AS hidden,", " m.location_id AS location,", " c.blocked AS blocked", @@ -357,7 +355,6 @@ impl Message { msg.text = Some(text); msg.param = row.get::<_, String>("param")?.parse().unwrap_or_default(); - msg.starred = row.get("starred")?; msg.hidden = row.get("hidden")?; msg.location_id = row.get("location")?; msg.chat_blocked = row @@ -582,10 +579,6 @@ impl Message { self.state as i32 >= MessageState::OutDelivered as i32 } - pub fn is_starred(&self) -> bool { - self.starred - } - pub fn is_forwarded(&self) -> bool { 0 != self.param.get_int(Param::Forwarded).unwrap_or_default() } @@ -1303,23 +1296,6 @@ pub async fn update_msg_state(context: &Context, msg_id: MsgId, state: MessageSt .is_ok() } -pub async fn star_msgs(context: &Context, msg_ids: Vec, star: bool) -> bool { - if msg_ids.is_empty() { - return false; - } - context - .sql - .with_conn(move |conn| { - let mut stmt = conn.prepare("UPDATE msgs SET starred=? WHERE id=?;")?; - for msg_id in msg_ids.into_iter() { - stmt.execute(paramsv![star as i32, msg_id])?; - } - Ok(()) - }) - .await - .is_ok() -} - /// Returns a summary text. pub async fn get_summarytext_by_raw( viewtype: Viewtype, diff --git a/src/stock.rs b/src/stock.rs index 4499cae49..5fee21f42 100644 --- a/src/stock.rs +++ b/src/stock.rs @@ -119,9 +119,6 @@ pub enum StockMessage { #[strum(props(fallback = "Archived chats"))] ArchivedChats = 40, - #[strum(props(fallback = "Starred messages"))] - StarredMsgs = 41, - #[strum(props(fallback = "Autocrypt Setup Message"))] AcSetupMsgSubject = 42,