]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
Implement penalty for WHO and PART based on eggdrop code.
authorRobin H. Johnson <robbat2@gentoo.org>
Wed, 17 Jun 2009 22:15:59 +0000 (22:15 +0000)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sun, 7 Mar 2010 19:34:58 +0000 (20:34 +0100)
lib/rbot/ircsocket.rb

index 36a223f9d52cc456efc1179835d143184e51f2ee..7c0253a5e8c966de1b300d02f8b882a6c0525123 100644 (file)
@@ -48,8 +48,14 @@ class ::String
       dests = pars.split($;,2).first
       penalty += dests.split(',').size
     when :WHO
-      # I'm too lazy to implement this one correctly
-      penalty += 5
+      args = parts.split
+      if args.length > 0
+        penalty += args.inject(0){ |sum,x| sum += ((x.length > 4) ? 3 : 5) }
+      else
+        penalty += 10
+      end
+    when :PART
+      penalty += 4
     when :AWAY, :JOIN, :VERSION, :TIME, :TRACE, :WHOIS, :DNS
       penalty += 2
     when :INVITE, :NICK