+#-- vim:sw=2:et
+#++
+#
+# :title: IRC Socket
+#
+# This module implements the IRC socket interface, including IRC message
+# penalty computation and the message queue system
+
require 'monitor'
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
+ # According to eggdrop, the initial penalty is
penalty = 1 + self.size/100
# on everything but UnderNET where it's
# penalty = 2 + self.size/120
# normalized uri of the current server
attr_reader :server_uri
+ # penalty multiplier (percent)
+ attr_accessor :penalty_pct
+
# default trivial filter class
class IdentityFilter
def in(x)
@spooler = false
@lines_sent = 0
@lines_received = 0
- if opts.kind_of?(Hash) and opts.key?(:ssl)
- @ssl = opts[:ssl]
- else
- @ssl = false
- end
+ @ssl = opts[:ssl]
+ @penalty_pct = opts[:penalty_pct] || 100
end
def connected?
@sock.syswrite actual
@last_send = now
@flood_send = now if @flood_send < now
- @flood_send += message.irc_send_penalty if penalty
+ @flood_send += message.irc_send_penalty*@penalty_pct/100.0 if penalty
@lines_sent += 1
end
rescue Exception => e