Skip to content

More gaim, utwho and utaction mobile Sun Ray users

October 17, 2006

My previous use of gaim-remote and utaction to update my IM status automatically was good but I kept not getting invited to lunch when I came into the office as I forgot to reset the message to be “In the Office” or slightly less irritatingly would get invited to lunch when I was a home.

Since for the common case I only really work in two locations, the office or at home and the Sun Ray at home does not change often if I can figure out which Sun Ray I am currently connected to I could set the message automatically.

First you need to run this command to get the identity of the Sun Ray that is at home (or in any other location that is “special”):

utwho -c | nawk -v d=${DISPLAY#:} ‘$1 == d { print $5 }’ 
Now write that into a file in your home directory followed by a colon and then the description you wish to have appear when you are connected via that Sun Ray:
utwho -c | nawk -v d=${DISPLAY#:} ‘$1 == d {OFS=":"; print $5, "Working @ Home" }’ >> ~/.ut_locations

You can populate that file with any number of specific locations.

Now put this script somewhere on your path called ut-where

#!/bin/ksh -xp  function get_location {         nawk -F: ‘$1 == "’$1’" { print $2 }’ ~/.ut_locations }   THIS_APPLIANCE=$(utwho -c | nawk -v d=${DISPLAY#:} ‘$1 == d { print $5 }’)  THIS_LOC=$(get_location ${THIS_APPLIANCE})  gaim-remote ‘setstatus?status=available&message=’"${THIS_LOC:-At Office}" 

As you can see it will set the default message to be “At Office” if it can’t find the named Sun Ray otherwise it used the second colon separated field as the message to use for gaim.

Then update the ut-gaim script to be:

#!/bin/ksh -p utaction -d "gaim-remote ‘setstatus?status=away&message=Away from Sun Ray’" > /dev/null 2>&1 & utaction -c "/home/cg13442/bin/sh/ut-where" > /dev/null 2>&1 & wait

All the above assumes that you have /opt/SUNWut/bin in your path.

Now when each Sun Ray appliance has a build in GPS that you can query to find it’s location this won’t be so hard to do in the more general case.*

Tags: topic:[Instant Messageing] topic:[Sun Ray] topic:[gaim]

*I have no idea if there are any plans to put a GPS in each Sun Ray in fact if there are I will be astounded.


From → Solaris

  1. You should start a timer when you leave your sunray and when you return it could stop… Then youd know how long you have been away from the sunray over a given period of time. 🙂

  2. But why would I want to know?
    I guess it could be deduced from the IM session anyway.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: