From: Robin H. Johnson Date: Wed, 17 Jun 2009 22:15:59 +0000 (+0000) Subject: Implement penalty for WHO and PART based on eggdrop code. X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=8893bf66c0aa6f2bbf2e2941f7be82486fecdb46;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git Implement penalty for WHO and PART based on eggdrop code. --- diff --git a/lib/rbot/ircsocket.rb b/lib/rbot/ircsocket.rb index 36a223f9..7c0253a5 100644 --- a/lib/rbot/ircsocket.rb +++ b/lib/rbot/ircsocket.rb @@ -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