diff --git a/CHANGELOG.md b/CHANGELOG.md index cecfd6723..0468cd6fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## UNRELEASED + +- removed api: dc_chat_get_subtitle(), dc_get_version_str() + + ## 1.28.0 - new flag DC_GCL_FOR_FORWARDING for dc_get_chatlist() diff --git a/deltachat-ffi/deltachat.h b/deltachat-ffi/deltachat.h index 39963644b..afe2bc213 100644 --- a/deltachat-ffi/deltachat.h +++ b/deltachat-ffi/deltachat.h @@ -2827,19 +2827,6 @@ int dc_chat_get_type (const dc_chat_t* chat); char* dc_chat_get_name (const dc_chat_t* chat); -/* - * Get a subtitle for a chat. The subtitle is eg. the email-address or the - * number of group members. - * - * Deprecated function. Subtitles should be created in the ui - * where plural forms and other specials can be handled more gracefully. - * - * @param chat The chat object to calulate the subtitle for. - * @return Subtitle as a string. Must be released using dc_str_unref() after usage. Never NULL. - */ -char* dc_chat_get_subtitle (const dc_chat_t* chat); - - /** * Get the chat's profile image. * For groups, this is the image set by any group member @@ -4667,8 +4654,6 @@ void dc_array_add_id (dc_array_t*, uint32_t); // depreca #define DC_STR_NOMESSAGES 1 #define DC_STR_SELF 2 #define DC_STR_DRAFT 3 -#define DC_STR_MEMBER 4 -#define DC_STR_CONTACT 6 #define DC_STR_VOICEMESSAGE 7 #define DC_STR_DEADDROP 8 #define DC_STR_IMAGE 9 @@ -4700,7 +4685,6 @@ void dc_array_add_id (dc_array_t*, uint32_t); // depreca #define DC_STR_STARREDMSGS 41 #define DC_STR_AC_SETUP_MSG_SUBJECT 42 #define DC_STR_AC_SETUP_MSG_BODY 43 -#define DC_STR_SELFTALK_SUBTITLE 50 #define DC_STR_CANNOT_LOGIN 60 #define DC_STR_SERVER_RESPONSE 61 #define DC_STR_MSGACTIONBYUSER 62 diff --git a/deltachat-ffi/src/lib.rs b/deltachat-ffi/src/lib.rs index 86fe8a651..8dd8e11f0 100644 --- a/deltachat-ffi/src/lib.rs +++ b/deltachat-ffi/src/lib.rs @@ -2436,19 +2436,6 @@ pub unsafe extern "C" fn dc_chat_get_name(chat: *mut dc_chat_t) -> *mut libc::c_ ffi_chat.chat.get_name().strdup() } -#[no_mangle] -pub unsafe extern "C" fn dc_chat_get_subtitle(chat: *mut dc_chat_t) -> *mut libc::c_char { - if chat.is_null() { - eprintln!("ignoring careless call to dc_chat_get_subtitle()"); - return "".strdup(); - } - let ffi_chat = &*chat; - let ffi_context: &ContextWrapper = &*ffi_chat.context; - ffi_context - .with_inner(|ctx| ffi_chat.chat.get_subtitle(ctx).strdup()) - .unwrap_or_else(|_| "".strdup()) -} - #[no_mangle] pub unsafe extern "C" fn dc_chat_get_profile_image(chat: *mut dc_chat_t) -> *mut libc::c_char { if chat.is_null() { diff --git a/python/src/deltachat/chat.py b/python/src/deltachat/chat.py index ea84c378c..0c07dae11 100644 --- a/python/src/deltachat/chat.py +++ b/python/src/deltachat/chat.py @@ -415,12 +415,6 @@ class Chat(object): """ return lib.dc_chat_get_color(self._dc_chat) - def get_subtitle(self): - """return the subtitle of the chat - :returns: the subtitle - """ - return from_dc_charpointer(lib.dc_chat_get_subtitle(self._dc_chat)) - # ------ location streaming API ------------------------------ def is_sending_locations(self): diff --git a/python/src/deltachat/const.py b/python/src/deltachat/const.py index 249be9804..13b638bb8 100644 --- a/python/src/deltachat/const.py +++ b/python/src/deltachat/const.py @@ -117,8 +117,6 @@ DC_CHAT_VISIBILITY_PINNED = 2 DC_STR_NOMESSAGES = 1 DC_STR_SELF = 2 DC_STR_DRAFT = 3 -DC_STR_MEMBER = 4 -DC_STR_CONTACT = 6 DC_STR_VOICEMESSAGE = 7 DC_STR_DEADDROP = 8 DC_STR_IMAGE = 9 @@ -150,7 +148,6 @@ DC_STR_ARCHIVEDCHATS = 40 DC_STR_STARREDMSGS = 41 DC_STR_AC_SETUP_MSG_SUBJECT = 42 DC_STR_AC_SETUP_MSG_BODY = 43 -DC_STR_SELFTALK_SUBTITLE = 50 DC_STR_CANNOT_LOGIN = 60 DC_STR_SERVER_RESPONSE = 61 DC_STR_MSGACTIONBYUSER = 62 diff --git a/python/tests/test_account.py b/python/tests/test_account.py index c8eeddc6d..4cbbab238 100644 --- a/python/tests/test_account.py +++ b/python/tests/test_account.py @@ -221,7 +221,6 @@ class TestOfflineChat: # assert d["param"] == chat.param assert d["color"] == chat.get_color() assert d["profile_image"] == "" if chat.get_profile_image() is None else chat.get_profile_image() - assert d["subtitle"] == chat.get_subtitle() assert d["draft"] == "" if chat.get_draft() is None else chat.get_draft() def test_group_chat_creation_with_translation(self, ac1): diff --git a/src/chat.rs b/src/chat.rs index fd90d2c7d..8685e3743 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -604,38 +604,6 @@ impl Chat { &self.name } - pub fn get_subtitle(&self, context: &Context) -> String { - // returns either the address or the number of chat members - - if self.typ == Chattype::Single && self.param.exists(Param::Selftalk) { - return context.stock_str(StockMessage::SelfTalkSubTitle).into(); - } - - if self.typ == Chattype::Single { - return context - .sql - .query_get_value( - context, - "SELECT c.addr - FROM chats_contacts cc - LEFT JOIN contacts c ON c.id=cc.contact_id - WHERE cc.chat_id=?;", - params![self.id], - ) - .unwrap_or_else(|| "Err".into()); - } - - if self.typ == Chattype::Group || self.typ == Chattype::VerifiedGroup { - if self.id.is_deaddrop() { - return context.stock_str(StockMessage::DeadDrop).into(); - } - let cnt = get_chat_contact_cnt(context, self.id); - return context.stock_string_repl_int(StockMessage::Member, cnt as i32); - } - - "Err".to_string() - } - pub fn get_profile_image(&self, context: &Context) -> Option { if let Some(image_rel) = self.param.get(Param::ProfileImage) { if !image_rel.is_empty() { @@ -693,7 +661,6 @@ impl Chat { is_sending_locations: self.is_sending_locations, color: self.get_color(context), profile_image: self.get_profile_image(context).unwrap_or_else(PathBuf::new), - subtitle: self.get_subtitle(context), draft, is_muted: self.is_muted(), }) @@ -1036,9 +1003,6 @@ pub struct ChatInfo { /// currently. pub profile_image: PathBuf, - /// Subtitle for the chat. - pub subtitle: String, - /// The draft message text. /// /// If the chat has not draft this is an empty string. @@ -2653,7 +2617,6 @@ mod tests { "is_sending_locations": false, "color": 15895624, "profile_image": "", - "subtitle": "bob@example.com", "draft": "", "is_muted": false } diff --git a/src/constants.rs b/src/constants.rs index 56d289f49..64ce2cd59 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -314,8 +314,6 @@ const DC_STR_SELFNOTINGRP: usize = 21; // deprecated; const DC_STR_NOMESSAGES: usize = 1; const DC_STR_SELF: usize = 2; const DC_STR_DRAFT: usize = 3; -const DC_STR_MEMBER: usize = 4; -const DC_STR_CONTACT: usize = 6; const DC_STR_VOICEMESSAGE: usize = 7; const DC_STR_DEADDROP: usize = 8; const DC_STR_IMAGE: usize = 9; @@ -347,7 +345,6 @@ const DC_STR_ARCHIVEDCHATS: usize = 40; const DC_STR_STARREDMSGS: usize = 41; const DC_STR_AC_SETUP_MSG_SUBJECT: usize = 42; const DC_STR_AC_SETUP_MSG_BODY: usize = 43; -const DC_STR_SELFTALK_SUBTITLE: usize = 50; const DC_STR_CANNOT_LOGIN: usize = 60; const DC_STR_SERVER_RESPONSE: usize = 61; const DC_STR_MSGACTIONBYUSER: usize = 62; diff --git a/src/dc_receive_imf.rs b/src/dc_receive_imf.rs index e5ef249dd..80654c561 100644 --- a/src/dc_receive_imf.rs +++ b/src/dc_receive_imf.rs @@ -1192,9 +1192,9 @@ fn create_or_lookup_adhoc_group( return Ok((ChatId::new(0), Blocked::Not)); } // use subject as initial chat name - let grpname = mime_parser.get_subject().unwrap_or_else(|| { - context.stock_string_repl_int(StockMessage::Member, member_ids.len() as i32) - }); + let grpname = mime_parser + .get_subject() + .unwrap_or("Unnamed group".to_string()); // create group record let new_chat_id: ChatId = create_group_record( diff --git a/src/stock.rs b/src/stock.rs index d536d522e..c5ff765f0 100644 --- a/src/stock.rs +++ b/src/stock.rs @@ -35,12 +35,6 @@ pub enum StockMessage { #[strum(props(fallback = "Draft"))] Draft = 3, - #[strum(props(fallback = "%1$s member(s)"))] - Member = 4, - - #[strum(props(fallback = "%1$s contact(s)"))] - Contact = 6, - #[strum(props(fallback = "Voice message"))] VoiceMessage = 7, @@ -136,9 +130,6 @@ pub enum StockMessage { ))] AcSetupMsgBody = 43, - #[strum(props(fallback = "Messages I sent to myself"))] - SelfTalkSubTitle = 50, - #[strum(props(fallback = "Cannot login as %1$s."))] CannotLogin = 60, @@ -430,8 +421,9 @@ mod tests { let t = dummy_context(); // uses %1$s substitution assert_eq!( - t.ctx.stock_string_repl_str(StockMessage::Member, "42"), - "42 member(s)" + t.ctx + .stock_string_repl_str(StockMessage::MsgAddMember, "Foo"), + "Member Foo added." ); // We have no string using %1$d to test... } @@ -440,8 +432,8 @@ mod tests { fn test_stock_string_repl_int() { let t = dummy_context(); assert_eq!( - t.ctx.stock_string_repl_int(StockMessage::Member, 42), - "42 member(s)" + t.ctx.stock_string_repl_int(StockMessage::MsgAddMember, 42), + "Member 42 added." ); }