public void AddHandler(object sender, ReceivedChannelModeEventArgs e) { List <HostMask> list = GetList(e.Channel); if (list.Count > e.Server.Settings.MaximumListSize && (!e.Channel.HasFlag("LongLists") || list.Count > e.Server.Settings.MaximumLongListSize)) { e.User.SendNumeric(Numerics.ERR_BANLISTFULL, "That list is full. Contact a network operator to override this."); e.Cancel(); return; } HostMask mask = HostMask.Parse(e.Argument); if ((mask.Nickname == null || mask.Username == null || mask.Hostname == null) && mask.Account == null) { e.User.SendNumeric(Numerics.ERR_BADMASK, "List entries must be fully qualified hostmasks."); e.Cancel(); return; } if (list.Contains(mask)) { e.Cancel(); return; } list.Add(mask); }
public void RemoveHandler(object sender, ReceivedChannelModeEventArgs e) { List <HostMask> list = GetList(e.Channel); HostMask mask = HostMask.Parse(e.Argument); if (!list.Remove(mask)) { e.Cancel(); } }
private void AcceptClient(TcpClient client, ListenerInfo info) { IPEndPoint ep = (IPEndPoint)client.Client.RemoteEndPoint; if (IsKLined(ep.Address)) { Console.WriteLine("Client is K:lined! Dropping."); client.Close(); return; } string ip = ep.Address.ToString(); HostMask mask = HostMask.Parse("*!:" + ep.Port + "@" + ip); mask.Account = "/" + ip; LocalUser user = new LocalUser(this, client, mask, info.Binding.Protocol == Protocols.Rfc2812 ? false : true); user.Start(); UsersByMask.Add(user.Mask, user); }