| 1 | #libPurple core-answerscripts plugin |
| 2 | * **Most hackable pidgin plugin!** |
| 3 | * Framework for hooking scripts to **respond received messages** (and maybe bit more in future) for various **libpurple** clients such as **pidgin or finch** |
| 4 | * 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.** |
| 5 | * 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... |
| 6 | |
| 7 | ##What can this do for me? |
| 8 | |
| 9 | There are lot of hacks that you can do with this simple framework if you know some basic scripting. eg.: |
| 10 | |
| 11 | - **Map any response to any incomming message** (You can even use some substitutions and regexes) |
| 12 | - **Forward your instant messages** to email, SMS gateway, text-to-speech (eg. espeak) or something... |
| 13 | - **Remote control** your music player (or anything else on your computer) using instant messages |
| 14 | - **Simple IRC/Jabber/ICQ bot** (currently accepts PM only, you can run finch in screen on server) |
| 15 | - Providing some **service** (Searching web, Weather info, System status, RPG game...) |
| 16 | - BackDoor (**even unintentional one - you've been warned**) |
| 17 | - Loging and analyzing messages |
| 18 | - Connect IM with **Arduino** |
| 19 | - Annoy everyone with spam (and probably **get banned everywhere**) |
| 20 | - **Anything else that you can imagine...** (i'm looking forward to hearing your stories) |
| 21 | |
| 22 | ##Writing own (answer)scripts |
| 23 | |
| 24 | * Check example scripts in **./purple/answerscripts.d/** to see how easy it is |
| 25 | * Basically |
| 26 | * Each time you receive message, the main **answerscripts.sh script (answerscripts.exe on M$ Windows) is executed** on background |
| 27 | * Every line that is outputed by this script to it's **STDOUT is sent** as response to message that executed it |
| 28 | * Following **environment values are passed** to the script: |
| 29 | * ANSW\_MSG (text of the message) |
| 30 | * ANSW\_FROM (who sent you message) |
| 31 | * ANSW\_FROM_GROUP (group which contains that buddy) |
| 32 | * ANSW\_PROTOCOL (protocol used to deliver the message. eg.: jabber, irc,...) |
| 33 | * ANSW\_STATUS (unique ID of status. eg.: available, away,...) |
| 34 | * ANSW\_STATUS\_MSG (status message set by user) |
| 35 | * **WARNING: You should mind security (don't let attackers to execute their messages/nicks!)** |
| 36 | * I guess that you will want to use more than one answerscript, so i made such answerscript which will execute all answerscripts in **~/.purple/answerscripts.d** |
| 37 | * It's quite smart and all you need to do is set the filenames and permissions of answerscripts in that directory properly... |
| 38 | * See it's (**./purple/answerscripts.sh**) comments for rest of documentation... |
| 39 | |
| 40 | ###Example |
| 41 | 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? |
| 42 | |
| 43 | #!/bin/sh |
| 44 | [ "$ANSW_STATUS" != 'available' ] && echo "<$ANSW_FROM> $ANSW_MSG" && echo "My status: $ANSW_STATUS_MSG"; |
| 45 | |
| 46 | ##Building & installation |
| 47 | |
| 48 | ###From packages |
| 49 | - ArchLinux: http://aur.archlinux.org/packages.php?ID=37942 |
| 50 | ###Manually |
| 51 | - The libpurple header files are needed to compile the plugin. |
| 52 | - To build and install : |
| 53 | You can compile the plugin using |
| 54 | |
| 55 | $ make |
| 56 | |
| 57 | and install it with |
| 58 | |
| 59 | $ make install |
| 60 | |
| 61 | This will install it in ~/.purple/plugins so that only the user who install it can use it. |
| 62 | |
| 63 | $ make user |
| 64 | |
| 65 | Install main script and sample answerscripts to ~/.purple/answerscripts.d/ |
| 66 | |
| 67 | - To install it for everybody on your computer, |
| 68 | |
| 69 | $ make |
| 70 | $ su |
| 71 | # make install PREFIX="/path/to/libpurple" (this command as root user) |
| 72 | |
| 73 | generally /path/to/libpurple is /usr or /usr/local. If you don't know the path then you can find out using |
| 74 | |
| 75 | $ whereis libpurple |
| 76 | |
| 77 | and look for the part before "/lib/libpurple.so". |