Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 protected UserSurrogate(HostMask mask, Authorizations level)
 {
     Mask = mask;
     Level = Level;
     Password = null;
     LastSeen = DateTime.MaxValue;
     Modes = new Dictionary<Modes, string>();
     Properties = new Dictionary<string, object>();
     Flags = new List<string>();
 }
Ejemplo n.º 3
0
 protected UserSurrogate(HostMask mask, Authorizations level)
 {
     Mask       = mask;
     Level      = Level;
     Password   = null;
     LastSeen   = DateTime.MaxValue;
     Modes      = new Dictionary <Modes, string>();
     Properties = new Dictionary <string, object>();
     Flags      = new List <string>();
 }
Ejemplo n.º 4
0
        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();
            }
        }
Ejemplo n.º 5
0
 protected UserBase(ServerBase server, Locations location, HostMask mask, Authorizations level)
     : base(mask, level)
 {
     Server       = server;
     Location     = location;
     Channels     = new Dictionary <string, ChannelBase>();
     SessionFlags = new List <string>();
     if (mask.Nickname != "*" && mask.Nickname != null)
     {
         Id = mask.Nickname.ToLower();
     }
 }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
        public LocalUser(Server server, TcpClient client, HostMask mask, bool encrypted)
            : base(server, Locations.Local, mask, Authorizations.Connecting)
        {
            Server    = server;
            Client    = client;
            PingTimer = new Timer(PingProc);
            Encrypted = encrypted;

            if (encrypted)
            {
                IsAuthenticated = false;
                Stream          = new SafeStream(client.GetStream(), Server.Certificates.Certificate);
            }
            else
            {
                IsAuthenticated = true;
                Stream          = new SafeStream(client.GetStream(), null);
            }

            PingTimer = new Timer(PingProc);
            OnPing();

            Initialize();
        }
Ejemplo n.º 8
0
 protected User(Server server, Locations location, HostMask mask, Authorizations level)
     : base(server, location, mask, level)
 {
 }