Commit | Line | Data |
---|---|---|
086adff4 | 1 | #libPurple core-answerscripts plugin |
39195dd6 | 2 | * **Most hackable pidgin plugin!** |
086adff4 | 3 | * Framework for hooking scripts to **respond received messages** (and maybe bit more in future) for various **libpurple** clients such as **pidgin or finch** |
0de4c204 | 4 | * 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.** |
086adff4 H |
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 | ||
ea57654e H |
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 | |
0de4c204 | 14 | - **Simple IRC/Jabber/ICQ/XMPP/Facebook bot** (you can run finch in headless screen on server) |
ea57654e | 15 | - Providing some **service** (Searching web, Weather info, System status, RPG game...) |
086adff4 H |
16 | - BackDoor (**even unintentional one - you've been warned**) |
17 | - Loging and analyzing messages | |
39195dd6 | 18 | - Connect IM with **Arduino** |
086adff4 H |
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 | |
b1866b8c | 28 | * Following **environment values are passed** to the script (ANSW\_L = local user, ANSW\_R = remote user = your buddy who sent the message): |
0de4c204 | 29 | * ANSW\_ACTION (what happend: IM/CHAT/UNKNOWN, show setting dialog, event, etc...) |
086adff4 | 30 | * ANSW\_MSG (text of the message) |
0de4c204 | 31 | * ANSW\_MSG\_HIGHLIGHTED (was my nick mentioned in message? true/false) |
7f54aeea | 32 | * ANSW\_PROTOCOL (protocol used to deliver the message. eg.: xmpp, irc,...) |
b1866b8c H |
33 | * ANSW\_R\_NAME (ID of remote user - "buddy") |
34 | * ANSW\_R\_GROUP (group which contains that buddy OR empty string) | |
0de4c204 | 35 | * ANSW\_R\_ALIAS (buddy's OPTIONAL alias, server alias, contact alias, username OR empty string) |
973a91a2 | 36 | * ANSW\_R\_STATUS (unique ID of remote user's status. eg.: available, away,...) |
0de4c204 | 37 | * ANSW\_R\_ROOM\_NAME (Chatroom name) |
973a91a2 | 38 | * ANSW\_R\_STATUS\_MSG (status message set by your buddy) |
b1866b8c | 39 | * ANSW\_L\_NAME (ID of local user) |
0de4c204 | 40 | * ANSW\_L\_ALIAS (OPTIONAL alias of local user OR empty string) |
b1866b8c H |
41 | * ANSW\_L\_STATUS (unique ID of local user's status. eg.: available, away,...) |
42 | * ANSW\_L\_STATUS\_MSG (status message set by local user) | |
43 | * ANSW\_L\_AGENT (ID of IM client used with answerscripts) | |
44 | * ANSW\_L\_AGENT\_VERSION (Version of client) | |
086adff4 H |
45 | * **WARNING: You should mind security (don't let attackers to execute their messages/nicks!)** |
46 | * 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** | |
47 | * It's quite smart and all you need to do is set the filenames and permissions of answerscripts in that directory properly... | |
48 | * See it's (**./purple/answerscripts.sh**) comments for rest of documentation... | |
49 | ||
50 | ###Example | |
0de4c204 | 51 | 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? |
086adff4 H |
52 | |
53 | #!/bin/sh | |
0de4c204 TM |
54 | [ "$ANSW_ACTION" = 'IM' ] && [ "$ANSW_L_STATUS" != 'available' ] && { |
55 | echo "<$ANSW_R_NAME> $ANSW_MSG" | |
56 | echo "My status: $ANSW_L_STATUS_MSG"; | |
57 | } | |
086adff4 H |
58 | |
59 | ##Building & installation | |
60 | ||
61 | ###From packages | |
62 | - ArchLinux: http://aur.archlinux.org/packages.php?ID=37942 | |
2aa9b0a9 | 63 | |
086adff4 H |
64 | ###Manually |
65 | - The libpurple header files are needed to compile the plugin. | |
66 | - To build and install : | |
67 | You can compile the plugin using | |
68 | ||
69 | $ make | |
70 | ||
71 | and install it with | |
72 | ||
73 | $ make install | |
74 | ||
75 | This will install it in ~/.purple/plugins so that only the user who install it can use it. | |
76 | ||
77 | $ make user | |
78 | ||
79 | Install main script and sample answerscripts to ~/.purple/answerscripts.d/ | |
80 | ||
81 | - To install it for everybody on your computer, | |
82 | ||
83 | $ make | |
84 | $ su | |
85 | # make install PREFIX="/path/to/libpurple" (this command as root user) | |
86 | ||
87 | generally /path/to/libpurple is /usr or /usr/local. If you don't know the path then you can find out using | |
88 | ||
89 | $ whereis libpurple | |
90 | ||
91 | and look for the part before "/lib/libpurple.so". |