Example #1
0
        public override void control(bot ircbot, ref IRCConfig conf, int module_id, string[] line, string command, int nick_access, string nick, string channel, bool bot_command, string type)
        {
            access access = new access();

            char[] charS       = new char[] { ' ' };
            string module_name = ircbot.conf.module_config[module_id][0];

            if ((type.Equals("channel") || type.Equals("query")) && bot_command == true)
            {
                foreach (List <string> tmp_command in conf.command_list)
                {
                    if (module_name.Equals(tmp_command[0]))
                    {
                        string[] triggers       = tmp_command[3].Split('|');
                        int      command_access = Convert.ToInt32(tmp_command[5]);
                        string[] blacklist      = tmp_command[6].Split(',');
                        bool     blocked        = false;
                        bool     cmd_found      = false;
                        bool     spam_check     = Convert.ToBoolean(tmp_command[8]);
                        foreach (string bl_chan in blacklist)
                        {
                            if (bl_chan.Equals(channel))
                            {
                                blocked = true;
                                break;
                            }
                        }
                        if (spam_check == true)
                        {
                            blocked = ircbot.get_spam_status(channel, nick);
                        }
                        foreach (string trigger in triggers)
                        {
                            if (trigger.Equals(command))
                            {
                                cmd_found = true;
                                break;
                            }
                        }
                        if (blocked == true && cmd_found == true)
                        {
                            ircbot.sendData("NOTICE", nick + " :I am currently too busy to process that.");
                        }
                        if (blocked == false && cmd_found == true)
                        {
                            foreach (string trigger in triggers)
                            {
                                switch (trigger)
                                {
                                case "alarm":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= command_access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            string[] new_line = line[4].Split(charS, 2, StringSplitOptions.RemoveEmptyEntries);
                                            if (new_line.GetUpperBound(0) > 0)
                                            {
                                                bool int_allowed = true;
                                                int  time        = 0;
                                                try
                                                {
                                                    time = Convert.ToInt32(new_line[0]);
                                                    if ((time * 1000) <= 0)
                                                    {
                                                        int_allowed = false;
                                                    }
                                                }
                                                catch
                                                {
                                                    int_allowed = false;
                                                }
                                                if (int_allowed == true)
                                                {
                                                    char[]   charSplit = new char[] { ' ' };
                                                    string[] ex        = new_line[1].Split(charSplit);
                                                    if (ex[0].TrimStart(Convert.ToChar(conf.command)).Equals("alarm"))
                                                    {
                                                        if (type.Equals("channel"))
                                                        {
                                                            ircbot.sendData("PRIVMSG", line[2] + " :Recursion is bad.");
                                                        }
                                                        else
                                                        {
                                                            ircbot.sendData("PRIVMSG", nick + " :Recursion is bad.");
                                                        }
                                                    }
                                                    else
                                                    {
                                                        tmp_conf = conf;
                                                        Timer alarm_trigger = new Timer();
                                                        alarm_trigger.Interval  = (time * 1000);
                                                        alarm_trigger.Enabled   = true;
                                                        alarm_trigger.AutoReset = false;
                                                        alarm_trigger.Elapsed  += (sender, e) => ring_alarm(sender, e, ircbot, nick, line[0], nick_access, channel, type, new_line[1]);
                                                        alarms.Add(alarm_trigger);

                                                        if (type.Equals("channel"))
                                                        {
                                                            ircbot.sendData("PRIVMSG", line[2] + " :Alarm added for " + new_line[0] + " seconds from now.");
                                                        }
                                                        else
                                                        {
                                                            ircbot.sendData("PRIVMSG", nick + " :Alarm added for " + new_line[0] + " seconds from now.");
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    if (type.Equals("channel"))
                                                    {
                                                        ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", please pick a valid time.");
                                                    }
                                                    else
                                                    {
                                                        ircbot.sendData("PRIVMSG", nick + " :" + nick + ", please pick a valid time.");
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                if (type.Equals("channel"))
                                                {
                                                    ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                                }
                                                else
                                                {
                                                    ircbot.sendData("PRIVMSG", nick + " :" + nick + ", you need to include more info.");
                                                }
                                            }
                                        }
                                        else
                                        {
                                            if (type.Equals("channel"))
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", nick + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }
Example #2
0
        public override void control(bot ircbot, ref IRCConfig conf, int module_id, string[] line, string command, int nick_access, string nick, string channel, bool bot_command, string type)
        {
            access access = new access();

            char[] charS = new char[] { ' ' };
            string module_name = ircbot.conf.module_config[module_id][0];
            if ((type.Equals("channel") || type.Equals("query")) && bot_command == true)
            {
                foreach (List<string> tmp_command in conf.command_list)
                {
                    if (module_name.Equals(tmp_command[0]))
                    {
                        string[] triggers = tmp_command[3].Split('|');
                        int command_access = Convert.ToInt32(tmp_command[5]);
                        string[] blacklist = tmp_command[6].Split(',');
                        bool blocked = false;
                        bool cmd_found = false;
                        bool spam_check = Convert.ToBoolean(tmp_command[8]);
                        foreach (string bl_chan in blacklist)
                        {
                            if (bl_chan.Equals(channel))
                            {
                                blocked = true;
                                break;
                            }
                        }
                        if (spam_check == true)
                        {
                            blocked = ircbot.get_spam_status(channel, nick);
                        }
                        foreach (string trigger in triggers)
                        {
                            if (trigger.Equals(command))
                            {
                                cmd_found = true;
                                break;
                            }
                        }
                        if (blocked == true && cmd_found == true)
                        {
                            ircbot.sendData("NOTICE", nick + " :I am currently too busy to process that.");
                        }
                        if (blocked == false && cmd_found == true)
                        {
                            foreach (string trigger in triggers)
                            {
                                switch (trigger)
                                {
                                    case "alarm":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                string[] new_line = line[4].Split(charS, 2, StringSplitOptions.RemoveEmptyEntries);
                                                if (new_line.GetUpperBound(0) > 0)
                                                {
                                                    bool int_allowed = true;
                                                    int time = 0;
                                                    try
                                                    {
                                                        time = Convert.ToInt32(new_line[0]);
                                                        if ((time * 1000) <= 0)
                                                        {
                                                            int_allowed = false;
                                                        }
                                                    }
                                                    catch
                                                    {
                                                        int_allowed = false;
                                                    }
                                                    if (int_allowed == true)
                                                    {
                                                        char[] charSplit = new char[] { ' ' };
                                                        string[] ex = new_line[1].Split(charSplit);
                                                        if (ex[0].TrimStart(Convert.ToChar(conf.command)).Equals("alarm"))
                                                        {
                                                            if (type.Equals("channel"))
                                                            {
                                                                ircbot.sendData("PRIVMSG", line[2] + " :Recursion is bad.");
                                                            }
                                                            else
                                                            {
                                                                ircbot.sendData("PRIVMSG", nick + " :Recursion is bad.");
                                                            }
                                                        }
                                                        else
                                                        {
                                                            tmp_conf = conf;
                                                            Timer alarm_trigger = new Timer();
                                                            alarm_trigger.Interval = (time * 1000);
                                                            alarm_trigger.Enabled = true;
                                                            alarm_trigger.AutoReset = false;
                                                            alarm_trigger.Elapsed += (sender, e) => ring_alarm(sender, e, ircbot, nick, line[0], nick_access, channel, type, new_line[1]);
                                                            alarms.Add(alarm_trigger);

                                                            if (type.Equals("channel"))
                                                            {
                                                                ircbot.sendData("PRIVMSG", line[2] + " :Alarm added for " + new_line[0] + " seconds from now.");
                                                            }
                                                            else
                                                            {
                                                                ircbot.sendData("PRIVMSG", nick + " :Alarm added for " + new_line[0] + " seconds from now.");
                                                            }
                                                        }
                                                    }
                                                    else
                                                    {
                                                        if (type.Equals("channel"))
                                                        {
                                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", please pick a valid time.");
                                                        }
                                                        else
                                                        {
                                                            ircbot.sendData("PRIVMSG", nick + " :" + nick + ", please pick a valid time.");
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    if (type.Equals("channel"))
                                                    {
                                                        ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                                    }
                                                    else
                                                    {
                                                        ircbot.sendData("PRIVMSG", nick + " :" + nick + ", you need to include more info.");
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                if (type.Equals("channel"))
                                                {
                                                    ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                                }
                                                else
                                                {
                                                    ircbot.sendData("PRIVMSG", nick + " :" + nick + ", you need to include more info.");
                                                }
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                }
                            }
                        }
                    }
                }
            }
        }
Example #3
0
        public override void control(bot ircbot, ref IRCConfig conf, int module_id, string[] line, string command, int nick_access, string nick, string channel, bool bot_command, string type)
        {
            access access = new access();

            char[] charS = new char[] { ' ' };
            string module_name = ircbot.conf.module_config[module_id][0];
            string disallowed_modes = ircbot.conf.module_config[module_id][3];
            if (type.Equals("channel") && bot_command == true)
            {
                foreach (List<string> tmp_command in conf.command_list)
                {
                    if (module_name.Equals(tmp_command[0]))
                    {
                        string[] triggers = tmp_command[3].Split('|');
                        int command_access = Convert.ToInt32(tmp_command[5]);
                        string[] blacklist = tmp_command[6].Split(',');
                        bool blocked = false;
                        bool cmd_found = false;
                        bool spam_check = Convert.ToBoolean(tmp_command[8]);
                        foreach (string bl_chan in blacklist)
                        {
                            if (bl_chan.Equals(channel))
                            {
                                blocked = true;
                                break;
                            }
                        }
                        if (spam_check == true)
                        {
                            blocked = ircbot.get_spam_status(channel, nick);
                        }
                        foreach (string trigger in triggers)
                        {
                            if (trigger.Equals(command))
                            {
                                cmd_found = true;
                                break;
                            }
                        }
                        if (blocked == true && cmd_found == true)
                        {
                            ircbot.sendData("NOTICE", nick + " :I am currently too busy to process that.");
                        }
                        if (blocked == false && cmd_found == true)
                        {
                            foreach (string trigger in triggers)
                            {
                                switch (trigger)
                                {
                                    case "founder":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                ircbot.sendData("MODE", line[2] + " +q " + line[4].ToLower());
                                                access.set_access_list(line[4].ToLower(), line[2], conf.founder_level.ToString(), ircbot);
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                    case "defounder":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                ircbot.sendData("MODE", line[2] + " -q " + line[4].ToLower());
                                                access.del_access_list(line[4].ToLower(), line[2], conf.founder_level.ToString(), ircbot);
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                    case "sop":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                ircbot.sendData("MODE", line[2] + " +a " + line[4].ToLower());
                                                access.set_access_list(line[4].ToLower(), line[2], conf.sop_level.ToString(), ircbot);
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                    case "asop":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                ircbot.sendData("MODE", line[2] + " +a " + line[4].ToLower());
                                                ircbot.sendData("PRIVMSG", "chanserv :SOP " + line[2] + " add " + line[4].ToLower());
                                                access.set_access_list(line[4].ToLower(), line[2], conf.sop_level.ToString(), ircbot);
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                    case "deasop":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                ircbot.sendData("MODE", line[2] + " -a " + line[4].ToLower());
                                                ircbot.sendData("PRIVMSG", "chanserv :SOP " + line[2] + " del " + line[4].ToLower());
                                                access.del_access_list(line[4].ToLower(), line[2], conf.sop_level.ToString(), ircbot);
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                    case "desop":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                ircbot.sendData("MODE", line[2] + " -a " + line[4].ToLower());
                                                access.del_access_list(line[4].ToLower(), line[2], conf.sop_level.ToString(), ircbot);
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                    case "op":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                ircbot.sendData("MODE", line[2] + " +o " + line[4].ToLower());
                                                access.set_access_list(line[4].ToLower(), line[2], conf.op_level.ToString(), ircbot);
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                    case "aop":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                ircbot.sendData("MODE", line[2] + " +o " + line[4].ToLower());
                                                ircbot.sendData("PRIVMSG", "chanserv :AOP " + line[2] + " add " + line[4].ToLower());
                                                access.set_access_list(line[4].ToLower(), line[2], conf.op_level.ToString(), ircbot);
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                    case "deaop":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                ircbot.sendData("MODE", line[2] + " -o " + line[4].ToLower());
                                                ircbot.sendData("PRIVMSG", "chanserv :AOP " + line[2] + " del " + line[4].ToLower());
                                                access.del_access_list(line[4].ToLower(), line[2], conf.op_level.ToString(), ircbot);
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                    case "deop":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                ircbot.sendData("MODE", line[2] + " -o " + line[4].ToLower());
                                                access.del_access_list(line[4].ToLower(), line[2], conf.op_level.ToString(), ircbot);
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                    case "ahop":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                ircbot.sendData("MODE", line[2] + " +h " + line[4].ToLower());
                                                ircbot.sendData("PRIVMSG", "chanserv :HOP " + line[2] + " add " + line[4].ToLower());
                                                access.set_access_list(line[4].ToLower(), line[2], conf.hop_level.ToString(), ircbot);
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                    case "deahop":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                ircbot.sendData("MODE", line[2] + " -h " + line[4].ToLower());
                                                ircbot.sendData("PRIVMSG", "chanserv :HOP " + line[2] + " del " + line[4].ToLower());
                                                access.del_access_list(line[4].ToLower(), line[2], conf.hop_level.ToString(), ircbot);
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                    case "hop":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                ircbot.sendData("MODE", line[2] + " +h " + line[4].ToLower());
                                                access.set_access_list(line[4].ToLower(), line[2], conf.hop_level.ToString(), ircbot);
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                    case "dehop":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                ircbot.sendData("MODE", line[2] + " -h " + line[4].ToLower());
                                                access.del_access_list(line[4].ToLower(), line[2], conf.hop_level.ToString(), ircbot);
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                    case "avoice":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                ircbot.sendData("MODE", line[2] + " +v " + line[4].ToLower());
                                                ircbot.sendData("PRIVMSG", "chanserv :VOP " + line[2] + " add " + line[4].ToLower());
                                                access.set_access_list(line[4].ToLower(), line[2], conf.voice_level.ToString(), ircbot);
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                    case "deavoice":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                ircbot.sendData("MODE", line[2] + " -v " + line[4].ToLower());
                                                ircbot.sendData("PRIVMSG", "chanserv :VOP " + line[2] + " del " + line[4].ToLower());
                                                access.del_access_list(line[4].ToLower(), line[2], conf.voice_level.ToString(), ircbot);
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                    case "voice":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                ircbot.sendData("MODE", line[2] + " +v " + line[4].ToLower());
                                                access.set_access_list(line[4].ToLower(), line[2], conf.voice_level.ToString(), ircbot);
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                    case "devoice":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                ircbot.sendData("MODE", line[2] + " -v " + line[4].ToLower());
                                                access.del_access_list(line[4].ToLower(), line[2], conf.voice_level.ToString(), ircbot);
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                    case "mode":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                string[] new_line = line[4].Split(charS, 2);
                                                char[] arr = new_line[0].ToCharArray();

                                                bool mode_allowed = true;
                                                bool positive = true;
                                                int mode_index = 0;
                                                foreach (char c in arr)
                                                {
                                                    if (!c.Equals('+') && !c.Equals('-'))
                                                    {
                                                        char[] modes_disallowed = disallowed_modes.ToCharArray();
                                                        foreach (char m in modes_disallowed)
                                                        {
                                                            if (m.Equals(c))
                                                            {
                                                                mode_allowed = false;
                                                                break;
                                                            }
                                                        }
                                                        if (mode_allowed == true)
                                                        {
                                                            if (c.Equals('q') || c.Equals('a') || c.Equals('o') || c.Equals('h') || c.Equals('v'))
                                                            {
                                                                int mode_access = ircbot.get_access_num(c.ToString(), true);
                                                                if (nick_access < mode_access)
                                                                {
                                                                    mode_allowed = false;
                                                                    break;
                                                                }
                                                            }
                                                        }
                                                        if (mode_allowed)
                                                        {
                                                            string leading_cmd = "";
                                                            if (positive)
                                                            {
                                                                leading_cmd = "+";
                                                            }
                                                            else
                                                            {
                                                                leading_cmd = "-";
                                                            }
                                                            bool nick_needed = false;
                                                            if (new_line.GetUpperBound(0) > 0)
                                                            {
                                                                string[] nicks = new_line[1].Split(charS);
                                                                if (nicks.GetUpperBound(0) >= mode_index)
                                                                {
                                                                    nick_needed = true;
                                                                }
                                                            }
                                                            if (nick_needed)
                                                            {
                                                                string[] nicks = new_line[1].Split(charS);
                                                                ircbot.sendData("MODE", line[2] + " " + leading_cmd + c.ToString() + " :" + nicks[mode_index]);
                                                            }
                                                            else
                                                            {
                                                                ircbot.sendData("MODE", line[2] + " " + leading_cmd + c.ToString());
                                                            }
                                                        }
                                                        mode_index++;
                                                    }
                                                    else if (c.Equals('+'))
                                                    {
                                                        positive = true;
                                                    }
                                                    else if (c.Equals('-'))
                                                    {
                                                        positive = false;
                                                    }
                                                }
                                                if (!mode_allowed)
                                                {
                                                    ircbot.sendData("PRIVMSG", line[2] + " :You do not have permission to use that command.");
                                                }
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                    case "topic":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                string[] new_line = line[4].Split(charS, 2);
                                                if (new_line.GetUpperBound(0) > 0)
                                                {
                                                    ircbot.sendData("TOPIC", line[2] + " :" + new_line[0] + " " + new_line[1]);
                                                }
                                                else
                                                {
                                                    ircbot.sendData("TOPIC", line[2] + " :" + new_line[0]);
                                                }
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                    case "invite":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                string[] new_line = line[4].ToLower().Split(charS, 2);
                                                if (new_line.GetUpperBound(0) > 0)
                                                {
                                                    ircbot.sendData("INVITE", new_line[0] + " " + new_line[1]);
                                                }
                                                else
                                                {
                                                    ircbot.sendData("INVITE", new_line[0] + " " + line[2]);
                                                }
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                    case "b":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                string[] new_line = line[4].ToLower().Split(charS, 2);
                                                string nicks = new_line[0].TrimStart(':');
                                                char[] charSep = new char[] { ',' };
                                                string[] total_nicks = new_line[0].Split(charSep, StringSplitOptions.RemoveEmptyEntries);
                                                int sent_nick_access = ircbot.get_user_access(total_nicks[0], line[2]);

                                                bool tmp_me = false;
                                                for (int y = 0; y <= total_nicks.GetUpperBound(0); y++)
                                                {
                                                    if (total_nicks[y].Equals(conf.name, StringComparison.OrdinalIgnoreCase))
                                                    {
                                                        tmp_me = true;
                                                    }
                                                }
                                                if (sent_nick_access == conf.owner_level)
                                                {
                                                    ircbot.sendData("PRIVMSG", line[2] + " :You can't ban my owner!");
                                                }
                                                else if (tmp_me == true)
                                                {
                                                    ircbot.sendData("PRIVMSG", line[2] + " :You can't ban me!");
                                                }
                                                else
                                                {
                                                    if (nick_access >= sent_nick_access)
                                                    {
                                                        string target_host = ircbot.get_user_host(total_nicks[0]);
                                                        string ban = "*!*@" + target_host;
                                                        if (target_host.Equals(""))
                                                        {
                                                            ban = new_line[0] + "!*@*";
                                                        }
                                                        if (new_line.GetUpperBound(0) > 0)
                                                        {
                                                            ircbot.sendData("MODE", line[2] + " +b " + ban + " :" + new_line[1]);
                                                        }
                                                        else
                                                        {
                                                            ircbot.sendData("MODE", line[2] + " +b " + ban + " :No Reason");
                                                        }
                                                    }
                                                    else
                                                    {
                                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                    case "ub":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                string[] new_line = line[4].ToLower().Split(charS, 2);
                                                char[] charSep = new char[] { ',' };
                                                string[] total_nicks = new_line[0].Split(charSep, StringSplitOptions.RemoveEmptyEntries);
                                                int sent_nick_access = ircbot.get_user_access(total_nicks[0].TrimStart(':'), line[2]);

                                                if (nick_access >= sent_nick_access)
                                                {
                                                    string target_host = ircbot.get_user_host(total_nicks[0]);
                                                    string ban = "*!*@" + target_host;
                                                    if (target_host.Equals(""))
                                                    {
                                                        ban = new_line[0] + "!*@*";
                                                    }
                                                    if (new_line.GetUpperBound(0) > 0)
                                                    {
                                                        ircbot.sendData("MODE", line[2] + " -b " + ban + " :" + new_line[1]);
                                                    }
                                                    else
                                                    {
                                                        ircbot.sendData("MODE", line[2] + " -b " + ban + " :No Reason");
                                                    }
                                                }
                                                else
                                                {
                                                    ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                                }
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                    case "clearban":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            ircbot.sendData("PRIVMSG", "chanserv :clear " + channel + " bans");
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                    case "kb":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                string[] new_line = line[4].ToLower().Split(charS, 2);
                                                string nicks = new_line[0].TrimStart(':');
                                                char[] charSep = new char[] { ',' };
                                                string[] total_nicks = nicks.Split(charSep, StringSplitOptions.RemoveEmptyEntries);
                                                int sent_nick_access = ircbot.get_user_access(total_nicks[0], line[2]);

                                                bool tmp_me = false;
                                                for (int y = 0; y <= total_nicks.GetUpperBound(0); y++)
                                                {
                                                    if (total_nicks[y].Equals(conf.name, StringComparison.OrdinalIgnoreCase))
                                                    {
                                                        tmp_me = true;
                                                    }
                                                }
                                                if (sent_nick_access == conf.owner_level)
                                                {
                                                    ircbot.sendData("PRIVMSG", line[2] + " :You can't kick-ban my owner!");
                                                }
                                                else if (tmp_me == true)
                                                {
                                                    ircbot.sendData("PRIVMSG", line[2] + " :You can't kick-ban me!");
                                                }
                                                else
                                                {
                                                    if (nick_access >= sent_nick_access)
                                                    {
                                                        string target_host = ircbot.get_user_host(total_nicks[0]);
                                                        string ban = "*!*@" + target_host;
                                                        if (target_host.Equals(""))
                                                        {
                                                            ban = new_line[0] + "!*@*";
                                                        }
                                                        if (new_line.GetUpperBound(0) > 0)
                                                        {
                                                            ircbot.sendData("MODE", line[2] + " +b " + ban + " :" + new_line[1]);
                                                            ircbot.sendData("KICK", line[2] + " " + total_nicks[0] + " :" + new_line[1]);
                                                        }
                                                        else
                                                        {
                                                            ircbot.sendData("MODE", line[2] + " +b " + ban + " :No Reason");
                                                            ircbot.sendData("KICK", line[2] + " " + total_nicks[0] + " :No Reason");
                                                        }
                                                    }
                                                    else
                                                    {
                                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                    case "tb":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                string[] new_line = line[4].ToLower().Split(charS, 3, StringSplitOptions.RemoveEmptyEntries);
                                                if (new_line.GetUpperBound(0) > 0)
                                                {
                                                    int time = Convert.ToInt32(new_line[0].TrimStart(':'));
                                                    string nicks = new_line[1];
                                                    char[] charSep = new char[] { ',' };
                                                    string[] total_nicks = nicks.Split(charSep, StringSplitOptions.RemoveEmptyEntries);
                                                    string target_host = ircbot.get_user_host(total_nicks[0]);
                                                    int sent_nick_access = ircbot.get_user_access(total_nicks[0], line[2]);

                                                    bool tmp_me = false;
                                                    for (int y = 0; y <= total_nicks.GetUpperBound(0); y++)
                                                    {
                                                        if (total_nicks[y].Equals(conf.name, StringComparison.OrdinalIgnoreCase))
                                                        {
                                                            tmp_me = true;
                                                        }
                                                    }
                                                    if (sent_nick_access == conf.owner_level)
                                                    {
                                                        ircbot.sendData("PRIVMSG", line[2] + " :You can't ban my owner!");
                                                    }
                                                    else if (tmp_me == true)
                                                    {
                                                        ircbot.sendData("PRIVMSG", line[2] + " :You can't ban me!");
                                                    }
                                                    else
                                                    {
                                                        if (nick_access >= sent_nick_access)
                                                        {
                                                            string ban = "*!*@" + target_host;
                                                            if (target_host.Equals(""))
                                                            {
                                                                ban = total_nicks[0] + "!*@*";
                                                            }
                                                            if (new_line.GetUpperBound(0) > 1)
                                                            {
                                                                ircbot.sendData("MODE", line[2] + " +b " + ban + " :" + new_line[2]);
                                                            }
                                                            else
                                                            {
                                                                ircbot.sendData("MODE", line[2] + " +b " + ban + " :No Reason");
                                                            }
                                                            Timer unban_trigger = new Timer();
                                                            unban_trigger.Interval = (Convert.ToInt32(new_line[0]) * 1000);
                                                            unban_trigger.Enabled = true;
                                                            unban_trigger.AutoReset = false;
                                                            unban_trigger.Elapsed += (sender, e) => unban_nick(sender, e, total_nicks[0], target_host, line[2]);
                                                            unban_triggers.Add(unban_trigger);
                                                            main = ircbot;
                                                        }
                                                        else
                                                        {
                                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                                }
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                    case "tkb":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                string[] new_line = line[4].ToLower().Split(charS, 3, StringSplitOptions.RemoveEmptyEntries);
                                                if (new_line.GetUpperBound(0) > 0)
                                                {
                                                    int time = Convert.ToInt32(new_line[0].TrimStart(':'));
                                                    string nicks = new_line[1];
                                                    char[] charSep = new char[] { ',' };
                                                    string[] total_nicks = nicks.Split(charSep, StringSplitOptions.RemoveEmptyEntries);
                                                    int sent_nick_access = ircbot.get_user_access(total_nicks[0], line[2]);
                                                    string target_host = ircbot.get_user_host(total_nicks[0]);

                                                    bool tmp_me = false;
                                                    for (int y = 0; y <= total_nicks.GetUpperBound(0); y++)
                                                    {
                                                        if (total_nicks[y].Equals(conf.name, StringComparison.OrdinalIgnoreCase))
                                                        {
                                                            tmp_me = true;
                                                        }
                                                    }
                                                    if (sent_nick_access == conf.owner_level)
                                                    {
                                                        ircbot.sendData("PRIVMSG", line[2] + " :You can't kick-ban my owner!");
                                                    }
                                                    else if (tmp_me == true)
                                                    {
                                                        ircbot.sendData("PRIVMSG", line[2] + " :You can't kick-ban me!");
                                                    }
                                                    else
                                                    {
                                                        if (nick_access >= sent_nick_access)
                                                        {
                                                            string ban = "*!*@" + target_host;
                                                            if (target_host.Equals(""))
                                                            {
                                                                ban = new_line[1] + "!*@*";
                                                            }
                                                            if (new_line.GetUpperBound(0) > 1)
                                                            {
                                                                ircbot.sendData("MODE", line[2] + " +b " + ban + " :" + new_line[2]);
                                                                ircbot.sendData("KICK", line[2] + " " + total_nicks[0] + " :" + new_line[2]);
                                                            }
                                                            else
                                                            {
                                                                ircbot.sendData("MODE", line[2] + " +b " + ban + " :No Reason");
                                                                ircbot.sendData("KICK", line[2] + " " + total_nicks[0] + " :No Reason");
                                                            }
                                                            System.Timers.Timer unban_trigger = new System.Timers.Timer();
                                                            unban_trigger.Interval = (Convert.ToInt32(new_line[0]) * 1000);
                                                            unban_trigger.Enabled = true;
                                                            unban_trigger.AutoReset = false;
                                                            unban_trigger.Elapsed += (sender, e) => unban_nick(sender, e, total_nicks[0], target_host, line[2]);
                                                            unban_triggers.Add(unban_trigger);
                                                            main = ircbot;
                                                        }
                                                        else
                                                        {
                                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                                }
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                    case "ak":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                string[] new_line = line[4].ToLower().Split(charS, 2);
                                                string nicks = new_line[0].TrimStart(':');
                                                char[] charSep = new char[] { ',' };
                                                string[] total_nicks = nicks.Split(charSep, StringSplitOptions.RemoveEmptyEntries);
                                                int sent_nick_access = ircbot.get_user_access(total_nicks[0], line[2]);
                                                bool tmp_me = false;
                                                for (int y = 0; y <= total_nicks.GetUpperBound(0); y++)
                                                {
                                                    if (total_nicks[y].Equals(conf.name, StringComparison.OrdinalIgnoreCase))
                                                    {
                                                        tmp_me = true;
                                                    }
                                                }
                                                if (sent_nick_access == conf.owner_level)
                                                {
                                                    ircbot.sendData("PRIVMSG", line[2] + " :You can't kick my owner!");
                                                }
                                                else if (tmp_me == true)
                                                {
                                                    ircbot.sendData("PRIVMSG", line[2] + " :You can't kick me!");
                                                }
                                                else
                                                {
                                                    if (nick_access >= sent_nick_access)
                                                    {
                                                        string target_host = ircbot.get_user_host(total_nicks[0]);
                                                        if (new_line.GetUpperBound(0) > 0)
                                                        {
                                                            add_auto(total_nicks[0], line[2], target_host, "k", new_line[1], ircbot);
                                                        }
                                                        else
                                                        {
                                                            add_auto(total_nicks[0], line[2], target_host, "k", "No Reason", ircbot);
                                                        }
                                                    }
                                                    else
                                                    {
                                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                    case "ab":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                string[] new_line = line[4].ToLower().Split(charS, 2);
                                                string target_host = ircbot.get_user_host(new_line[0]);
                                                string nicks = new_line[0].TrimStart(':');
                                                char[] charSep = new char[] { ',' };
                                                string[] total_nicks = nicks.Split(charSep, StringSplitOptions.RemoveEmptyEntries);
                                                int sent_nick_access = ircbot.get_user_access(total_nicks[0], line[2]);
                                                bool tmp_me = false;
                                                for (int y = 0; y <= total_nicks.GetUpperBound(0); y++)
                                                {
                                                    if (total_nicks[y].Equals(conf.name, StringComparison.OrdinalIgnoreCase))
                                                    {
                                                        tmp_me = true;
                                                    }
                                                }
                                                if (sent_nick_access == conf.owner_level)
                                                {
                                                    ircbot.sendData("PRIVMSG", line[2] + " :You can't ban my owner!");
                                                }
                                                else if (tmp_me == true)
                                                {
                                                    ircbot.sendData("PRIVMSG", line[2] + " :You can't ban me!");
                                                }
                                                else
                                                {
                                                    if (nick_access >= sent_nick_access)
                                                    {
                                                        if (new_line.GetUpperBound(0) > 0)
                                                        {
                                                            add_auto(total_nicks[0], line[2], target_host, "b", new_line[1], ircbot);
                                                        }
                                                        else
                                                        {
                                                            add_auto(total_nicks[0], line[2], target_host, "b", "No Reason", ircbot);
                                                        }
                                                    }
                                                    else
                                                    {
                                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                    case "akb":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                string[] new_line = line[4].ToLower().Split(charS, 2);
                                                string target_host = ircbot.get_user_host(new_line[0]);
                                                string nicks = new_line[0].TrimStart(':');
                                                char[] charSep = new char[] { ',' };
                                                string[] total_nicks = nicks.Split(charSep, StringSplitOptions.RemoveEmptyEntries);
                                                int sent_nick_access = ircbot.get_user_access(total_nicks[0], line[2]);
                                                bool tmp_me = false;
                                                for (int y = 0; y <= total_nicks.GetUpperBound(0); y++)
                                                {
                                                    if (total_nicks[y].Equals(conf.name, StringComparison.OrdinalIgnoreCase))
                                                    {
                                                        tmp_me = true;
                                                    }
                                                }
                                                if (sent_nick_access == conf.owner_level)
                                                {
                                                    ircbot.sendData("PRIVMSG", line[2] + " :You can't kick-ban my owner!");
                                                }
                                                else if (tmp_me == true)
                                                {
                                                    ircbot.sendData("PRIVMSG", line[2] + " :You can't kick-ban me!");
                                                }
                                                else
                                                {
                                                    if (nick_access >= sent_nick_access)
                                                    {
                                                        if (new_line.GetUpperBound(0) > 0)
                                                        {
                                                            add_auto(total_nicks[0], line[2], target_host, "kb", new_line[1], ircbot);
                                                        }
                                                        else
                                                        {
                                                            add_auto(total_nicks[0], line[2], target_host, "kb", "No Reason", ircbot);
                                                        }
                                                    }
                                                    else
                                                    {
                                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                    case "deak":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                string target_host = ircbot.get_user_host(line[4].ToLower());
                                                del_auto(line[4].ToLower(), line[2], target_host, "k", ircbot);
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                    case "deab":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                string target_host = ircbot.get_user_host(line[4].ToLower());
                                                del_auto(line[4].ToLower(), line[2], target_host, "b", ircbot);
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                    case "deakb":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                string target_host = ircbot.get_user_host(line[4].ToLower());
                                                del_auto(line[4].ToLower(), line[2], target_host, "kb", ircbot);
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                    case "k":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                string[] new_line = line[4].ToLower().Split(charS, 2);
                                                string nicks = new_line[0].TrimStart(':');
                                                char[] charSep = new char[] { ',' };
                                                string[] total_nicks = nicks.Split(charSep, StringSplitOptions.RemoveEmptyEntries);
                                                int sent_nick_access = ircbot.get_user_access(total_nicks[0], line[2]);
                                                bool tmp_me = false;
                                                for (int y = 0; y <= total_nicks.GetUpperBound(0); y++)
                                                {
                                                    if (total_nicks[y].Equals(conf.name, StringComparison.OrdinalIgnoreCase))
                                                    {
                                                        tmp_me = true;
                                                    }
                                                }
                                                if (sent_nick_access == conf.owner_level)
                                                {
                                                    ircbot.sendData("PRIVMSG", line[2] + " :You can't kick my owner!");
                                                }
                                                else if (tmp_me == true)
                                                {
                                                    ircbot.sendData("PRIVMSG", line[2] + " :You can't kick me!");
                                                }
                                                else
                                                {
                                                    if (nick_access >= sent_nick_access)
                                                    {
                                                        if (new_line.GetUpperBound(0) > 0)
                                                        {
                                                            ircbot.sendData("KICK", line[2] + " " + total_nicks[0] + " :" + new_line[1]);
                                                        }
                                                        else
                                                        {
                                                            ircbot.sendData("KICK", line[2] + " " + total_nicks[0] + " :No Reason");
                                                        }
                                                    }
                                                    else
                                                    {
                                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                        }
                                        break;
                                    case "kme":
                                        if (spam_check == true)
                                        {
                                            ircbot.add_spam_count(channel);
                                        }
                                        if (nick_access >= command_access)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                ircbot.sendData("KICK", line[2] + " " + nick + " :" + line[4]);
                                            }
                                            else
                                            {
                                                ircbot.sendData("KICK", line[2] + " " + nick + " :No Reason");
                                            }
                                        }
                                        break;
                                }
                            }
                        }
                    }
                }
            }
            if (type.Equals("join"))
            {
                string[] user_info = line[0].Split('@');
                string nick_host = user_info[1];
                check_auto(nick, channel.TrimStart(':'), nick_host, ircbot);
            }
        }
Example #4
0
 public int get_user_access(string nick, string channel)
 {
     int access_num = conf.default_level;
     try
     {
         string access = access_num.ToString();
         string tmp_custom_access = "";
         if (nick.Equals(conf.nick))
         {
             access = conf.owner_level.ToString();
         }
         bool user_identified = get_user_ident(nick);
         if (user_identified == true)
         {
             for (int x = 0; x < conf.module_config.Count(); x++)
             {
                 if (conf.module_config[x][0].Equals("access"))
                 {
                     bool chan_allowed = true;
                     foreach (string blacklist in conf.module_config[x][2].Split(','))
                     {
                         if (blacklist.Equals(channel))
                         {
                             chan_allowed = false;
                             break;
                         }
                     }
                     if (chan_allowed)
                     {
                         if (channel != null)
                         {
                             Modules.access acc = new Modules.access();
                             tmp_custom_access = acc.get_access_list(nick, channel, this);
                             access = tmp_custom_access;
                         }
                     }
                     break;
                 }
             }
         }
         for (int x = 0; x < nick_list.Count(); x++)
         {
             if (nick_list[x][0].Equals(channel) || channel == null)
             {
                 for (int i = 2; i < nick_list[x].Count(); i++)
                 {
                     string[] lists = nick_list[x][i].Split(':');
                     if (lists.GetUpperBound(0) > 0)
                     {
                         if (lists[1].ToLower().Equals(nick))
                         {
                             access += "," + lists[0];
                             break;
                         }
                     }
                 }
                 break;
             }
         }
         if (user_identified == true)
         {
             string[] owners = conf.owner.Split(','); // Get list of owners
             for (int x = 0; x <= owners.GetUpperBound(0); x++)
             {
                 if (nick.Equals(owners[x].ToLower()))
                 {
                     access += "," + conf.owner_level.ToString();
                 }
             }
         }
         string[] tmp_access = access.TrimStart(',').TrimEnd(',').Split(',');
         foreach (string access_line in tmp_access)
         {
             if (access_line != "")
             {
                 if (Convert.ToInt32(access_line) > access_num)
                 {
                     access_num = Convert.ToInt32(access_line);
                 }
             }
         }
         if (access_num == conf.default_level && channel != null)
         {
             bool nick_found = false;
             access_num = get_user_op(nick, channel);
             if (access_num != conf.default_level)
             {
                 for (int x = 0; x < nick_list.Count(); x++)
                 {
                     if (nick_list[x][0].Equals(channel))
                     {
                         for (int i = 2; i < nick_list[x].Count(); i++)
                         {
                             string[] lists = nick_list[x][i].Split(':');
                             if (lists.GetUpperBound(0) > 0)
                             {
                                 if (lists[1].ToLower().Equals(nick))
                                 {
                                     nick_found = true;
                                     string new_nick = access_num.ToString();
                                     for (int z = 1; z < lists.Count(); z++)
                                     {
                                         new_nick += ":" + lists[z];
                                     }
                                     nick_list[x][i] = new_nick;
                                     break;
                                 }
                             }
                         }
                         if (nick_found == false)
                         {
                             nick_list[x].Add(access_num + ":" + nick);
                         }
                         break;
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         lock (ircbot.errorlock)
         {
             ircbot.log_error(ex);
         }
     }
     return access_num;
 }