|
# File rbot/ircbot.rb, line 283
def sendmsg(type, where, message)
# limit it 440 chars + CRLF.. so we have to split long lines
left = 440 - type.length - where.length - 3
begin
if(left >= message.length)
sendq("#{type} #{where} :#{message}")
log_sent(type, where, message)
return
end
line = message.slice!(0, left)
lastspace = line.rindex(/\s+/)
if(lastspace)
message = line.slice!(lastspace, line.length) + message
message.gsub!(/^\s+/, "")
end
sendq("#{type} #{where} :#{line}")
log_sent(type, where, line)
end while(message.length > 0)
end
|