/// <summary> /// Called when we have joined a new chat channel. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public static void OnJoinedChatChannel(object sender, JoinedChatChannelEventArgs e) { // Find an existing channel with the same name var channel = AvailableChatChannels.Find(x => x.Name == e.Channel); // If the channel doesn't actually exist in our available ones, that must mean the server is placing // us in one that we don't know about, so we'll have to create a new chat channel object. if (channel == null) { var newChannel = new ChatChannel { Name = e.Channel, Description = "No Description", AllowedUserGroups = UserGroups.Normal }; JoinedChatChannels.Add(newChannel); Logger.Important($"Joined ChatChannel: {e.Channel} which was previously unknown", LogType.Network); Dialog.ChatChannelList.InitializeChannel(newChannel); return; } if (JoinedChatChannels.All(x => x.Name != channel.Name)) { JoinedChatChannels.Add(channel); Dialog.ChatChannelList.InitializeChannel(channel); Logger.Important($"Joined chat channel: {e.Channel}", LogType.Network); } }