summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/noise/TODO60
-rwxr-xr-xmodules/noise/cron/bin/zeit16
-rwxr-xr-xmodules/noise/init.d/noise48
-rwxr-xr-xmodules/noise/modules/cat (renamed from modules/cat)0
-rwxr-xr-xmodules/noise/modules/chat (renamed from modules/chat)0
-rwxr-xr-xmodules/noise/modules/date (renamed from modules/date)0
-rwxr-xr-xmodules/noise/modules/echo (renamed from modules/echo)0
-rwxr-xr-xmodules/noise/modules/ein_mal_eins (renamed from modules/ein_mal_eins)0
-rwxr-xr-xmodules/noise/modules/espeak (renamed from modules/espeak)0
-rwxr-xr-xmodules/noise/modules/help (renamed from modules/help)0
-rwxr-xr-xmodules/noise/modules/join (renamed from modules/join)0
-rwxr-xr-xmodules/noise/modules/lang (renamed from modules/lang)0
-rwxr-xr-xmodules/noise/modules/mpc (renamed from modules/mpc)0
-rwxr-xr-xmodules/noise/modules/names (renamed from modules/names)0
-rwxr-xr-xmodules/noise/modules/nick (renamed from modules/nick)0
-rwxr-xr-xmodules/noise/modules/part (renamed from modules/part)0
-rwxr-xr-xmodules/noise/modules/ping (renamed from modules/ping)0
-rwxr-xr-xmodules/noise/modules/play (renamed from modules/play)0
-rwxr-xr-xmodules/noise/modules/pong (renamed from modules/pong)0
-rwxr-xr-xmodules/noise/modules/query (renamed from modules/query)0
-rwxr-xr-xmodules/noise/modules/send_to_channel (renamed from modules/send_to_channel)0
-rwxr-xr-xmodules/noise/modules/sendmail (renamed from modules/sendmail)0
-rwxr-xr-xmodules/noise/modules/shackstatus (renamed from modules/shackstatus)0
-rwxr-xr-xmodules/noise/modules/sleep (renamed from modules/sleep)0
-rwxr-xr-xmodules/noise/modules/stream (renamed from modules/stream)0
-rwxr-xr-xmodules/noise/modules/temp (renamed from modules/temp)0
-rwxr-xr-xmodules/noise/modules/test (renamed from modules/test)0
-rwxr-xr-xmodules/noise/modules/twitter (renamed from modules/twitter)0
-rwxr-xr-xmodules/noise/modules/vvs (renamed from modules/vvs)0
-rwxr-xr-xmodules/noise/modules/wall (renamed from modules/wall)0
-rwxr-xr-xmodules/noise/modules/zeit (renamed from modules/zeit)0
-rwxr-xr-xmodules/noise/noise182
-rwxr-xr-xmodules/noise/noise-as-user4
-rwxr-xr-xmodules/noise/noise-server4
34 files changed, 314 insertions, 0 deletions
diff --git a/modules/noise/TODO b/modules/noise/TODO
new file mode 100644
index 00000000..a20f74e9
--- /dev/null
+++ b/modules/noise/TODO
@@ -0,0 +1,60 @@
+#### file:noise/TODO
+
+- /channels
+- /hist N -- zum anzeigen von N letzten Nachrichten
+ - Log? Es werden maximal chat_histsize Zeilen gespeichert.
+- Anbindung ans MoinMoin
+- IRC <-> 23.shack - Brücke
+- when nick changes say "You're now known as XXX" to yourself
+- twitter: push new tweets as they arrive to all connected clients with
+ the variable tweet_me set to ON
+
+- Author, Maintainer etc. direkt in die Module in der erweiterten Hilfe, also
+ in /help MODULENAME -> man sollte sich auf ein einheitliches Dokmentierungs-
+ Format einigen.
+ - All modules should contain:
+ - Author(s) w/ e-mail, Copyright, License
+ - Maintainer(s) w/ e-mail
+ - Module-Version
+ - last tested System-Version
+ - we need to export the system version
+- GIT commits tweeten (shack und root)
+- /kick [CHANNEL] # from channel / telnet
+- /ban # :-)
+- /op
+- USER-A: /ping USER-B
+ - USER-B: /pong
+ - write time to USER-{A,B}
+- style-sheets for everything MOAR!!1
+- libraries
+- HTTP-interface
+- /whois, /whoami, /whowas
+- join,part&co. should support multiple channels
+- /TODO,/bug,/issue or something should be added as tracking-system
+- /part should say something like "X has left."
+- /join should say something like "X has joined."
+ # it's obvious that the channels is meant...
+ - or else say: "X has joined channel Y." when we can join more than one
+ channel
+- /part should unset chat_channel (somehow) else keeping /part'ing will
+ broadcast to chat_channel that X has quit...
+- split /twitter into /tweet and X, to make it clear when tweets are fired
+- POP3 mail off googlemail and show them to curious telnetters
+- /set x 23 -> blah $x
+
+- /rewrite -- e.g. /rewrite "!%s" "/play %s" oder sowasi
+- Zugriff per ssh
+- module to standard unix-commands (name like /system)
+ - unix-commands should simply link to system
+- /save TOKEN, /load TOKEN
+- /op # NUR VIA SSH! (s.o.)
+- MODULE-TEST-SUITE [blackbox]
+- sub-modules like /chat-join which may be abbreviated as /join when
+ $default_command is set to /chat, YAY
+ - unclutter /help:
+ - /help -> show all (main) modules
+ - /help MODULE -> show help of MODULE and show all sub-modules
+ - /help MODULE SUB-MODULE -> show help of SUB-MODULE and show all sub^2...
+- watchdog
+
+#### end of file.
diff --git a/modules/noise/cron/bin/zeit b/modules/noise/cron/bin/zeit
new file mode 100755
index 00000000..ec50c898
--- /dev/null
+++ b/modules/noise/cron/bin/zeit
@@ -0,0 +1,16 @@
+#! /bin/sh
+
+expect >/dev/null <<EOF
+spawn nc localhost telnet
+expect READY.
+send "/zeit\r"
+expect READY.
+# pitch set to 10
+expect READY.
+# Playing WAVE 'stdin' : Signed 16 bit Little Endian, Rate 22050 Hz, Mono
+expect READY.
+# pitch changed from 10 to 100
+expect READY.
+EOF
+sleep 1
+/sbin/morse -l 100 -f 700 `date +%k`
diff --git a/modules/noise/init.d/noise b/modules/noise/init.d/noise
new file mode 100755
index 00000000..991f14b7
--- /dev/null
+++ b/modules/noise/init.d/noise
@@ -0,0 +1,48 @@
+#!/bin/sh -e
+### BEGIN INIT INFO
+# Provides: noise
+# Required-Start: $remote_fs $syslog dbus
+# Required-Stop: $remote_fs $syslog dbus
+# Default-Start: 2 3 4 5
+# Default-Stop: 1
+# Short-Description: Start the noise "Telnet" server
+# Description: System mode startup script for
+# the noise "Telnet" server.
+### END INIT INFO
+
+DAEMON=/root/noise/noise-server
+
+test -x $DAEMON || exit 1
+
+noise_pid() {
+ ps aux | grep tcpserver | grep noise-as-user | awk '{print$2}'
+}
+
+noise_start() {
+ "$DAEMON" &
+}
+
+noise_stop() {
+ kill "`noise_pid`"
+}
+
+case "$1" in
+ start|stop)
+ noise_${1}
+ ;;
+ restart|reload|force-reload)
+ noise_stop
+ noise_start
+ ;;
+ #force-stop) ;;
+ status)
+ kill -s 0 "`noise_pid`"
+ exit $?
+ ;;
+ *)
+ echo "Usage: /etc/init.d/noise {start|stop|force-stop|restart|reload|force-reload|status}"
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/modules/cat b/modules/noise/modules/cat
index e090acba..e090acba 100755
--- a/modules/cat
+++ b/modules/noise/modules/cat
diff --git a/modules/chat b/modules/noise/modules/chat
index e5badc36..e5badc36 100755
--- a/modules/chat
+++ b/modules/noise/modules/chat
diff --git a/modules/date b/modules/noise/modules/date
index 8cd1b0c1..8cd1b0c1 100755
--- a/modules/date
+++ b/modules/noise/modules/date
diff --git a/modules/echo b/modules/noise/modules/echo
index 344dd963..344dd963 100755
--- a/modules/echo
+++ b/modules/noise/modules/echo
diff --git a/modules/ein_mal_eins b/modules/noise/modules/ein_mal_eins
index fb385b31..fb385b31 100755
--- a/modules/ein_mal_eins
+++ b/modules/noise/modules/ein_mal_eins
diff --git a/modules/espeak b/modules/noise/modules/espeak
index 4e88918f..4e88918f 100755
--- a/modules/espeak
+++ b/modules/noise/modules/espeak
diff --git a/modules/help b/modules/noise/modules/help
index bc4c2931..bc4c2931 100755
--- a/modules/help
+++ b/modules/noise/modules/help
diff --git a/modules/join b/modules/noise/modules/join
index 68afcb66..68afcb66 100755
--- a/modules/join
+++ b/modules/noise/modules/join
diff --git a/modules/lang b/modules/noise/modules/lang
index 07b6802e..07b6802e 100755
--- a/modules/lang
+++ b/modules/noise/modules/lang
diff --git a/modules/mpc b/modules/noise/modules/mpc
index 0ab72058..0ab72058 100755
--- a/modules/mpc
+++ b/modules/noise/modules/mpc
diff --git a/modules/names b/modules/noise/modules/names
index f5922064..f5922064 100755
--- a/modules/names
+++ b/modules/noise/modules/names
diff --git a/modules/nick b/modules/noise/modules/nick
index 5ed1e9d9..5ed1e9d9 100755
--- a/modules/nick
+++ b/modules/noise/modules/nick
diff --git a/modules/part b/modules/noise/modules/part
index d35ac501..d35ac501 100755
--- a/modules/part
+++ b/modules/noise/modules/part
diff --git a/modules/ping b/modules/noise/modules/ping
index acf2529f..acf2529f 100755
--- a/modules/ping
+++ b/modules/noise/modules/ping
diff --git a/modules/play b/modules/noise/modules/play
index 749b450a..749b450a 100755
--- a/modules/play
+++ b/modules/noise/modules/play
diff --git a/modules/pong b/modules/noise/modules/pong
index eb2df46d..eb2df46d 100755
--- a/modules/pong
+++ b/modules/noise/modules/pong
diff --git a/modules/query b/modules/noise/modules/query
index ceeff8a5..ceeff8a5 100755
--- a/modules/query
+++ b/modules/noise/modules/query
diff --git a/modules/send_to_channel b/modules/noise/modules/send_to_channel
index 4a0470af..4a0470af 100755
--- a/modules/send_to_channel
+++ b/modules/noise/modules/send_to_channel
diff --git a/modules/sendmail b/modules/noise/modules/sendmail
index 182d96e3..182d96e3 100755
--- a/modules/sendmail
+++ b/modules/noise/modules/sendmail
diff --git a/modules/shackstatus b/modules/noise/modules/shackstatus
index a5058f0a..a5058f0a 100755
--- a/modules/shackstatus
+++ b/modules/noise/modules/shackstatus
diff --git a/modules/sleep b/modules/noise/modules/sleep
index 89712cac..89712cac 100755
--- a/modules/sleep
+++ b/modules/noise/modules/sleep
diff --git a/modules/stream b/modules/noise/modules/stream
index 1e6fd0c5..1e6fd0c5 100755
--- a/modules/stream
+++ b/modules/noise/modules/stream
diff --git a/modules/temp b/modules/noise/modules/temp
index 4e0c47a2..4e0c47a2 100755
--- a/modules/temp
+++ b/modules/noise/modules/temp
diff --git a/modules/test b/modules/noise/modules/test
index 2c0b8e0d..2c0b8e0d 100755
--- a/modules/test
+++ b/modules/noise/modules/test
diff --git a/modules/twitter b/modules/noise/modules/twitter
index 26982525..26982525 100755
--- a/modules/twitter
+++ b/modules/noise/modules/twitter
diff --git a/modules/vvs b/modules/noise/modules/vvs
index fc23375f..fc23375f 100755
--- a/modules/vvs
+++ b/modules/noise/modules/vvs
diff --git a/modules/wall b/modules/noise/modules/wall
index c73744ea..c73744ea 100755
--- a/modules/wall
+++ b/modules/noise/modules/wall
diff --git a/modules/zeit b/modules/noise/modules/zeit
index 9fbc33e4..9fbc33e4 100755
--- a/modules/zeit
+++ b/modules/noise/modules/zeit
diff --git a/modules/noise/noise b/modules/noise/noise
new file mode 100755
index 00000000..bd6b17c8
--- /dev/null
+++ b/modules/noise/noise
@@ -0,0 +1,182 @@
+#! /bin/sh
+
+noise_set() { # set a variable
+ case "$1" in
+ (-q|--quiet) echo=: ; shift ;;
+ (*) echo=echo ;;
+ esac
+ case $# in
+ (0) ## print all noise variables
+ env | sed -rn '
+ s/^noise_([[:alnum:]_]+)=(.*)$/\1 = \2/p
+ ' | sort
+ ;;
+ (1) ## print value the specified variable
+ eval "echo \"$1 = \$noise_$1\""
+ ;;
+ (*) ## set the specified variable
+ if echo "$1" | grep -q '[^[:alnum:]_]' ; then
+ fail invalid variable name "$1"
+ return 23
+ fi
+ eval "old=\"\$noise_$1\""
+ if test "x$old" = "x$2" ; then
+ eval "$echo \"$1 is already $2\""
+ elif test -z "$old" ; then
+ eval "export noise_$1='$2' ; $echo \
+\"$1 set to $2\""
+ else
+ eval "export noise_$1='$2' ; $echo \
+\"$1 changed from $old to $2\""
+ fi
+ ## write variable to $env
+ if grep -q "^$1=" "$env" ; then
+ sed -ri "s'^($1)=(.*)\$'\1=\'$2\''" $env
+ else
+ echo "$1='$2'" >>$env
+ fi
+ ;;
+ esac
+}
+
+noise_unset() { # unset a variable
+ case "$1" in
+ (-q|--quiet) echo=: ; shift ;;
+ (*) echo=echo ;;
+ esac
+ case $# in
+ (1) ##
+ unset "noise_$1"
+ sed -ni "/^$1=/!p" $env
+ ;;
+ (*)
+ fail "broken commandline: $@"
+ ;;
+ esac
+}
+
+noise_quit() { # exit
+ echo "Good bye!"
+ exit
+}
+
+fail() {
+ echo "FAIL: $*"
+ return 23
+}
+
+cleanup() {
+ kill $jobs
+ rm -f $linefeed $env
+ rmdir /tmp/noise/$$ 2>/dev/null
+ rmdir /tmp/noise 2>/dev/null
+}
+
+exec 2>&1
+qname="`readlink -f "$0"`"
+dirname="`dirname "$qname"`"
+export HOME='/home/noise'
+if test -d "$dirname/modules" ; then
+ export NOISE_PATH="${NOISE_PATH+$NOISE_PATH:}$dirname/modules"
+ export NOISE_PATH="${NOISE_PATH+$NOISE_PATH:}$HOME/noise/modules"
+fi
+mkdir -p /tmp/noise/$$
+linefeed="/tmp/noise/$$/linefeed"
+env="/tmp/noise/$$/environment"
+trap cleanup EXIT
+mkfifo $linefeed
+touch $env
+##
+##
+##
+readline() {
+ { read REPLY && echo "$REPLY" ; } | sed -rn "
+ s/[']//g
+ s/~%/\n/g
+ s/([^\\])([#<>])/\1\\\\\2/g
+ s:^/([a-z_]+)([[:space:]]+(.*))?$:command=\1; args='\3';:p;t
+ s@^([[:alnum:]_/+-]+):[[:space:]]*(.*)@command=lang; args='\1 \2';@p;t
+ s@^\![[:space:]]*(.*)@command=play; args='\1';@p;t
+ s:.*:command='$noise_default_command'; args='&';:p;t
+ "
+}
+##
+##
+##
+while echo -n "$noise_prompt" && eval "`readline`" ; do
+ ## modcall
+ for dir in `echo "$NOISE_PATH" | tr : \ ` ; do
+ module="$dir/$command"
+ if test -x "$module" ; then
+#echo foo $module:$@:
+ #shift
+ eval 'NOISE="$0" NOISE_pid="$$" NOISE_linefeed="$linefeed" "$module"' "$args"
+ continue 2
+ fi
+ done
+ ## funcall
+ if type noise_$command | grep -q function ; then
+ eval 'noise_$command' "$args"
+ continue
+ fi
+ ##
+ fail unknown command "$command"
+done <$linefeed &
+jobs="${jobs+$jobs }`jobs -p`"
+##
+##
+##
+cat<<EOF
+Welcome to 23.shack version 0.9 beta 4 \
+commit `
+ cd $dirname &&
+ git log -n 1 | head -n 1 | cut -d\ -f 2 | dd count=23 bs=1 2>/dev/null
+`...
+
+## Motto Of The Day\
+
+Join the 23.shack-dev-team, we've got `
+ sloccount $dirname/* |
+ sed -rn '
+ s/.*\(SLOC\)[[:space:]]*=[[:space:]]*([0-9]+)$/\1/p
+ '` SLOC, `
+ {
+ ls $dirname/modules/
+ test -d ~noise/modules && ls ~noise/modules/
+ } | sort | uniq | wc -l
+ ` mods,
+`grep ^- $dirname/TODO | wc -l`+ TODOs and drive the irregular Hackathon @shackspace.
+Follow http://twitter.com/shackspam FTW!
+
+## Hints\
+
+Start your telnet session with rlwrap for MAXIMUM profit.
+Get online-help with /help.
+
+EOF
+# TODO: MOTD-candidates:
+#twitter: #shackspam
+#mail: shockspasm@googlemail.com
+#irc: freenode/#shackspace
+#afk: @shackspace
+##
+##
+##
+exec >>$linefeed
+##
+##
+##
+echo '/set -q default_command espeak'
+echo '/set -q prompt "READY.~%"'
+##
+##
+##
+while read REPLY; do
+ case $REPLY in
+ (/quit) echo /quit ; exit ;;
+ (*) tr \; \\n | grep . ;;
+ esac<<EOF
+$REPLY
+EOF
+done
+#### end of file.
diff --git a/modules/noise/noise-as-user b/modules/noise/noise-as-user
new file mode 100755
index 00000000..15af5f03
--- /dev/null
+++ b/modules/noise/noise-as-user
@@ -0,0 +1,4 @@
+#! /bin/sh
+qname="`readlink -f "$0"`"
+dirname="`dirname "$qname"`"
+exec sudo -u noise env -i TCPREMOTEIP="$TCPREMOTEIP" "$dirname/noise"
diff --git a/modules/noise/noise-server b/modules/noise/noise-server
new file mode 100755
index 00000000..0df803b1
--- /dev/null
+++ b/modules/noise/noise-server
@@ -0,0 +1,4 @@
+#! /bin/sh
+qname="`readlink -f "$0"`"
+dirname="`dirname "$qname"`"
+exec tcpserver -c 423 -t 2 -D 0.0.0.0 23 "$dirname/noise-as-user"