Fix input with backslash and uri grabbing. - annna - Annna the nice friendly bo… | |
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
commit a487ecc2b59075400fd82440ac42e5b4250afcef | |
parent 821f4a797dd7867fe0700edd8f5ae400706ab632 | |
Author: Annna Robert-Houdin <[email protected]> | |
Date: Fri, 18 May 2018 20:34:47 +0200 | |
Fix input with backslash and uri grabbing. | |
Diffstat: | |
M annna-start-services | 48 ++++++++++++++++-------------… | |
1 file changed, 24 insertions(+), 24 deletions(-) | |
--- | |
diff --git a/annna-start-services b/annna-start-services | |
@@ -42,9 +42,9 @@ then | |
| grep -v --line-buffered '[0-9]* -!- ' \ | |
| sed -u 's,[0-9]* <\([^ >]*\)> \(.*\),\1\n\2,' \ | |
| { | |
- while read user; | |
+ while read -r user; | |
do | |
- read text | |
+ read -r text | |
[ "$user" = "${botname}" ] && continue | |
@@ -74,9 +74,9 @@ then | |
| grep -v --line-buffered '[0-9]* -!- ' \ | |
| sed -u 's,[0-9]* <\([^ >]*\)> \(.*\),\1\n\2,' \ | |
| { | |
- while read user; | |
+ while read -r user; | |
do | |
- read text | |
+ read -r text | |
[ "$user" = "${botname}" ] && continue | |
uri="$(printf "%s\n" "${text}" \ | |
@@ -146,6 +146,26 @@ then | |
;; | |
esac | |
+ if [ "${text}" = "${botname}, I'm bored." ]; | |
+ then | |
+ randomlink="$(/br/bin/bitreich-lawn-random-link)" | |
+ linktype="$(printf "%s\n" "${randomlink}" | cut -d '|'… | |
+ linktext="$(printf "%s\n" "${randomlink}" | cut -d '|'… | |
+ linksel="$(printf "%s\n" "${randomlink}" | cut -d '|' … | |
+ linkserver="$(printf "%s\n" "${randomlink}" | cut -d '… | |
+ linkport="$(printf "%s\n" "${randomlink}" | cut -d '|'… | |
+ outtext="$(printf "%s - gopher://%s" "$linktext" "$lin… | |
+ if [ "$linkport" != "70" -a "$linkport" != "port" ]; | |
+ then | |
+ outtext="$(printf "%s:%s" "$outtext" "$linkpor… | |
+ fi | |
+ if [ -n "$linksel" ]; | |
+ then | |
+ outtext="$(printf "%s/%s%s" "$outtext" "$linkt… | |
+ fi | |
+ annna-say -c "#bitreich-en" "$outtext" | |
+ fi | |
+ | |
ismember=0 | |
for member in $brmembers; | |
do | |
@@ -274,26 +294,6 @@ then | |
continue; | |
fi | |
- if [ "${text}" = "${botname}, I'm bored." ]; | |
- then | |
- randomlink="$(/br/bin/bitreich-lawn-random-link)" | |
- linktype="$(printf "%s\n" "${randomlink}" | cut -d '|'… | |
- linktext="$(printf "%s\n" "${randomlink}" | cut -d '|'… | |
- linksel="$(printf "%s\n" "${randomlink}" | cut -d '|' … | |
- linkserver="$(printf "%s\n" "${randomlink}" | cut -d '… | |
- linkport="$(printf "%s\n" "${randomlink}" | cut -d '|'… | |
- outtext="$(printf "%s - gopher://%s" "$linktext" "$lin… | |
- if [ "$linkport" != "70" -a "$linkport" != "port" ]; | |
- then | |
- outtext="$(printf "%s:%s" "$outtext" "$linkpor… | |
- fi | |
- if [ -n "$linksel" ]; | |
- then | |
- outtext="$(printf "%s/%s%s" "$outtext" "$linkt… | |
- fi | |
- annna-say -c "#bitreich-en" "$outtext" | |
- fi | |
- | |
if [ "${text}" = "${botname}, please help." ]; | |
then | |
# TODO: Add multiple line support to annna-say -c(1) w… |