From: Tomas Mudrunka Date: Wed, 18 Feb 2015 09:38:01 +0000 (+0100) Subject: Doc update X-Git-Url: http://git.harvie.cz/?p=mirrors%2Flibpurple-core-answerscripts.git;a=commitdiff_plain;h=0de4c2047c7cc14218a898038fab6822ff7d23cf;hp=151174844b0a5f0686ad544bf52b0d86dad8d0e9 Doc update --- diff --git a/README.md b/README.md index 20bbc3c..bf53d98 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ #libPurple core-answerscripts plugin * **Most hackable pidgin plugin!** * Framework for hooking scripts to **respond received messages** (and maybe bit more in future) for various **libpurple** clients such as **pidgin or finch** - * This simple plugin just passes every single message received by any libPurple-based client (pidgin,finch) to sript(s) in user's home directory... So **you can add various hooks.** + * This simple plugin just passes every single message received by any libPurple-based client (pidgin,finch) to script(s) in user's home directory... So **you can add various hooks.** * There are already few sample (answer)scripts in ./purple directory, so you can check how easy it is to write some script for pidgin or finch... ##What can this do for me? @@ -11,7 +11,7 @@ There are lot of hacks that you can do with this simple framework if you know so - **Map any response to any incomming message** (You can even use some substitutions and regexes) - **Forward your instant messages** to email, SMS gateway, text-to-speech (eg. espeak) or something... - **Remote control** your music player (or anything else on your computer) using instant messages -- **Simple IRC/Jabber/ICQ bot** (currently accepts PM only, you can run finch in screen on server) +- **Simple IRC/Jabber/ICQ/XMPP/Facebook bot** (you can run finch in headless screen on server) - Providing some **service** (Searching web, Weather info, System status, RPG game...) - BackDoor (**even unintentional one - you've been warned**) - Loging and analyzing messages @@ -26,16 +26,18 @@ There are lot of hacks that you can do with this simple framework if you know so * Each time you receive message, the main **answerscripts.sh script (answerscripts.exe on M$ Windows) is executed** on background * Every line that is outputed by this script to it's **STDOUT is sent** as response to message that executed it * Following **environment values are passed** to the script (ANSW\_L = local user, ANSW\_R = remote user = your buddy who sent the message): - * ANSW\_ACTION (what happend: im, chat, show setting dialog, event, etc...) + * ANSW\_ACTION (what happend: IM/CHAT/UNKNOWN, show setting dialog, event, etc...) * ANSW\_MSG (text of the message) + * ANSW\_MSG\_HIGHLIGHTED (was my nick mentioned in message? true/false) * ANSW\_PROTOCOL (protocol used to deliver the message. eg.: xmpp, irc,...) * ANSW\_R\_NAME (ID of remote user - "buddy") * ANSW\_R\_GROUP (group which contains that buddy OR empty string) - * ANSW\_R\_ALIAS (buddy's alias, server alias, contact alias, username OR empty string) + * ANSW\_R\_ALIAS (buddy's OPTIONAL alias, server alias, contact alias, username OR empty string) * ANSW\_R\_STATUS (unique ID of remote user's status. eg.: available, away,...) + * ANSW\_R\_ROOM\_NAME (Chatroom name) * ANSW\_R\_STATUS\_MSG (status message set by your buddy) * ANSW\_L\_NAME (ID of local user) - * ANSW\_L\_ALIAS (Alias of local user OR empty string) + * ANSW\_L\_ALIAS (OPTIONAL alias of local user OR empty string) * ANSW\_L\_STATUS (unique ID of local user's status. eg.: available, away,...) * ANSW\_L\_STATUS\_MSG (status message set by local user) * ANSW\_L\_AGENT (ID of IM client used with answerscripts) @@ -46,10 +48,13 @@ There are lot of hacks that you can do with this simple framework if you know so * See it's (**./purple/answerscripts.sh**) comments for rest of documentation... ###Example -Following answerscript will reply to each incoming message if you are not available. Reply will consist of two messages: one with username of your buddy who sent you a message and text of that message; and second with your status message. Simple huh? +Following answerscript will reply to each incoming private message if you are not available. Reply will consist of two messages: one with username of your buddy who sent you a message and text of that message; and second with your status message. Simple huh? #!/bin/sh - [ "$ANSW_L_STATUS" != 'available' ] && echo "<$ANSW_R_NAME> $ANSW_MSG" && echo "My status: $ANSW_L_STATUS_MSG"; + [ "$ANSW_ACTION" = 'IM' ] && [ "$ANSW_L_STATUS" != 'available' ] && { + echo "<$ANSW_R_NAME> $ANSW_MSG" + echo "My status: $ANSW_L_STATUS_MSG"; + } ##Building & installation diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..65fbdd0 --- /dev/null +++ b/TODO.md @@ -0,0 +1,10 @@ +#What TODO? + * GUI for managing answerscripts with following features + * list answerscripts + * enable/disable answerscripts (by chmod +x/-x on them) + * edit/create/delete answerscripts + * install/update/share answerscripts using online git repository (aka script market) + * Add more ANSW_ variables and features + * Make this answerscript API stable + * Port whole idea and plugin to other (non-purple) libraries/clients while maintaining compatibility of existing answerscripts and API + * probably move answerscripts out of ~/.purple/ to ~/.config/answ/ or something, so they can be shared between multiple agents diff --git a/purple/answerscripts.d/00-debug.sh b/purple/answerscripts.d/00-debug.sh index 1921912..0a62ef5 100755 --- a/purple/answerscripts.d/00-debug.sh +++ b/purple/answerscripts.d/00-debug.sh @@ -1,5 +1,5 @@ #!/bin/sh -#Debug +#Debug to pidgin's STDERR ( echo "DATE: $(date)"; env | grep -a '^ANSW_' | sort;