--- a/mcabber/contrib/eventcmd Thu Feb 08 23:14:13 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-#! /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
-
--- /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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mcabber/contrib/events/eventcmd.osd Sat Feb 10 18:42:02 2007 +0100
@@ -0,0 +1,46 @@
+#! /bin/sh
+#
+# Sample events script for mcabber
+# Use OSD to display events on the user's desktop
+#
+# To use this script, set the "events_command" option to the path of
+# the script (see the mcabberrc.example file for an example)
+#
+# MiKael, 2006-01-07
+
+XOSD_CMD_PIPE='osd_cat --pos=bottom --align=center --delay=4 --color=magenta --font=-*-courier-*-*-*-*-14-*-*-*-*-*-iso8859-15'
+
+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
+ echo "You have an IM from <$arg2>" | $XOSD_CMD_PIPE > /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 "<$arg2> has changed status to: [$arg1]" | $XOSD_CMD_PIPE > /dev/null 2>&1
+ echo > /dev/null
+fi
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mcabber/contrib/events/mcnotify.py Sat Feb 10 18:42:02 2007 +0100
@@ -0,0 +1,50 @@
+#!/usr/bin/python
+# Version 0.05
+#
+# Copyright (C) 2007 Adam Wolk "Mulander" <netprobe@gmail.com>
+# Slightly updated by Mikael Berthe
+#
+# To use this script, set the "events_command" option to the path of
+# the script (see the mcabberrc.example file for an example)
+#
+# This script is provided under the terms of the GNU General Public License,
+# see the file COPYING in the root mcabber source directory.
+#
+
+import sys
+
+#CMD_MSG_IN="/usr/bin/play /home/mulander/sound/machine_move.ogg"
+CMD_MSG_IN=""
+SHORT_NICK=True
+
+if len(sys.argv) == 5:
+ event,arg1,arg2,filename = sys.argv[1:5]
+else:
+ event,arg1,arg2 = sys.argv[1:4]
+ filename = None
+
+if event == 'MSG' and arg1 == 'IN':
+ import pynotify,os,locale
+ encoding = (locale.getdefaultlocale())[1]
+ msg = 'sent you a message.'
+
+ if SHORT_NICK and '@' in arg2:
+ arg2 = arg2[0:arg2.index('@')]
+
+ if filename is not None:
+ f = file(filename)
+ msg = f.read()
+
+ pynotify.init('mcnotify')
+ msgbox = pynotify.Notification(unicode(arg2, encoding),unicode(msg, encoding))
+ msgbox.set_timeout(3000)
+ msgbox.set_urgency(pynotify.URGENCY_LOW)
+ msgbox.show()
+ if (CMD_MSG_IN):
+ os.system(CMD_MSG_IN + '> /dev/null 2>&1')
+
+ if filename is not None and os.path.exists(filename):
+ os.remove(filename)
+ pynotify.uninit()
+
+# vim:set noet sts=8 sw=8: