diff --git a/bot.ml b/bot.ml index 32a7343..3a99e25 100644 --- a/bot.ml +++ b/bot.ml @@ -8,8 +8,20 @@ let write iobuf command args text = let cmd = Command.create None command args text in Iobuf.write iobuf cmd -let msg iobuf recip text = - write iobuf "PRIVMSG" [recip] (Some text) +let rec msg iobuf recip text = + match text with + | "" -> () + | _ -> + let tl = String.length text in + let s, rest = + if (tl > 400) then + ((Str.string_before text 400) ^ "↩", + "↪" ^ (Str.string_after text 400)) + else + (text, "") + in + write iobuf "PRIVMSG" [recip] (Some s); + msg iobuf recip rest let split = Str.split (Str.regexp "[ \t]*\r?\n") diff --git a/firebot b/firebot index 0666c11..38b2281 100755 --- a/firebot +++ b/firebot @@ -8,13 +8,13 @@ firebot () { echo "$args" | bc -l ;; units) - src=$(echo "$args" | sed 's/ ->.*//') - dst=$(echo "$args" | sed 's/.*-> //') + src=$(printf "%s" "$args" | sed 's/ ->.*//') + dst=$(printf "%s" "$args" | sed 's/.*-> //') units -1 -v -- "$src" "$dst" ;; .note) - who=$(echo $args | cut -d\ -f1 | tr -d -c A-Za-z0-9) - what=$(echo $args | cut -d\ -f2-) + who=$(printf "%s" "$args" | sed 's/ .*//;s/[^-A-Za-z0-9]/./') + what=$(printf "%s" "$args" | cut -d\ -f2-) when=$(date) echo "($when) <$sender> $what" > notes/$who echo "I've left $who a note, $sender." diff --git a/infobot b/infobot index 573c741..d48b64e 100755 --- a/infobot +++ b/infobot @@ -37,7 +37,7 @@ EOF !l*) printf "%s" "$args" cdb -q -m $db "$args" | \ - awk '{printf(" | \"%s\"", $0);}' + awk '{printf("¦\"%s\"", $0);}' echo ;; !a*)