diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2006-07-19 16:55:09 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2006-07-19 16:55:09 +0000 |
commit | 63d19509dd6858dca025b68e3557914fa5e4cc18 (patch) | |
tree | be3043c5afc946651f8d75347cf3528dc5faa69c /lib/rbot/ircbot.rb | |
parent | 455eaba9fcc043cd0e7f497626555af8a5281a2b (diff) |
Fine-tune byterate throttling flood prevention. Better than before, but still not there.
Diffstat (limited to 'lib/rbot/ircbot.rb')
-rw-r--r-- | lib/rbot/ircbot.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb index fb33b7f5..d513cb71 100644 --- a/lib/rbot/ircbot.rb +++ b/lib/rbot/ircbot.rb @@ -407,8 +407,12 @@ class IrcBot # relevant say() or notice() methods. This one should be used for IRCd # extensions you want to use in modules. def sendmsg(type, where, message) - # limit it 440 chars + CRLF.. so we have to split long lines - left = 440 - type.length - where.length - 3 + # limit it according to the byterate, splitting the message + # taking into consideration the actual message length + # and all the extra stuff + # TODO allow something to do for commands that produce too many messages + # TODO example: math 10**10000 + left = @socket.bytes_per - type.length - where.length - 4 begin if(left >= message.length) sendq("#{type} #{where} :#{message}") |