Skip to content

Commit 95ac764

Browse files
authored
test: Mark receive_imf() as only for tests and "internals" feature (#6235)
`receive_imf() is only used in tests and the REPL, which enables the "internals" feature. This PR marks it as such, so that it's clear not only from the comment that this function is not used for anything else.
1 parent e121fc1 commit 95ac764

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/receive_imf.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::str::FromStr;
66
use anyhow::{Context as _, Result};
77
use deltachat_contact_tools::{addr_cmp, may_be_valid_addr, sanitize_single_line, ContactAddress};
88
use iroh_gossip::proto::TopicId;
9-
use mailparse::{parse_mail, SingleInfo};
9+
use mailparse::SingleInfo;
1010
use num_traits::FromPrimitive;
1111
use once_cell::sync::Lazy;
1212
use regex::Regex;
@@ -73,12 +73,13 @@ pub struct ReceivedMsg {
7373
///
7474
/// This method returns errors on a failure to parse the mail or extract Message-ID. It's only used
7575
/// for tests and REPL tool, not actual message reception pipeline.
76+
#[cfg(any(test, feature = "internals"))]
7677
pub async fn receive_imf(
7778
context: &Context,
7879
imf_raw: &[u8],
7980
seen: bool,
8081
) -> Result<Option<ReceivedMsg>> {
81-
let mail = parse_mail(imf_raw).context("can't parse mail")?;
82+
let mail = mailparse::parse_mail(imf_raw).context("can't parse mail")?;
8283
let rfc724_mid =
8384
imap::prefetch_get_message_id(&mail.headers).unwrap_or_else(imap::create_message_id);
8485
if let Some(download_limit) = context.download_limit().await? {
@@ -105,6 +106,7 @@ pub async fn receive_imf(
105106
/// Emulates reception of a message from "INBOX".
106107
///
107108
/// Only used for tests and REPL tool, not actual message reception pipeline.
109+
#[cfg(any(test, feature = "internals"))]
108110
pub(crate) async fn receive_imf_from_inbox(
109111
context: &Context,
110112
rfc724_mid: &str,

src/securejoin.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,10 @@ async fn verify_sender_by_fingerprint(
244244

245245
/// What to do with a Secure-Join handshake message after it was handled.
246246
///
247-
/// This status is returned to [`receive_imf`] which will use it to decide what to do
247+
/// This status is returned to [`receive_imf_inner`] which will use it to decide what to do
248248
/// next with this incoming setup-contact/secure-join handshake message.
249249
///
250-
/// [`receive_imf`]: crate::receive_imf::receive_imf
250+
/// [`receive_imf_inner`]: crate::receive_imf::receive_imf_inner
251251
#[derive(Debug, PartialEq, Eq)]
252252
pub(crate) enum HandshakeMessage {
253253
/// The message has been fully handled and should be removed/delete.

0 commit comments

Comments
 (0)