Make some minor cosmetic changes

This commit is contained in:
Nick Chambers 2021-11-07 01:19:51 -05:00
parent c837e1a84f
commit d8b55a72c2
1 changed files with 10 additions and 7 deletions

17
rowbot
View File

@ -77,7 +77,7 @@ is_action() {
}
is_chan() {
[[ ${msg_args[${1:-0}]:0:1} = \# ]]
[[ ${msg_args[0]:0:1} = \# ]]
}
# cryptography secure (almost probably) random number generators
@ -442,12 +442,11 @@ on_sys_after_002_net() {
}
on_sys_exit_998_net() {
log_info "rowbot is closing the connection to %s" "$(url)"
if [[ ${config[tls]} = no ]]; then
log_info "rowbot is closing the connection to irc://%s:%s" "${config[server]}" "${config[port]}"
exec {irc_sock}>&-
else
log_info "rowbot is closing the connection to ircs://%s:%s" "${config[server]}" "${config[port]}"
if [[ -v tls_pid ]] && is_running "$tls_pid"; then
kill -STOP "$tls_pid"
fi
@ -728,6 +727,10 @@ irc_on_396() {
log_info "%s %s" "${msg_args[1]}" "${msg_args[-1]}"
}
irc_on_401() {
log_info "%s is unavailable: %s" "${msg_args[1]}" "${msg_args[-1]}"
}
irc_on_433() {
log_info "somebody is already using %s" "${msg_args[1]}"
}
@ -1014,7 +1017,7 @@ annoyatron900_alternick() {
on_msg_NICK_alternick() {
if [[ ${msg[from]} = "${config[nick]}" ]]; then
desired_nick=
log_info "got desired nick!"
log_info "got desired nick %s!" "${msg_args[-1]}"
config[nick]=${msg_args[-1]}
fi
}
@ -1113,7 +1116,7 @@ on_register_mode_getter() {
}
###
# cleanup
# atexit(3)-style cleanup
###
cleanup() {
@ -1216,7 +1219,7 @@ while net_recv line; do
if [[ ${msg[cmd]} = @(PRIVMSG|NOTICE) ]]; then
msg[to]=${msg[from]}
if [[ ${msg_args[0]:0:1} = \# ]]; then
if is_chan; then
msg[to]=${msg_args[0]}
fi