Mercurial > ~mikael > mcabber > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
1146:d9eb7656440f | 1147:fcef5d34b7d4 |
---|---|
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 | |
10 | |
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" | |
14 | |
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. | |
21 | |
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 fi | |
47 |