comparison mcabber/contrib/eventcmd @ 1000:76c03fafabd3

Make the sample event script more portable Thanks to Khalil Petit.
author Mikael Berthe <mikael@lilotux.net>
date Sun, 05 Nov 2006 18:05:14 +0100
parents c7f94f6e51f0
children
comparison
equal deleted inserted replaced
999:9687ecc59303 1000:76c03fafabd3
17 arg2=$3 17 arg2=$3
18 filename=$4 18 filename=$4
19 # Note that the 4th argument is only provided for incoming messages 19 # Note that the 4th argument is only provided for incoming messages
20 # and when 'event_log_files' is set. 20 # and when 'event_log_files' is set.
21 21
22 if [ $event == "MSG" ]; then 22 if [ $event = "MSG" ]; then
23 case "$arg1" in 23 case "$arg1" in
24 IN) 24 IN)
25 # Incoming message from buddy $arg2 25 # Incoming message from buddy $arg2
26 $CMD_MSG_IN > /dev/null 2>&1 26 $CMD_MSG_IN > /dev/null 2>&1
27 if [[ -n "$filename" && -f "$filename" ]]; then 27 if [ -n "$filename" -a -f "$filename" ]; then
28 # We could process filename here... 28 # We could process filename here...
29 /bin/rm $filename 29 /bin/rm $filename
30 fi 30 fi
31 ;; 31 ;;
32 MUC) 32 MUC)
33 # Groupchat message in room $arg2 33 # Groupchat message in room $arg2
34 if [[ -n "$filename" && -f "$filename" ]]; then 34 if [ -n "$filename" && -f "$filename" ]; then
35 # We could process filename here... 35 # We could process filename here...
36 /bin/rm $filename 36 /bin/rm $filename
37 fi 37 fi
38 ;; 38 ;;
39 OUT) 39 OUT)
40 # Outgoing message for buddy $arg2 40 # Outgoing message for buddy $arg2
41 ;; 41 ;;
42 esac 42 esac
43 elif [ $event == "STATUS" ]; then 43 elif [ $event = "STATUS" ]; then
44 # Buddy $arg2 status is $arg1 (_, O, I, F, D, N, A) 44 # Buddy $arg2 status is $arg1 (_, O, I, F, D, N, A)
45 echo > /dev/null 45 echo > /dev/null
46 fi 46 fi
47 47