]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
AutoOp now triggers on nick change too
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Thu, 10 Aug 2006 22:21:37 +0000 (22:21 +0000)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Thu, 10 Aug 2006 22:21:37 +0000 (22:21 +0000)
ChangeLog
data/rbot/plugins/autoop.rb

index 1b65ce95f54186a1c32cfdeb404bbd349648d9c8..82614afcf97b1b8021d51f6e0d07439fd73b6266 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2006-08-11  Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
 
        * AutoOp plugin: adapted to the new IRC framework.
+       * AutoOp plugin: trigger autoop on nick change too.
 
 2006-08-10  Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
 
index 5f416e41ee31db953c4aee5871eb5c880cac506b..a47375ca69d00e6ae5ccf096d07a4b1f961fdfa0 100644 (file)
@@ -14,6 +14,24 @@ class AutoOP < Plugin
       }
     end
 
+    def nick(m)
+      return if m.address?
+      is_on = m.server.channels.inject(ChannelList.new) { |list, ch|
+        list << ch if ch.users.include?(m.source)
+        list
+      }
+      is_on.each { |channel|
+        ch = channel.to_s
+        @registry.each { |mask,channels|
+          if m.source.matches?(mask.to_irc_netmask(:server => m.server)) &&
+            (channels.empty? || channels.include?(ch))
+            @bot.mode(ch, "+o", m.source.nick)
+            return
+          end
+        }
+      }
+    end
+
     def add(m, params)
       @registry[params[:mask]] = params[:channels].dup
       m.okay