Merge the development branch: streams of every channel

Brings in the streams of every channel (StreamItem::channel, the streams
panel listing other channels' streams after ours, the viewer's channel)
and the answer to a streamer's new offer.

streams.rs keeps both of the viewer's new values: whether the streamer
is an admin (this branch) and the stream's channel (the development
branch). The phone's pieces that list Bridge.streams now say where a
stream of another channel is: the voice screen's stream cards ("Lumen ·
in Gaming") and Home's Live now cards, whose comment and the server
rail's live flag no longer claim they are about our channel only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
selikhovandClaude Opus 5.5 committed 2026-10-03 22:24:13 +03:00
commit acbb8c1124
18 files changed
+342 -71

No files matched your search

+2 -1
View File
@@ -1048,7 +1048,8 @@ pub enum StreamPermissions {
/// Friends (contacts marked friend) are accepted; others are shown to
/// the user ([`crate::Event::StreamViewerRequest`]).
Friends,
/// Clients in our channel are accepted, others denied.
/// Clients in our channel are accepted; others (a stream can be watched
/// from any channel) are shown to the user.
#[default]
Channel,
/// Every join request is denied.
+15 -10
View File
@@ -4,13 +4,16 @@
//! The voice task forwards stream notifications here and sends the resulting
//! commands. Only started for TeamSpeak 6 servers.
//!
//! Streams that started before we joined are looked up on the server
//! (`requeststreaminfo`) and in the session's gateway directory: its
//! registered entries (stream id and streamer) are handed to the stream
//! sessions ([`voelin_stream::Streams::discovered`]) for streamers in our
//! channel, and a [`StreamLookup`] answers for the gateway when the server
//! cannot. Our own stream's life (live, viewers, ended) goes back to the
//! session ([`OwnStreamEvent`]), which keeps its directory entry.
//! The streams of the whole server are listed, in every channel: a stream can
//! be watched from any channel, as with the official client. Streams that
//! started before we joined, and streams in other channels (the server
//! announces a stream only in its channel), are looked up on the server
//! (`requeststreaminfo`), so no gateway is needed. A gateway's directory is a
//! second source: its registered entries (stream id and streamer) are handed
//! to the stream sessions ([`voelin_stream::Streams::discovered`]), and a
//! [`StreamLookup`] answers for the gateway when the server cannot. Our own
//! stream's life (live, viewers, ended) goes back to the session
//! ([`OwnStreamEvent`]), which keeps its directory entry.
use std::collections::{BTreeMap, BTreeSet};
use std::fmt;
@@ -554,10 +557,11 @@ impl StreamTask {
StreamPermissions::Nobody => Some(false),
// Friends are let in; others: ask.
StreamPermissions::Friends => self.friends.contains(&viewer.0).then_some(true),
// Our channel is let in; viewers from other channels: ask.
StreamPermissions::Channel => {
let discovery = self.streams.discovery();
let own = discovery.own_channel();
Some(own.is_some() && discovery.channel_of(viewer) == own)
(own.is_some() && discovery.channel_of(viewer) == own).then_some(true)
}
}
}
@@ -1016,7 +1020,8 @@ mod tests {
assert_eq!(parse_kind("game"), StreamKind::Screen);
}
/// `stream.permissions` answers join requests (`friends`: friends only, others are asked).
/// `stream.permissions` answers join requests (`friends` and `channel`:
/// those are let in, others are asked).
#[tokio::test(flavor = "multi_thread")]
async fn permissions_answer_join_requests() {
let in_channels = |streamer: u64, viewer: u64| {
@@ -1028,7 +1033,7 @@ mod tests {
for (permissions, viewer_channel, friend, expected) in [
(StreamPermissions::Everyone, 2, false, Some(true)),
(StreamPermissions::Channel, 1, false, Some(true)),
(StreamPermissions::Channel, 2, false, Some(false)),
(StreamPermissions::Channel, 2, false, None),
(StreamPermissions::Nobody, 1, false, Some(false)),
(StreamPermissions::Friends, 1, false, None),
(StreamPermissions::Friends, 2, true, Some(true)),