3 "addop" => "handle_addop",
4 "rmop" => "handle_rmop",
5 "listop" => "handle_listop"
8 def help(plugin, topic="")
9 "perform autoop based on hostmask - usage: addop <hostmask>, rmop <hostmask>, listop"
14 @registry.each { |mask,channels|
15 if(Irc.netmaskmatch(mask, m.source) && channels.include?(m.channel))
16 @bot.mode(m.channel, "+o", m.sourcenick)
24 if (!m.params || m.params == "list")
26 elsif (m.params =~ /^add\s+(.+)$/)
28 elsif (m.params =~ /^rm\s+(.+)$/)
34 def handle_addop(m, params)
35 ma = /^(.+?)(\s+(.+))?$/.match(params)
36 channels = ma[2] ? ma[2] : @bot.config['JOIN_CHANNELS']
38 @registry[ma[1]] = channels.split(/,\s*/).collect { |x|
43 m.reply @bot.lang.get('dunno')
47 def handle_rmop(m, params)
48 if(!@registry.delete(params))
49 m.reply @bot.lang.get('dunno')
57 @registry.each { |mask,channels|
58 m.reply "#{mask} in #{channels.join(', ')}"
67 plugin.register("autoop")