fixed .exe suffix
authorHarvie <tomas@mudrunka.cz>
Wed, 2 Jun 2010 03:35:12 +0000 (05:35 +0200)
committerHarvie <tomas@mudrunka.cz>
Wed, 2 Jun 2010 03:35:12 +0000 (05:35 +0200)
plugins/pidgin-plugins/core-answerscripts/.gitignore [new file with mode: 0644]
plugins/pidgin-plugins/core-answerscripts/Makefile
plugins/pidgin-plugins/core-answerscripts/README
plugins/pidgin-plugins/core-answerscripts/answerscripts.c
plugins/pidgin-plugins/core-answerscripts/purple/answerscripts.d/autokiss.sh [new file with mode: 0755]
plugins/pidgin-plugins/core-answerscripts/purple/answerscripts.d/debug.sh [new file with mode: 0755]
plugins/pidgin-plugins/core-answerscripts/purple/answerscripts.d/espeak.sh [new file with mode: 0755]
plugins/pidgin-plugins/core-answerscripts/purple/answerscripts.d/menu.pl [new file with mode: 0755]
plugins/pidgin-plugins/core-answerscripts/purple/answerscripts.d/repeat.sh [new file with mode: 0755]
plugins/pidgin-plugins/core-answerscripts/purple/answerscripts.sh [new file with mode: 0755]

diff --git a/plugins/pidgin-plugins/core-answerscripts/.gitignore b/plugins/pidgin-plugins/core-answerscripts/.gitignore
new file mode 100644 (file)
index 0000000..ce68fe8
--- /dev/null
@@ -0,0 +1,3 @@
+*.o
+*.so
+*~
index dbb2dd66910d2c78c24ddd0d732895f7c4982086..160e3d085ecfdb418a41602598be2079c81cd509 100644 (file)
@@ -52,3 +52,4 @@ clean:
 
 user:
        cp -r purple/* $(HOME)/.purple/
+       mv $(HOME)/.purple/$(PIDGIN_AUTOANSWER).sh $(HOME)/.purple/$(PIDGIN_AUTOANSWER).exe
index 57642cdedb7bfb497edc5d4c23159aff3909fec7..60ef349af3b82f395e8ad6925b40b1a3c6dd69a0 100644 (file)
@@ -1,4 +1,5 @@
 libPurple core-answerscripts plugin
+       Framework for hooking scripts to received messages for various libpurple clients
 
 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 to your pidgin or finch without need of writing and compiling own C plugin or messing with buggy perl plugin and restarting client after each change in plugin.
 
index 51c49338e3aec3ef6e15d09190f814c87a2a1537..7c7da4e1cf2de3c1ae8d4a9460183614c05355bf 100755 (executable)
@@ -76,7 +76,7 @@ static PurplePluginInfo info = {
        "core-answerscripts",
        "AnswerScripts",
        "0.1",
-       "Framework for writing various hooks for libpurple clients",
+       "Framework for hooking scripts to received messages for various libpurple clients",
        "This plugin will call ~/.purple/" HOOK_SCRIPT " (or wherever purple_user_dir() points) "
                "script (or any executable) for each single message called."
                "Envinronment values PURPLE_MSG and PURPLE_FROM will be set to carry "
diff --git a/plugins/pidgin-plugins/core-answerscripts/purple/answerscripts.d/autokiss.sh b/plugins/pidgin-plugins/core-answerscripts/purple/answerscripts.d/autokiss.sh
new file mode 100755 (executable)
index 0000000..b054c5c
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+#AutoKiss :-* (just wanna be polite)
+echo "$PURPLE_MSG" | grep -o ':-\*';
diff --git a/plugins/pidgin-plugins/core-answerscripts/purple/answerscripts.d/debug.sh b/plugins/pidgin-plugins/core-answerscripts/purple/answerscripts.d/debug.sh
new file mode 100755 (executable)
index 0000000..021c713
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+#Debug
+echo "<$PURPLE_FROM> $PURPLE_MSG" >&2;
diff --git a/plugins/pidgin-plugins/core-answerscripts/purple/answerscripts.d/espeak.sh b/plugins/pidgin-plugins/core-answerscripts/purple/answerscripts.d/espeak.sh
new file mode 100755 (executable)
index 0000000..c0dec78
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+#Say it loudly and proudly!
+test -x "$(which espeak)" && echo "$PURPLE_MSG" | espeak -v $(echo "$LANG" | head -c 2) &
diff --git a/plugins/pidgin-plugins/core-answerscripts/purple/answerscripts.d/menu.pl b/plugins/pidgin-plugins/core-answerscripts/purple/answerscripts.d/menu.pl
new file mode 100755 (executable)
index 0000000..c2f48d6
--- /dev/null
@@ -0,0 +1,15 @@
+#!/usr/bin/env perl
+#Just for you to see that you can use almost any language :-)
+use strict;
+use warnings;
+use Switch;
+
+switch ($ENV{PURPLE_MSG}) {
+       case /^!help$/  { print "What did you expected? A help?! :-P"; }
+       case /^!ping$/  { print "PONG"; }
+       case /^!whoami$/        { print "You are: $ENV{PURPLE_FROM}"; }
+       case /^!(reboot|reset|restart|halt)$/   { print "Broadcast message: The system is going down for reboot NOW !!"; }
+       case /^!google/ { print "UTFG Yourself: http://google.com/"; }
+       case /^!uptime$/        { print qx{uptime}; }
+       case /^!date$/  { print qx{date}; }
+}
diff --git a/plugins/pidgin-plugins/core-answerscripts/purple/answerscripts.d/repeat.sh b/plugins/pidgin-plugins/core-answerscripts/purple/answerscripts.d/repeat.sh
new file mode 100755 (executable)
index 0000000..0719cd8
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+#Dumb libpurple core-answerscripts script. Hello world!
+echo "REPEAT:$PURPLE_FROM> $PURPLE_MSG";
diff --git a/plugins/pidgin-plugins/core-answerscripts/purple/answerscripts.sh b/plugins/pidgin-plugins/core-answerscripts/purple/answerscripts.sh
new file mode 100755 (executable)
index 0000000..032d6fc
--- /dev/null
@@ -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
+
This page took 0.178647 seconds and 4 git commands to generate.