From de52c85164a0f98dee94d62b824dd2360cd77d54 Mon Sep 17 00:00:00 2001 From: "shackspace e.V" Date: Thu, 6 May 2010 22:36:57 +0200 Subject: initial commit number two --- modules/atwall | 11 +++++++++++ modules/join | 14 ++++++++++++++ modules/test | 10 +++++++--- modules/twitter | 10 +++++----- 4 files changed, 37 insertions(+), 8 deletions(-) create mode 100755 modules/atwall create mode 100755 modules/join diff --git a/modules/atwall b/modules/atwall new file mode 100755 index 00000000..66fca5e6 --- /dev/null +++ b/modules/atwall @@ -0,0 +1,11 @@ +#! /bin/sh + +case "$1" in + (--help) echo send text to everyone with @@ prepended ;; + (q) + echo quit chat mode + echo /set default_command espeak >$NOISE_linefeed;; + + (*) + echo /wall @@ $* >$NOISE_linefeed +esac diff --git a/modules/join b/modules/join new file mode 100755 index 00000000..af1c0117 --- /dev/null +++ b/modules/join @@ -0,0 +1,14 @@ +#! /bin/sh + +case "$1" in + (--help) echo set default_command to atwall and back ;; + (off) + echo /set default_command espeak >$NOISE_linefeed + echo "disabled chat mode (set back to espeak)" ;; + (*) + echo /set default_command atwall >$NOISE_linefeed + echo "enabled chat mode" + echo q or /chat off to go back to espeak ;; + + +esac diff --git a/modules/test b/modules/test index 30444bf7..2c0b8e0d 100755 --- a/modules/test +++ b/modules/test @@ -3,7 +3,11 @@ case "$1" in (--help) echo do some test-module related stuff ;; (*) - echo test-module called with following arguments: "$@" - ## send command for re-evaluation: - echo /espeak test >$NOISE_linefeed + + echo -n ">> " + read TEST + if [ $TEST == 'q' ]; then exit; fi + echo /wall @@ $TEST >$NOISE_linefeed + #sleep 1 + #sleep 1; echo /test >$NOISE_linefeed & esac diff --git a/modules/twitter b/modules/twitter index e8962657..fa4d366d 100755 --- a/modules/twitter +++ b/modules/twitter @@ -33,7 +33,7 @@ def parse(text): escape = "" if piece.startswith("@"): escape = "" - if piece[1:].lower() == "shackspace": + if piece[1:].lower() == "shackspam" or piece[1:].lower() == "shackspace": escape = "" elif piece.startswith("#"): @@ -48,16 +48,16 @@ def parse(text): return new if len(sys.argv) > 1 and sys.argv[1] == "--help": - print "read or post to the shackspace twitter timeline" + print "read or post to the shackspam twitter timeline" if len(sys.argv) == 3 and sys.argv[2] == "--verbose": print "call without parameters to read" - print "use /twitter [your tweet] to tweet something to the shackspace twitter timeline" + print "use /twitter [your tweet] to tweet something to the shackspam twitter timeline" exit() -api = twitter.Api(username="shackspace", password="0b0dallaf4lla") +api = twitter.Api(username="shackspam", password="sh4ckit") #api.SetXTwitterHeaders("Shackspace UTTERANCE","","0.00.0.01.42") @@ -93,7 +93,7 @@ else: a.reverse() for i in a: text = i.text - if i.user.screen_name.lower() == "shackspace": + if i.user.screen_name.lower() == "shackspace" or i.user.screen_name.lower() == "shackspam": info = "" + i.user.screen_name + " " + shorten(i.GetRelativeCreatedAt()) + "" else: info = "" + i.user.screen_name + " " + shorten(i.GetRelativeCreatedAt()) + "" -- cgit v1.2.3 From f199aff05248164cc49391de2e9785416e9902fb Mon Sep 17 00:00:00 2001 From: "shackspace e.V" Date: Thu, 6 May 2010 22:47:01 +0200 Subject: prepared /join and /part for room based chatting --- modules/atwall | 11 ----------- modules/chat | 11 +++++++++++ modules/join | 10 ++++------ modules/part | 10 ++++++++++ 4 files changed, 25 insertions(+), 17 deletions(-) delete mode 100755 modules/atwall create mode 100755 modules/chat create mode 100755 modules/part diff --git a/modules/atwall b/modules/atwall deleted file mode 100755 index 66fca5e6..00000000 --- a/modules/atwall +++ /dev/null @@ -1,11 +0,0 @@ -#! /bin/sh - -case "$1" in - (--help) echo send text to everyone with @@ prepended ;; - (q) - echo quit chat mode - echo /set default_command espeak >$NOISE_linefeed;; - - (*) - echo /wall @@ $* >$NOISE_linefeed -esac diff --git a/modules/chat b/modules/chat new file mode 100755 index 00000000..66fca5e6 --- /dev/null +++ b/modules/chat @@ -0,0 +1,11 @@ +#! /bin/sh + +case "$1" in + (--help) echo send text to everyone with @@ prepended ;; + (q) + echo quit chat mode + echo /set default_command espeak >$NOISE_linefeed;; + + (*) + echo /wall @@ $* >$NOISE_linefeed +esac diff --git a/modules/join b/modules/join index af1c0117..0e0bec2a 100755 --- a/modules/join +++ b/modules/join @@ -1,14 +1,12 @@ #! /bin/sh case "$1" in - (--help) echo set default_command to atwall and back ;; - (off) - echo /set default_command espeak >$NOISE_linefeed - echo "disabled chat mode (set back to espeak)" ;; + (--help) echo set default_command to chat and join channel ;; (*) echo /set default_command atwall >$NOISE_linefeed - echo "enabled chat mode" - echo q or /chat off to go back to espeak ;; + echo /set chat_channel $1 >$NOISE_linefeed + echo "joined channel $1" + echo /part off to go back to espeak ;; esac diff --git a/modules/part b/modules/part new file mode 100755 index 00000000..beb95163 --- /dev/null +++ b/modules/part @@ -0,0 +1,10 @@ +#! /bin/sh + +case "$1" in + (--help) echo leave chat mode ;; + (*) + echo /set default_command espeak >$NOISE_linefeed + echo "disabled chat mode (set back to espeak)" ;; + + +esac -- cgit v1.2.3 From 47361ddde830e7ce4653d33d380e4d66bed9c1b4 Mon Sep 17 00:00:00 2001 From: "shackspace e.V" Date: Thu, 6 May 2010 22:47:45 +0200 Subject: fixed join (atwall) --- modules/join | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/join b/modules/join index 0e0bec2a..2705abac 100755 --- a/modules/join +++ b/modules/join @@ -3,7 +3,7 @@ case "$1" in (--help) echo set default_command to chat and join channel ;; (*) - echo /set default_command atwall >$NOISE_linefeed + echo /set default_command chat >$NOISE_linefeed echo /set chat_channel $1 >$NOISE_linefeed echo "joined channel $1" echo /part off to go back to espeak ;; -- cgit v1.2.3 From 81344217c8a54e46d7cfc38466303d046e08e77f Mon Sep 17 00:00:00 2001 From: root Date: Fri, 7 May 2010 02:01:02 +0200 Subject: noise: write /set'ed variables to $env Additionally: - Export $TCPREMOTIP to noise and modules. - Hardwired $HOME in noise. ;-) - Read ~% as Newline. --- noise | 26 +++++++++++++++++++------- noise-as-shack | 2 +- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/noise b/noise index 11976f68..0e60bbf2 100755 --- a/noise +++ b/noise @@ -29,6 +29,12 @@ noise_set() { # set a variable 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 } @@ -44,26 +50,30 @@ fail() { } cleanup() { - rm -f $linefeed + rm -f $linefeed $env kill $jobs } qname="`readlink -f "$0"`" dirname="`dirname "$qname"`" +export HOME='/home/shack' 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 linefeed="/tmp/noise-client-$$" +env="/tmp/noise-client-$$-env" trap cleanup EXIT mkfifo $linefeed +touch $env ## ## ## readline() { { read && echo "$REPLY" ; } | sed -rn " s/[']//g + s/~%/\n/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 @@ -73,12 +83,6 @@ readline() { ## ## ## -export noise_prompt="READY. -" -export noise_default_command=espeak -## -## -## while echo -n "$noise_prompt" && eval "`readline`" ; do ## modcall for dir in `echo "$NOISE_PATH" | tr : \ ` ; do @@ -110,6 +114,14 @@ EOF ## ## exec >>$linefeed +## +## +## +echo '/set prompt "READY.~%"' +echo '/set default_command espeak' +## +## +## while read ; do case $REPLY in (/quit) echo /quit ; exit ;; diff --git a/noise-as-shack b/noise-as-shack index c327bb81..10ae3c1c 100755 --- a/noise-as-shack +++ b/noise-as-shack @@ -1,4 +1,4 @@ #! /bin/sh qname="`readlink -f "$0"`" dirname="`dirname "$qname"`" -exec su - shack -c "$dirname"/noise +exec su - shack -c "env -i TCPREMOTEIP=\"$TCPREMOTEIP\" \"$dirname/noise\"" -- cgit v1.2.3 From b9a22654b96cf5a32f227ef6991ea81176cacb50 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 7 May 2010 02:24:01 +0200 Subject: noise: use folders for connected clients Additionally export $NOISE_pid to modules. --- modules/wall | 5 ++--- noise | 11 +++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/modules/wall b/modules/wall index fa7618fe..7c32d01d 100755 --- a/modules/wall +++ b/modules/wall @@ -2,8 +2,7 @@ case "$1" in (--help) : ;; (?*) - for client in /tmp/noise-client-* ; do - #echo /msg "$*`printf '\a'`" >$client - echo /msg "$*" >$client + for linefeed in /tmp/noise/*/linefeed ; do + echo /msg "$*" >$linefeed done esac diff --git a/noise b/noise index 0e60bbf2..2b63acbe 100755 --- a/noise +++ b/noise @@ -50,8 +50,10 @@ fail() { } cleanup() { - rm -f $linefeed $env kill $jobs + rm -f $linefeed $env + rmdir /tmp/noise/$$ 2>/dev/null + rmdir /tmp/noise 2>/dev/null } @@ -62,8 +64,9 @@ 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 -linefeed="/tmp/noise-client-$$" -env="/tmp/noise-client-$$-env" +mkdir -vp /tmp/noise/$$ +linefeed="/tmp/noise/$$/linefeed" +env="/tmp/noise/$$/environment" trap cleanup EXIT mkfifo $linefeed touch $env @@ -89,7 +92,7 @@ while echo -n "$noise_prompt" && eval "`readline`" ; do module="$dir/$command" if test -x "$module" ; then shift - eval 'NOISE="$0" NOISE_linefeed="$linefeed" "$module"' "$args" + eval 'NOISE="$0" NOISE_pid="$$" NOISE_linefeed="$linefeed" "$module"' "$args" continue 2 fi done -- cgit v1.2.3 From 0b25165144fb6a6c0e63df62bf282f13465baa82 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 7 May 2010 03:45:50 +0200 Subject: renamed module msg to echo --- modules/echo | 6 ++++++ modules/msg | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) create mode 100755 modules/echo delete mode 100755 modules/msg diff --git a/modules/echo b/modules/echo new file mode 100755 index 00000000..344dd963 --- /dev/null +++ b/modules/echo @@ -0,0 +1,6 @@ +#! /bin/sh +case "$1" in + (--help) : ;; + (*) + echo "$*" +esac diff --git a/modules/msg b/modules/msg deleted file mode 100755 index 344dd963..00000000 --- a/modules/msg +++ /dev/null @@ -1,6 +0,0 @@ -#! /bin/sh -case "$1" in - (--help) : ;; - (*) - echo "$*" -esac -- cgit v1.2.3 From f06c19d559b1dd80cc0f4adf39a78257ecf2219e Mon Sep 17 00:00:00 2001 From: "shackspace e.V" Date: Fri, 7 May 2010 04:02:27 +0200 Subject: split nick and names from chat --- modules/chat | 34 ++++++++++++++++++++++++++++------ modules/names | 21 +++++++++++++++++++++ modules/nick | 10 ++++++++++ 3 files changed, 59 insertions(+), 6 deletions(-) create mode 100755 modules/names create mode 100755 modules/nick diff --git a/modules/chat b/modules/chat index 66fca5e6..e5badc36 100755 --- a/modules/chat +++ b/modules/chat @@ -2,10 +2,32 @@ case "$1" in (--help) echo send text to everyone with @@ prepended ;; - (q) - echo quit chat mode - echo /set default_command espeak >$NOISE_linefeed;; - - (*) - echo /wall @@ $* >$NOISE_linefeed + (/nick) + echo set nick to $2 + echo /set chat_nick $2 >$NOISE_linefeed;; + (/names) + cd /tmp/noise + . $NOISE_pid/environment + nick="${chat_nick-$NOISE_pid}" + channel="$chat_channel" + echo "Users in channel $channel" + for client in * ; do + . $client/environment + chat_nick="${chat_nick-$client}" + if test "$channel" = "$chat_channel" && test "$default_command" = chat ; then + echo "$chat_nick" + fi + unset chat_nick + unset chat_channel + unset default_command + done ;; + (*) + cd /tmp/noise + . $NOISE_pid/environment + nick="${chat_nick-$NOISE_pid}" + + echo "/send_to_channel $chat_channel $nick: $*" > $NOISE_linefeed + + + #echo /wall @@ $* >$NOISE_linefeed esac diff --git a/modules/names b/modules/names new file mode 100755 index 00000000..750917a5 --- /dev/null +++ b/modules/names @@ -0,0 +1,21 @@ +#! /bin/sh + +case "$1" in + (--help) echo send text to everyone with @@ prepended ;; + (*) + cd /tmp/noise + . $NOISE_pid/environment + nick="${chat_nick-$NOISE_pid}" + channel="${1-$chat_channel}" + echo "Users in channel $channel" + for client in * ; do + . $client/environment + chat_nick="${chat_nick-$client}" + if test "$channel" = "$chat_channel" && test "$default_command" = chat ; then + echo "$chat_nick" + fi + unset chat_nick + unset chat_channel + unset default_command + done +esac diff --git a/modules/nick b/modules/nick new file mode 100755 index 00000000..b60a7433 --- /dev/null +++ b/modules/nick @@ -0,0 +1,10 @@ +#! /bin/sh + +case "$1" in + (--help) echo send text to everyone with @@ prepended ;; + (*) + . /tmp/noise/$NOISE_pid/environment + nick="${chat_nick-$NOISE_pid}" + echo /send_to_channel $nick is now known as $2 > $NOISE_linefeed + echo /set chat_nick $2 >$NOISE_linefeed;; +esac -- cgit v1.2.3 From 29e111bd9921c3730c751a059e449af765d551a4 Mon Sep 17 00:00:00 2001 From: "shackspace e.V" Date: Fri, 7 May 2010 04:03:59 +0200 Subject: added module send_to_channel --- modules/send_to_channel | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 modules/send_to_channel diff --git a/modules/send_to_channel b/modules/send_to_channel new file mode 100755 index 00000000..4a0470af --- /dev/null +++ b/modules/send_to_channel @@ -0,0 +1,17 @@ +#! /bin/sh + +case "$1" in + (--help) : ;; + (*) + cd /tmp/noise + channel="$1" + shift + for client in * ; do + . $client/environment + if test "$channel" = "$chat_channel" && test "$default_command" = chat ; then + echo "/echo $*" > $client/linefeed + fi + unset chat_channel + + done +esac -- cgit v1.2.3 From 0cd01b51b46f270a8232f3b525bcde06ffe58c4e Mon Sep 17 00:00:00 2001 From: root Date: Fri, 7 May 2010 04:05:52 +0200 Subject: noise: allow '#'s in input and '_' in module-names --- noise | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/noise b/noise index 2b63acbe..f979c34c 100755 --- a/noise +++ b/noise @@ -77,7 +77,8 @@ readline() { { read && echo "$REPLY" ; } | sed -rn " s/[']//g s/~%/\n/g - s:^/([a-z]+)([[:space:]]+(.*))?$:command=\1; args='\3';:p;t + s/([^\\])#/\1\\\\#/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 -- cgit v1.2.3 From 71fa84f005bb73e813a34e78dd4cb58a072b3879 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 7 May 2010 04:06:42 +0200 Subject: Added module: sleep --- modules/sleep | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100755 modules/sleep diff --git a/modules/sleep b/modules/sleep new file mode 100755 index 00000000..b8d350f7 --- /dev/null +++ b/modules/sleep @@ -0,0 +1,10 @@ +#! /bin/sh +case "$1" in + (--help) echo "pause for NUMBER seconds" ;; + (*) + if ! echo "$1" | grep -Eq '^([0-9]+(\.[0-9]*)?|[0-9]*\.[0-9]+)$' ; then + echo 'FAIL: $1 is not a number' + else + sleep "$1" + fi +esac -- cgit v1.2.3 From d8b74770d5ed5e724c9c145dbb894cbb2ec99acb Mon Sep 17 00:00:00 2001 From: root Date: Fri, 7 May 2010 04:11:00 +0200 Subject: Added module: date --- modules/date | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100755 modules/date diff --git a/modules/date b/modules/date new file mode 100755 index 00000000..8cd1b0c1 --- /dev/null +++ b/modules/date @@ -0,0 +1,6 @@ +#! /bin/sh +case "$1" in + (--help) : ;; + (*) + date --rfc-3339=s +esac -- cgit v1.2.3 From f77ad7ef9f1ebb63716a754315e878aabe2eee62 Mon Sep 17 00:00:00 2001 From: "shackspace e.V" Date: Fri, 7 May 2010 04:22:49 +0200 Subject: added additional check for default_command --- modules/names | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/names b/modules/names index 750917a5..f5922064 100755 --- a/modules/names +++ b/modules/names @@ -5,6 +5,7 @@ case "$1" in (*) cd /tmp/noise . $NOISE_pid/environment + if test "$default_command" != chat ; then exit ; fi nick="${chat_nick-$NOISE_pid}" channel="${1-$chat_channel}" echo "Users in channel $channel" -- cgit v1.2.3 From cc7314993b00d4f94c5837f36a4854ba6420350e Mon Sep 17 00:00:00 2001 From: "shackspace e.V" Date: Fri, 7 May 2010 04:27:16 +0200 Subject: telling the others who parted --- modules/part | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/part b/modules/part index beb95163..d35ac501 100755 --- a/modules/part +++ b/modules/part @@ -3,6 +3,11 @@ case "$1" in (--help) echo leave chat mode ;; (*) + . /tmp/noise/$NOISE_pid/environment + nick="${chat_nick-$NOISE_pid}" + + echo "/send_to_channel $chat_channel $nick has quit ${*-no reason}" > $NOISE_linefeed + echo /set default_command espeak >$NOISE_linefeed echo "disabled chat mode (set back to espeak)" ;; -- cgit v1.2.3 From 5664f6beafe6a7796835dc1c5be7bac4a0c4aa65 Mon Sep 17 00:00:00 2001 From: "shackspace e.V" Date: Fri, 7 May 2010 04:28:14 +0200 Subject: now telling who joined --- modules/join | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/join b/modules/join index 2705abac..68afcb66 100755 --- a/modules/join +++ b/modules/join @@ -3,10 +3,13 @@ case "$1" in (--help) echo set default_command to chat and join channel ;; (*) + . /tmp/noise/$NOISE_pid/environment + nick="${chat_nick-$NOISE_pid}" + echo /send_to_channel "${1-#23}" "$nick" joined the channel >$NOISE_linefeed echo /set default_command chat >$NOISE_linefeed - echo /set chat_channel $1 >$NOISE_linefeed - echo "joined channel $1" - echo /part off to go back to espeak ;; + echo /set chat_channel "${1-#23}" >$NOISE_linefeed + echo " joined channel ${1-#23}" + echo /part to go back to espeak ;; esac -- cgit v1.2.3 From c83842518c14a7c258e06baf9fe45a93b5d159e8 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 7 May 2010 04:28:49 +0200 Subject: zeit: use /espeak instead of $default_command --- modules/zeit | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/zeit b/modules/zeit index 75ffc20a..4c41fa10 100755 --- a/modules/zeit +++ b/modules/zeit @@ -9,10 +9,10 @@ case "$1" in M=`date +%M|sed 's/0*//'` echo /set pitch 10 case "$lang" in - (de|'') echo " Es ist $k Uhr $M" >$NOISE_linefeed ;; + (de|'') echo "/espeak Es ist $k Uhr $M" ;; (en|*-en) test -z "$M" || M="and $M minutes" - echo " It is $k o clock $M" >$NOISE_linefeed ;; + echo "/espeak It is $k o clock $M" ;; (*) echo "Error: unsupported lang = $lang" >&2 esac echo /set pitch ${noise_pitch-100} -- cgit v1.2.3 From 4830460590cf013cb79df8d04b96ebaf725db6af Mon Sep 17 00:00:00 2001 From: "shackspace e.V" Date: Fri, 7 May 2010 04:31:49 +0200 Subject: nick: fixed not telling others, fixed not working AT ALL --- modules/nick | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/nick b/modules/nick index b60a7433..5ed1e9d9 100755 --- a/modules/nick +++ b/modules/nick @@ -5,6 +5,6 @@ case "$1" in (*) . /tmp/noise/$NOISE_pid/environment nick="${chat_nick-$NOISE_pid}" - echo /send_to_channel $nick is now known as $2 > $NOISE_linefeed - echo /set chat_nick $2 >$NOISE_linefeed;; + echo /send_to_channel $chat_channel $nick is now known as $1 > $NOISE_linefeed + echo /set chat_nick $1 >$NOISE_linefeed;; esac -- cgit v1.2.3 From 6abf375996b0f28a7ebba80d9f0052c1f1394788 Mon Sep 17 00:00:00 2001 From: "shackspace e.V" Date: Fri, 7 May 2010 04:34:21 +0200 Subject: twitter: fixed the "a"-bug, fixed 81 width --- modules/twitter | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/twitter b/modules/twitter index fa4d366d..49d092fb 100755 --- a/modules/twitter +++ b/modules/twitter @@ -22,6 +22,7 @@ def shorten(text): text = text.replace(" years", "y") text = text.replace(" year", "y") text = text.replace(" ago", "") + text = text.replace("a", "1") return text @@ -93,6 +94,7 @@ else: a.reverse() for i in a: text = i.text + ilen = len(i.user.screen_name) + len(shorten(i.GetRelativeCreatedAt())) + 2 if i.user.screen_name.lower() == "shackspace" or i.user.screen_name.lower() == "shackspam": info = "" + i.user.screen_name + " " + shorten(i.GetRelativeCreatedAt()) + "" else: @@ -102,12 +104,12 @@ else: t = text.split(" ") tmp = "" for n in t: - if ((len(tmp) + len(n)) > 80): + if ((len(tmp) + len(n)) >= 80): print parse(tmp).encode("utf8") - tmp = " " *( len(info)-15) + tmp = " " * ilen tmp += " " + n - if len(tmp) > (len(info)-15+1): + if len(tmp) > ilen: print parse(tmp).encode("utf8") -- cgit v1.2.3 From 50be3334a221c7e7a1b20eb8f1da481d7e9e9729 Mon Sep 17 00:00:00 2001 From: "shackspace e.V" Date: Fri, 7 May 2010 04:36:26 +0200 Subject: added .gitignore for samples --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..81154dd4 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +samples -- cgit v1.2.3 From 04fa9b3513d909cf71554b01c6c7bd883e964cf4 Mon Sep 17 00:00:00 2001 From: "shackspace e.V" Date: Fri, 7 May 2010 04:42:48 +0200 Subject: added query command to whisper users --- modules/query | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 modules/query diff --git a/modules/query b/modules/query new file mode 100755 index 00000000..dd6f415a --- /dev/null +++ b/modules/query @@ -0,0 +1,20 @@ +#! /bin/sh + +case "$1" in + (--help) echo send a message to a specific user ;; + (*) + cd /tmp/noise + nick="$1" + shift + for client in * ; do + . $client/environment + if test "$nick" = "${chat_nick-$client}" ; then + echo "/echo $*" > $client/linefeed + exit + fi + unset chat_channel + + done + + echo "$nick not found" +esac -- cgit v1.2.3 From bd0a3e505cb4384101a4a044fe52a6a1ed4d5e7f Mon Sep 17 00:00:00 2001 From: "shackspace e.V" Date: Fri, 7 May 2010 04:50:48 +0200 Subject: fixed query not working AT ALL --- modules/query | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/query b/modules/query index dd6f415a..ceeff8a5 100755 --- a/modules/query +++ b/modules/query @@ -4,13 +4,16 @@ case "$1" in (--help) echo send a message to a specific user ;; (*) cd /tmp/noise - nick="$1" + . $NOISE_pid/environment + nick="${chat_nick-$NOISE_pid}" + target="$1" shift for client in * ; do . $client/environment - if test "$nick" = "${chat_nick-$client}" ; then - echo "/echo $*" > $client/linefeed - exit + if test "$target" = "${chat_nick-$client}" ; then + echo "/echo <-- $nick: $*" > $client/linefeed + echo "--> $target: $*" + exit fi unset chat_channel -- cgit v1.2.3 From 8b7cd604d16b5f01128dda2927dde2c8dfe1f2dd Mon Sep 17 00:00:00 2001 From: root Date: Fri, 7 May 2010 04:50:54 +0200 Subject: noise: escape '<' and '>' in reader --- noise | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noise b/noise index f979c34c..cb4b8531 100755 --- a/noise +++ b/noise @@ -77,7 +77,7 @@ readline() { { read && echo "$REPLY" ; } | sed -rn " s/[']//g s/~%/\n/g - s/([^\\])#/\1\\\\#/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 -- cgit v1.2.3