Add the contact list (friends, blocked, neutral)
Mirrors the TeamSpeak 3 client's Contacts: clients can be filed as friend,
blocked or neutral from their context menu or by dragging them into the
Contacts window, given a custom and phonetic nickname, shown under either
name or both, and per contact muted automatically, ignored in server/channel
or private chat and pokes, have their away message hidden and whispers
allowed or denied. Friends are green and blocked clients red in the tree
(optional), new contacts start from per-type defaults ("Set Defaults"), and
the global whisper policy lives in Options -> Contacts. "Change Volume..."
adds a per-client dB gain that a contact entry remembers.
Contacts are stored in ~/.ts3jclient/contacts.txt using the exact record
format the official client keeps in the Contacts table of its settings.db
(field names and codes recovered from the binary), so entries move between
the two verbatim. A small read-only pure-Java SQLite reader imports the
official client's list on first run and on demand, without a driver.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
package com.ts3client.ui;
|
||||
|
||||
import com.ts3client.config.Settings;
|
||||
import com.ts3client.contacts.ContactStore;
|
||||
import com.ts3client.contacts.ContactType;
|
||||
import com.ts3client.net.ChannelNode;
|
||||
import com.ts3client.net.ChannelSettings;
|
||||
import com.ts3client.net.ClientEntry;
|
||||
@@ -106,6 +109,20 @@ public final class ServerTreePanel extends JScrollPane {
|
||||
|
||||
/** A new nickname for ourselves, typed into the tree row. */
|
||||
void renameSelf(String nickname);
|
||||
|
||||
/** Files a client in the contact list as a friend, blocked or neutral. */
|
||||
void addContact(ClientEntry client, ContactType type);
|
||||
|
||||
/** Opens the contact list at this client's entry. */
|
||||
void editContact(ClientEntry client);
|
||||
|
||||
void removeContact(ClientEntry client);
|
||||
|
||||
/** The type a client is filed under, or {@code null} for a client that is no contact. */
|
||||
ContactType contactTypeOf(ClientEntry client);
|
||||
|
||||
/** Opens the per-client volume dialog. */
|
||||
void changeClientVolume(ClientEntry client);
|
||||
}
|
||||
|
||||
private final DropIndicatorTree tree;
|
||||
@@ -134,7 +151,8 @@ public final class ServerTreePanel extends JScrollPane {
|
||||
private final NicknameCellEditor nicknameEditor;
|
||||
private int selfClientId = -1;
|
||||
|
||||
public ServerTreePanel(ServerModel model, GroupIcons groupIcons, Actions actions) {
|
||||
public ServerTreePanel(ServerModel model, GroupIcons groupIcons, ContactStore contacts, Settings settings,
|
||||
Actions actions) {
|
||||
this.model = model;
|
||||
this.groupIcons = groupIcons;
|
||||
this.actions = actions;
|
||||
@@ -153,7 +171,7 @@ public final class ServerTreePanel extends JScrollPane {
|
||||
tree.setRowHeight(20);
|
||||
tree.setBackground(Theme.treeBg());
|
||||
tree.setFont(Theme.uiFont());
|
||||
ServerTreeCellRenderer renderer = new ServerTreeCellRenderer(id -> id == selfClientId);
|
||||
ServerTreeCellRenderer renderer = new ServerTreeCellRenderer(id -> id == selfClientId, contacts, settings);
|
||||
tree.setCellRenderer(renderer);
|
||||
nicknameEditor = NicknameCellEditor.create(tree, renderer, id -> id == selfClientId);
|
||||
tree.setCellEditor(nicknameEditor);
|
||||
|
||||
Reference in New Issue
Block a user