X-Git-Url: https://git.harvie.cz/?p=mirrors%2Flibpurple-core-answerscripts.git;a=blobdiff_plain;f=purple%2Fanswerscripts.sh;fp=purple%2Fanswerscripts.sh;h=032d6fc27243a183b10a60d70b6b5346ce7f7506;hp=0000000000000000000000000000000000000000;hb=4c3335b4ed3c610750eb0b0886a44743ced2b78c;hpb=b44d7b66f2faa75e72c5bb5435bdb83c8bd5da2a diff --git a/purple/answerscripts.sh b/purple/answerscripts.sh new file mode 100755 index 0000000..032d6fc --- /dev/null +++ b/purple/answerscripts.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +# This file is called for every message received by libpurple clients (pidgin,finch,...) + # Env variables PURPLE_MSG and PURPLE_FROM are passed to this script + # Which means you should mind security (don't let attackers to execute their messages) + # Each line of output is sent as reply to that message + # You can try to rewrite this script in PERL or C for better performance + # This script have .exe suffix as i hope it can be eventualy replaced by some binary on windows + +# Basic example can look like this: + # echo "<$PURPLE_FROM> $PURPLE_MSG"; + +# There are lot of hacks that you can do with this simple framework if you know some scripting. eg.: + # Forward your instant messages to email, SMS gateway, text-to-speach (eg. espeak) or something... + # Smart auto-replying messages based on regular expressions + # Remote control your music player (or anything else on your computer) using instant messages + # Simple IRC/Jabber/ICQ bot (accepts PM only) + # Providing some service (Searching web, Weather info, System status, RPG game...) + # BackDoor (even unintentional one - you've been warned) + # Loging and analyzing messages + # Connect IM with Arduino + # Annoy everyone with spam (and probably get banned everywhere) + # Anything else that you can imagine... + +# Maybe you will want to add more hooks for receiving messages, so i've made following script + # It just executes all +x files in answerscripts.d directory so you should do your magic there + # To disable some of those scripts just use chmod -x script + +dir="$(dirname "$0")"/answerscripts.d +if test -d "$dir"; then + for script in "$dir"/*; do + test -x "$script" && "$script" + done +fi +