summaryrefslogtreecommitdiff
path: root/lib/rbot/rfc2812.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbot/rfc2812.rb')
-rw-r--r--lib/rbot/rfc2812.rb64
1 files changed, 0 insertions, 64 deletions
diff --git a/lib/rbot/rfc2812.rb b/lib/rbot/rfc2812.rb
index 9fa81cb5..26549539 100644
--- a/lib/rbot/rfc2812.rb
+++ b/lib/rbot/rfc2812.rb
@@ -1,67 +1,3 @@
-class ::String
- # Calculate the penalty which will be assigned to this message
- # by the IRCd
- def irc_send_penalty
- # According to eggrdop, the initial penalty is
- penalty = 1 + self.length/100
- # on everything but UnderNET where it's
- # penalty = 2 + self.length/120
-
- cmd, pars = self.split($;,2)
- debug "cmd: #{cmd}, pars: #{pars.inspect}"
- case cmd.to_sym
- when :KICK
- chan, nick, msg = pars.split
- chan = chan.split(',')
- nick = nick.split(',')
- penalty += nick.length
- penalty *= chan.length
- when :MODE
- chan, modes, argument = pars.split
- extra = 0
- if modes
- extra = 1
- if argument
- extra += modes.split(/\+|-/).length
- else
- extra += 3 * modes.split(/\+|-/).length
- end
- end
- if argument
- extra += 2 * argument.split.length
- end
- penalty += extra * chan.split.length
- when :TOPIC
- penalty += 1
- penalty += 2 unless pars.split.length < 2
- when :PRIVMSG, :NOTICE
- dests = pars.split($;,2).first
- penalty += dests.split(',').length
- when :WHO
- # I'm too lazy to implement this one correctly
- penalty += 5
- when :AWAY, :JOIN, :VERSION, :TIME, :TRACE, :WHOIS, :DNS
- penalty += 2
- when :INVITE, :NICK
- penalty += 3
- when :ISON
- penalty += 1
- else # Unknown messages
- penalty += 1
- end
- if penalty > 99
- debug "Wow, more than 99 secs of penalty!"
- penalty = 99
- end
- if penalty < 2
- debug "Wow, less than 2 secs of penalty!"
- penalty = 2
- end
- debug "penalty: #{penalty}"
- return penalty
- end
-end
-
module Irc
# RFC 2812 Internet Relay Chat: Client Protocol
#