From 9e0f0e05adb11352c6c1f52ebee2ec7023794dfe Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 6 Oct 2026 20:09:01 +0000 Subject: [PATCH] ui: other people's badges, named on the member card and drawn after their name Clients only send badge GUIDs. voelin-model names them from tsclientlib's table plus the newer entries of TeamSpeak's own list, and the engine fetches the first three pictures of each client from TeamSpeak's badge server (/.svg, checked to answer) with the banners, under cache.fetch_images. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AVRENKftQqGoEeswiR9TDQ --- CHANGELOG.md | 3 + crates/voelin-core/src/lib.rs | 11 +- crates/voelin-core/src/session.rs | 66 +++++++++- crates/voelin-core/src/settings.rs | 4 +- crates/voelin-core/src/web.rs | 4 +- crates/voelin-model/data/badges.csv | 94 ++++++++++++++ crates/voelin-model/src/badges.rs | 144 +++++++++++++++++++++ crates/voelin-model/src/lib.rs | 1 + crates/voelin-ui/src/app.rs | 4 +- crates/voelin-ui/src/dev.rs | 29 ++++- crates/voelin-ui/src/members.rs | 2 + crates/voelin-ui/src/vm/tree.rs | 92 ++++++++++++- crates/voelin-ui/ui/bridge.slint | 19 +++ crates/voelin-ui/ui/components/badge.slint | 41 ++++++ crates/voelin-ui/ui/components/index.slint | 2 +- crates/voelin-ui/ui/screens/channels.slint | 12 +- crates/voelin-ui/ui/screens/members.slint | 31 ++++- docs/architecture.md | 4 +- docs/ui.md | 21 ++- 19 files changed, 554 insertions(+), 30 deletions(-) create mode 100644 crates/voelin-model/data/badges.csv create mode 100644 crates/voelin-model/src/badges.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index 67513f1..17592b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,9 @@ User-visible changes of the apps and the `tsgw` gateway. The format follows disabled. - The voice channel view on desktop can copy an invite link to the channel, as the phone's Invite button does. +- Other people's myTeamSpeak badges: up to three pictures after their name + in the channel tree and the members panel, and their names on the member + card (what each is for on hover). ### Changed diff --git a/crates/voelin-core/src/lib.rs b/crates/voelin-core/src/lib.rs index 28abf56..6ed456d 100644 --- a/crates/voelin-core/src/lib.rs +++ b/crates/voelin-core/src/lib.rs @@ -39,9 +39,9 @@ //! [`Event::Poke`]), private messages to any client (a //! [`ChatTarget::Private`] chat, stored under the peer's unique id), the //! channels' file browsers, avatars and icons ([`files`], cached in -//! [`cache`]) and offline messages ([`offline`]). The host banner and -//! channel banners are pictures on the web, fetched into the same cache -//! ([`Event::PictureReady`]). Contacts (friends, blocked people, per-person +//! [`cache`]) and offline messages ([`offline`]). The host banner, channel +//! banners and the clients' badges are pictures on the web, fetched into the +//! same cache ([`Event::PictureReady`]). Contacts (friends, blocked people, per-person //! volume) are engine-wide ([`contacts`]). mod audio; @@ -679,8 +679,9 @@ pub enum Event { path: PathBuf, }, /// A picture on the web is in the cache: the host banner - /// ([`ServerDetails::banner_gfx_url`]) or a channel's - /// ([`voelin_model::ChannelInfo::banner_gfx_url`]) at `url` (setting + /// ([`ServerDetails::banner_gfx_url`]), a channel's + /// ([`voelin_model::ChannelInfo::banner_gfx_url`]) or a badge's + /// ([`voelin_model::badges::icon_url`]) at `url` (setting /// `cache.fetch_images`). Comes again when the host banner was reloaded /// (`banner_gfx_interval_s`, at least a minute): the file at `path` /// changed. diff --git a/crates/voelin-core/src/session.rs b/crates/voelin-core/src/session.rs index c5a301d..69c537c 100644 --- a/crates/voelin-core/src/session.rs +++ b/crates/voelin-core/src/session.rs @@ -19,7 +19,7 @@ use tracing::{debug, warn}; use tsclientlib::ClientId; use voelin_audio::AudioSettings; use voelin_gateway_proto::{ErrorCode, HistoryEntry, StreamEntry, StreamSpec, feature}; -use voelin_model::{ChatMessage, ChatTarget, GroupInfo, Presence, ServerDetails}; +use voelin_model::{ChatMessage, ChatTarget, GroupInfo, Presence, ServerDetails, badges}; use voelin_stream::ClientState; use crate::audio::{self, AudioEvent, AudioHandle, AudioIn}; @@ -224,7 +224,8 @@ struct Session { avatars: HashMap, /// Icons reported or being fetched, voice only. icons: HashSet, - /// Pictures on the web (banners) reported or being fetched, by address. + /// Pictures on the web (banners, badges) reported or being fetched, by + /// address. pictures: HashSet, image_epoch: u64, images_enabled: bool, @@ -1007,8 +1008,9 @@ impl Session { || (self.voice_presence.is_some() && files::server_image(url).is_some()) } - /// Fetch the banners of the presence shown (any source) that are new, - /// and have the host banner reloaded as often as the server asks. + /// Fetch the banners and the clients' badges of the presence shown (any + /// source) that are new, and have the host banner reloaded as often as + /// the server asks. fn fetch_pictures(&mut self, p: &Presence) { let enabled = self.settings.current().get(&CACHE_FETCH_IMAGES); let reload = Some((&p.server.banner_gfx_url, p.server.banner_gfx_interval_s)) @@ -1039,10 +1041,16 @@ impl Session { if !enabled { return; } - let urls: HashSet<_> = std::iter::once(&p.server.banner_gfx_url) - .chain(p.channels.values().filter_map(|c| c.banner_gfx_url.as_ref())) + // The badges shown, from TeamSpeak's server. + let badge_urls = p + .clients + .values() + .flat_map(|c| c.badges.iter().take(badges::SHOWN)) + .filter_map(|guid| badges::icon_url(guid)); + let urls: HashSet = std::iter::once(p.server.banner_gfx_url.clone()) + .chain(p.channels.values().filter_map(|c| c.banner_gfx_url.clone())) + .chain(badge_urls) .filter(|u| self.can_fetch_picture(u)) - .cloned() .collect(); self.pictures.retain(|url| urls.contains(url)); for url in &urls { @@ -2293,6 +2301,50 @@ mod banner_tests { assert!(timer.is_finished()); } + /// The pictures of the badges clients show (the first three of each, the + /// known ones) come with the presence, and only with + /// `cache.fetch_images`. + #[tokio::test] + async fn badge_pictures_come_with_the_presence() { + let (mut session, _) = session("badges"); + let guids = [ + "4b27be5a-b92a-4b30-8b2d-14b59653f427", + "00000000-0000-0000-0000-000000000000", + "2bf80270-8efe-46dc-a472-3280a0479145", + "05114019-6b46-4b13-b5a1-e5179ef69fb5", + ]; + let mut presence = Presence::default(); + let client = voelin_model::ClientInfo { + id: 1, + badges: guids.iter().map(|g| g.to_string()).collect(), + ..Default::default() + }; + presence.clients.insert(1, client); + // Own the downloads, so none goes to the network. + let cache = session.cache.current(); + let urls: Vec = guids.iter().filter_map(|g| badges::icon_url(g)).collect(); + for url in &urls { + let _pending = cache.fetch(&cache::picture_key(url).unwrap(), false, Box::new(|_| {})); + } + session.settings.current().set(&CACHE_FETCH_IMAGES, false).unwrap(); + session.fetch_pictures(&presence); + assert!(session.pictures.is_empty()); + session.settings.current().set(&CACHE_FETCH_IMAGES, true).unwrap(); + session.fetch_pictures(&presence); + let mut fetched: Vec<_> = session.pictures.iter().cloned().collect(); + fetched.sort(); + let mut shown = urls[..2].to_vec(); + shown.sort(); + assert_eq!( + fetched, shown, + "the unknown second badge has no picture; the fourth is not shown" + ); + // Gone with the client. + session.fetch_pictures(&Presence::default()); + assert!(session.pictures.is_empty()); + let _ = std::fs::remove_dir_all(cache.dir()); + } + /// The priority speakers and the server's dimming reach the audio thread /// once, and again when either changes. #[tokio::test] diff --git a/crates/voelin-core/src/settings.rs b/crates/voelin-core/src/settings.rs index 4b42fb1..25fb7f4 100644 --- a/crates/voelin-core/src/settings.rs +++ b/crates/voelin-core/src/settings.rs @@ -1125,11 +1125,11 @@ pub static CACHE_MAX_MB: Key = Key::new( || 256, ); -/// Download the avatars, icons and banners of servers we are on. +/// Download the avatars, icons, banners and badges of servers we are on. pub static CACHE_FETCH_IMAGES: Key = Key::new( "cache.fetch_images", Kind::Bool, - "Download avatars, icons and banners of the servers we are on.", + "Download avatars, icons, banners and badges of the servers we are on.", || true, ); diff --git a/crates/voelin-core/src/web.rs b/crates/voelin-core/src/web.rs index 9af4ddf..669521c 100644 --- a/crates/voelin-core/src/web.rs +++ b/crates/voelin-core/src/web.rs @@ -1,5 +1,7 @@ //! Pictures from the web: the host banner and TeamSpeak 6 channel banners, -//! which servers give as `http(s)` addresses on any host. +//! which servers give as `http(s)` addresses on any host, and the pictures +//! of the clients' badges on TeamSpeak's server +//! ([`voelin_model::badges::icon_url`]). //! //! They go into the engine's cache ([`crate::cache`], named by the MD5 hash //! of the address) like avatars and icons, and only with diff --git a/crates/voelin-model/data/badges.csv b/crates/voelin-model/data/badges.csv new file mode 100644 index 0000000..1ec643c --- /dev/null +++ b/crates/voelin-model/data/badges.csv @@ -0,0 +1,94 @@ +uid,name,description,filename,codes +4b27be5a-b92a-4b30-8b2d-14b59653f427,20th Anniversary,Celebrating 20 Years of TeamSpeak,20_years, +f81ad44d-e931-47d1-a3ef-5fd160217cf8,4Netplayers,4Netplayers customer,4netplayers, +b78a0f3e-8758-4572-b102-42a79b4a0342,????,Reads between the line,hat, +2bf80270-8efe-46dc-a472-3280a0479145,Alpha Tester,Helped to test our software. THANK YOU!,Alpha, +05114019-6b46-4b13-b5a1-e5179ef69fb5,April Fools!,"Roses are red, gaming is fun, you are carrying too much to be able to run :(",rpg, +1a518885-520c-4f54-9f49-8b1acb674771,Braindance,I’m chippin’ in,Braindance,P4TEKZ80PZ +cbf5aafd-2554-4053-80bb-0cf82ec0a430,Bright Idea,TeamSpeak took my idea on board,FeatureBadge_Lightbulb, +d6062d9c-42a3-49c9-91dd-8c43a5a46805,Bug Catcher,I found a bug!,BugBadge_Splat, +dfc70674-0fd0-431e-b3a1-edc32d7b09b2,Challenge Accepted,"Unlocked at SCILL Play — Challenges, tournaments and more!",scill, +afed63f4-82f1-4479-ab02-0ef053f55723,Communities Early Adopter,Thank you for your Support!,communities_early_adopter, +54be472d-3163-4076-9059-7f46128d937e,Communities Purchase,Purchased a TeamSpeak Community,communities_purchase, +f85f7e21-753a-4566-b26a-4e3e9155d2ef,Cyberpunk,We have a city to burn,Cyberpunk, +c028298c-84ff-4e22-be4e-b8c17552b4bb,Digi,Digi joined your channel #DIGWIN,digi, +56df5ce2-6c5a-4a24-90e2-29e497e26170,Drone Champions League,I follow the Drone Champions League,DCL_Badge,DRONECHAMP +935e5a2a-954a-44ca-aa7a-55c79285b601,E3 2018 - Winner,Discovered at E3 2018,E3-2018, +61723e54-3da2-4f19-a33f-fcdc8ef5eaa0,Father's Day 2022,Not all heroes wear capes,fathersday2022, +b9c7d6ad-5b99-40fb-988c-1d02ab6cc130,Found Tim Speak,Found Tim Speak at Gamescom 2018,met_tim,XJN4WJZEJN +809bdd5a-2601-4152-82ff-a21d23d8fd46,G2 Esports,Aged 20 years being a G2 fan,G2_Esports, +62444179-0d99-42ba-a45c-c6b1557d079a,Gamescom 2014,Registered at Gamescom 2014,gamescom_2014, +50bbdbc8-0f2a-46eb-9808-602225b49627,Gamescom 2016,Registered during Gamescom 2016,gamescom_2016, +534c9582-ab02-4267-aec6-2d94361daa2a,Gamescom 2017,Visited TeamSpeak at Gamescom 2017,gamescom_2017,DK9JGRJH1Q +4eef1ecf-a0ea-423d-bfd0-496543a00305,Gamescom 2018,Visited TeamSpeak at Gamescom 2018,gamescom_2018,8CXB49KPJ4 +b82a45a5-b235-4926-be77-de102222e5eb,Gamescom 2019,Visited TeamSpeak at Gamescom 2019,Gamescom19,PNKCB76VZ8 +34dbfa8f-bd27-494c-aa08-a312fc0bb240,Gamescom Hero 2017,Gaming Hero at Gamescom 2017,hero_2017, +24512806-f886-4440-b579-9e26e4219ef6,Gamescom Hero 2018,Gamescom Exclusive Gaming Hero 2018,gamescom_2018_played,BJCFQBU53C +d49fd07e-99fb-41de-8d7b-c98064713171,GommeHD.net,Your #1 Minecraft Network for over 10 years,GMHD, +c565972a-3912-457b-826f-84820c1ba6ca,Halloween 2021,Happy Halloween 2021,halloween21, +133595e7-950f-4ef2-b113-f91a68b5770d,Halloween 2021 Special,Earned by participating in our Halloween 2021 special stream,halloween21_special, +fb154277-5fe7-428a-85a4-43c0bdcdda3d,Halloween 2022,Spooky_Scary_Skeletons.mp4,halloween22, +e6679ce2-d458-493c-8ffb-5660e47ac99f,Happy Hanami,Enjoy the view,hanami2023, +de7bd960-eb02-47e1-9ce2-a44f6e255d8f,Happy Holidays 2019,Happy holidays from everyone at TeamSpeak!,Happy_Holidays, +d4ea0251-ba46-4c1a-83b7-59db3f89e52c,Happy New Year 2021,Survived the great toilet paper crisis of 2020,firework_2020, +1519e001-06a0-458c-9195-a8a6d0ec87fc,Happy New Year 2023,"Aw man, here we go again",2023_NewYear, +834d4cc1-cd80-48d6-96c4-23d131d78649,Happy Summer 2023,heat death of the universe,happy_summer_2023, +c68bcc52-7aeb-4868-b4d2-e7b20716f9ba,Heatwave 2022,I'm melting... help,summer_icecream, +94242c4e-6742-4540-8b66-ce951ed57159,Helping Hand,\ pushed some buttons *beep* *bop* ~ thanks!,homebase, +288a56c6-4da3-48de-9c9f-bd9eede5d832,Immortal Roleplay,This is your life.,Immortal_Roleplay, +69bfffc8-e9c0-4f70-8a37-47cb8c73fb1d,International Peace Day,"United we stand, divided we fall",peaceday2022, +9ea23c77-8755-4d82-b30c-92f4aac109ef,International Women's Day 2021,"To all the mums, sisters, aunties, nieces and beyond, Happy Women's Day!",wft, +7d9fa2b1-b6fa-47ad-9838-c239a4ddd116,MIFCOM,MIFCOM | Entered Performance,mifcom, +ed85bdff-2a2b-4bea-a1a5-4d06fcc0d776,Merry Christmas 2019,It’s the most wonderful ‘Tim’ of the Year,Christmas, +c6480fe2-ee25-4ee8-9853-243652c8ec54,Merry Christmas 2020,"Let it snow, let it snow, let it snow!",Christmas2020, +0581aa0f-8c2d-4681-bb9f-8492fec49977,Merry Christmas 2021,Look what Santa's left under the server tree!,christmas2021, +d4875b30-9908-43cb-a1eb-1a958e226078,Merry Christmas 2022,There's snow place like home,christmas2022, +87ccf9ea-67c9-45e5-adbc-77e210e6128a,Met Tim,Met Tim Speak IRL,tim_irl, +0d98391c-ecdf-4f26-931a-49bfd669cda7,Mind Egg,Found in the TeamSpeak 2020 Easter Egg Hunt,E_MindEgg, +2fdda3c6-20e0-48f1-9c12-f39239a2ed02,Mother's Day 2022,Thanks for bearing with us,rose, +c3f823eb-5d5c-40f9-9dbd-3437d59a539d,Official TeamSpeak Gamer,New myTeamSpeak member,TS-2018, +8dfa37ac-b40d-4466-b393-ff2184a9adf3,Overwatch League,I follow the Overwatch League,OWL_Badge, +4ce435d1-6ac5-4530-b81d-6d14ddaaa1ac,PGL Antwerp 2022,Watched the PGL CS:GO Major,PGLant, +fa3ece28-64df-431f-b1b3-90844bfdd2d9,Paris Games Week 2014,Registered at Paris Games Week 2014,paris_gamesweek_2014, +d95f9901-c42d-4bac-8849-7164fd9e2310,Paris Games Week 2016,Registered during Paris Games Week 2016,paris_gamesweek_2016, +0005232e-538e-4cb2-93b6-d7d83e873829,PietSmiet,Werde Snob auf PietSmiet.de ;),PietSmiet, +be932556-dfa9-4dc6-afd0-98de0ab25777,PolTeamgeist,WooOOHoohOOHooo,PolTeamgeist, +5f6d49e4-35c8-4809-8c81-6e71f7f749e9,Power Egg,Found in the TeamSpeak 2020 Easter Egg Hunt,E_PowerEgg, +ceee2445-4fbf-4f06-9421-286f0f4e875a,Pride,Never be afraid to show your colors.,pride, +1aa375e8-7207-45bf-8b80-556bafafc834,Reality Egg,Found in the TeamSpeak 2020 Easter Egg Hunt,E_RealityEgg, +f22c22f1-8e2d-4d99-8de9-f352dc26ac5b,Rocket Beans TV,Rocket Beans TV Community,rbtv,RWGE2NURJZ +2c9698c1-1fec-4baa-a28f-4845f045f42f,Soul Egg,Found in the TeamSpeak 2020 Easter Egg Hunt,E_SoulEgg, +641a4d85-2351-482c-97a1-02fc3b6abbb5,Space Egg,Found in the TeamSpeak 2020 Easter Egg Hunt,E_SpaceEgg, +63261116-4359-4842-873e-56820afbe068,SpartaTheOriginal,Olaf Toast @ twitch.tv/SpartaTheOriginal,Toast, +ef567ec5-f46e-4520-be07-6021023cf6bd,Sponsorship License,Sponsored by TeamSpeak,Sponsorship, +7a627d47-5496-4d68-83b5-2c4eafff9b30,"Stay Home, Stay Safe","Playing Apart, Staying Connected",StaySafeStayHome, +7262a528-c7df-4369-bc2c-d34bf5853d7b,TS Chat Alpha Tester,"Helped us test our new mobile app, thanks!",slim_golden, +6eee759e-b1e9-4937-b023-07fc778532a2,TS Gameday Participant,At least i tried...,silvered, +e1447b99-53b0-448a-98b7-ee7bad8bd268,TS Gameday Winner,As shiny as the golden frying pan,goldenjoystick, +1cb07348-34a4-4741-b50f-c41e584370f7,TeamSpeak Addon Author,Creator of TeamSpeak Addons,addon_author, +450f81c1-ab41-4211-a338-222fa94ed157,TeamSpeak Addon Developer (Bronze),Creator of at least 1 TeamSpeak Addon,addon_author_bronze, +94ec66de-5940-4e38-b002-970df0cf6c94,TeamSpeak Addon Developer (Gold),Creator of at least 5 TeamSpeak Addons,addon_author_gold, +c9e97536-5a2d-4c8e-a135-af404587a472,TeamSpeak Addon Developer (Silver),Creator of at least 3 TeamSpeak Addons,addon_author_silver, +9cd152a7-bf65-4ece-aeba-62d27678f79a,TeamSpeak Competition Winner Badge,TeamSpeak Competition Winner,CompWinnerBadge, +64221fd1-706c-4bb2-ba55-996c39effa79,TeamSpeak Jedi,myTeamSpeak early adopter,TS-OG, +6b187e83-873b-46b0-b2c2-a31af15e76a4,TeamSpeak Merch Badge,TeamSpeak Merch Owner - 1st Edition,cap_red, +22b9ec39-7694-453e-864c-dfc7b1b0d7c7,TeamSpeak Merch Badge 2.0,TeamSpeak Merch Owner - 2nd Edition,topper, +205916f3-a953-4754-8905-bc15069b1f91,TeamSpeak Merch Badge 3.0,TeamSpeak Merch Owner — 3rd Edition,Merch3, +8d843dfa-c51a-407f-87b3-94cfc8f03e96,TeamSpeak Staff,Official Staff Member,teamspeak_staff, +c2368518-3728-4260-bcd1-8b85e9f8984c,Test,"Testing, Testing.",Testing, +4086a249-a503-4f31-9e83-8a0a8e3089bd,Tim-o'-Lantern,Mwuhaahaahaahaahaa,Tim-O-Lantern,JQGCTAQWHT +089c7295-3aa2-48b0-b2f1-2dd1bec12caf,Time Egg,Found in the TeamSpeak 2020 Easter Egg Hunt,E_TimeEgg, +904e232c-f369-44db-87f7-5142e15620cc,Time Machine,Worked like a machine to update addons in super-quick time.,time_machine, +4c61af66-22ef-4897-b0bb-25fcef2acf60,Undead Nightmare,I'm the last of my kind,undead_nightmare, +b0a36aea-3e46-4e83-a455-6e92ae1b9d94,Undead Nightmare,I'm the last of my kind,undead_nightmare, +0cd924ed-c5ea-459e-b60a-4f1bc0b65f07,"Up, Up and Away!",Find me on Mount Chiliad,"up,_up_and_away!", +4b0fd4f5-d456-4294-973d-853a1db5c7d8,Valentim's Day 2019,Valentim's Day 2019,Valentines_Badge, +92801833-e721-4b7e-84d4-6c02dbb332b9,Valentim's Day 2020,Valentim's Day 2020,Valentim2020, +958f904b-8260-48a4-a961-f786cbd39411,Valentine's Day 2023,Love you like my Tamagotchi,ValentinesDay23, +a676c708-da67-4784-ba7f-3fb7e8d2e865,Valentines Day 2021,"Roses are red, TS is blue, Servers are Sweet and so are you.",valentine21, +c54a9f92-07f7-4214-90f3-eafeea8005da,World Backup Day,Don't be an April Fool. Back up your data!,backupday_2023, +448a6d13-4e08-46a1-aafa-b4ff6d6c2d06,World Bonsai Day,"harmony, balance, patience",bonsai_day, +0f976a27-ddf5-447c-b79c-0644a8e8a297,Year of the Dragon 2024,"Arise, Shenron!",year_of_the_dragon_2024, +8c22fe26-30ac-4231-8b31-67d8a75c808a,Year of the Ox 2021,Only listen to the fortune cookie; disregard all other fortune telling units.,ox21, +970c70e6-00a1-41c1-ac5c-81c89a06c7a6,Year of the Rabbit 2023,Do a barrel roll!,chineseNY2023, +92356386-0451-4a97-87d9-10ff4f43260c,Year of the Tiger 2022,Rocky sends his regards,tiger, diff --git a/crates/voelin-model/src/badges.rs b/crates/voelin-model/src/badges.rs new file mode 100644 index 0000000..be1461c --- /dev/null +++ b/crates/voelin-model/src/badges.rs @@ -0,0 +1,144 @@ +//! myTeamSpeak badges: what the GUIDs a client shows (`client_badges`) +//! stand for, and where TeamSpeak keeps their pictures. +//! +//! The table is `data/badges.csv`: tsclientlib's list (2023, also in +//! `proto/tsproto-structs/declarations`) and the newer badges of +//! TeamSpeak's own list (`https://badges-content.teamspeak.com/list`, a +//! protobuf) as of October 2026. Badges added since are unknown here. + +use std::collections::HashMap; +use std::sync::LazyLock; + +/// How many badges a client shows at most (TeamSpeak lets one pick three). +pub const SHOWN: usize = 3; + +/// TeamSpeak's server for the badges' pictures. +const CONTENT: &str = "https://badges-content.teamspeak.com"; + +/// One badge of the table. +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct BadgeInfo { + pub name: String, + pub description: String, + /// Its picture's name on TeamSpeak's server, without `.svg`. + pub filename: String, +} + +/// The table by GUID (lower case), read once. +static BADGES: LazyLock> = LazyLock::new(|| { + // Columns: uid, name, description, filename, codes. + records(include_str!("../data/badges.csv")) + .into_iter() + .skip(1) + .filter_map(|mut fields| { + fields.truncate(4); + let [uid, name, description, filename] = <[String; 4]>::try_from(fields).ok()?; + Some((uid.to_ascii_lowercase(), BadgeInfo { name, description, filename })) + }) + .collect() +}); + +/// What a badge GUID stands for; none for one the table does not know. +pub fn info(guid: &str) -> Option<&'static BadgeInfo> { + BADGES.get(&guid.to_ascii_lowercase()) +} + +/// The address of a badge's picture (an SVG); none for an unknown badge. +pub fn icon_url(guid: &str) -> Option { + let info = info(guid)?; + Some(format!("{CONTENT}/{}/{}.svg", guid.to_ascii_lowercase(), info.filename)) +} + +/// The records of a CSV text (RFC 4180): fields split at commas; a quoted +/// field may hold commas and line breaks, and `""` for a quote. +fn records(text: &str) -> Vec> { + let mut records = Vec::new(); + let mut record = Vec::new(); + let mut field = String::new(); + let mut quoted = false; + let mut chars = text.chars().peekable(); + while let Some(c) = chars.next() { + match c { + '"' if quoted => { + if chars.next_if_eq(&'"').is_some() { + field.push('"'); + } else { + quoted = false; + } + } + '"' if field.is_empty() => quoted = true, + ',' if !quoted => record.push(std::mem::take(&mut field)), + '\r' if !quoted => {} + '\n' if !quoted => { + record.push(std::mem::take(&mut field)); + records.push(std::mem::take(&mut record)); + } + c => field.push(c), + } + } + if !field.is_empty() || !record.is_empty() { + record.push(field); + records.push(record); + } + records +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn known_badges() { + let info = info("4b27be5a-b92a-4b30-8b2d-14b59653f427").unwrap(); + assert_eq!(info.name, "20th Anniversary"); + assert_eq!(info.description, "Celebrating 20 Years of TeamSpeak"); + assert_eq!(info.filename, "20_years"); + // Upper case on the wire finds it too. + assert_eq!(super::info("4B27BE5A-B92A-4B30-8B2D-14B59653F427"), Some(info)); + assert_eq!( + icon_url("4b27be5a-b92a-4b30-8b2d-14b59653f427").as_deref(), + Some( + "https://badges-content.teamspeak.com/4b27be5a-b92a-4b30-8b2d-14b59653f427/20_years.svg" + ) + ); + } + + #[test] + fn quoted_fields_keep_their_commas() { + let fools = info("05114019-6b46-4b13-b5a1-e5179ef69fb5").unwrap(); + assert_eq!(fools.name, "April Fools!"); + assert_eq!( + fools.description, + "Roses are red, gaming is fun, you are carrying too much to be able to run :(" + ); + assert_eq!(fools.filename, "rpg"); + let stay = info("7a627d47-5496-4d68-83b5-2c4eafff9b30").unwrap(); + assert_eq!(stay.name, "Stay Home, Stay Safe"); + assert_eq!(stay.description, "Playing Apart, Staying Connected"); + let up = info("0cd924ed-c5ea-459e-b60a-4f1bc0b65f07").unwrap(); + assert_eq!(up.filename, "up,_up_and_away!"); + } + + #[test] + fn unknown_badges() { + assert_eq!(info("00000000-0000-0000-0000-000000000000"), None); + assert_eq!(info(""), None); + assert_eq!(icon_url("00000000-0000-0000-0000-000000000000"), None); + } + + #[test] + fn every_row_is_read() { + let rows = include_str!("../data/badges.csv").lines().count() - 1; + assert_eq!(BADGES.len(), rows); + assert!(BADGES.values().all(|b| !b.name.is_empty() && !b.filename.is_empty())); + } + + #[test] + fn csv_records() { + assert_eq!( + records("a,\"b, \"\"c\"\"\",\r\n\"multi\nline\",d"), + [vec!["a", "b, \"c\"", ""], vec!["multi\nline", "d"]] + ); + assert!(records("").is_empty()); + } +} diff --git a/crates/voelin-model/src/lib.rs b/crates/voelin-model/src/lib.rs index 44dd2f8..e77193e 100644 --- a/crates/voelin-model/src/lib.rs +++ b/crates/voelin-model/src/lib.rs @@ -3,6 +3,7 @@ //! Nothing in here does IO; the types describe what a server offers and what //! the user sees. +pub mod badges; mod chat; mod presence; mod server; diff --git a/crates/voelin-ui/src/app.rs b/crates/voelin-ui/src/app.rs index a19373b..15dda55 100644 --- a/crates/voelin-ui/src/app.rs +++ b/crates/voelin-ui/src/app.rs @@ -219,7 +219,8 @@ pub(crate) struct SessionView { pub avatars: HashMap, /// Icons in the engine's cache, by icon id ([`Event::IconReady`]). pub icons: HashMap, - /// Banners in the engine's cache, by address ([`Event::PictureReady`]). + /// Banners and badges in the engine's cache, by address + /// ([`Event::PictureReady`]). pub pictures: HashMap, /// The server's icon id as its voice connection last told it /// ([`Event::ServerDetails`]); kept while disconnected, for the rail. @@ -1062,6 +1063,7 @@ impl App { self.refresh_toolbar(); self.refresh_tree(); self.refresh_chat(); + self.refresh_member_card(); } } Event::Transfer { session, transfer, state } => { diff --git a/crates/voelin-ui/src/dev.rs b/crates/voelin-ui/src/dev.rs index 4321ee5..2e7f13d 100644 --- a/crates/voelin-ui/src/dev.rs +++ b/crates/voelin-ui/src/dev.rs @@ -536,6 +536,9 @@ fn demo_ui(app: &mut App) { clients[5].server_groups = vec![GROUP_MEMBER]; clients[6].server_groups = vec![GROUP_GUEST]; clients[7].server_groups = vec![GROUP_GUEST]; + // myTeamSpeak badges; their pictures arrive below. + clients[0].badges = DEMO_BADGES[..2].iter().map(|g| g.to_string()).collect(); + clients[1].badges = DEMO_BADGES[2..].iter().map(|g| g.to_string()).collect(); for c in clients { p.clients.insert(c.id, c); } @@ -1095,9 +1098,18 @@ const DEMO_SERVER_ICON: u32 = 3_120_211_001; const DEMO_ADMIN_ICON: u32 = 3_120_211_002; const DEMO_MOD_ICON: u32 = 3_120_211_003; const DEMO_MUSIC_ICON: u32 = 3_120_211_004; +/// Real badge GUIDs: 20th Anniversary, TeamSpeak Jedi (Nova's), Gamescom +/// 2019, Pride and Year of the Tiger 2022 (Lumen's). +const DEMO_BADGES: [&str; 5] = [ + "4b27be5a-b92a-4b30-8b2d-14b59653f427", + "64221fd1-706c-4bb2-ba55-996c39effa79", + "b82a45a5-b235-4926-be77-de102222e5eb", + "ceee2445-4fbf-4f06-9421-286f0f4e875a", + "92356386-0451-4a97-87d9-10ff4f43260c", +]; -/// Avatars, icons and banners as the engine reports them once they are in -/// its cache (here a folder of synthetic pictures in the temporary +/// Avatars, icons, banners and badges as the engine reports them once they +/// are in its cache (here a folder of synthetic pictures in the temporary /// directory). fn demo_pictures(app: &mut App) { let session = DEMO as u64; @@ -1134,6 +1146,19 @@ fn demo_pictures(app: &mut App) { let path = save(&icon.to_string(), demo_icon(color, shape)); events.push(Event::IconReady { session, icon, path }); } + // Stand-ins for the badges' pictures on TeamSpeak's server. + let badge_looks = [ + ([242, 178, 44], Shape::Ring), + ([90, 170, 255], Shape::Moon), + ([45, 196, 132], Shape::Diamond), + ([240, 110, 160], Shape::Disc), + ([255, 140, 90], Shape::Diamond), + ]; + for (guid, (color, shape)) in DEMO_BADGES.into_iter().zip(badge_looks) { + let Some(url) = voelin_model::badges::icon_url(guid) else { continue }; + let path = save(&format!("badge-{guid}"), demo_icon(color, shape)); + events.push(Event::PictureReady { session, url, path }); + } // Some people have pictures, the rest initials. for (sample_session, uid, seed) in [ (session, "demo-2", 1), diff --git a/crates/voelin-ui/src/members.rs b/crates/voelin-ui/src/members.rs index 2023eed..8a24742 100644 --- a/crates/voelin-ui/src/members.rs +++ b/crates/voelin-ui/src/members.rs @@ -53,6 +53,7 @@ impl App { .filter_map(|g| view.server_groups.iter().find(|i| i.id == *g)) .map(|g| g.name.clone().into()) .collect(); + let badges = vm::tree::badge_items(&client.badges, &view.pictures); Some(MemberCard { open: true, id: i32::from(id), @@ -63,6 +64,7 @@ impl App { status: vm::tree::status_of(client, view.talking.contains(&id)).into(), description: client.description.clone().unwrap_or_default().into(), groups: crate::app::model(groups), + badges: crate::app::model(badges), country: client.country.clone().unwrap_or_default().into(), talk_power: client.talk_power, friend: contact.is_some_and(|c| c.relation == Relation::Friend), diff --git a/crates/voelin-ui/src/vm/tree.rs b/crates/voelin-ui/src/vm/tree.rs index 41d05b4..7189ae5 100644 --- a/crates/voelin-ui/src/vm/tree.rs +++ b/crates/voelin-ui/src/vm/tree.rs @@ -6,10 +6,11 @@ use std::path::PathBuf; pub use voelin_model::channel_title; use voelin_model::{ - BannerMode, ChannelId, ChannelInfo, ClientInfo, GroupInfo, Presence, Spacer, TreeRow, tree_rows, + BannerMode, ChannelId, ChannelInfo, ClientInfo, GroupInfo, Presence, Spacer, TreeRow, badges, + tree_rows, }; -use crate::app::{MemberItem, TreeItem}; +use crate::app::{BadgeItem, MemberItem, TreeItem}; use crate::settings::ClientPlaybackMap; use crate::vm::avatar; @@ -27,6 +28,31 @@ pub fn banner(pictures: &HashMap, url: Option<&str>) -> slint:: avatar::image(url.and_then(|u| pictures.get(u))) } +/// A badge's picture, if the engine fetched it. +fn badge_icon(pictures: &HashMap, guid: &str) -> slint::Image { + avatar::image(badges::icon_url(guid).and_then(|url| pictures.get(&url))) +} + +/// A client's badges for the member card: the first three in its order. +/// One the app does not know is "Badge", with its GUID as description. +pub fn badge_items(guids: &[String], pictures: &HashMap) -> Vec { + guids + .iter() + .take(badges::SHOWN) + .map(|guid| { + let (name, description) = match badges::info(guid) { + Some(info) => (info.name.as_str(), info.description.as_str()), + None => ("Badge", guid.as_str()), + }; + BadgeItem { + name: name.into(), + description: description.into(), + icon: badge_icon(pictures, guid), + } + }) + .collect() +} + /// What the tree shows besides the presence. pub struct TreeInput<'a> { pub presence: &'a Presence, @@ -43,7 +69,7 @@ pub struct TreeInput<'a> { /// Icons in the engine's cache, by icon id (channel, group and client /// icons). pub icons: &'a HashMap, - /// Banner pictures in the engine's cache, by address. + /// Banners and badges in the engine's cache, by address. pub pictures: &'a HashMap, /// The server groups in display order; members are grouped by the /// first one each client is in. @@ -77,6 +103,18 @@ impl TreeInput<'_> { .collect() } + /// The pictures of the badges a client shows that arrived, in its + /// order; empty slots last. + fn badges(&self, client: &ClientInfo) -> [slint::Image; badges::SHOWN] { + let mut icons = client + .badges + .iter() + .take(badges::SHOWN) + .map(|guid| badge_icon(self.pictures, guid)) + .filter(|i| i.size().width > 0); + std::array::from_fn(|_| icons.next().unwrap_or_default()) + } + /// The group a client is sorted under: the first of its server groups /// in display order. fn group_of(&self, client: &ClientInfo) -> Option<&GroupInfo> { @@ -178,6 +216,7 @@ pub fn rows(input: &TreeInput) -> Vec { .copied() .unwrap_or_default(); let mut icons = input.client_icons(client).into_iter(); + let [badge, badge_2, badge_3] = input.badges(client); TreeItem { is_channel: false, depth: depth as i32, @@ -197,6 +236,9 @@ pub fn rows(input: &TreeInput) -> Vec { icon: icons.next().unwrap_or_default(), icon_2: icons.next().unwrap_or_default(), icon_3: icons.next().unwrap_or_default(), + badge, + badge_2, + badge_3, ..Default::default() } } @@ -279,6 +321,7 @@ impl TreeInput<'_> { Some(channel) if elsewhere => format!("In {}", channel_title(channel).0), _ => status_of(c, talking), }; + let [badge, badge_2, badge_3] = self.badges(c); MemberItem { id: c.id as i32, name: c.nickname.clone().into(), @@ -303,6 +346,9 @@ impl TreeInput<'_> { commander: c.channel_commander, recording: c.recording, talk_power: c.talk_power, + badge, + badge_2, + badge_3, } } } @@ -536,6 +582,46 @@ mod tests { std::fs::remove_dir_all(dir).unwrap(); } + /// A client's badges: the first three in its order, on the card by name + /// ("Badge" for one the app does not know), in the rows the pictures + /// that arrived. + #[test] + fn badges_on_the_card_and_in_rows() { + let dir = std::env::temp_dir().join(format!("voelin-tree-badges-{}", std::process::id())); + std::fs::create_dir_all(&dir).unwrap(); + let guids: Vec = [ + "4b27be5a-b92a-4b30-8b2d-14b59653f427", + "00000000-0000-0000-0000-000000000000", + "05114019-6b46-4b13-b5a1-e5179ef69fb5", + "2bf80270-8efe-46dc-a472-3280a0479145", + ] + .map(String::from) + .into(); + let picture = |i: usize, width| { + (badges::icon_url(&guids[i]).unwrap(), picture_file(&dir, &format!("badge-{i}"), width)) + }; + let e = Extras { + pictures: HashMap::from([picture(0, 3), picture(2, 5), picture(3, 7)]), + ..Default::default() + }; + let width = |i: &slint::Image| i.size().width; + let card = badge_items(&guids, &e.pictures); + let names: Vec<_> = card.iter().map(|b| b.name.as_str()).collect(); + assert_eq!(names, ["20th Anniversary", "Badge", "April Fools!"]); + assert_eq!(card[1].description.as_str(), guids[1]); + assert_eq!(card.iter().map(|b| width(&b.icon)).collect::>(), [3, 0, 5]); + + let mut p = presence(); + p.clients.get_mut(&11).unwrap().badges = guids; + let (t, c, pb) = (HashSet::new(), HashSet::new(), ClientPlaybackMap::new()); + let tree = input(&p, &t, &c, &pb, "", &e); + let bob = rows(&tree).into_iter().find(|r| !r.is_channel && r.id == 11).unwrap(); + assert_eq!([&bob.badge, &bob.badge_2, &bob.badge_3].map(width), [3, 5, 0]); + let bob = members(&tree).into_iter().find(|m| m.id == 11).unwrap(); + assert_eq!([&bob.badge, &bob.badge_2, &bob.badge_3].map(width), [3, 5, 0]); + std::fs::remove_dir_all(dir).unwrap(); + } + #[test] fn spacer_rows_keep_tree_identity() { let mut p = presence(); diff --git a/crates/voelin-ui/ui/bridge.slint b/crates/voelin-ui/ui/bridge.slint index 594ab03..57e3b9c 100644 --- a/crates/voelin-ui/ui/bridge.slint +++ b/crates/voelin-ui/ui/bridge.slint @@ -62,6 +62,11 @@ export struct TreeItem { icon: image, icon-2: image, icon-3: image, + // A client's badges (myTeamSpeak), the first three in its order, empty + // where absent; shown after the name. + badge: image, + badge-2: image, + badge-3: image, // A channel's banner picture (TeamSpeak 6), drawn behind the row; // Wire sizing metadata; compact decorative backgrounds always cover. banner: image, @@ -103,6 +108,18 @@ export struct MemberItem { recording: bool, // `client_talk_power`; shown when the channel needs it. talk-power: int, + // myTeamSpeak badges, as in `TreeItem`. + badge: image, + badge-2: image, + badge-3: image, +} + +// A myTeamSpeak badge on the member card: "Badge" and its GUID for one +// the app does not know; its picture is empty until it is downloaded. +export struct BadgeItem { + name: string, + description: string, + icon: image, } // The member card over a member row: everything about one client and what @@ -118,6 +135,8 @@ export struct MemberCard { description: string, // Server groups, one per line. groups: [string], + // The badges the client shows (at most three, in its order). + badges: [BadgeItem], country: string, talk-power: int, friend: bool, diff --git a/crates/voelin-ui/ui/components/badge.slint b/crates/voelin-ui/ui/components/badge.slint index b5e1a02..cca5970 100644 --- a/crates/voelin-ui/ui/components/badge.slint +++ b/crates/voelin-ui/ui/components/badge.slint @@ -53,6 +53,8 @@ export component LiveBadge inherits Rectangle { export component Chip inherits Rectangle { in property text; in property icon; + // A picture in its own colours (a badge's), instead of a tinted icon. + in property picture; in property tint: Theme.text-secondary; in property fill: Theme.surface-3; in property outlined; @@ -76,6 +78,14 @@ export component Chip inherits Rectangle { tint: root.tint; y: (parent.height - self.height) / 2; } + if root.picture.width > 0: Image { + source: root.picture; + width: 14px; + height: 14px; + image-fit: contain; + y: (parent.height - self.height) / 2; + accessible-role: AccessibleRole.none; + } Text { text: root.text; color: root.tint; @@ -86,6 +96,37 @@ export component Chip inherits Rectangle { } } +// Up to three badge pictures in their own colours, 14 px high, after a +// name; empty ones take no room. +export component BadgeIcons inherits HorizontalLayout { + in property first; + in property second; + in property third; + spacing: 2px; + cross-axis-alignment: center; + Image { + source: root.first; + width: root.first.width > 0 ? 14px : 0px; + height: 14px; + image-fit: contain; + accessible-role: AccessibleRole.none; + } + Image { + source: root.second; + width: root.second.width > 0 ? 14px : 0px; + height: 14px; + image-fit: contain; + accessible-role: AccessibleRole.none; + } + Image { + source: root.third; + width: root.third.width > 0 ? 14px : 0px; + height: 14px; + image-fit: contain; + accessible-role: AccessibleRole.none; + } +} + // A coloured dot (online, connection state). export component Dot inherits Rectangle { in property size: 8px; diff --git a/crates/voelin-ui/ui/components/index.slint b/crates/voelin-ui/ui/components/index.slint index f07d22a..79a0a21 100644 --- a/crates/voelin-ui/ui/components/index.slint +++ b/crates/voelin-ui/ui/components/index.slint @@ -10,7 +10,7 @@ export { Slider } from "slider.slint"; export { SegmentedTabs, TabItem } from "tabs.slint"; export { Status, Avatar } from "avatar.slint"; export { BannerPicture } from "banner-picture.slint"; -export { CountBadge, LiveBadge, Chip, Dot } from "badge.slint"; +export { CountBadge, LiveBadge, Chip, BadgeIcons, Dot } from "badge.slint"; export { SectionHeader, Card, Divider, Banner } from "card.slint"; export { Meter, SpeakingBars } from "meter.slint"; export { NavItem, ListItem } from "list-item.slint"; diff --git a/crates/voelin-ui/ui/screens/channels.slint b/crates/voelin-ui/ui/screens/channels.slint index f4a9541..c53e189 100644 --- a/crates/voelin-ui/ui/screens/channels.slint +++ b/crates/voelin-ui/ui/screens/channels.slint @@ -6,7 +6,7 @@ import { Theme } from "../theme.slint"; import { Icons } from "../icons.slint"; import { Bridge, TreeItem } from "../bridge.slint"; import { Nav } from "../nav.slint"; -import { Icon, Button, ButtonKind, IconButton, Avatar, LiveBadge, Chip, SectionHeader, SpeakingBars, PopupMenu, MenuEntry, ListView, BannerPicture } from "../components/index.slint"; +import { Icon, Button, ButtonKind, IconButton, Avatar, LiveBadge, Chip, BadgeIcons, SectionHeader, SpeakingBars, PopupMenu, MenuEntry, ListView, BannerPicture } from "../components/index.slint"; // The banner at the top of the sidebar: server name, counts, a menu. export component ServerHeader inherits Rectangle { @@ -257,14 +257,22 @@ component TreeRow inherits Rectangle { label: item.name; } } + // The name elides first; its badges follow it, then the free room. Text { text: item.name; color: item.away ? Theme.text-muted : item.myself ? Theme.accent-text : Theme.text-secondary; font-weight: item.myself ? Theme.weight-semibold : Theme.weight-regular; vertical-alignment: center; - horizontal-stretch: 1; + horizontal-stretch: 0; overflow: elide; } + BadgeIcons { + horizontal-stretch: 1; + alignment: start; + first: item.badge; + second: item.badge-2; + third: item.badge-3; + } if item.talking: VerticalLayout { alignment: center; SpeakingBars { } diff --git a/crates/voelin-ui/ui/screens/members.slint b/crates/voelin-ui/ui/screens/members.slint index b494cf5..28e3c33 100644 --- a/crates/voelin-ui/ui/screens/members.slint +++ b/crates/voelin-ui/ui/screens/members.slint @@ -6,7 +6,7 @@ import { Theme } from "../theme.slint"; import { Icons } from "../icons.slint"; import { Bridge, MemberItem } from "../bridge.slint"; import { Nav } from "../nav.slint"; -import { Icon, IconButton, Button, ButtonKind, Avatar, Status, LiveBadge, Chip, Divider, Slider, SpeakingBars, Tooltip, SearchBox, ListView } from "../components/index.slint"; +import { Icon, IconButton, Button, ButtonKind, Avatar, Status, LiveBadge, Chip, BadgeIcons, Divider, Slider, SpeakingBars, Tooltip, SearchBox, ListView } from "../components/index.slint"; // Crown, priority speaker, channel commander, recording. component MemberBadges inherits HorizontalLayout { @@ -118,6 +118,11 @@ export component MemberRow inherits Rectangle { member: member; y: (parent.height - self.height) / 2; } + BadgeIcons { + first: member.badge; + second: member.badge-2; + third: member.badge-3; + } } HorizontalLayout { spacing: Theme.space-2; @@ -251,6 +256,30 @@ export component MemberCardPopup inherits Rectangle { overflow: elide; } } + // myTeamSpeak badges; each tells what it is for on hover. + if Bridge.member-card.badges.length > 0: VerticalLayout { + spacing: Theme.space-2; + Text { + text: @tr("Badges"); + color: Theme.text-muted; + font-size: Theme.font-xs; + font-weight: Theme.weight-semibold; + } + // Chips that do not fit go on the next line. + FlexboxLayout { + spacing: Theme.space-2; + for badge in Bridge.member-card.badges: Tooltip { + text: badge.description; + width: chip.width; + height: chip.height; + chip := Chip { + text: badge.name; + picture: badge.icon; + outlined: true; + } + } + } + } HorizontalLayout { spacing: Theme.space-2; alignment: start; diff --git a/docs/architecture.md b/docs/architecture.md index 6b660ab..92e977d 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -161,7 +161,9 @@ platform, version and priority speaker dimming; the server and channel groups `Event::ServerDetails` and `Event::Groups` come when those parts change. Gateway and query presence fill what their rows have. The new fields are optional in JSON, so gateways and clients of different versions still -understand each other. +understand each other. Badges are GUIDs: `voelin_model::badges` names them +from a table and gives the address of their pictures on TeamSpeak's server, +which the engine fetches like web banners. ## Files, avatars and icons diff --git a/docs/ui.md b/docs/ui.md index 5243b47..4f85260 100644 --- a/docs/ui.md +++ b/docs/ui.md @@ -111,7 +111,8 @@ puts them on an inner `face`). | `Avatar` | avatar.slint | `image` or `initials` + `tint`, `size`, `status` (`Status.online/idle/dnd/offline/info`), `speaking` (green ring), `crown`, `square` (server icons) | | `CountBadge` | badge.slint | count bubble: `count`, `fill` (red), `ink` (the number) | | `LiveBadge` | badge.slint | `text` (LIVE), `large` | -| `Chip` | badge.slint | tag: `text`, `icon`, `tint`, `fill`, `outlined` | +| `Chip` | badge.slint | tag: `text`, `icon`, `picture` (in its own colours, a badge's), `tint`, `fill`, `outlined` | +| `BadgeIcons` | badge.slint | up to three 14 px pictures after a name (`first`, `second`, `third`); empty ones take no room | | `Dot` | badge.slint | a status dot | | `Card` | card.slint | panel card with optional `title`, `icon`, `subtitle`, `selected`; `inset`, `gap` | | `SectionHeader` | card.slint | `text`, `icon`, `count`, `action` ("See All >"), `small`; `action-clicked` | @@ -145,8 +146,8 @@ comes from the engine's events; what a gateway adds is hidden without it. | Part | `VOELIN_OPEN` | What it shows | Engine data | |---|---|---|---| | Chat | `server` | Header with Pinned Messages, Topics, the voice channel and the members button; chat tabs; messages grouped by author ("Today at 10:14"), avatars, emoji, reactions with an add button, pin and topic marks, file cards with download; composer with attach, emoji and send. Opens at the newest message and follows new ones while at the end | `ChatHistory` (and `Chat` for servers without history), `AvatarReady`, `Transfer`, `Gateway` (pins; reactions arrive as stored messages); `Command::LoadOlderHistory`, `DownloadChatFile`, `UploadFile`, `GatewayRequest::React`, `Unreact`, `Pin`, `Unpin` | -| Members panel | `server` (`panel`, `no-panel`) | "Members — N" and a search; those streaming first (the people in our channel while the voice channel or a stream is shown), then each server group in the server's order with its icon, then those without a group. Rows: avatar with status, name, crown (admin groups), priority speaker, channel commander, recording, moderator role, talk power, what they do or the channel they are in. Resizable: the width is `ui.members_width` | `Presence`, `Groups`, `Talking`, `IconReady` | -| Member card | `member` | Description, groups, talk power, country; private message, poke, friend, block; volume and mute for us | `ContactsChanged`; `Command::SetContact`, `SetClientVolume`, `SetClientMuted`, `Poke` | +| Members panel | `server` (`panel`, `no-panel`) | "Members — N" and a search; those streaming first (the people in our channel while the voice channel or a stream is shown), then each server group in the server's order with its icon, then those without a group. Rows: avatar with status, name, crown (admin groups), priority speaker, channel commander, recording, up to three myTeamSpeak badges, moderator role, talk power, what they do or the channel they are in. Resizable: the width is `ui.members_width` | `Presence`, `Groups`, `Talking`, `IconReady`, `PictureReady` | +| Member card | `member` | Description, groups, badges (up to three chips in the client's order, what each is for on hover; "Badge" for one the app does not know), talk power, country; private message, poke, friend, block; volume and mute for us | `ContactsChanged`, `PictureReady` (badges); `Command::SetContact`, `SetClientVolume`, `SetClientMuted`, `Poke` | | Poke | `poke` (the first other member's, card open; after `friends` a contact's) | `PokeDialog`, from the member card, a friend's row and the direct message header: an optional message with a "12/100" count, Send off above 100 characters, Enter sends, Escape cancels | `Command::Poke` (trimmed, cut to 100 characters; the engine cuts too) | | Channel password | `channel-password`, `channel-password:wrong` | Joining a channel (a double-click in the tree, joining a friend) moves there with voice, or connects into it (by its id) without; when the server puts us elsewhere on connecting, as it does for a wrong password, it is joined again, which says why. A locked channel first asks for its password in `ChannelPasswordDialog`, unless one was given since voice connected; a refused one asks again under "Wrong password". A full channel or another refusal is a toast | `Presence` (`has_password`), `JoinFailed`; `Command::MoveToChannel`, `ConnectVoice` (`channel_password`) | | Pinned messages | `pins` | In the members panel's place: cards with author, time, text, files and reactions; the pin unpins, a click jumps to the message | `Gateway` `Pins`, `Pinned`, `Unpinned`; `GatewayRequest::Pins`, `Unpin` | @@ -494,7 +495,19 @@ profile requires account setup before the server list, so no fresh-profile network capture was obtained. These observations do not establish that every server or client version lacks a pre-login mechanism. -The engine downloads banners only while `cache.fetch_images` is enabled. +Badges arrive as GUIDs (`client_badges`). Their names and descriptions come +from a table in `voelin-model` (`badges::info`, tsclientlib's list and the +newer entries of TeamSpeak's own, `https://badges-content.teamspeak.com/list`, +as of October 2026); newer badges show as "Badge". Their pictures are SVGs +on TeamSpeak's server (`https://badges-content.teamspeak.com//.svg`, +`badges::icon_url`), fetched like web banners for the first three badges of +each client in the presence shown, and reported with `PictureReady`. A +client's tree row shows the pictures that arrived right after the name (its +group and client icons stay at the end); so does its row in the members +panel. + +The engine downloads banners and badges only while `cache.fetch_images` is +enabled. Banners on the web (`http`, `https`) come from their host; banners in the server's own files, linked as `ts3image://` (TeamSpeak 5 and 6: `ts3image://?port=…&channel=…&path=…&filename=…`, the file browser's