- @@handlers = {
- "addop" => "handle_addop",
- "rmop" => "handle_rmop",
- "listop" => "handle_listop"
+ Config.register Config::BooleanValue.new('autoop.on_nick',
+ :default => true,
+ :desc => "Determines if the bot should auto-op when someone changes nick " +
+ "and the new nick matches a listed netmask")
+
+ Config.register Config::StringValue.new('autoop.seed_format',
+ :default => "*!%{user}@*",
+ :desc => "Hostmask format used when seeding channels. Recognized tokens: " +
+ "nick, user, host")
+
+ def help(plugin, topic="")
+ return "perform autoop based on hostmask - usage:" +
+ "add <hostmask> [channel channel ...], rm <hostmask> [channel], " +
+ "If you don't specify which channels, all channels are assumed, " +
+ "list - list current ops, " +
+ "restore [channel] - op anybody that would " +
+ "have been opped if they had just joined, " +
+ "seed [channel] - Find current ops and make sure they will " +
+ "continue to be autoopped"
+ end
+
+ def join(m)
+ return if m.address?
+ @registry.each { |mask,channels|
+ if m.source.matches?(mask.to_irc_netmask(:server => m.server)) &&
+ (channels.empty? || channels.include?(m.channel.to_s))
+ @bot.mode(m.channel, "+o", m.source.nick)
+ return
+ end