As you may have noticed, I’ve been aggregating a lot of personal data, both to mine for my own interests, and to give you, my faithful readers/ friends/ internet stalkers, a comprehensive way to keep track of me. Notably recent has been My Twitter Feed, which I’ve been updating fairly often. While there are some limitations with the Twitter Facebook App (how about a very simple way to find facebook friends who twitter to follow?) you CAN automatically update your facebook status based on your tweets. Synchronicity isn’t just a great Police album afterall!
Well the only other place I find myself updating status regularly is Google Talk (ICQ is so Eastern Europe, and AIM is so 1996) It’s wonderful that you can update your Twitter status by sending an im to the twitter@twitter.com bot, but I was thinking that it would be cool to have Twitter update when you change your Google Talk Status. Remarkably this hasn’t been done (other than using a ghetto spanish jabberbot) Please let me know if it has, because I wasn’t able to find it!
There’s a cool Twitter API and a very cool Jabber::Simple library. So I thought I’d play around for a few minutes. Unfortunately according to the XMPP people, the status part can be a little buggy, especially for Google Talk, because of multiple instances, etc, etc. So this is nowhere near perfect, and represents a very quick proof of concept. (duh) Anyway, I thought it would be fun to post some code, because I haven’t for a while.
So here it is, this was written from the point of view of having a bot to monitor your status updates, then twitter for you. Enough rambling.
require 'rubygems'
require 'twitter'
require 'xmpp4r-simple'
include Jabber
puts "Connecting Monitor..."
@jabber = Jabber::Simple.new('another_account@gmail.com', 'pass')
@twitter = Twitter::Client.new(:login => 'TWITTER_NAME',
:password => 'TWITTER_PASS')
@latest_tweet = @twitter.timeline_for(:me, :count => 1)
puts "Now Doing Update Checking"
@jabber.presence_updates do |update|
if update[0] == "YOUREMAIL@gmail.com"
&& update[1] ==
nline
&& update[2] != nil
&& update[2] != @latest_tweet.to_s #twitter it
@twitter.status(:post, update[2])
end
end
sleep 15
2 Comments
my very intelligent friend’s latest interest is XMPP. maybe something could be done with this.
I’m trying to do the same thing, make sure to post info if you get something working…
Leave Comment