Kick and ban clients from the context menu
The client menu gains "Kick Client from Channel", "Kick Client from Server" and "Ban Client", each asking for a reason first. Kicks use a shared prompt that enforces the protocol's 40-character limit; the ban dialog adds a duration, whose unit dropdown ends in "Permanent" — the zero-length ban the server understands. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -340,6 +340,32 @@ final class ServerTab implements ConnectionListener, ServerTreePanel.Actions {
|
||||
if (msg != null) conn.poke(client.id, msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void kickClientFromChannel(ClientEntry client) {
|
||||
String reason = kickReason("Kick Client from Channel", client);
|
||||
if (reason != null) conn.kickFromChannel(client.id, reason);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void kickClientFromServer(ClientEntry client) {
|
||||
String reason = kickReason("Kick Client from Server", client);
|
||||
if (reason != null) conn.kickFromServer(client.id, reason);
|
||||
}
|
||||
|
||||
private String kickReason(String title, ClientEntry client) {
|
||||
if (!conn.isConnected()) return null;
|
||||
return ReasonDialog.prompt(host, title, "Reason for kicking " + client.nickname + ":",
|
||||
ReasonDialog.KICK_REASON_LIMIT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void banClient(ClientEntry client) {
|
||||
if (!conn.isConnected()) return;
|
||||
BanDialog dialog = new BanDialog(host, client.nickname);
|
||||
dialog.setVisible(true);
|
||||
if (dialog.isConfirmed()) conn.banClient(client.id, dialog.getSeconds(), dialog.getReason());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toggleClientMute(ClientEntry client) {
|
||||
if (conn.getPlayback() == null) return;
|
||||
|
||||
Reference in New Issue
Block a user