Mercurial > ~mikael > mcabber > hg
diff mcabber/contrib/events/eventcmd @ 1147:fcef5d34b7d4
Add a few sample event scripts
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sat, 10 Feb 2007 18:42:02 +0100 |
parents | mcabber/contrib/eventcmd@76c03fafabd3 |
children | 3bf11085c6a5 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mcabber/contrib/events/eventcmd Sat Feb 10 18:42:02 2007 +0100 @@ -0,0 +1,47 @@ +#! /bin/sh +# +# Sample events script for mcabber +# Plays a sound when receiving a message +# +# To use this script, set the "events_command" option to the path of +# the script (see the mcabberrc.example file for an example) +# +# MiKael, 2005-07-15 + +# The following sound comes with the gtkboard package, +# you can modify this line to play another one... +CMD_MSG_IN="/usr/bin/play /usr/share/sounds/gtkboard/machine_move.ogg" + +event=$1 +arg1=$2 +arg2=$3 +filename=$4 +# Note that the 4th argument is only provided for incoming messages +# and when 'event_log_files' is set. + +if [ $event = "MSG" ]; then + case "$arg1" in + IN) + # Incoming message from buddy $arg2 + $CMD_MSG_IN > /dev/null 2>&1 + if [ -n "$filename" -a -f "$filename" ]; then + # We could process filename here... + /bin/rm $filename + fi + ;; + MUC) + # Groupchat message in room $arg2 + if [ -n "$filename" && -f "$filename" ]; then + # We could process filename here... + /bin/rm $filename + fi + ;; + OUT) + # Outgoing message for buddy $arg2 + ;; + esac +elif [ $event = "STATUS" ]; then + # Buddy $arg2 status is $arg1 (_, O, I, F, D, N, A) + echo > /dev/null +fi +