From 068648469065bd1fd522ed0748b6e4bd567874ac Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sun, 28 Jan 2007 23:18:09 +0000 Subject: Try to squeeze as much characters as possible on a single line --- lib/rbot/ircbot.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'lib') 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 -- cgit v1.2.3