private static void Connection_ClientTimeout(Client client, Channel oldChannel, Channel newChannel, TeamSpeak.Sdk.Visibility visibility, string message) { Console.WriteLine($"{client.Nickname} timeouts with message {message}"); if (client != Connection.Self) { // Check if client is in same channel as self if (oldChannel == Connection.Self.Channel) { // Play sound SoundFeedbackHelper.PlaySoundFromString("neutral_connection_connectionlost_currentchannel.wav"); } // Client disconnected, remove from channel list mainForm.channelList.RemoveClient(client, oldChannel, client.Nickname == Connection.Self.Nickname); } }
private static void Connection_ClientMoved(Client client, Channel oldChannel, Channel newChannel, TeamSpeak.Sdk.Visibility visibility, Client invoker, string message) { Console.WriteLine($"{client.Nickname} moves from channel {oldChannel?.Name ?? "nowhere"} to {newChannel?.Name ?? "nowhere"} with message {message}"); try { List <Channel> channels = Connection.AllChannels.ToList(); if (mainForm.channelList == null) { DisplayAllChannelsOnForm(); } else { if (oldChannel != null && newChannel != null) { // Move the client label mainForm.channelList.MoveClient(client, oldChannel, newChannel, client.Nickname == Connection.Self.Nickname); } else if (newChannel == null) { // Client disconnected, remove from channel list mainForm.channelList.RemoveClient(client, oldChannel, client.Nickname == Connection.Self.Nickname); } else if (oldChannel == null) { // Client connected, add to channel list mainForm.channelList.RemoveClient(client, newChannel, client.Nickname == Connection.Self.Nickname); // Allow whispers from client Connection.AllowWhispersFrom(client); // Initialize clients chatbrowser mainForm.AddClientChatBrowser(client); } } // Check if client = self if (client.Nickname == Connection.Self.Nickname) { // Self, so update the channelName label next to the application logo mainForm.UpdateCurrentChannelLabel(newChannel); // Update clients icon in channel list updateClientIconBasedOnActivity(client, SelfTalkStatus); // Update aplication icon UpdateApplicationIconBasedOnActivity(SelfTalkStatus); } else { // Check whether the client joined or left the self clients channel if (oldChannel == Connection.Self.Channel) { if (newChannel == null) { // Client disconnected, play disconnected sound SoundFeedbackHelper.PlaySoundFromString("neutral_connection_disconnected_currentchannel.wav"); } else { // Sound feedback SoundFeedbackHelper.PlaySoundFromString("neutral_switched_awayfromcurrentchannel.wav"); } } else if (newChannel == Connection.Self.Channel) { // Sound feedback SoundFeedbackHelper.PlaySoundFromString("neutral_switched_tocurrentchannel.wav"); } } } catch (TeamSpeak.Sdk.TeamSpeakException) { // Do nothing, client disconnected } }
private static void Connection_SubscriptionClientMoved(Client client, Channel oldChannel, Channel newChannel, TeamSpeak.Sdk.Visibility visibility) { Console.WriteLine($"New client: {client.Nickname}"); }