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