Generate the URL in a function
This commit is contained in:
parent
576738e85e
commit
8cfdeb5a99
13
rowbot
13
rowbot
|
@ -98,6 +98,16 @@ run_callbacks() {
|
|||
return 0
|
||||
}
|
||||
|
||||
url() {
|
||||
if [[ ${config[tls]} = no ]]; then
|
||||
printf irc://
|
||||
else
|
||||
printf ircs://
|
||||
fi
|
||||
|
||||
printf %s:%s "${config[server]}" "${config[port]}"
|
||||
}
|
||||
|
||||
###
|
||||
# configure rowbot's environment
|
||||
###
|
||||
|
@ -300,9 +310,9 @@ on_sys_init_002_net() {
|
|||
|
||||
on_sys_first_002_net() {
|
||||
local conn_args
|
||||
log_info "rowbot is connecting to %s" "$(url)"
|
||||
|
||||
if [[ ${config[tls]} = no ]]; then
|
||||
log_info "rowbot is connecting to irc://%s:%s" "${config[server]}" "${config[port]}"
|
||||
exec {irc_sock}<>/dev/tcp/"${config[server]}"/"${config[port]}"
|
||||
in_sock=$irc_sock out_sock=$irc_sock
|
||||
else
|
||||
|
@ -310,7 +320,6 @@ on_sys_first_002_net() {
|
|||
die "please install socat to use tls with rowbot."
|
||||
fi
|
||||
|
||||
log_info "rowbot is connecting to ircs://%s:%s" "${config[server]}" "${config[port]}"
|
||||
sock_dir=$(mktemp -d)
|
||||
log_debug "socket directory is %s" "$sock_dir"
|
||||
mkfifo "$sock_dir"/rowbot-{in,out}.sock
|
||||
|
|
Loading…
Reference in New Issue