]> oss.titaniummirror.com Git - smckown/dotfiles.git/blobdiff - mcabber.eventcmd
mcabber: changes to config
[smckown/dotfiles.git] / mcabber.eventcmd
diff --git a/mcabber.eventcmd b/mcabber.eventcmd
new file mode 100755 (executable)
index 0000000..12aa549
--- /dev/null
@@ -0,0 +1,64 @@
+#! /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
+
+# Script execution comments from 'man mcabber':
+#   $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)
+#
+# Sounds from the freedesktop project (available by default in Xubuntu)
+CMD_MSG_IN="/usr/bin/play /usr/share/sounds/freedesktop/stereo/message-new-instant.oga"
+CMD_STATUS_ONLINE="/usr/bin/play /usr/share/sounds/freedesktop/stereo/service-login.oga"
+CMD_STATUS_OFFLINE="/usr/bin/play /usr/share/sounds/freedesktop/stereo/service-logout.oga"
+
+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" -a -f "$filename" ]; then
+        # We could process filename here...
+        /bin/rm $filename
+      fi
+      ;;
+    OUT)
+      # Outgoing message for buddy $arg2
+      ;;
+    STATUS)
+      # Status change for buddy $arg2, new status is $arg1
+      echo "New status $arg1 for buddy $arg2" >> /tmp/xaa
+      ;;
+  esac
+elif [ "$event" = "STATUS" ]; then
+  # Buddy $arg2 status is $arg1 (_, O, I, F, D, N, A)
+  echo > /dev/null
+elif [ "$event" = "UNREAD" ]; then
+  # $arg1 contains 4 numbers separated with space chars:
+  # Nr of unread buffers, nr of unread buffers with attention sign,
+  # nr of MUC unread buffers, nr of MUC unread buffers with attention sign.
+  echo > /dev/null
+fi