summaryrefslogtreecommitdiff
path: root/lib/rbot
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-02-05 15:53:54 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-02-05 15:53:54 +0000
commita92733f2f61cbce1b867d6ec3d7c7d8e434f5013 (patch)
tree02535b8caf582165c05245876605c63d27b79180 /lib/rbot
parent94e4174de0616fdae0592922d73f86bff4664d84 (diff)
Fix max_lines handling in new sendmsg code
Diffstat (limited to 'lib/rbot')
-rw-r--r--lib/rbot/ircbot.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb
index 5cd0ac4d..c744ca51 100644
--- a/lib/rbot/ircbot.rb
+++ b/lib/rbot/ircbot.rb
@@ -786,19 +786,21 @@ class IrcBot
# Counter to check the number of lines sent by this command
cmd_lines = 0
max_lines = opts[:max_lines]
+ maxed = false
line = String.new
lines.each { |msg|
begin
- if(left >= msg.length)
- sendq "#{fixed}#{msg}", chan, ring
- log_sent(type, where, msg)
- break
- end
- if opts[:max_lines] and cmd_lines == max_lines - 1
+ if max_lines and cmd_lines == max_lines - 1
debug "Max lines count reached for message #{original_message.inspect} while sending #{msg.inspect}, truncating"
truncate = opts[:truncate_text]
truncate = @default_send_options[:truncate_text] if truncate.length > left
truncate = "" if truncate.length > left
+ maxed = true
+ end
+ if(left >= msg.length) and not maxed
+ sendq "#{fixed}#{msg}", chan, ring
+ log_sent(type, where, msg)
+ break
end
if truncate
line.replace msg.slice(0, left-truncate.length)