예제 #1
0
        public void Parse(BaseClient client, string line)
        {
            string[] tokens = line.Split(" \t".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            string commandArg;
            Command command;
            int argIndex;

            if (tokens[0][0] == ':')
            {
                commandArg = tokens[1];
                argIndex = 2;
            }
            else
            {
                commandArg = tokens[0];
                argIndex = 1;
            }

            if (!Commands.TryGetValue(commandArg, out command))
            {
                if (client.IsRegistered() && client is Client)
                {
                    var c = client as Client;

                    c.Numeric(421, commandArg);
                }
                return;
            }

            if (command.MinAccess > AccessLevel.Unregistered && !client.IsRegistered())
                return;

            var args = new object[tokens.Length - argIndex + 1];
            args[0] = client;
            Array.Copy(tokens, argIndex, args, 1, tokens.Length - argIndex);
        }
예제 #2
0
 public static void DeleteName(BaseClient client)
 {
     if (!String.IsNullOrEmpty(client.Name))
         Names.Remove(client.Name);
 }
예제 #3
0
 public static void AddUnregistered(BaseClient client)
 {
     Unregistered.Add(client);
 }
예제 #4
0
 public static void AddName(BaseClient client)
 {
     Names.Add(client.Name, client);
 }
예제 #5
0
 public ClientStringEventArgs(BaseClient client, string str)
 {
     Client = client;
     Str = str;
 }
예제 #6
0
 public static void RemoveUnregistered(BaseClient client)
 {
     Unregistered.Remove(client);
 }
예제 #7
0
 public static bool nick_changing(BaseClient client, string str)
 {
     return client.NickChanging == null || client.NickChanging(client, str);
 }