Skip to content

Add unpublished flag for transports#7994

Open
Hocuri wants to merge 2 commits intomainfrom
hoc/unpublished-addrs
Open

Add unpublished flag for transports#7994
Hocuri wants to merge 2 commits intomainfrom
hoc/unpublished-addrs

Conversation

@Hocuri
Copy link
Collaborator

@Hocuri Hocuri commented Mar 15, 2026

Closes #7980. First commit moves some code around, second commit implements the unpublished flag.

Unpublished transports are not advertised to contacts, and self-sent messages are not sent there, so that we don't cause extra messages to the corresponding inbox, but can still receive messages from contacts who don't know the new relay addresses yet.

  • This adds list_transports_ex() and set_transport_unpublished() JsonRPC functions
  • By default, transports are published, but when updating, all existing transports except for the primary one become unpublished in order not to break existing users that followed https://delta.chat/legacy-move
  • It is not possible to unpublish the primary transport, and setting a transport as primary automatically sets it to published

An optional TODO would be to maybe change the existing list_transports API rather than adding a new one list_transports_ex. But to be honest, I don't mind the _ex prefix that much, and I am wary about compatibility issues. But maybe it would be fine; see b08ba4b for how this would look.

@Hocuri Hocuri force-pushed the hoc/unpublished-addrs branch from 09521f6 to b94d9f9 Compare March 17, 2026 14:28
if context.get_config_bool(Config::BccSelf).await?
|| msg.param.get_cmd() == SystemMessage::AutocryptSetupMessage
{
smtp::add_self_recipients(context, &mut recipients, rendered_msg.is_encrypted).await?;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change actually fixes an unrelated bug, and is necessary for the tests to pass: We need to pass is_encrypted to add_self_recipients(), not needs_encryption

@Hocuri Hocuri force-pushed the hoc/unpublished-addrs branch from b94d9f9 to 72c8c7b Compare March 17, 2026 15:18
@Hocuri Hocuri requested review from iequidoo and link2xt March 17, 2026 15:18
@Hocuri Hocuri changed the title [WIP] Add unpublished flag for transports Add unpublished flag for transports Mar 17, 2026
/// so that we don't cause extra messages to the corresponding inbox,
/// but can still receive messages from contacts who don't know the new relay addresses yet.
///
/// The default is true, but when updating,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default is false, because it is "unpublished", not "published"

/// so that we don't cause extra messages to the corresponding inbox,
/// but can still receive messages from contacts who don't know the new relay addresses yet.
///
/// The default is true, but when updating,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default is false


let alice_fp = self_fingerprint(alice).await?;
let secret_for_encryption = dbg!(format!("securejoin/{alice_fp}/{authcode}"));
let secret_for_encryption = format!("securejoin/{alice_fp}/{authcode}");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something unrelated

self.sql
.query_map_vec(
"SELECT addr FROM transports
WHERE is_published=1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
WHERE is_published=1
WHERE is_published

"SELECT value FROM config WHERE keyname='configured_addr'",
(),
|row| row.get(0),
)?;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs .context() so we know what query fails if we at some point do something about "primary relay" (failover) and remove configured_addr. Or just someone calls this function on unconfigured context, this will fail because of no rows.

}
}

fn concat(slices: &[&[&'static str]]) -> Vec<&'static str> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can as well return BTreeSet since you always convert the vector into a set immediately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a way to "unpublish" a relay

2 participants