Link the clients and channels named in server log lines
Log lines now name clients and channels with TeamSpeak's own client:// and channel:// links, the same ones a dragged-in reference produces, so the chat log's existing handling turns them into the context menus. The log is rendered with a links-only pass rather than the full BBCode renderer: its lines are assembled by the client itself, so nothing else in them should be interpreted — a channel called "[b]VIP" stays literal. Channels we no longer have (a deleted one) are still named in plain text. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -190,10 +190,14 @@ public final class ChatPanel extends JPanel {
|
||||
+ BBCode.escape(text) + "</span>"));
|
||||
}
|
||||
|
||||
/** Server-side events (client joins/leaves/moves, group changes, channel edits, …). */
|
||||
/**
|
||||
* Server-side events (client joins/leaves/moves, group changes, channel edits, …).
|
||||
* These lines name clients and channels with TeamSpeak's own links, which stay
|
||||
* clickable here — everything else in them is literal text.
|
||||
*/
|
||||
public void appendServerLog(String text) {
|
||||
edt(() -> serverTab.appendLine("<span style=\"color:" + hex(Theme.CHANNEL_TEXT) + "\">" + stamp()
|
||||
+ BBCode.escape(text) + "</span>"));
|
||||
+ BBCode.linksToHtml(text) + "</span>"));
|
||||
}
|
||||
|
||||
public void appendServerMessage(int fromId, String from, String text) {
|
||||
@@ -318,6 +322,10 @@ public final class ChatPanel extends JPanel {
|
||||
// Client references look exactly like a message author's name.
|
||||
css.addRule("a." + BBCode.IDENTITY_LINK_CLASS
|
||||
+ " { color:" + hex(Theme.CHAT_NAME) + "; font-weight:bold; text-decoration:none; }");
|
||||
// Channel (and other TeamSpeak protocol) references, which the log leans on
|
||||
// heavily: same weight as the text around them, but their own colour.
|
||||
css.addRule("a." + BBCode.TS_LINK_CLASS
|
||||
+ " { color:" + hex(Theme.CHAT_NAME) + "; text-decoration:none; }");
|
||||
// External links are underlined so they can't be mistaken for an identity.
|
||||
css.addRule("a." + BBCode.EXTERNAL_LINK_CLASS
|
||||
+ " { color:" + hex(Theme.LINK) + "; text-decoration:underline; }");
|
||||
|
||||
Reference in New Issue
Block a user