Skip to content

Conversation

@iequidoo
Copy link
Collaborator

@iequidoo iequidoo commented Feb 6, 2026

They are already applied by the broadcast owner and other subscriber's devices, no changes are
needed on the receiver side.

Checked by hand as well. Close #7679

Also removed sending "Chat-Group-Name*" headers by broadcast subscribers, it looks unnecessary at first glance, see the commit message.

@iequidoo iequidoo force-pushed the iequidoo/broadcast-webxdc-updates branch from adaf527 to c6600b5 Compare February 6, 2026 11:46
@iequidoo iequidoo requested review from Hocuri and r10s February 6, 2026 11:47
Broadcast subscribers can't change the chat name, so sending the "Chat-Group-Name{,-Timestamp}"
headers looks unnecessary. That could be useful for other subscriber's devices, but having only the
chat name isn't enough anyway, at least knowing the secret is necessary which is sent by the
broadcast owner.
They are already applied by the broadcast owner and other subscriber's devices, no changes are
needed on the receiver side.
@iequidoo iequidoo force-pushed the iequidoo/broadcast-webxdc-updates branch from c6600b5 to aed8d8c Compare February 8, 2026 07:04
@iequidoo iequidoo marked this pull request as draft February 8, 2026 09:18
We don't remember which status updates are "initial" (sent initially by the broadcast owner) and
which were sent by subscribers, so don't resend any of them to avoid accidental sharing of
confidential data.
@iequidoo iequidoo marked this pull request as ready for review February 8, 2026 12:06
/// A 1:1 chat, i.e. a normal chat with a single contact.
///
/// Created by [`ChatId::create_for_contact`].
#[default]
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 is to avoid adding Option<Chattype> to Message. We don't really have messages ouside of chats in the db.

@iequidoo
Copy link
Collaborator Author

iequidoo commented Feb 8, 2026

Copy link
Collaborator

@Hocuri Hocuri left a comment

Choose a reason for hiding this comment

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

Thanks for implementing!

Not sure about d250e70, because it means that when a Webxdc is resent in a channel, its state will never show for new subscribers. And I don't think that it's a problem that subscribers might send confidential status updates into a channel.

OTOH, it could be weird that the channel owner relays webxdc updates only if clicking "Resend" on the message; could lead to bugs.

Comment on lines -2696 to +2698
if let Some(reason) = chat.why_cant_send_ex(context, &skip_fn).await? {
if msg.param.get_cmd() == SystemMessage::WebxdcStatusUpdate {
// Already checked in `send_webxdc_status_update_struct()`.
} else if let Some(reason) = chat.why_cant_send_ex(context, &skip_fn).await? {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not just add | SystemMessage::WebxdcStatusUpdate to this code above:

        CantSendReason::InBroadcast => {
            matches!(
                msg.param.get_cmd(),
                SystemMessage::MemberRemovedFromGroup | SystemMessage::SecurejoinMessage
            )
        }

?

Then the let skip_fn = |reason: &CantSendReason| *reason == CantSendReason::InBroadcast; change in webxdc.rs also wouldn't be necessary.

Comment on lines +590 to +593
// This is safe: see `ChatId::delete_ex()`, `None` chat type can't happen.
chat_typ: row
.get::<_, Option<_>>("chat_typ")?
.unwrap_or(Chattype::Single),
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think it makes sense to load all kind of chat data every time we load a message. chat_visibility and chat_blocked also has only one usage each in the entire codebase (tests excluded), both of which could be easily removed.

Also, chat_typ is only needed when (re)sending messages, which doesn't happen as often as receiving messages.

assert_eq!(bob_instance.chat_id, bob_chat_id);

let provider = BackupProvider::prepare(bob).await?;
let bob1 = &tcm.unconfigured().await;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should be called bob2 for consistency with other tests.

FTR, it would be possible to get a second Bob by calling &tcm.bob().await again, but the way done here is fine, too.

.await?;
bob.flush_status_updates().await?;
let sent_msg = bob.pop_sent_msg().await;
let sent_msg = bob.pop_sent_msg_opt(Duration::ZERO).await.unwrap();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why this change?

StatusUpdateSerial::MAX,
None,
)
.await?
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not very used to the webxdc code, but: Doesn't this change mean that no status updates will be sent into OutBroadcasts at all anymore? And, isn't the change in src/chat.rs enough to prevent resending into OutBroadcasts?

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.

channels: let subscriber send webxdc updates to channel owner

2 participants