# Journal

My current setup:

1. Send my current status to the Identica bot using Adium. I have Adium configured to run an Applescript whenever I do that.
2. The script waits a few seconds and determines the current status by checking the Identica RSS feed.
3. Then the script posts the status to Twitter using the Twitter API.
4. Then the script tells the Adium application to use the status.

Applescript for Mac OS 10.4 / Adium 1.3.1:

delay 5
set myStatus to do shell script "~/bin/identica --nick kensanata"
do shell script "~/bin/twitter " & quoted form of myStatus
repeat with theAccount in accounts
go online theAccount with message myStatus
end repeat
end tell

The script that fetches my current status:

#!/usr/bin/perl
use LWP::UserAgent;
use Getopt::Long;

my $verbose = undef; sub get_feed { my$url = shift;
my $ua = LWP::UserAgent->new; my$response = $ua->get($url);
print $response->code, ' ',$response->message, "\n" if $verbose; return$response->content if $response->is_success; die$response->code, ' ', $response->message, "\n"; } sub get_status { my$url = shift;
my $rss = new XML::RSS; my$string = get_feed($url); print$string if $verbose;$rss->parse($string); return$rss->{items}->[0]->{title};
}

sub main {
my $nick = ''; GetOptions('nick=s' => \$nick,
'verbose' => \$verbose); my$url = "http://identi.ca/$nick/rss"; warn "No nick specified.\n" unless$nick;
binmode STDOUT, ':utf8'; # I assume?
my $status = get_status($url) . "\n";
$status =~ s/^$nick: //;
print $status; } main(); The twitter status posting script: #!/bin/sh if test -z "$*"; then
echo "Status is missing" 1>&2
exit 1;
fi
CODE=curl --silent --output /dev/null --write "%{http_code}" \
--user kensanata@gmail.com:mypassword --data status="$*" \ http://twitter.com/statuses/update.xml if test "$CODE" != "200"; then
echo "$CODE: Posting failed" 1>&2 exit 1; fi Add Comment # 2008-07-14 Identi.ca Bot and Adium Goal: Send a message to update@identi.ca via my GTalk account, which posts it to http://identi.ca/kensanata. At the same time, Adium should refresh my status from Identi.ca. In order to do that, I tell Adium to run a little AppleScript whenever I send a message to update@identi.ca which in turn runs a little Perl script [1], which fetches my RSS feed from Identi.ca and extracts the latest status and uses it. Thus, we need three pieces: 1. A Perl script to extract the current status from http://identi.ca/kensanata/rss 2. An AppleScript to run the Perl script and set the Adium status 3. Configure Adium to run the AppleScript whenever I send a message to update@identi.ca ## Perl Script I call it identica and have it stored in my ~/bin folder. Make sure this directory is in your PATH and that it is executable (chmod +x identica). Test it by running identica --nick kensanata and you should get my current status. Note the dependencies. You might have to install those Perl modules. Sorry about that. #!/usr/bin/perl use XML::RSS; use LWP::UserAgent; use Getopt::Long; my$verbose = undef;

sub get_feed {
my $url = shift; my$ua = LWP::UserAgent->new;
my $response =$ua->get($url); print$response->code, ' ', $response->message, "\n" if$verbose;
return $response->content if$response->is_success;
die $response->code, ' ',$response->message, "\n";
}

sub get_status {
my $url = shift; my$rss = new XML::RSS;
my $string = get_feed($url);
print $string if$verbose;
$rss->parse($string);
return $rss->{items}->[0]->{title}; } sub main { my$nick = '';
GetOptions('nick=s' => \$nick, 'verbose' => \$verbose);
my $url = "http://identi.ca/$nick/rss";
warn "No nick specified.\n" unless $nick; binmode STDOUT, ':utf8'; # I assume? my$status = get_status($url) . "\n";$status =~ s/^$nick: //; print$status;
}

main();


## AppleScript

Open the Script Editor and create the following script, replacing “kensanata” with your own nick. Make sure you call up the library list using ⇧⌘L and add Adium.

I called the script “Identica to Adium” and also saved it as a script in my ~/bin folder.

Unfortunately, if you are using Mac OS 10.3 you are stuck with Adium 1.0.

### Adium 1.0 for Mac OS 10.3

set myStatus to do shell script "~/bin/identica --nick kensanata"
set my status message to myStatus
end tell


### Adium 1.2 for Mac OS 10.4

set myStatus to do shell script "~/bin/identica --nick kensanata"
tell application "Adium" to go online with message myStatus
end tell


In your list of contacts, edit the info for update@identi.ca, switch to the events tab, and find the entry that says “message sent” or something similar (my own Adium says “Nachricht gesendet”). Edit it and specify that you want to run an AppleScript and pick the “Identica to Adium” we just created.

## Test

Send the message “Testing…” to update@identi.ca. After a second your Adium status should change accordingly.

Hurray!

You can check my current status message on a website (and this post used to transclude the text back into Oddmuse again).

The status itself was sent to a Twitter Bot via GTalk, who posted it to Twitter, which got picked up by TwitterAdium and set as the status message for all my accounts in Adium, which in turn was picked up by a JabberLand bot I had added to my contact list, and included on that first page I linked to. Scary.

I’m sort of looking for the way to set all my status messages from a single place. This seems to work!

I still don’t get the Twitter craze, but perhaps I need some more friends on Twitter to appreciate “it”.

This reminds me of LJ Bot (Frank) – if you send him a message using your Talk acount, the message will turn into a LiveJournal blog post.

A long time ago I had a proof of concept using a programmable bot that did the same thing for Oddmuse.

Bots rule.

If you want to add more friends, I recommend using Twubble. It scans your friend’s freinds and lists those that occur in more than one of your friend’s lists. The idea is that if several of your friends like what they say, chances are you will to. And you know what? It works

I picked up around 100 new folks to follow using Twubble, and a fair percentage of those followed me back in return too. Which is nice. The sheer noise of 300 people actively tweeting is terrific!

GreyWulf 2008-04-22 19:06 UTC

And you didn’t think bots checking your contact lists was creepy? I guess I’m still under the influence of events in the Internet dark ages where friends discovered services that kept contact info up to date and started out by sending an email to all your contacts. That was very creepy.

AlexSchroeder 2008-04-22 19:10 UTC

That’s one of the (many) things that makes twitter so cool. When everything is public, privacy doesn’t matter.

GreyWulf 2008-04-22 19:46 UTC

Ah… I tried it and now I get it. Not creepy. Plus you’re my only friend on Twitter so Twubble doesn’t find any friends of two friends.

AlexSchroeder 2008-04-22 20:13 UTC

Yeh. I’m unsure of those too. There are far too many services requesting your gmail username and password these days. In an ideal world, gmail would provide an rss feed of all your contacts. Now, that would be cool…….

GreyWulf 2008-04-22 21:51 UTC

Ok, it seems that today a friendly American idiot discovered that I have joined and is registering the feeds of a gazillion American politicians as “follower”. Twits, all of them!! If I don’t block them I’m in fact increasing their pagerank. How do I deal with this? I don’t want spammers!

AIM was great in the old days: If somebody did something annoying, the mere doing of the act enabled recipients to give you a “warning” – and that automatically prevented you from adressing anybody whose warning level was less than yours (ie. almost everybody else except for the very people that you warned instead). That meant that as long as you were polite to strangers you had zero warnings and no problems.

I don’t want to just block spammers. I want to block them and deny them the use of the service for a while. That’s true Web 2.0 Spam Protection! :punch: :punch: :punch:

AlexSchroeder 2008-04-24 21:44 UTC

Spammers are the only reason I think guns are a good idea. Them, and politicians. And old people in queues. And…. hmmm. I better stop now.

In twitter, I just ignore the spammers. They’re welcome to follow me, but I won’t do the same back so I don’t get to see what they’re trying to peddle. I don’t care if it gets their pagerank up; that’s Google’s job to fix an abuse of their system.

GreyWulf 2008-04-24 23:12 UTC

Grrr. The blocking cycle requires way too many clicks. Click on the list of followers, wait for reload, click on the block button, click on the ok button, and repeat.

AlexSchroeder 2008-04-26 08:40 UTC

Also strange: Several total strangers have started following me. One appears to be a D&D player. Another appears to be a journalist in Zürich. They have no apparent spam agenda, so I’m not blocking them.

AlexSchroeder 2008-04-26 22:58 UTC

Hi Alex, I’ve read this and checked if you are already on Twitter. Doing so, I accidently sent you an invitation by e-mail. I hope you don’t mind.

Stefan Bucher 2008-05-04 15:04 UTC

Of course not.

AlexSchroeder 2008-05-04 19:29 UTC