Add the Tools > Ban List window

Reimplements the official client's ban list: a searchable table of the
server's bans with Add / Remove / Edit, an own-ban filter and highlight,
choosable columns, and the Add/Edit dialog whose IP and name patterns
can be read as IPv4/IPv6 wildcards, fixed strings or regular expressions
(translated to the regexes banadd takes exactly as the official client
does). Editing is add-then-delete, since the protocol has no banedit.

The ban list is read from the notifybanlist burst that answers banlist,
like channelpermlist. The menu item is only shown where the server grants
b_client_ban_list.

Also fixes ServerModel numbering permissions from 0 instead of 1, which
had every selfPermissionValue() lookup reading the neighbouring
permission — including the group-assignment menus.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-17 23:00:18 +00:00
parent 636090d075
commit 22e0304f25
20 changed files with 1705 additions and 44 deletions

View File

@@ -3,6 +3,7 @@ package com.ts3client.ui;
import com.ts3client.audio.AudioBackend;
import com.ts3client.audio.desktop.DesktopAudioBackend;
import com.ts3client.config.AwayMessages;
import com.ts3client.config.BanReasonPresets;
import com.ts3client.config.Bookmark;
import com.ts3client.config.Bookmarks;
import com.ts3client.config.IdentityStore;
@@ -55,6 +56,7 @@ public final class MainFrame extends JFrame implements ServerTabPane.Listener {
/** The tab whose views are on screen. */
private ServerTab selected;
private BanReasonPresets banReasonPresets;
/** The tab that owns the capture device; null when nobody is capturing. */
private ServerTab micTab;
@@ -191,6 +193,16 @@ public final class MainFrame extends JFrame implements ServerTabPane.Listener {
showIdentities();
}
@Override
public boolean canViewBanList() {
return selected != null && selected.canViewBanList();
}
@Override
public void onShowBanList() {
if (selected != null) selected.showBanList(banReasonPresets());
}
@Override
public void onShowSettings() {
showSettings();
@@ -743,6 +755,12 @@ public final class MainFrame extends JFrame implements ServerTabPane.Listener {
System.exit(0);
}
/** Loaded the first time a ban dialog needs them, and shared by every tab from then on. */
private BanReasonPresets banReasonPresets() {
if (banReasonPresets == null) banReasonPresets = BanReasonPresets.load();
return banReasonPresets;
}
private void showIdentities() {
new IdentitiesDialog(this, identities, settings, bookmarks, null).setVisible(true);
}