diff --git a/rowbot b/rowbot index 1a826a1..5193eac 100755 --- a/rowbot +++ b/rowbot @@ -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