More gaim, utwho and utaction mobile Sun Ray users

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:

\*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.

Comments:

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. :)

Posted by Jonathan Cowper-Andrewes on October 24, 2006 at 07:06 AM BST #

But why would I want to know?

I guess it could be deduced from the IM session anyway.

Posted by Chris Gerhard on October 24, 2006 at 07:12 AM BST #

Post a Comment:
Comments are closed for this entry.
About

This is the old blog of Chris Gerhard. It has mostly moved to http://chrisgerhard.wordpress.com

Search

Archives
« April 2014
MonTueWedThuFriSatSun
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today