equal
deleted
inserted
replaced
|
1 #! /bin/sh |
|
2 # |
|
3 # Copyright (C) 2010 Mikael Berthe <mikael@lilotux.net> |
|
4 # |
|
5 # Copy this script on your system and specify the path for mcabber |
|
6 # by setting the 'extsay_script_path' option. |
|
7 # |
|
8 # This script is free software. |
|
9 # MiKael, 2010-04-02 |
|
10 |
|
11 FIFOPATH="$HOME/.mcabber/mcabber.fifo" |
|
12 tmpdir=${TMPDIR:="/tmp"} |
|
13 editor=${EDITOR:="vi"} |
|
14 jid="." |
|
15 |
|
16 # Use argument as a recipient JID, if it is provided |
|
17 [ $# -eq 1 ] && jid=$1 |
|
18 |
|
19 # Leave if the FIFO is not available |
|
20 [ -p $FIFOPATH ] || exit 255 |
|
21 |
|
22 tf=$(mktemp --tmpdir=$tmpdir extsay-XXXXXX) || exit 255 |
|
23 |
|
24 # This will not work if the editor runs in the background! |
|
25 $editor $tf |
|
26 |
|
27 # Send the message using MCabber's pipe |
|
28 if [ -s $tf ]; then |
|
29 cmd="say_to -f $tf $jid" |
|
30 echo $cmd >> $FIFOPATH |
|
31 fi |
|
32 |
|
33 rm $tf |
|
34 exit 0 |