diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-01-28 23:18:09 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-01-28 23:18:09 +0000 |
commit | 068648469065bd1fd522ed0748b6e4bd567874ac (patch) | |
tree | f0b806c28709dc5a4a15a3ac49a265fb47476c4e | |
parent | ed05ade02af030196f2850389e6fc291440b79b2 (diff) |
Try to squeeze as much characters as possible on a single line
-rw-r--r-- | lib/rbot/ircbot.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb index 96947c5a..a64cedb4 100644 --- a/lib/rbot/ircbot.rb +++ b/lib/rbot/ircbot.rb @@ -668,12 +668,11 @@ 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, chan=nil, ring=0) - # Split the message so that each line sent is not longher than 400 bytes - # TODO allow something to do for commands that produce too many messages - # TODO example: math 10**10000 - # TODO try to use the maximum line length allowed by the server, if there is - # a way to know what it is - left = 400 - type.length - where.to_s.length - 3 + # The IRC protocol requires that each raw message must be not longer + # than 512 characters, including the EOL terminators (CR+LF), so we + # split the incoming message so that each line sent is not longher + # than that. + left = 510 - type.to_s.length - where.to_s.length - 3 begin if(left >= message.length) sendq "#{type} #{where} :#{message}", chan, ring |