From 86a6f4bd34058eea916904981cc8b3bef50f08c6 Mon Sep 17 00:00:00 2001 From: "R. Steve McKown" Date: Fri, 25 Mar 2016 18:07:12 -0600 Subject: [PATCH] mcabber: changes to config * Set up eventcmd, and have it play a sound on new message and buddy status changes. * Activate fifo, in expectation of the screen saver mechanism changing status. This replaces the autoaway setting, which does not understand the system but only activity in the mcabber application. --- install.sh | 1 + mcabber.eventcmd | 64 ++++++++++++++++++++++++++++++++++++++++++++++++ mcabberrc | 8 +++--- 3 files changed, 69 insertions(+), 4 deletions(-) create mode 100755 mcabber.eventcmd diff --git a/install.sh b/install.sh index 0c2f837..c2c947f 100755 --- a/install.sh +++ b/install.sh @@ -47,4 +47,5 @@ dolink ../.dotfiles/gpg.conf .gnupg/gpg.conf dolink ../.dotfiles/gpg-agent.conf .gnupg/gpg-agent.conf dolink ../.dotfiles/ssh_config .ssh/config dolink ../.dotfiles/mcabberrc .mcabber/mcabberrc +dolink ../.dotfiles/mcabber.eventcmd .mcabber/eventcmd dolink ../../.dotfiles/profrc .config/profanity/profrc diff --git a/mcabber.eventcmd b/mcabber.eventcmd new file mode 100755 index 0000000..12aa549 --- /dev/null +++ b/mcabber.eventcmd @@ -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 diff --git a/mcabberrc b/mcabberrc index 9f442ea..0779db6 100644 --- a/mcabberrc +++ b/mcabberrc @@ -259,7 +259,7 @@ set beep_on_message = 1 # $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) # See sample script in contrib/ directory. -#set events_command = ~/.mcabber/eventcmd +set events_command = ~/.mcabber/eventcmd # #set events_ignore_active_window = 0 # @@ -297,11 +297,11 @@ set beep_on_message = 1 # When FIFO is configured, you can turn it off and on in real time with # the 'fifo_ignore' option (default: 0). When set to 1, the FIFO input is # still read but it is discarded. -#set fifo_name = ~/.mcabber/mcabber.fifo +set fifo_name = ~/.mcabber/mcabber.fifo #set fifo_hide_commands = 0 #set fifo_ignore = 0 # -#module load fifo +module load fifo # URL extractor # Set 'url_regex' to a regular expression matching urls. If it matches an @@ -332,7 +332,7 @@ module load xttitle # (command, message, move in the buddylist...). Note: auto-away only changes # the status when it is "available" (online) or "free_for_chat". # See 'message_autoaway' below. -set autoaway = 300 +#set autoaway = 0 # Message blocking # Set 'block_unsubscribed' to 1 if you want to block (drop) incoming -- 2.39.2