Let chat logs be turned off or kept elsewhere
Chat logs always went into the TeamSpeak 3 client's own folder. A new Chat page in Options can turn them off, or point them at another folder; left empty, they are still shared with the TeamSpeak 3 client. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -183,6 +183,11 @@ public final class Settings {
|
||||
/** Whose whispers are played. */
|
||||
public WhisperPolicy whisperPolicy = WhisperPolicy.ALLOW_UNLESS_DENIED;
|
||||
|
||||
/** Keep chat logs, and show their history when a chat opens. */
|
||||
public boolean chatLogs = true;
|
||||
/** Where chat logs go; empty for the TeamSpeak 3 client's own folder, so both share them. */
|
||||
public String chatLogDir = "";
|
||||
|
||||
public static Settings load() {
|
||||
Settings s = new Settings();
|
||||
try {
|
||||
@@ -271,6 +276,8 @@ public final class Settings {
|
||||
contactDefaults.load(props);
|
||||
colorContacts = parseB(props.getProperty("colorContacts"), colorContacts);
|
||||
whisperPolicy = parseEnum(WhisperPolicy.class, props.getProperty("whisperPolicy"), whisperPolicy);
|
||||
chatLogs = parseB(props.getProperty("chatLogs"), chatLogs);
|
||||
chatLogDir = props.getProperty("chatLogDir", chatLogDir);
|
||||
}
|
||||
|
||||
private void writeToProps() {
|
||||
@@ -321,6 +328,8 @@ public final class Settings {
|
||||
contactDefaults.store(props);
|
||||
props.setProperty("colorContacts", Boolean.toString(colorContacts));
|
||||
props.setProperty("whisperPolicy", whisperPolicy.name());
|
||||
props.setProperty("chatLogs", Boolean.toString(chatLogs));
|
||||
props.setProperty("chatLogDir", chatLogDir);
|
||||
}
|
||||
|
||||
private static <E extends Enum<E>> E parseEnum(Class<E> type, String v, E def) {
|
||||
|
||||
@@ -34,14 +34,15 @@ import com.ts3client.text.TsLink;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Consumer;
|
||||
@@ -1389,14 +1390,16 @@ public final class TeamspeakConnection implements TS3Listener {
|
||||
}
|
||||
|
||||
private void loadChatLogs() {
|
||||
chatLogs = null;
|
||||
if (!settings.chatLogs) return;
|
||||
try {
|
||||
String uniqueId = serverUniqueId();
|
||||
if (uniqueId == null) {
|
||||
chatLogs = null;
|
||||
ui.onStatus("Chat logs unavailable: the server's unique id is not known");
|
||||
return;
|
||||
}
|
||||
ChatLogStore logs = new ChatLogStore(uniqueId);
|
||||
String dir = settings.chatLogDir == null ? "" : settings.chatLogDir.trim();
|
||||
ChatLogStore logs = new ChatLogStore(dir.isEmpty() ? ChatLogStore.defaultRoot() : Path.of(dir), uniqueId);
|
||||
chatLogs = logs;
|
||||
logs.begin();
|
||||
List<String> serverHistory = logs.serverHtmlHistory();
|
||||
|
||||
Reference in New Issue
Block a user