repo: janus-extras
action: blob
revision: 
path_from: janus-irc-hack-part2
revision_from: refs/heads/master:
path_to: 
revision_to: 
git.thebackupbox.net
janus-extras
git clone git://git.thebackupbox.net/janus-extras

blob of:

janus-extras

/ janus-irc-hack-part2

blob_plain of this file

refs/heads/master:/janus-irc-hack-part2

 #!/usr/bin/env bash

 while read -r line <&3 ;do
 	logger -p crot "from janus to IRC: $line"
 	# FROM JANUS TO IRC
 	jti="$(jq -r .data <<< "${line}")"
 	printf "%s\n" "${jti}"
 done &

 while read -r asdf ;do
 	logger -p crit "from IRC to janus: $asdf"
 	# FROM IRC TO JANUS
 	nick="$(sed 's/^<\(.*\)>.*$/\1/' <<< "${asdf}" | jq -R .)"
 	msg="$(sed 's/^<[^>]*> //' <<< "${asdf}" | jq -R .)"
 	printf '{"method":"user_chat","data":{"message":{"data":%s},"userId":%s}}\n' "${msg}" "${nick}" >&4
 done