[Web4lib] script recommendation

TUCKER-RAYMOND Caleb calebt at multcolib.org
Mon May 14 19:08:05 EDT 2007


Hi,

I don't have a magic ready-made script for you, but there are a number
of places you can start.

Assuming you're using GAIM/Pidgin to monitor multiple IM services, and
assuming that Yahoo! Messenger and AOL Instant Messenger might be among
them, you can use either of those services' presence indicators to
determine if you are on IM or not.

Yahoo! Messenger uses a simple webservice-like presence tool that you
could use either to display images or process with a script.

http://messenger.yahoo.com/addpresence.php

My Yahoo! Messenger presence in an image,

http://opi.yahoo.com/online?u=calebMCL&m=g&t=5&l=us

Play around with that 't' parameter (type? try t=0, t=1, t=2) to see the
different images. 

You don't need a script for this - just load the URL in an image tag:

<img src="http://opi.yahoo.com/online?u=calebMCL&m=g&t=2&l=us"/>

Use the 'm' parameter to get a text only version (mode? try both m=t&t=0
and m=t&t=1). With either one, you could set up a PHP function to query
the text-based version, and depending on the reply, display the online
or offline image of your chosing. 

ie, using the PHP cURL library (http://us.php.net/curl) to see if I am
online:

<?php

   $ch =
curl_init("http://opi.yahoo.com/online?u=calebMCL&m=1&t=1&l=us");
   curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
   $result = curl_exec($ch);
   curl_close ($ch);
   if ($result == '01') { echo 'yaaay!'; } else { echo 'boooo!'; }

?>

More complicated, but JavaScript-only in case you don't have server side
access at all, AOL has instructions for showing presence on web pages
with JavaScript, which would "work with GAIM" if one of the services you
are covering with GAIM is AOL Instant Messenger.

http://dev.aol.com/adding-web-aim-presence-buddies

You need an AOL Developer ID, but don't be scared off, it's easy to come
by and set up.

The script works by applying each person's status as a CSS style - so
you can have a style for 'online' with a green button, a style for
'offline' with a red one, make your 'away' status known by giant purple
letters, etc.

AOL's example is for one one person, not a whole buddy list, but you can
extrapolate and add a separate <div></div> pair for each screen name you
want to show the status for.

Two things I've noticed:

 - you need to put all the screen names in lowercase in your script

 - my JavaScript buddy list doesn't always match my Trillian buddy list

There is all kinds of fun you can have with this - load (or expose) a
PlugooMeeboMeWidget when the patron clicks on a name, or load one
randomly to start, or if no one is online, display a link to your
friendly statewide virtual reference service instead. 

Good luck!

Caleb Tucker-Raymond

Oregon Statewide Digital Reference Project Coordinator
Multnomah County Library
(503) 988-5438
calebt at multcolib.org
AIM/Y!: calebMCL
www.oregonlibraries.net






> -----Original Message-----
> From: web4lib-bounces at webjunction.org 
> [mailto:web4lib-bounces at webjunction.org] On Behalf Of Sigrid Kelsey
> Sent: Monday, May 14, 2007 9:14 AM
> To: web4lib at webjunction.org
> Subject: [Web4lib] script recommendation
> 
> 
> Can anyone recommend a "who's on IM" script?  For example, a 
> library patron could access web page with a list of staff and 
> IM anyone who had a green light next to their name- and a red 
> light would appear for librarian who are not at their desk or 
> logged off?  My gmail does this.
> 
> Preferences would be works with GAIM, uses PHP, and is free 
> and open source, but any suggestions are welcome.
> thanks-
> Sigrid Kelsey
> _______________________________________________
> Web4lib mailing list
> Web4lib at webjunction.org
> http://lists.webjunction.org/web4lib/
> 


More information about the Web4lib mailing list