Kick, ban and set groups from the Android client sheet, with a ban list
The client sheet offers kicking from the channel or the server (asking to confirm, with an optional reason), banning with a reason and duration, and the client's server groups and channel group. The server sheet opens the ban list: search, own bans only, and adding, editing and deleting bans, with the reason presets the desktop keeps. Kick and ban powers, like move power, never come with the needed permissions, so core now asks for all four in one piped permget. The ban permission checks, a ban's summary, the duration units, the group choices for a client and the kick reason limit move into core, and Swing uses them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import com.ts3client.contacts.ContactType;
|
||||
import com.ts3client.net.ChannelNode;
|
||||
import com.ts3client.net.ClientEntry;
|
||||
import com.ts3client.net.Group;
|
||||
import com.ts3client.net.GroupChoice;
|
||||
import com.ts3client.net.ServerModel;
|
||||
|
||||
import javax.swing.JCheckBoxMenuItem;
|
||||
@@ -128,12 +129,12 @@ final class ClientMenu {
|
||||
menu.add(dialog);
|
||||
menu.addSeparator();
|
||||
|
||||
for (Group g : model.allServerGroups()) {
|
||||
boolean assigned = client.inServerGroup(g.id);
|
||||
if (!model.canToggleGroup(g, assigned)) continue;
|
||||
for (GroupChoice choice : model.serverGroupChoices(client)) {
|
||||
if (!choice.allowed()) continue;
|
||||
Group g = choice.group();
|
||||
JCheckBoxMenuItem item = new JCheckBoxMenuItem(g.name, groupIcons.iconOf(g));
|
||||
item.setSelected(assigned);
|
||||
item.addActionListener(a -> actions.setClientServerGroup(client, g, !assigned));
|
||||
item.setSelected(choice.assigned());
|
||||
item.addActionListener(a -> actions.setClientServerGroup(client, g, !choice.assigned()));
|
||||
menu.add(item);
|
||||
}
|
||||
return menu;
|
||||
@@ -144,12 +145,11 @@ final class ClientMenu {
|
||||
JMenu menu = new JMenu("Set Channel Group");
|
||||
menu.setIcon(Icons.of("PERMISSIONS_CHANNEL_GROUPS"));
|
||||
int defaultGroupId = model.defaultChannelGroupId();
|
||||
for (Group g : model.allChannelGroups()) {
|
||||
if (g.id == defaultGroupId) continue;
|
||||
boolean assigned = client.channelGroupId == g.id;
|
||||
if (!model.canToggleGroup(g, assigned)) continue;
|
||||
for (GroupChoice choice : model.channelGroupChoices(client)) {
|
||||
Group g = choice.group();
|
||||
if (g.id == defaultGroupId || !choice.allowed()) continue;
|
||||
JCheckBoxMenuItem item = new JCheckBoxMenuItem(g.name, groupIcons.iconOf(g));
|
||||
item.setSelected(assigned);
|
||||
item.setSelected(choice.assigned());
|
||||
item.addActionListener(a -> actions.setClientChannelGroup(client, g));
|
||||
menu.add(item);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user