Adium
Dock Icons Emoticons Contact List Styles Message Styles Sound Sets AppleScripts Status Icons Service Icons Menu Bar Icons Plugins Miscellaneous All
TwitterAdium

TwitterAdium

Submitted By Jesse Newland (jnewland)

Description

Version 1.1 requires your username, email, and password in your ~/.twitter file

Follow updates to TwitterAdium on Twitter - http://twitter.com/twitteradium

%_Twitter - this key, anywhere in Adium (away message, chat, profile, etc) will be replaced with your latest Twitter.

USAGE


  1. Type %_Twitter in a chat to yourself
  2. Fill in and save the config file that opens (located at ~/.twitter)
  3. Type %_Twitter again

Changes

v1.3 Feb 4, 2008
  • 120 seconds between updates to be nicer to twitter
  • Works for multiple users
  • Timezone friendly


v1.2 May 7, 2007
  • Better error handling



v1.1 Mar 29, 2007
  • Now additionally requires username in config file as well as email and password.
  • More friendly on Twitter servers.
  • Displays cached Tweet if one is available when Twitter is unavailable.


v1.0 Mar 21, 2007
  • Now uses email and password in ~/.twitter like other Twitter API apps.
  • Works for accounts with protected updates.
  • Asks Twitter for much less XML (uses http://twitter.com/statuses/user_timeline.xml?count=1).
  • Polls every 60 seconds, caches last Tweet locally.
  • Displays "Twitter is slow" after 15 seconds of no response from Twitter.


v0.3 Mar 6, 2007
  • Tweets with colons in them are no longer truncated


v0.2 Dec 6, 2006
  • Fixed config file creation routine
  • Moved config from .twitterc to .twitter to match the twitter ruby gem
  • Added a hint to create your config file if none exists


v0.1
  • Initial release

Images

Comments

You can reply to individual comments by clicking the "Reply" link next to each.

# by gerwitz on 01/24/07 at 11:55:07

This is just silently failing for me. Any hints on how to diagnose?

# by gerwitz on 01/25/07 at 07:43:53

nevermind, human error. I neglected to read the config file and see that I needed to enter the "number from my RSS feed".

I've also noticed that the email and password fields are not used from that file; I deleted them (makes me feel more secure) and this still works admirably.

# by jnewland on 01/25/07 at 07:49:14

Yeah, I should make that more obvious.

The email and password fields are used by some other scripts, including the Twitter Ruby Gem (http://twitter.rubyforge.org/), which I'm working on porting this plugin to use.

What other twitter features would be useful in this plugin?

# by ecable on 01/26/07 at 00:52:08

hey all, just a note - this has totally stopped working for me, as has my launchbar twitting script - dunno WTFs up, but I'm not sure if it's this plugin or the Twitter API which is broken. Twitterific is all acting weird too...

# by gerwitz on 01/26/07 at 12:42:21

> What other twitter features would be useful in this plugin?

Since you asked... my ideal setup:
- When I connect, if I'm on a different network than last seen, set my status to my plazes.com location ("at %_Plazes").
- Reverse this script: tweet my Adium status to twitter whenever it changes (either manually or as a result of the aforementioned script).

# by ericdfields on 01/30/07 at 19:51:31

I followed the default instructions, saving the config after it popps up after the first %_Twitter, but it seems to not work after that. What's the next step I should take?

# by ericdfields on 01/30/07 at 19:56:48

Well i missed the RSS thing as well. I put my ID in and set my status to '%_Twitter' but my status simply reads 'adium'

Any takers?

# by ericdfields on 01/30/07 at 21:03:19

Alright... i think twitter.com was just flippin out for a while. works beautifully now.

BTW... i highly recommend using this quicksilver action in combination with this adium plugin: http://blog.codahale.com/2007/01/15/t...uicksilver/

Set my Adium away message to be %_Twitter, type ctrl+space, [period], [message], tab, tw(autocompletes to 'twitter'), and BAM... IM and Twitter status are the same. Harmony.

# by jnewland on 01/30/07 at 21:09:56

Glad it's working for ya. I made some updates to that quicksilver action as well, and posted instructions for making it a trigger:

http://soylentfoo.jnewland.com/articl...quicksilver

# by janit0r on 02/05/07 at 14:16:12

Odd behavior: with a twitter status of text followed by URL (e.g. "anything is possible at http://www.zombo.com/"), the status displayed by Adium truncates after http (e.g. "anything is possible at http"). Statuses of equivalent length without URL are not truncated. Text parsing to blame?

Have any suggestions for troubleshooting?

# by jnewland on 02/05/07 at 14:18:48

That looks like a bug - I'll look into it and release a fix ASAP

# by janit0r on 02/22/07 at 13:56:35

Looks like the colon is responsible for skipping the rest of the text in other contexts as well. Any news on a new release?

# by jnewland on 02/22/07 at 14:06:22

I'm a bit swamped, but look for a new release fixing these bugs within a week or so.

# by akatsuki on 02/11/07 at 10:50:47

I would also almost prefer it to upload my status to twitter instead of downloading it.

# by Seeq on 02/12/07 at 00:48:39

This script isn't working for me at all. I did everything the instruction said but no go.

# by hibiscusroto on 02/17/07 at 12:50:16

OK, I'm able to update my Twitter via Adium, but am unable to get my Twitter to display as my status message in Adium. I have an away message setup like this...the title field and body are both set to "%_Twitter". Am I missing something? Any help would be appreciated.

# by billyd on 03/10/07 at 14:45:01

I had problems getting this to work to. It turns out it only works if you have a public Twitter profile, so if you have "Protect my updates" checked in your Twitter settings, this xtra won't work.

Any chance we can get a version of this that uses the API to access private accounts? (If that's even at all possible)

# by jnewland on 03/10/07 at 17:20:45

Unfortunately, the API doesn't currently provide access to a timeline for the logged-in user. I'm asking some people if that could change, however, and will keep everyone updated.

# by jnewland on 03/21/07 at 07:47:54

I've just uploaded version 1.0, which supports protected updates.

# by michaelrjohnson on 03/29/07 at 22:38:03

I am having the same issue as hiscusroto. I've installed the newest version (v1.1), configured the .twitter file by sending "%_Twitter". Every time that I use the "%_Twitter" command, it just re-opens the configuration file.

What have I missed? Any help would be much appreciated. Thanks!

# by jnewland on 03/29/07 at 22:40:27

Michael - does your .twitter file have your username, email, and password in it? Please adjust it to contain all three.

# by michaelrjohnson on 03/29/07 at 22:43:42

Yes, all information is correct. I even double-checked my password by logging out and into twitter.com.

# by jnewland on 03/30/07 at 06:12:17

Michael - please contact me via aim at jbnewland or google talk at jnewland@gmail.com so I can investigate this further.

# by spalmer47 on 03/04/08 at 12:36:25

I'm having this issue. Everything is correct in the config, but nothing happens after the config is saved. Typing "%_Twitter" in the status or chats does nothing at all. I'm running 1.3 with Adium 1.2.2.

# by ecable on 04/02/07 at 14:28:00

Comment for all those poor souls who were having it silently fail for them: until jesse gets it fixed, you can try removing the following line from the twitter.rb script itself, and see if that helps:
`require 'Time'`
Maybe this will help somebody d-:

# by bradgarland on 04/10/07 at 09:23:24

Hey guys,

Talked w/ the author and if you're having the re-opening of the config file issue. The deal is the Twitter API updated again and you need to change your config file from saying 'userid:' and put in 'username:' then your shortname, not the numbers. (ie. bradgarland)

Hope this helps somebody! Love the plugin.

# by argjamesi on 04/10/07 at 22:54:22

This is the fix! Thanks so much -- I was getting very frustrated!

# by omnivector on 04/24/07 at 15:52:25

Okay I'm confused -- How do make a status message in adium get pushed to twitter?

# by ecable on 05/07/07 at 16:02:14

You don't. That's a totally different idea. This is pulling down from twitter to adium status. Or whatever in adium.

# by ecable on 05/07/07 at 16:02:41

P.S. You could use Twitterrific to set adium, skype, iChat, and twitter all at once if you so desire; that's what I do.

# by woeishyang on 09/13/07 at 21:04:02

I have made a small fix that enables South Australian users (who also have the same time zone as CST) to use this script properly. Also added a tiny modification so each user on a multi user system has their temp files named differently.

Simply replace the contents of twitter.rb with the following:

#TwitterAdium
#Jesse Newland
#jnewland@gmail.com

require 'yaml'
require 'rexml/document'
require 'fileutils'
require 'net/http'
require 'timeout'
require 'Time'

#handle first run config file creation
begin
configfile = open(ENV["HOME"]+"/.twitter")
config = YAML::load configfile
rescue
begin
Fileutils.mv(ENV["HOME"]+"/.twitterc",ENV["HOME"]+"/.twitter")
rescue
template =

# by woeishyang on 09/13/07 at 21:06:34

Hmm...

Oh well, seems like the post got truncated.

Simple change all instances of

open(timefile,"w").write(Time.now.to_s)

to

open(timefile,"w").write(Time.now.strftime("%a %b %d %H:%M:%S %Y"))

and replace the lines

timefile = "/tmp/TwitterAdium.time"
twitterfile = "/tmp/TwitterAdium.twitter"

with
timefile = "/tmp/.#{ENV["LOGNAME"]}_TwitterAdium.time"
twitterfile = "/tmp/.#{ENV["LOGNAME"]}_TwitterAdium.twitter"

Works great now :)

# by kikollan on 11/30/07 at 08:22:37

I would like to reduce the poll frequency (the time between requests to writter servers), because I am using twiterrific and the sum of the two is bigger than the limit of twitter servers (70 requests per hour)...

any idea?!?
thanks in advance

# by josephcp on 12/01/07 at 08:39:58

open the file in your user directory:
Library/Application Support/Adium 2.0/Scripts/Twitter.AdiumScripts/Contents/Resources/twitter.rb

Search for 60, change that to however many seconds between requests you want.

# by josephcp on 12/01/07 at 22:30:37

I wanted to include status-update time and if you want to also, edit twitter.rb and replace the block "when Net::HTTPSuccess" with:

when Net::HTTPSuccess
xmldoc = REXML::Document.new(response.body)
timestring = Time.parse(xmldoc.root.elements["status[1]/created_at"].text)
twitter = xmldoc.root.elements["status[1]/text"].text + "n" + Time.parse(xmldoc.root.elements["status[1]/created_at"].text).strftime("%a %b %d %I:%M%p %Z %Y")
open(twitterfile,"w").write(twitter)
puts twitter

# by adam0101 on 02/04/08 at 06:43:09

Is anyone else having a problem with leopard and adium 1.2.1 where the twitter plugin does not update the away message with "%_twitter". It relays the content from my twitter fine but just does not update until i change the away to something else and back to %_twitter.

Ideas?

# by jnewland on 02/04/08 at 08:23:48

Adam -

I haven't updated this plugin to work with the new Applescript setup yet. Will do that this AM and post a new version.

# by adam0101 on 02/06/08 at 21:17:00

I really appreciate the fast response, although this still does not seem to work for me. My away message status is still set to %_twitter. yet ill make an update to twitter remotely and come home to see if my away message has changed and it still has not.

# by jnewland on 02/07/08 at 07:42:37

Adam -

Are you running any other applications using the Twitter API? They've implemented a 70 request/minute/account rate limit. Once over that rate limit, TwitterAdium displays your last cached tweet. Is it possible that this is occurring?

# by adam0101 on 02/10/08 at 12:53:27

Nope this is the only thing i use that uses the twitter api and it works fine as soon as i click off of the twitter away message and then right back on it so doesnt seem as if twitter is blocking my latest update.

# by adam0101 on 03/20/08 at 19:26:35

Any idea why this continues to fail, looks like i'm not the only one...

# by hedbngr on 02/21/08 at 09:20:03

I have the same exact problem. Twitteradium is also the only client I'm using.

# by bikefridaywalter on 04/25/08 at 00:52:50

same here. sux. this used to work.

# 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.

# by tedger on 03/26/08 at 22:50:04

I was wondering, could you strip tweets that are @ from the display, similar to the twitter facebook apps. I use twitter as a ubiquitous status, but I'd like to start using the "messaging" nature of it, but I can't really do both if the Adium script doesn't strip @ tweets.

# by dandiemer on 09/17/08 at 18:57:15

I actually just patched this myself and it seems to work.

using the finder click Go than Go To Folder, then type ~/Library/Application Support/Scripts
right click on Twitter.AdiumScripts and hit Show Package Contents, then navigate to Contents/Resources and edit the twitter.rb file with a text editor.

Replace the following:

open(twitterfile,"w").write(twitter)
puts twitter

with:

if twitter.index('@') == 0
else
open(twitterfile,"w").write(twitter)
puts twitter
end

Lemme know if it works for you.

# by friendartiste on 04/08/08 at 03:38:21

I really like the script, but it needs a small security tweak. I was noticing the permissions on the .twitter file generated by the script are, by default, world readable. Although not inherently 'dangerous,' since the .twitter file stores the password as plain text, it would be nice to have the script fix the permissions so it couldn't be exploited.

# by haruki_zaemon on 05/04/08 at 09:27:01

My file system is case-sensitive which means the require 'Time' needs to be require 'time' (lowercase 't') otherwise the script barfs. Changing to lowercase would mean it runs on all environments. Cheers, Simon.

# by broox on 05/12/08 at 15:55:39

it would be nice if you could edit the frequency of updates in that YAML file. I've now got at least 7 apps hitting my twitter acconut, so being able to set it to like 5 minutes would be rad.

for now, I've just updated my local copy to poll every 5 minutes.

in ~/.twitter
i added:
interval: 500

in ~/Library/Application Support/Adium 2.0/Scripts/Twitter.AdiumScripts/Contents/Resources/twitter.rb
i added (just before the following comment halfway through the code: #store last twitter and timestamp):
begin
interval = (config["interval"] == nil || config["interval"] < 120) ? 120 : config["interval"]
rescue
interval = 120
end

# by broox on 05/12/08 at 15:58:07

oh, and don't forget to change this line:
if (Time.now.to_i - last.to_i) > 120 || last_twitter == ''
to this:
if (Time.now.to_i - last.to_i) > interval || last_twitter == ''

# by broox on 05/12/08 at 16:02:34

also, that interval: 500 was a typo... i did the math right in real life.
;-)

# by yanokwa on 06/10/08 at 21:44:08

just seconding tedger's request. can you place strip the @ private messages?

# by dandiemer on 09/17/08 at 18:58:58

Check my patch on http://www.adiumxtras.com/index.php?a...3484#c20195 and see if it works

# by abricko on 08/19/08 at 02:08:51

I love this script. The only issue I have is that I wish it was smart enough to ignore replies that I write towards others. Seems like it would be simple enough to do just ignore / skip status update if the message contains @someword near the beginning

# by dandiemer on 09/17/08 at 18:59:23

try out my patch http://www.adiumxtras.com/index.php?a...3484#c20195 and see if it works

# by abricko on 09/27/08 at 01:41:35

thanks, that did it!

# by zerock on 09/14/08 at 20:57:20

looking forward to an update, perhaps?

# by stonemonk on 11/03/08 at 10:39:16

grt script j, and thx also to dandiemer & biphenyl for the improvs, they have made this script usable for me. would be nice to see these included an update, as well as setting the permission on the .twitter file to 600 on 1st run...

# by a_JAguar on 02/19/09 at 06:37:38

I install the Script but it doesn't run. When i type %_Twitter in nothing Pop up.

# by GhostFaction on 03/27/09 at 17:14:28

Where is the .twitter file? I can't find it anywhere. I have to change my username since I can't get into my old Twitter account but I cant find the config file to do so. I changed the name in the .rb file but it did nothing. I even tried deleting/uninstalling this script but for some reason it saved my old username.

# by djcashman on 04/03/09 at 15:07:37

I just created my own .twitter file in my home directory with the followng:

username:
email:
password:

Worked fine after that.

# by pixelauthor on 04/08/09 at 13:31:52

This script works, but I'm having some issues with the twitter "maximum requests" error since I added it. How often does this script update?

# by pixelauthor on 04/10/09 at 11:17:49

Yes, I'm replying to myself because I like to help people once I've solved my problem. Sorry, was having some issues because I'm running Nambu and this script at the same time. Twitter has an API refresh cap of 70 refreshes an hour, and I was running Nambu with dynamic refreshes. With that, AND this script updating every 2 minutes, it was overloading Twitter and I was getting locked out towards last third of every hour. There are several ways to solve this problem - here is what I did:

I didn't want to change my Nambu refresh rate, because that results in crappy updates for all my followed tweets. So I cracked open the twitter.rb file inside the Twitter.AdiumScripts package (right-click, and view package contents.) Around line 56 or so there's an "if" condition that controls the timer ("if (Time.now.to_i - last.to_i) > 120 || last_twitter == ''") The number 120 is the number of seconds between refreshes (correct me if I'm wrong). Change this number to the desired refresh rate. I changed mine to 900, to refresh on the quarter-hour. This means only 4 of my 70 hourly refreshes are used up, freeing 66 up for Nambu. Hope this helps someone - I know all you scripters are rolling your eyes at the obviousness of this info, but there are plenty out there with little or no scripting knowledge that may gain something from this. Cheers!

# by IcyMidnight on 07/19/09 at 22:48:37

In addition, the script seems to work without first logging into twitter. Comment out the line containing req.basic_auth config["username"], config["password"] and the script will still work without using up your precious API requests.

# by smithjo on 09/01/09 at 17:01:02

Is this working in snow leopard? Doesn't seem to be pulling my latest tweets.

# by smithjo on 09/05/09 at 17:44:12

Anyone????? Frustrated that it just stopped working and only displays an old twitter message.

# by lcalcote on 11/23/09 at 20:59:35

I'm experiencing the same issue in Snow Leopard.

# by statusspb on 11/02/09 at 12:46:47

Plz tell me, how to tweet via adium?

# by Ozy on 12/13/09 at 12:43:52

The following version of twitter.rb works in Snow Leopard: http://pastebin.com/f2f76e41e

# by smithjo on 12/23/09 at 14:09:12

Thanks for the update in snow leopard ... This only seems to pull the first time, it doesn't grab any of my updates on twitter. Is there something I need to tweak?

# by Ozy on 04/30/10 at 11:12:58

Not sure what your problem may be. However, here is the updated copy I am using: http://pastebin.com/mNZ1N8yG. There may be problems if you've overrun your connections per unit time, but in this case, the old status is displayed.

I've also noticed that after you delete a status, the deleted status still shows. This is because Twitter doesn't update the most current status, which the script pulls, after a deletion.

# by Ozy on 04/30/10 at 21:19:10

As a note, I would highly recommend commenting out the authentication line in the XML request if you have a non-protected account. This cuts down on your logins and allows you to poll more frequently.

# by Ozy on 04/30/10 at 21:49:08

Actually, I'd suggest checking out TwitterStatus. Very nice php script.

Post a New Comment

You must be logged in to post comments.

Install | Download
6.83kb (17192 downloads)

12345
3.60 / 95 votes
Current Version: 1.3
Last Updated: 02/04/08
Credits:
Mike Brodhead
woeishyang