internal int get_nick_access(string tmp_nick, string channel) { List<int> access_num = new List<int>(); int top_access = Conf.Default_Level; access_num.Add(Conf.Default_Level); try { Nick_Info nick_info = get_nick_info(tmp_nick, channel); if (nick_info != null) { access_num.Add(nick_info.Access); } else { Nick_Info new_nick = new Nick_Info(); new_nick.Nick = tmp_nick; new_nick.Access = Conf.Default_Level; new_nick.Identified = false; add_nick_info(new_nick, channel); nick_info = new_nick; } if (nick_info.Nick.Equals(nick, StringComparison.InvariantCultureIgnoreCase)) { access_num.Add(Conf.Owner_Level); } if (!nick_info.Identified) { nick_info.Identified = get_nick_ident(nick_info.Nick); } if (nick_info.Identified == true) { foreach (Modules.Module module in Conf.Modules) { if (module.Class_Name.Equals("access")) { bool chan_allowed = true; foreach (string blacklist in module.Blacklist) { if (blacklist.Equals(channel, StringComparison.InvariantCultureIgnoreCase)) { chan_allowed = false; break; } } if (chan_allowed) { Modules.access acc = new Modules.access(); access_num.AddRange(acc.get_access_list(tmp_nick, channel, this)); } break; } } } if (nick_info.Identified == true) { foreach (string owner in Conf.Owners) { if (tmp_nick.Equals(owner, StringComparison.InvariantCultureIgnoreCase)) { access_num.Add(Conf.Owner_Level); } } } foreach (int access in access_num) { if (access > top_access) { top_access = access; } } if (top_access == Conf.Default_Level && channel != null) { top_access = get_nick_chan_access(tmp_nick, channel); if (top_access != Conf.Default_Level) { nick_info.Access = top_access; } } } catch (Exception ex) { lock (controller.errorlock) { controller.log_error(ex, Conf.Logs_Path); } } return top_access; }
public override void control(bot ircbot, BotConfig Conf, 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 disallowed_modes = this.Options["disallowed_modes"]; if (type.Equals("channel") && bot_command == true) { foreach (Command tmp_command in this.Commands) { bool blocked = tmp_command.Blacklist.Contains(channel) || tmp_command.Blacklist.Contains(nick); bool cmd_found = false; bool spam_check = ircbot.get_spam_check(channel, nick, tmp_command.Spam_Check); if (spam_check == true) { blocked = blocked || ircbot.get_spam_status(channel); } cmd_found = tmp_command.Triggers.Contains(command); 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 tmp_command.Triggers) { switch (trigger) { case "founder": if (spam_check == true) { ircbot.add_spam_count(channel); } if (nick_access >= tmp_command.Access) { if (line.GetUpperBound(0) > 3) { ircbot.sendData("MODE", line[2] + " +q " + line[4]); access.set_access_list(line[4], 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 >= tmp_command.Access) { if (line.GetUpperBound(0) > 3) { ircbot.sendData("MODE", line[2] + " -q " + line[4]); access.del_access_list(line[4], 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 >= tmp_command.Access) { if (line.GetUpperBound(0) > 3) { ircbot.sendData("MODE", line[2] + " +a " + line[4]); access.set_access_list(line[4], 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 >= tmp_command.Access) { if (line.GetUpperBound(0) > 3) { ircbot.sendData("MODE", line[2] + " +a " + line[4]); ircbot.sendData("PRIVMSG", "chanserv :SOP " + line[2] + " add " + line[4]); access.set_access_list(line[4], 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 >= tmp_command.Access) { if (line.GetUpperBound(0) > 3) { ircbot.sendData("MODE", line[2] + " -a " + line[4]); ircbot.sendData("PRIVMSG", "chanserv :SOP " + line[2] + " del " + line[4]); access.del_access_list(line[4], 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 >= tmp_command.Access) { if (line.GetUpperBound(0) > 3) { ircbot.sendData("MODE", line[2] + " -a " + line[4]); access.del_access_list(line[4], 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 >= tmp_command.Access) { if (line.GetUpperBound(0) > 3) { ircbot.sendData("MODE", line[2] + " +o " + line[4]); access.set_access_list(line[4], 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 >= tmp_command.Access) { if (line.GetUpperBound(0) > 3) { ircbot.sendData("MODE", line[2] + " +o " + line[4]); if (!ircbot.get_nick_auto("SOP", line[2], line[4])) { ircbot.sendData("PRIVMSG", "chanserv :AOP " + line[2] + " add " + line[4]); } access.set_access_list(line[4], 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 >= tmp_command.Access) { if (line.GetUpperBound(0) > 3) { ircbot.sendData("MODE", line[2] + " -o " + line[4]); ircbot.sendData("PRIVMSG", "chanserv :AOP " + line[2] + " del " + line[4]); access.del_access_list(line[4], 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 >= tmp_command.Access) { if (line.GetUpperBound(0) > 3) { ircbot.sendData("MODE", line[2] + " -o " + line[4]); access.del_access_list(line[4], 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 >= tmp_command.Access) { if (line.GetUpperBound(0) > 3) { ircbot.sendData("MODE", line[2] + " +h " + line[4]); if (!ircbot.get_nick_auto("AOP", line[2], line[4]) && !ircbot.get_nick_auto("SOP", line[2], line[4])) { ircbot.sendData("PRIVMSG", "chanserv :HOP " + line[2] + " add " + line[4]); } access.set_access_list(line[4], 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 >= tmp_command.Access) { if (line.GetUpperBound(0) > 3) { ircbot.sendData("MODE", line[2] + " -h " + line[4]); ircbot.sendData("PRIVMSG", "chanserv :HOP " + line[2] + " del " + line[4]); access.del_access_list(line[4], 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 >= tmp_command.Access) { if (line.GetUpperBound(0) > 3) { ircbot.sendData("MODE", line[2] + " +h " + line[4]); access.set_access_list(line[4], 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 >= tmp_command.Access) { if (line.GetUpperBound(0) > 3) { ircbot.sendData("MODE", line[2] + " -h " + line[4]); access.del_access_list(line[4], 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 >= tmp_command.Access) { if (line.GetUpperBound(0) > 3) { ircbot.sendData("MODE", line[2] + " +v " + line[4]); if (!ircbot.get_nick_auto("AOP", line[2], line[4]) && !ircbot.get_nick_auto("SOP", line[2], line[4]) && !ircbot.get_nick_auto("VOP", line[2], line[4])) { ircbot.sendData("PRIVMSG", "chanserv :VOP " + line[2] + " add " + line[4]); } access.set_access_list(line[4], 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 >= tmp_command.Access) { if (line.GetUpperBound(0) > 3) { ircbot.sendData("MODE", line[2] + " -v " + line[4]); ircbot.sendData("PRIVMSG", "chanserv :VOP " + line[2] + " del " + line[4]); access.del_access_list(line[4], 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 >= tmp_command.Access) { if (line.GetUpperBound(0) > 3) { ircbot.sendData("MODE", line[2] + " +v " + line[4]); access.set_access_list(line[4], 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 >= tmp_command.Access) { if (line.GetUpperBound(0) > 3) { ircbot.sendData("MODE", line[2] + " -v " + line[4]); access.del_access_list(line[4], 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 >= tmp_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 >= tmp_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 >= tmp_command.Access) { if (line.GetUpperBound(0) > 3) { string[] new_line = line[4].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 >= tmp_command.Access) { if (line.GetUpperBound(0) > 3) { string[] new_line = line[4].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_nick_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_nick_host(total_nicks[0]); string ban = "*!*@" + target_host; if (String.IsNullOrEmpty(target_host)) { 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 >= tmp_command.Access) { if (line.GetUpperBound(0) > 3) { string[] new_line = line[4].Split(charS, 2); char[] charSep = new char[] { ',' }; string[] total_nicks = new_line[0].Split(charSep, StringSplitOptions.RemoveEmptyEntries); int sent_nick_access = ircbot.get_nick_access(total_nicks[0].TrimStart(':'), line[2]); if (nick_access >= sent_nick_access) { string target_host = ircbot.get_nick_host(total_nicks[0]); string ban = "*!*@" + target_host; if (String.IsNullOrEmpty(target_host)) { 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 >= tmp_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 >= tmp_command.Access) { if (line.GetUpperBound(0) > 3) { string[] new_line = line[4].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_nick_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.InvariantCultureIgnoreCase)) { 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_nick_host(total_nicks[0]); string ban = "*!*@" + target_host; if (String.IsNullOrEmpty(target_host)) { 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 >= tmp_command.Access) { if (line.GetUpperBound(0) > 3) { string[] new_line = line[4].Split(charS, 3, StringSplitOptions.RemoveEmptyEntries); if (new_line.GetUpperBound(0) > 0) { string nicks = new_line[1]; char[] charSep = new char[] { ',' }; string[] total_nicks = nicks.Split(charSep, StringSplitOptions.RemoveEmptyEntries); string target_host = ircbot.get_nick_host(total_nicks[0]); int sent_nick_access = ircbot.get_nick_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.InvariantCultureIgnoreCase)) { 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 (String.IsNullOrEmpty(target_host)) { 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 >= tmp_command.Access) { if (line.GetUpperBound(0) > 3) { string[] new_line = line[4].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_nick_access(total_nicks[0], line[2]); string target_host = ircbot.get_nick_host(total_nicks[0]); bool tmp_me = false; for (int y = 0; y <= total_nicks.GetUpperBound(0); y++) { if (total_nicks[y].Trim().Equals(Conf.Name, StringComparison.InvariantCultureIgnoreCase)) { 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 (String.IsNullOrEmpty(target_host)) { 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 >= tmp_command.Access) { if (line.GetUpperBound(0) > 3) { string[] new_line = line[4].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_nick_access(total_nicks[0], line[2]); bool tmp_me = false; for (int y = 0; y <= total_nicks.GetUpperBound(0); y++) { if (total_nicks[y].Trim().Equals(Conf.Name, StringComparison.InvariantCultureIgnoreCase)) { 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_nick_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 >= tmp_command.Access) { if (line.GetUpperBound(0) > 3) { string[] new_line = line[4].Split(charS, 2); string target_host = ircbot.get_nick_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_nick_access(total_nicks[0], line[2]); bool tmp_me = false; for (int y = 0; y <= total_nicks.GetUpperBound(0); y++) { if (total_nicks[y].Trim().Equals(Conf.Name, StringComparison.InvariantCultureIgnoreCase)) { 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 >= tmp_command.Access) { if (line.GetUpperBound(0) > 3) { string[] new_line = line[4].Split(charS, 2); string target_host = ircbot.get_nick_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_nick_access(total_nicks[0], line[2]); bool tmp_me = false; for (int y = 0; y <= total_nicks.GetUpperBound(0); y++) { if (total_nicks[y].Trim().Equals(Conf.Name, StringComparison.InvariantCultureIgnoreCase)) { 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 >= tmp_command.Access) { if (line.GetUpperBound(0) > 3) { string target_host = ircbot.get_nick_host(line[4]); del_auto(line[4], 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 >= tmp_command.Access) { if (line.GetUpperBound(0) > 3) { string target_host = ircbot.get_nick_host(line[4]); del_auto(line[4], 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 >= tmp_command.Access) { if (line.GetUpperBound(0) > 3) { string target_host = ircbot.get_nick_host(line[4]); del_auto(line[4], 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 >= tmp_command.Access) { if (line.GetUpperBound(0) > 3) { string[] new_line = line[4].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_nick_access(total_nicks[0], line[2]); bool tmp_me = false; for (int y = 0; y <= total_nicks.GetUpperBound(0); y++) { if (total_nicks[y].Trim().Equals(Conf.Name, StringComparison.InvariantCultureIgnoreCase)) { 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 >= tmp_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); } }