Adium

Profile: Matt Mechtley (biphenyl)

Comment Count 1 comments
0 xtras

Latest comments

# by biphenyl on 07/17/08 at 19:57:29

My friend and I just started using TwitterAdium today and were having this problem. After a bit of debugging we determined that TwitterAdium was saving a new timestamp to its temp file every 30 seconds instead of every 120. This of course put it over the 70 requests/minute allowed by Twitter, so it was locking us out of the updates. We think the problem is related to how ruby was parsing the date saved in the temp file. We were able to solve it by replacing this block in ~/Library/Application Support/Adium 2.0/Scripts/Twitter.AdiumScripts/Contents/Resources/twitter.rb:

begin
last = Time.parse(open(timefile).read).to_i
last_twitter = open(twitterfile).read.to_s
rescue
last = Time.now.to_i
open(timefile,"w").write(Time.now.strftime("%a %b %d %H:%M:%S %Y"))
last_twitter = ''
end

if (Time.now.to_i - last.to_i) > 120 || last_twitter == ''
open(timefile,"w").write(Time.now.to_s)
else
puts last_twitter
exit(0)
end

with this block:

begin
last = open(timefile).read.to_i
last_twitter = open(twitterfile).read.to_s
rescue
last = Time.now.to_i
open(timefile,"w").write(Time.now.to_i)
last_twitter = ''
end

if (Time.now.to_i - last.to_i) > 120 || last_twitter == ''
open(timefile,"w").write(Time.now.to_i)
else
puts last_twitter
exit(0)
end

This stores everything as a unix integer timestamp, so there's no question of how it's being parsed. Updates are now properly occurring once every two minutes and TwitterAdium is working correctly.