Page 1 of 1

mcabber cli jabber client, with notifications

Posted: Fri Jan 24, 2014 4:02 pm
by wuxmedia
Hi,
We use jabber at work to chat with colleagues around the country.
So in my slow quest to get a CLI based work station, I found mcabber.

works nice, not as pretty as pidgin, main drawback being no default notifications.
This is pretty important for me as people get upset if they don't get a response to 'Mission critical server XYZ has crashed reboot please!!' in 100ms or less.

So this is the useful bit from the .mcabberrc
BTW the sid install doesn't make one for you - you'll need to pull the gzipped example from the /usr/share/doc/mcabber/examples/ directory.

Code: Select all

# External command for events
# You can specify a script or process to be launched when an event occurs.
# Set 'events_ignore_active_window' to 1 if you don't want the script to
# be run for a message to the current active window (default: 0).
#
# If 'event_log_files' is set, a file is created and contains the body of
# the message (incoming messages only); the file name is the last parameter.
# If you enable this, you can specify the directory mcabber will use to
# create these messages with the 'event_log_dir' variable (default is the
# system temp dir, or MCABBERTMPDIR environment variable).  Please note
# that mcabber won't delete these files, it's your script's job.
#
# The command is called the following way:
#   $events_command MSG IN jabber@id [file] (when receiving a message)
#   $events_command MSG OUT jabber@id       (when sending a message)
#   $events_command MSG MUC room_id [file]  (when receiving a MUC message)
#   $events_command STATUS X jabber@id      (new buddy status is X)
#   $events_command UNREAD "N x y z"        (number of unread buddy buffers)
#   (x=attention y=muc unread buffers z=muc unread buffers with attention sign)
# See sample script in contrib/ directory.
set events_command = ~/event.sh
#
#set events_ignore_active_window = 0
#
#set event_log_files = 1
#set event_log_dir = ~/event_files
This references the event.sh script below:

Code: Select all

#!/bin/bash
echo "$1 $2 $3 $4" >> ~/test.mcabber.log
EVENT_TYPE=$1
EVENT_SUBTYPE=$2
JID=$3
FILE=$4
TITLE="Mcabber Message"
#TIMEOUT=10000
 
 function new_message_in() {
     notify-send "$TITLE" "New message from ${JID}."
         }
          
          if [ $EVENT_TYPE == "MSG" ] && [ $EVENT_SUBTYPE == "IN" ]
          then
              new_message_in
              fi
if [ $EVENT_TYPE == "MSG" ] && [ $EVENT_SUBTYPE == "IN" ]
then
    new_message_in
    fi
I'm using dunst, I guess one could pipe it to a bar, or wherever...
I'm not 100% sure how this script pulls the mssg data of the file, or even where it comes from. XD
But it works.

I pulled the script from here where it is explained better and has more functions that I didn't need.
https://gist.github.com/JamesTheBard/5746867

This outputs simply who sent a mssg, and dunst gives a time counter by default I think - which is fine for me...
I'd really like it to pull the message body out of events_files, but I haven't had much luck.

I guess another way for me to see the whole thing is to open a small tile with mcabber in it. but I tend to copypasta commands and server names via jabber, so i'd need a term window or nine open.

Re: mcabber cli jabber client, with notifications

Posted: Fri Jan 24, 2014 4:15 pm
by GekkoP
Didn't know about this. I'm used to finch now, but this looks lighter.

Re: mcabber cli jabber client, with notifications

Posted: Fri Jan 24, 2014 9:25 pm
by wuxmedia
so finch is a cli version of pidgin, hmm interesting.
looks quite busy.
mcabber just makes me feel like i'm using IRC. 8)

Re: mcabber cli jabber client, with notifications

Posted: Fri Jan 24, 2014 10:58 pm
by machinebacon
finch needs the dependencies of pidgin, so it makes really sense if pidgin is already installed and one wants to have a CLI version of it. I'm using centerim for anything related to jabber/msn/... but mcabber comes close, so thanks for the write-up :)

Re: mcabber cli jabber client, with notifications

Posted: Sat Jan 25, 2014 2:14 am
by dkeg
like mb, use centerim, not mcabber. Thanks for the write up. I have no friends anyway, so really, I don't use it, should have said I have it.

Re: mcabber cli jabber client, with notifications

Posted: Sat Jan 25, 2014 9:42 am
by GekkoP
Well, centerim is already on Elektra and I wasn't aware of it. Enough with finch, then. :)

Re: mcabber cli jabber client, with notifications

Posted: Sat Jan 25, 2014 10:13 am
by machinebacon
Gekko, open a term, enter 'bbq' and browse through all apps :)

Re: mcabber cli jabber client, with notifications

Posted: Sat Jan 25, 2014 10:30 am
by GekkoP
^ thanks, doing it right now.