public static string GenerateNames(string channel, Channel chan) { string nameList = ""; foreach (KeyValuePair<string, Client> entry in chan.Clients) nameList += entry.Value.NickName + " "; return "server NAMES " + channel + " :" + nameList; }
public void SendToChannel(Channel channel, string message, Client sender, bool sendToSender = false) { try { foreach (KeyValuePair<string, Client> client in channel.Clients) if (client.Value.NickName != sender.NickName || sendToSender) SendToUser(client.Value.NickName, message, sender); } catch (IOException ex) { Console.WriteLine(ex.Message); } }
private void removeUser(Client client, Channel channel) { channel.Clients.Remove(client.NickName); if (channel.OpUsers.ContainsKey(client.NickName)) channel.OpUsers.Remove(client.NickName); client.Channels.Remove(channel.ChannelName); }
public static string GenerateTopic(Channel channel) { return "server TOPIC " + channel.ChannelName + " :" + channel.ChannelTopic; }
private bool checkPerms(Channel channel, string nick) { return channel.OpUsers.ContainsKey(nick); }