главная|main page

состояние|status

блог|blog

файлы|files

программы|software

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xechoz.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/echoz.sh b/echoz.sh
index b6c14f2..e5b8321 100755
--- a/echoz.sh
+++ b/echoz.sh
@@ -12,6 +12,15 @@ port="$(echo "$srv" | cut -d' ' -f3)"
authstr="$(echo -ne "\0$username\0$password" | base64)"
rm -f "$pipename"
mkfifo "$pipename"
+DEBUG_PATH=${DEBUG_PATH:-}
+if [[ "x$DEBUG_PATH" != "x" ]]; then
+ debug_recv="${DEBUG_PATH}recv.xml"
+ debug_sent="${DEBUG_PATH}sent.xml"
+ rm -f "$debug_sent" "$debug_recv"
+else
+ debug_recv=/dev/null
+ debug_sent=/dev/null
+fi
stdbuf -i0 -o0 \
openssl s_client \
-starttls xmpp \
@@ -21,7 +30,9 @@ stdbuf -i0 -o0 \
< "$pipename" \
| (echo -ne "$jid $authstr\n"; \
stdbuf -o0 tr '>\n' '\n\001') \
+ | stdbuf -o0 tee "$debug_recv" \
| stdbuf -o0 "$thisdir/echoz.sed" \
+ | stdbuf -o0 tee "$debug_sent" \
| stdbuf -o0 tr -d '\n' \
| stdbuf -o0 tr '\001' '\n' \
> "$pipename"