Add the chat log store missing from earlier commits

TeamspeakConnection and ChatPanel already use com.ts3client.chatlog, but the
package itself was never committed, so the tree did not build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-23 19:02:40 +00:00
parent f409f500fd
commit bab89f9b50
3 changed files with 289 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
package com.ts3client.chatlog;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
class ChatLogStoreTest {
@TempDir
Path temp;
@Test
void writesTs3CompatibleClientLogNamesAndEntries() throws Exception {
ChatLogStore logs = new ChatLogStore(temp, "+Tyg2JtxE8vRNZp+JiUBnmBh0MY=");
logs.begin();
logs.appendPrivateMessage("cckqISCrfr6Lq2SLMC//afsbO9w=", true,
610, "bdrlePoB9hU8K8CyjCabY07t3Wo=", "ericek111", "hello");
Path serverDir = temp.resolve("K1R5ZzJKdHhFOHZSTlpwK0ppVUJubUJoME1ZPQ==");
Path clientHtml = serverDir.resolve("clients")
.resolve("Y2NrcUlTQ3JmcjZMcTJTTE1DLy9hZnNiTzl3PQ==.html");
Path clientTxt = serverDir.resolve("clients")
.resolve("Y2NrcUlTQ3JmcjZMcTJTTE1DLy9hZnNiTzl3PQ==.txt");
assertTrue(Files.isRegularFile(serverDir.resolve("server.html")));
assertTrue(Files.isRegularFile(serverDir.resolve("channel.html")));
assertTrue(Files.isRegularFile(clientHtml));
assertEquals(1, Files.readAllLines(clientTxt).size());
List<String> history = logs.privateHtmlHistory("cckqISCrfr6Lq2SLMC//afsbO9w=");
assertEquals(1, history.size());
assertTrue(history.get(0).contains("TextMessage_Message"));
assertTrue(history.get(0).contains("ericek111"));
assertTrue(history.get(0).contains("hello"));
}
}