def self.post_retweet(s, comment = nil)
s[:user][:protected] and
config.plugins.retweet.confirm_protected and
!confirm("#{s.user.screen_name} is protected! Are you sure?", false) and
return
if comment.nil? && config.plugins.retweet.official_retweet
begin
Termtter::API.twitter.retweet(s.id)
puts TermColor.parse("<blue>=> RT @#{s.user.screen_name}: #{s.text}</blue>")
return
rescue Rubytter::APIError
if $!.to_s == 'Not found'
Termtter::Client.logger.warn "Failed official retweet. Set twitter langage to English in https://twitter.com/account/settings or set config.plugins.retweet.official_retweet to false."
else
raise
end
end
end
comment += ' ' unless comment.nil?
rt_or_qt = (config.plugins.retweet.quotetweet and comment) ? 'QT' : 'RT'
text = ERB.new(config.plugins.retweet.format).result(binding)
params = config.plugins.retweet.as_reply ? {:in_reply_to_status_id => s.id} : {}
Termtter::API.twitter.update(text, params)
puts "=> #{text}"
end