2 def help(plugin, topic="")
3 "perform autoop based on hostmask - usage: add <hostmask> [channel channel ...], rm <hostmask> [channel], list - list current ops. If you don't specify which channels, all channels are assumed"
8 @registry.each { |mask,channels|
9 if m.source.matches?(mask.to_irc_netmask(:server => m.server)) &&
10 (channels.empty? || channels.include?(m.channel.to_s))
11 @bot.mode(m.channel, "+o", m.source.nick)
19 is_on = m.server.channels.inject(ChannelList.new) { |list, ch|
20 list << ch if ch.users.include?(m.source)
23 is_on.each { |channel|
25 @registry.each { |mask,channels|
26 if m.source.matches?(mask.to_irc_netmask(:server => m.server)) &&
27 (channels.empty? || channels.include?(ch))
28 @bot.mode(ch, "+o", m.source.nick)
36 @registry[params[:mask]] = params[:channels].dup
41 unless @registry.has_key?(params[:mask])
42 m.reply @bot.lang.get('dunno')
45 if (!params[:channels].empty? && @registry[params[:mask]] != nil)
46 params[:channels].each do |c|
47 @registry[params[:mask]] = @registry[params[:mask]].reject {|ele| ele =~ /^#{c}$/i}
49 if @registry[params[:mask]].empty?
50 @registry.delete(params[:mask])
53 @registry.delete(params[:mask])
59 debug @registry.length
60 if(@registry.length > 0)
61 @registry.each { |mask,channels|
62 m.reply "#{mask} in #{channels.empty? ? 'all channels' : channels.join(', ')}"
72 plugin.map 'autoop list', :action => 'list'
73 plugin.map 'autoop add :mask *channels', :action => 'add'
74 plugin.map 'autoop add :mask', :action => 'add'
75 plugin.map 'autoop rm :mask *channels', :action => 'rm'
76 plugin.map 'autoop rm :mask', :action => 'rm'