a non-geek's blog

Random notes on linux and web development

Playing with CenterIM, a command line instant messenger

leave a comment »

When working in the terminal, I use a lot CenterIM, an instant messenger client. While Finch (Pidgin on ncurse) is more feature-rich than CenterIM and has almost all the plugins that Pidgin has, I prefer CenterIM because it has a very clean interface, offering you just what you need to communicate:

-a contact list

-a chat window

-a log window (I find it quite informative)

There is one function in Pidgin that I like a lot and that is  the “Pounce”  option (being announce with a pop-up when an user log off, log in or some other event you select).  After reading the   CenterIM Documentation, I found a very simple solution to implement this feature to my favorite command line IM client. So here it is:

In the external file (~/.centerim/external), add this lines:

1|  %action         Notification
2|  event           online
3|  proto           all
4|  status          all
5|  options         stdin
6|  %exec
7| #!/bin/sh
8|  if test "$CONTACT_NICK" = "contact name"; then
9|   zenity --info   --text $CONTACT_NICK" is online"
10| fi

That’s all. In the script above, don’t forget to replace “contact_name” with the name of the friend you want to be notified about.

If  you want to be notified when every friend from your contact list comes online,  comment lines 8 and 10 (put a # at the begging of the line).

Of course, you can replace the “on_line” event (see line 2) with any other event. Other possible events are:
“msg”, “sms”, “url”, “offline”, “auth”, “contacts” or “notification”.

You can do a lot more interesting things in this magical file.  For example,  on the CenterIM documentation you can find out  how to create a “away message” :

%action         Answering machine
event           msg
proto           all
status          away na
options         stdout

%exec
#!/bin/sh

fname=`head -n 2 $CONTACT_INFODIR/info | tail -n 1`
lname=`head -n 3 $CONTACT_INFODIR/info | tail -n 1`

cat <<EOF
Hello, $fname $lname!
Unfortunately, I'm not near my box now, but I'll certainly contact you
as soon as I get here.

--
me
EOF

For any other idea that you have, check the excellent documentation for CenterIM. Have fun!

About these ads

Written by nongeekboy

November 29, 2010 at 4:21 pm

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 210 other followers

%d bloggers like this: