bool VerifyNick(string nick, ref string error) { IRCControllerVerify verify = Server.IRCVerify; if (verify == IRCControllerVerify.None) { return(true); } if (verify == IRCControllerVerify.HalfOp) { string prefix = GetPrefix(nick); if (prefix == "" || prefix == "+") { error = "You must be at least a half-op on the channel to use commands from IRC."; return(false); } return(true); } else { List <string> chanNicks = null; users.TryGetValue(opchannel, out chanNicks); int index = GetNickIndex(nick, chanNicks); if (index == -1) { error = "You must have joined the opchannel to use commands from IRC."; return(false); } return(true); } }
bool VerifyNick(string channel, string userNick, ref string error, ref bool foundAtAll) { List <string> chanNicks = GetNicks(channel); if (chanNicks.Count == 0) { return(false); } int index = GetNickIndex(userNick, chanNicks); if (index == -1) { return(false); } foundAtAll = true; IRCControllerVerify verify = Server.Config.IRCVerify; if (verify == IRCControllerVerify.None) { return(true); } if (verify == IRCControllerVerify.HalfOp) { string prefix = GetPrefix(chanNicks[index]); if (prefix.Length == 0 || prefix == "+") { error = "You must be at least a half-op on the channel to use commands from IRC."; return(false); } return(true); } else { foreach (string chan in bot.opchannels) { chanNicks = GetNicks(chan); if (chanNicks.Count == 0) { continue; } index = GetNickIndex(userNick, chanNicks); if (index != -1) { return(true); } } error = "You must have joined the opchannel to use commands from IRC."; return(false); } }