mcabber

view mcabber/contrib/events/eventcmd @ 1846:048bcde98fc6

Update contrib eventcmd sample script
author Mikael Berthe <mikael@lilotux.net>
date Sun, 28 Mar 2010 19:28:21 +0200
parents 3bf11085c6a5
children cca19ce862ef
line source
1 #! /bin/sh
2 #
3 # Sample events script for mcabber
4 # Plays a sound when receiving a message
5 #
6 # To use this script, set the "events_command" option to the path of
7 # the script (see the mcabberrc.example file for an example)
8 #
9 # MiKael, 2005-07-15
11 # The following sound comes with the gtkboard package,
12 # you can modify this line to play another one...
13 CMD_MSG_IN="/usr/bin/play /usr/share/sounds/gtkboard/machine_move.ogg"
15 event=$1
16 arg1=$2
17 arg2=$3
18 filename=$4
19 # Note that the 4th argument is only provided for incoming messages
20 # and when 'event_log_files' is set.
22 if [ $event = "MSG" ]; then
23 case "$arg1" in
24 IN)
25 # Incoming message from buddy $arg2
26 $CMD_MSG_IN > /dev/null 2>&1
27 if [ -n "$filename" -a -f "$filename" ]; then
28 # We could process filename here...
29 /bin/rm $filename
30 fi
31 ;;
32 MUC)
33 # Groupchat message in room $arg2
34 if [ -n "$filename" && -f "$filename" ]; then
35 # We could process filename here...
36 /bin/rm $filename
37 fi
38 ;;
39 OUT)
40 # Outgoing message for buddy $arg2
41 ;;
42 esac
43 elif [ $event = "STATUS" ]; then
44 # Buddy $arg2 status is $arg1 (_, O, I, F, D, N, A)
45 echo > /dev/null
46 elif [ $event = "UNREAD" ]; then
47 # $arg1 contains 4 numbers separated with space chars:
48 # Nr of unread buffers, nr of unread buffers with attention sign,
49 # nr of MUC unread buffers, nr of MUC unread buffers with attention sign.
50 echo > /dev/null
51 fi