Playing with CenterIM, a command line instant messenger

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!

One thought on “Playing with CenterIM, a command line instant messenger

Leave a comment