case saw.type.to_sym
when :PUBLIC
- ret << "saying #{saw.message}"
+ ret << "saying \"#{saw.message}\""
when :ACTION
ret << "doing #{saw.nick} #{saw.message}"
when :NICK
ret << "changing nick from #{saw.nick} to #{saw.message}"
when :PART
ret << "leaving #{saw.where}"
+ ret << " (#{saw.message})" unless saw.message.empty?
when :JOIN
ret << "joining #{saw.where}"
when :QUIT
ret << "quitting IRC (#{saw.message})"
when :TOPIC
- ret << "changing the topic of #{saw.where} to #{saw.message}"
+ ret << "changing the topic of #{saw.where} to \"#{saw.message}\""
end
+
+ case saw.type.to_sym
+ when :PART, :QUIT
+ before = reg.first
+ if before.type == "PUBLIC" || before.type == "ACTION"
+ time_diff = saw.time - before.time
+ if time_diff < 300
+ time = "a moment"
+ elsif time_diff < 3600
+ time = "a while"
+ else
+ return ret
+ end
+
+ ret << ' and %{time} before' % { :time => time }
+
+ if before.type == "PUBLIC"
+ ret << ' saying "%{message}"' % {
+ :message => before.message
+ }
+ elsif before.type == "ACTION"
+ ret << ' doing *%{message}*' % {
+ :nick => saw.nick,
+ :message => before.message
+ }
+ end
+ end
+ end
+ return ret
end
def store(m, saw)