# Utility, Botnet Notify. utl_botnetnotify.tcl - http://nukie.front.ru/
# This script notifies a channel what a user joins the partyline, when a user leave the partyline, when a bot disconnects, when a bot
# links, and when a user changes their handle. If hub mode is set to 1, it will notify when any bot links or delinks.

# Set your botnet info channel here.
set botnetnotify_setting(infochan) "#nukie"

# If your bot is a hub, set "1" here. Else if it's a leaf, set it to 0.
#set botnetnotify_setting(hub) 1 (moved to config file)

######### Please do not edit anything below unless you know what you are doing ;) #########

bind bcst - * bnet_user_remote_login
bind chon - * bnet_user_login
bind chof - * bnet_user_logout
bind link - * bnet_bot_link
bind disc - * bnet_bot_disconnect

proc bnet_user_login {hand idx} {
	global botnetnotify_setting
	putserv "PRIVMSG $botnetnotify_setting(infochan) :\[4x]: $hand has joined the partyline"
}
proc bnet_user_logout {hand idx} {
	global botnetnotify_setting
	putserv "PRIVMSG $botnetnotify_setting(infochan) :\[4x]: $hand has left the partyline"
}
proc bnet_user_remote_login {hand idx botname} {
	global botnetnotify_setting
	if {$botnetnotify_setting(hub)} {
		putserv "PRIVMSG $botnetnotify_setting(infochan) :\[4x]: $hand has joined the partyline on $botname"
	}
}
proc bnet_bot_link {botname to} {
	global botnetnotify_setting
	if {$botnetnotify_setting(hub)} {
		putserv "PRIVMSG $botnetnotify_setting(infochan) :\[4x]: $botname is now linked to $to" 
	}
}
proc bnet_bot_disconnect {botname} {
	global botnetnotify_setting
	if {$botnetnotify_setting(hub)} {
		putserv "PRIVMSG $botnetnotify_setting(infochan) :\[4x]: $botname has disconnected from the botnet" 
	}
}

putlog "\[4x]: Utility, Botnet Notify. Loaded."
putlog "\[4x]: Botnet Info is being sent to $botnetnotify_setting(infochan)"

if {$botnetnotify_setting(hub)} {
	putlog "\[4x]: Botnet Hub Mode is on"
} else {
	putlog "\[4x]: Botnet Leaf Mode is on"
}