def status_line(s, time_format, event, indent = 0)
return '' unless s
text = escape(TermColor.escape(s.text))
color = color_of_user(s.user)
status_id = Termtter::Client.data_to_typable_id(s.id)
reply_to_status_id =
if s.in_reply_to_status_id
Termtter::Client.data_to_typable_id(s.in_reply_to_status_id)
else
nil
end
retweeted_status_id =
if s.retweeted_status
Termtter::Client.data_to_typable_id(s.retweeted_status.id)
else
nil
end
time = "(#{Time.parse(s.created_at).strftime(time_format)})"
source =
case s.source
when />(.*?)</ then $1
when 'web' then 'web'
end
text = colorize_users(text)
text = Client.get_hooks(:pre_coloring).inject(text) {|result, hook|
hook.call(result, event)
}
indent_text = indent > 0 ? eval(config.plugins.stdout.indent_format) : ''
erbed_text = ERB.new(config.plugins.stdout.timeline_format).result(binding)
erbed_text = Client.get_hooks(:pre_output).inject(erbed_text) {|result, hook|
hook.call(result, event)
}
text = TermColor.unescape(TermColor.parse(erbed_text) + "\n")
if config.plugins.stdout.show_reply_chain && s.in_reply_to_status_id
indent += 1
unless indent > config.plugins.stdout.max_indent_level
begin
if status = Termtter::API.twitter.cached_status(s.in_reply_to_status_id)
text << status_line(status, time_format, event, indent)
end
rescue Rubytter::APIError
end
end
end
text
end