def call(statuses, event, indent = 0)
if event == :update_friends_timeline
msg_type = PRIVMSG
else
time_format = Termtter::Client.time_format_for statuses
msg_type = NOTICE
end
statuses.each do |s|
typable_id = Termtter::Client.data_to_typable_id(s.id)
time = Time.parse(s.created_at).strftime(time_format) if time_format
reply_to_status_id_str =
if s.in_reply_to_status_id
"(reply to #{Termtter::Client.data_to_typable_id(s.in_reply_to_status_id)})"
else
nil
end
padding = indent > 0 ? '→' : nil
post s.user.screen_name, msg_type, main_channel, [time, padding, CGI.unescapeHTML(s.text), typable_id, reply_to_status_id_str].compact.join(' ')
if config.plugins.stdout.show_reply_chain && s.in_reply_to_status_id && indent < config.plugins.stdout.max_indent_level
begin
if reply = Termtter::API.twitter.cached_status(s.in_reply_to_status_id)
call([reply], event, indent+1)
end
rescue Rubytter::APIError
end
end
end
end