Renamed scripts to obey rules (numbered filenames) that will be brought in next commit
[mirrors/libpurple-core-answerscripts.git] / purple / answerscripts.sh
CommitLineData
b44d7b66
H
1#!/bin/sh
2
3# This file is called for every message received by libpurple clients (pidgin,finch,...)
0636d441
H
4# - Following env values are passed to this script:
5# - ANSW_FROM (who sent you message)
6# - ANSW_MSG (text of the message)
7# - ANSW_STATUS (unique ID of status. eg.: available, away,...)
8# - ANSW_STATUS_MSG (status message set by user)
9# - WARNING: You should mind security (don't let attackers to execute their messages/nicks!)
10# - Each line of output is sent as reply to that message
11# - You can try to rewrite this script in PERL or C for better performance (or different platform)
12# - This script have .exe suffix as i hope it can be eventualy replaced by some binary on windows
13#
b44d7b66 14# Basic example can look like this:
0636d441
H
15# [ "$ANSW_STATUS" != 'available' ] && echo "<$ANSW_FROM> $ANSW_MSG" && echo "My status: $ANSW_STATUS_MSG";
16#
b44d7b66 17# There are lot of hacks that you can do with this simple framework if you know some scripting. eg.:
0636d441
H
18# - Forward your instant messages to email, SMS gateway, text-to-speach (eg. espeak) or something...
19# - Smart auto-replying messages based on regular expressions
20# - Remote control your music player (or anything else on your computer) using instant messages
21# - Simple IRC/Jabber/ICQ bot (accepts PM only, you can run finch in screen on server)
22# - Providing some service (Searching web, Weather info, System status, RPG game...)
23# - BackDoor (even unintentional one - you've been warned)
24# - Loging and analyzing messages
25# - Connect IM with Arduino
26# - Annoy everyone with spam (and probably get banned everywhere)
27# - Anything else that you can imagine...
28#
b44d7b66 29# Maybe you will want to add more hooks for receiving messages, so i've made following script
0636d441
H
30# - It just executes all +x files in answerscripts.d directory so you should do your magic there
31# - To disable some of those scripts just use chmod -x script
b44d7b66 32
0636d441
H
33#legacy support, please do NOT use PURPLE_* variables in new scripts,
34#this will be removed in future releases:
35export PURPLE_FROM="$ANSW_FROM"
36export PURPLE_MSG="$ANSW_MSG"
37
38#this should be modified to use run-parts in future:
b44d7b66
H
39dir="$(dirname "$0")"/answerscripts.d
40if test -d "$dir"; then
41 for script in "$dir"/*; do
42 test -x "$script" && "$script"
43 done
44fi
This page took 0.135226 seconds and 4 git commands to generate.