diff --git a/deltachat-ffi/src/lib.rs b/deltachat-ffi/src/lib.rs index 6a2b932e4..402627206 100644 --- a/deltachat-ffi/src/lib.rs +++ b/deltachat-ffi/src/lib.rs @@ -2852,7 +2852,11 @@ pub unsafe extern "C" fn dc_chat_get_mailinglist_addr(chat: *mut dc_chat_t) -> * return "".strdup(); } let ffi_chat = &*chat; - ffi_chat.chat.get_mailinglist_addr().unwrap_or_default().strdup() + ffi_chat + .chat + .get_mailinglist_addr() + .unwrap_or_default() + .strdup() } #[no_mangle] diff --git a/deltachat-jsonrpc/src/api/types/chat.rs b/deltachat-jsonrpc/src/api/types/chat.rs index 40308333d..f5a5c3bcd 100644 --- a/deltachat-jsonrpc/src/api/types/chat.rs +++ b/deltachat-jsonrpc/src/api/types/chat.rs @@ -81,7 +81,7 @@ impl FullChat { false }; - let mailing_list_address = chat.get_mailinglist_addr().map(|s|s.to_string()); + let mailing_list_address = chat.get_mailinglist_addr().map(|s| s.to_string()); Ok(FullChat { id: chat_id, diff --git a/src/receive_imf.rs b/src/receive_imf.rs index 3d078b91a..9b97ce032 100644 --- a/src/receive_imf.rs +++ b/src/receive_imf.rs @@ -2989,7 +2989,7 @@ mod tests { assert!(chat.can_send(&t.ctx).await?); assert_eq!( chat.get_mailinglist_addr(), - "reply+elernshsetushoyseshetihseusaferuhsedtisneu@reply.github.com" + Some("reply+elernshsetushoyseshetihseusaferuhsedtisneu@reply.github.com") ); assert_eq!(chat.name, "deltachat/deltachat-core-rust"); assert_eq!(chat::get_chat_contacts(&t.ctx, chat_id).await?.len(), 1); @@ -2998,7 +2998,7 @@ mod tests { let chat = chat::Chat::load_from_db(&t.ctx, chat_id).await?; assert!(!chat.can_send(&t.ctx).await?); - assert_eq!(chat.get_mailinglist_addr(), ""); + assert_eq!(chat.get_mailinglist_addr(), None); let chats = Chatlist::try_load(&t.ctx, 0, None, None).await?; assert_eq!(chats.len(), 1); @@ -3057,7 +3057,7 @@ mod tests { let chat = Chat::load_from_db(&t.ctx, chat_id).await.unwrap(); assert_eq!(chat.name, "delta-dev"); assert!(chat.can_send(&t).await?); - assert_eq!(chat.get_mailinglist_addr(), "delta@codespeak.net"); + assert_eq!(chat.get_mailinglist_addr(), Some("delta@codespeak.net")); let msg = get_chat_msg(&t, chat_id, 0, 1).await; let contact1 = Contact::load_from_db(&t.ctx, msg.from_id).await.unwrap(); @@ -3320,7 +3320,7 @@ Hello mailinglist!\r\n" assert_eq!(chat.name, "ola"); assert_eq!(chat::get_chat_msgs(&t, chat.id, 0).await.unwrap().len(), 1); assert!(!chat.can_send(&t).await?); - assert_eq!(chat.get_mailinglist_addr(), ""); + assert_eq!(chat.get_mailinglist_addr(), None); // receive another message with no sender name but the same address, // make sure this lands in the same chat @@ -3373,7 +3373,7 @@ Hello mailinglist!\r\n" ); assert_eq!(chat.name, "Atlas Obscura"); assert!(!chat.can_send(&t).await?); - assert_eq!(chat.get_mailinglist_addr(), ""); + assert_eq!(chat.get_mailinglist_addr(), None); Ok(()) } @@ -3402,7 +3402,7 @@ Hello mailinglist!\r\n" assert_eq!(chat.grpid, "1234ABCD-123LMNO.mailing.dhl.de"); assert_eq!(chat.name, "DHL Paket"); assert!(!chat.can_send(&t).await?); - assert_eq!(chat.get_mailinglist_addr(), ""); + assert_eq!(chat.get_mailinglist_addr(), None); Ok(()) } @@ -3431,7 +3431,7 @@ Hello mailinglist!\r\n" assert_eq!(chat.grpid, "dpdde.mxmail.service.dpd.de"); assert_eq!(chat.name, "DPD"); assert!(!chat.can_send(&t).await?); - assert_eq!(chat.get_mailinglist_addr(), ""); + assert_eq!(chat.get_mailinglist_addr(), None); Ok(()) } @@ -3452,7 +3452,7 @@ Hello mailinglist!\r\n" assert_eq!(chat.grpid, "96540.xt.local"); assert_eq!(chat.name, "Microsoft Store"); assert!(!chat.can_send(&t).await?); - assert_eq!(chat.get_mailinglist_addr(), ""); + assert_eq!(chat.get_mailinglist_addr(), None); receive_imf( &t, @@ -3465,7 +3465,7 @@ Hello mailinglist!\r\n" assert_eq!(chat.grpid, "121231234.xt.local"); assert_eq!(chat.name, "DER SPIEGEL Kundenservice"); assert!(!chat.can_send(&t).await?); - assert_eq!(chat.get_mailinglist_addr(), ""); + assert_eq!(chat.get_mailinglist_addr(), None); Ok(()) } @@ -3488,7 +3488,7 @@ Hello mailinglist!\r\n" assert_eq!(chat.grpid, "51231231231231231231231232869f58.xing.com"); assert_eq!(chat.name, "xing.com"); assert!(!chat.can_send(&t).await?); - assert_eq!(chat.get_mailinglist_addr(), ""); + assert_eq!(chat.get_mailinglist_addr(), None); Ok(()) }