Replace the chat target dropdown with a tab strip along the bottom of the chat panel: a Server and a Channel tab plus one closable tab per private chat, each with its own log and an unread marker. Render logs and channel/client descriptions as HTML through a new BBCode renderer in core, supporting b/i/u/s, color, size, url, center and lists, with auto-linked bare URLs. Input is escaped and tag values validated, so server-supplied text cannot inject markup or unsafe schemes. Sender names and TeamSpeak's own client:// links open the same context menu as the server tree (menus extracted into ClientMenu/ChannelMenu); channel:// links open the channel menu. Links are styled by CSS class: identities bold in the author colour, other TS protocols plain, and links leaving the client underlined so they cannot be mistaken for an identity. Dragging a client or channel out of the tree yields the TS3 link BBCode. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
28 lines
911 B
Java
28 lines
911 B
Java
package com.ts3client.ui;
|
|
|
|
import javax.swing.JOptionPane;
|
|
import java.awt.Component;
|
|
import java.awt.Desktop;
|
|
import java.net.URI;
|
|
|
|
/** Opens http(s) links from chat messages and descriptions in the system browser. */
|
|
final class Links {
|
|
|
|
private Links() {
|
|
}
|
|
|
|
static void open(String href, Component parent) {
|
|
try {
|
|
URI uri = new URI(href);
|
|
String scheme = uri.getScheme() == null ? "" : uri.getScheme().toLowerCase();
|
|
if (!scheme.equals("http") && !scheme.equals("https") && !scheme.equals("ftp")) return;
|
|
if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
|
|
Desktop.getDesktop().browse(uri);
|
|
return;
|
|
}
|
|
} catch (Exception ignored) {
|
|
}
|
|
JOptionPane.showInputDialog(parent, "Could not open the link. Copy it instead:", href);
|
|
}
|
|
}
|