X-Git-Url: http://git.harvie.cz/?a=blobdiff_plain;f=purple%2Fanswerscripts.sh;h=3b72f961a438905d4ff97246aae90e2777e110b8;hb=61b8b7d94f6e188a074de8d697a08bdf00c140de;hp=4410ee473e9af61f422cf55d292bc9b6f6f9c30e;hpb=086adff43587c02f12b80d3fc17e5f75c37b79ea;p=mirrors%2Flibpurple-core-answerscripts.git diff --git a/purple/answerscripts.sh b/purple/answerscripts.sh index 4410ee4..3b72f96 100755 --- a/purple/answerscripts.sh +++ b/purple/answerscripts.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # This file is called for every message received by libpurple clients (pidgin,finch,...) # - You can try to rewrite this script in PERL or C for better performance (or different platform) - let me know @@ -12,16 +12,11 @@ # - AB?!_ scripts without numbers are NOT executed! # - 00 executed immediately, zero or single line output (parallel async processing) # - 01-48 executed immediately, multiline output (serial processing) -# - 49 delay script (adds random delay to emulate human factor) +# - 49 delay script (adds random delay to emulate human factor, no user scripts at this level!) # - 50 executed after delay, zero or single line output (parallel async processing) # - 51-79 executed after delay, multiline output (serial processing) # - 80-99 reserved for future -#legacy support, please do NOT use PURPLE_* variables in new scripts, -#this will be removed in future releases: -export PURPLE_FROM="$ANSW_FROM" -export PURPLE_MSG="$ANSW_MSG" - #this may be modified to use run-parts from coreutils in future (can't get it to work): dir="$(dirname "$0")"; cd "$dir" #chdir to ~/.purple/ or similar @@ -31,7 +26,8 @@ if test -d "$dir"; then #sleep at 49 (this can be replaced by 49-delay.sh, but this should be faster) [ $i -eq 49 ] && { - sleep $[ 2 + ($RANDOM % 8) ]; #2-9 seconds of sleep + find "$dir"/[5-9][0-9]-* -executable | grep . >/dev/null && #check if it's worth waiting + sleep $(( 2 + ($RANDOM % 8) )); #2-9 seconds of sleep continue; }