Update connection and chat handling

This commit is contained in:
2026-09-06 19:14:42 +00:00
parent 62d5af7cf9
commit ad62f5fc92
6 changed files with 316 additions and 27 deletions

View File

@@ -7,6 +7,7 @@ import com.ts3client.net.TeamspeakConnection;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import java.util.List;
/**
* Marshals {@link ConnectionListener} callbacks onto the EDT and fans them out to
@@ -129,18 +130,34 @@ final class ServerTabConnectionEvents implements ConnectionListener {
}
@Override
public void onChat(ChatScope scope, int fromClientId, String fromName, String message) {
switch (scope) {
case PRIVATE:
chatPanel.appendPrivateMessage(fromClientId, fromName, fromClientId, fromName, message);
break;
case SERVER:
chatPanel.appendServerMessage(fromClientId, fromName, message);
break;
default:
chatPanel.appendChannelMessage(fromClientId, fromName, message);
break;
}
public void onChat(ChatScope scope, int fromClientId, String fromUniqueId, String fromName, String message) {
SwingUtilities.invokeLater(() -> {
switch (scope) {
case PRIVATE:
chatPanel.appendPrivateMessage(fromClientId, fromUniqueId, fromName,
fromClientId, fromUniqueId, fromName, message);
break;
case SERVER:
chatPanel.appendServerMessage(fromClientId, fromUniqueId, fromName, message);
break;
default:
chatPanel.appendChannelMessage(fromClientId, fromUniqueId, fromName, message);
break;
}
});
}
@Override
public void onChatHistory(ChatScope scope, List<String> htmlEntries) {
SwingUtilities.invokeLater(() -> {
if (scope == ChatScope.SERVER) chatPanel.setServerHistory(htmlEntries);
else if (scope == ChatScope.CHANNEL) chatPanel.setChannelHistory(htmlEntries);
});
}
@Override
public void onPrivateChatHistory(int clientId, String nickname, List<String> htmlEntries) {
SwingUtilities.invokeLater(() -> chatPanel.setPrivateHistory(clientId, nickname, htmlEntries));
}
@Override
@@ -165,6 +182,11 @@ final class ServerTabConnectionEvents implements ConnectionListener {
SwingUtilities.invokeLater(() -> chatPanel.appendServerLog(message));
}
@Override
public void onServerLogHtml(String html) {
SwingUtilities.invokeLater(() -> chatPanel.appendServerLogHtml(html));
}
@Override
public void onPoke(String fromName, String message) {
SwingUtilities.invokeLater(() -> {