Merge branch 'alternick' of uplime/rowbot into master
This commit is contained in:
commit
abe9621d4b
1 changed files with 41 additions and 5 deletions
46
rowbot
46
rowbot
|
@ -140,9 +140,14 @@ trap cleanup EXIT
|
||||||
if [[ $reload = yes ]]; then
|
if [[ $reload = yes ]]; then
|
||||||
in_sock=$IN_SOCK out_sock=$OUT_SOCK
|
in_sock=$IN_SOCK out_sock=$OUT_SOCK
|
||||||
trigger=$TRIGGER dev=$DEV level=$LOG_LEVEL
|
trigger=$TRIGGER dev=$DEV level=$LOG_LEVEL
|
||||||
|
registered=$REGISTERED
|
||||||
|
|
||||||
debug "doing a reload. pid is %d" "$$"
|
debug "doing a reload. pid is %d" "$$"
|
||||||
|
|
||||||
|
if [[ -v KEEP_TRYING ]]; then
|
||||||
|
keep_trying=$KEEP_TRYING desired_nick=$DESIRED
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $tls = yes ]]; then
|
if [[ $tls = yes ]]; then
|
||||||
sock_dir=$SOCK_DIR
|
sock_dir=$SOCK_DIR
|
||||||
tls_pid=$tls_pid
|
tls_pid=$tls_pid
|
||||||
|
@ -274,6 +279,7 @@ on_001() {
|
||||||
|
|
||||||
ping_pid=$!
|
ping_pid=$!
|
||||||
nick=${params[0]}
|
nick=${params[0]}
|
||||||
|
registered=yes
|
||||||
who "$nick" %%uht,42
|
who "$nick" %%uht,42
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -375,6 +381,14 @@ on_376() {
|
||||||
debug %s "${params[1]}"
|
debug %s "${params[1]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
on_433() {
|
||||||
|
info "somebody is already using %s" "${params[1]}"
|
||||||
|
|
||||||
|
if [[ $registered = no ]]; then
|
||||||
|
nick "${nick}_"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
on_473() {
|
on_473() {
|
||||||
error "%s: %s" "${params[1]}" "${params[2]}"
|
error "%s: %s" "${params[1]}" "${params[2]}"
|
||||||
}
|
}
|
||||||
|
@ -467,11 +481,16 @@ who() {
|
||||||
# keepalive code
|
# keepalive code
|
||||||
###
|
###
|
||||||
|
|
||||||
ping-handler() {
|
alarm-handler() {
|
||||||
ping "row your bot gently down the stream"
|
ping "row your bot gently down the stream"
|
||||||
|
|
||||||
|
if [[ $keep_trying = yes ]]; then
|
||||||
|
info "trying for %s again" "$desired_nick"
|
||||||
|
nick "$desired_nick"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
trap ping-handler ALRM
|
trap alarm-handler ALRM
|
||||||
|
|
||||||
###
|
###
|
||||||
# app hooks
|
# app hooks
|
||||||
|
@ -604,7 +623,11 @@ hook_post_PRIVMSG_control_panel() {
|
||||||
reload)
|
reload)
|
||||||
export IN_SOCK=$in_sock OUT_SOCK=$out_sock LOG_FD=$log DEV=$dev
|
export IN_SOCK=$in_sock OUT_SOCK=$out_sock LOG_FD=$log DEV=$dev
|
||||||
export RELOAD_TO=$to TRIGGER=$trigger LOG_LEVEL=$level
|
export RELOAD_TO=$to TRIGGER=$trigger LOG_LEVEL=$level
|
||||||
export NICK=$nick IDENT=$ident
|
export NICK=$nick IDENT=$ident REGISTERED=$registered
|
||||||
|
|
||||||
|
if [[ $keep_trying = yes ]]; then
|
||||||
|
export KEEP_TRYING=yes DESIRED=$desired_nick
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -v host ]]; then
|
if [[ -v host ]]; then
|
||||||
export HOST=$host
|
export HOST=$host
|
||||||
|
@ -664,15 +687,28 @@ hook_post_PRIVMSG_control_panel() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hook_post_433_alternick() {
|
||||||
|
if [[ -z $desired_nick && $registered = no ]]; then
|
||||||
|
desired_nick=${params[1]}
|
||||||
|
keep_trying=yes
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
hook_post_NICK_alternick() {
|
||||||
|
if [[ ${params[0]} = $desired_nick ]]; then
|
||||||
|
keep_trying=no
|
||||||
|
info "obtained nick %s" "$desired_nick"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
###
|
###
|
||||||
# driver
|
# driver
|
||||||
###
|
###
|
||||||
|
|
||||||
trap ping-handler ALRM
|
|
||||||
|
|
||||||
if [[ $reload = yes ]]; then
|
if [[ $reload = yes ]]; then
|
||||||
privmsg "$RELOAD_TO" done.
|
privmsg "$RELOAD_TO" done.
|
||||||
else
|
else
|
||||||
|
registered=no
|
||||||
nick "$nick"
|
nick "$nick"
|
||||||
user "$ident" "$realname"
|
user "$ident" "$realname"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue