09ead3200721497d0e74f515ecf4d48330c45f5a
3 # This file is called for every message received by libpurple clients (pidgin,finch,...)
4 # - You can try to rewrite this script in PERL or C for better performance (or different platform) - let me know
5 # - On M$ Windows answerscripts.exe from libpurple directory will be called instead of this script
7 # Maybe you will want to add more hooks for receiving messages, so i've made following script
8 # - It just executes all +x files in answerscripts.d directory so you should do your magic there
9 # - To disable some of those scripts simply use: chmod -x ./script
10 # - There is some basic structure, which means that all scripts should start their names with two-digit number
11 # - Files are executed in order specified by those numbers and some numbers have special meanings:
12 # - AB?!_ scripts without numbers are NOT executed!
13 # - 00 executed immediately, zero or single line output (parallel async processing)
14 # - 01-48 executed immediately, multiline output (serial processing)
15 # - 49 delay script (adds random delay to emulate human factor, no user scripts at this level!)
16 # - 50 executed after delay, zero or single line output (parallel async processing)
17 # - 51-79 executed after delay, multiline output (serial processing)
18 # - 80-99 reserved for future
20 #this may be modified to use run-parts from coreutils in future (can't get it to work):
22 dir
="$(dirname "$0")"; cd "$dir" #chdir to ~/.purple/ or similar
23 dir
="${dir}/answerscripts.d"
24 if test -d "$dir"; then
27 #sleep at 49 (this can be replaced by 49-delay.sh, but this should be faster)
29 find "$dir"/[5-9][0-9]-* -executable |
grep .
>/dev
/null
&& #check if it's worth waiting
30 sleep $
(( 2 + ($RANDOM % 8) )); #2-9 seconds of sleep
35 ls -1 "$dir/$i"* 2>/dev
/null |
while read script; do
36 test -x "$script" && {
37 #determine wheter execute on background or foreground
38 if [ $i -eq 00 ] ||
[ $i -eq 50 ]; then
46 wait; #wait for processes on background
51 #return 0 = do not block the message
This page took 0.266424 seconds and 3 git commands to generate.