Florian 8 лет назад
Родитель
Сommit
0f6d0289d7

+ 1856 - 0
BlackTools2.5.1/BlackTools/Commands/BT.AddCmds.tcl

@@ -0,0 +1,1856 @@
+#########################################################################
+##          BlackTools - The Ultimate Channel Control Script           ##
+##                    One TCL. One smart Eggdrop                       ##
+#########################################################################
+############################   ADDCMDS TCL   ############################
+#########################################################################
+##						                       ##
+##     BlackTools  : http://blacktools.tclscripts.net	               ##
+##     Bugs report : http://www.tclscripts.net/	                       ##
+##     Online Help : irc://irc.undernet.org/tcl-help 	               ##
+##                   #TCL-HELP / UnderNet                              ##
+##                   You can ask in english or romanian                ##
+##					                               ##
+#########################################################################
+
+
+############################## Commands #################################
+
+########################## adduser ##################################
+
+proc add:process {user uhost handle level hand host chan chan1 nick type cmd} {
+global black botnick
+	set cmd_status [btcmd:status $chan $hand $cmd 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+if {[matchattr $hand q]} { 
+	blacktools:tell $nick $host $hand $chan $chan1 gl.glsuspend none
+	return
+}
+if {[matchattr $hand -|q $chan]} { 
+	blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
+	return
+}
+if {[validuser $handle]} {
+	set user $handle
+}
+if {$user == ""} {
+	switch $type {
+	0 {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr "$cmd"
+	}
+	1 {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr_nick "$cmd"
+	}
+	2 {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr_priv "$cmd"
+		}
+	}
+	return
+}
+	set show_user $user
+	set time [unixtime]
+	set flags "nmo|NMOAVH"
+
+if {![validchan $chan]} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
+	return
+}
+	
+if {$user != ""} {
+	set user [strip:all $user]
+	set replace(%user%) $show_user
+if {$uhost == ""} {
+	set uhost [string map [array get replace] $black(hostadd)]
+}
+if {[userlist] != ""} {
+foreach usr [userlist] {
+	set hst [getuser $usr hosts]
+foreach hhost $hst {
+if {[string match -nocase $hhost $uhost] && (![string match -nocase $usr $user])} {
+	blacktools:tell $nick $host $hand $chan $chan1 add.5 $usr
+	set user $usr
+	set show_user $usr
+			}
+		}
+	}
+}
+ 
+if {[matchattr $hand -|A $chan] && ($level == [string tolower [blacktools:getlevelname 3 $hand]])} {
+	blacktools:tell $nick $host $hand $chan $chan1 add.6 [blacktools:getlevelname 3 $hand]
+	return
+}
+if {[matchattr $hand -|A $chan] && ($level == [string tolower [blacktools:getlevelname 4 $hand]])} {
+	blacktools:tell $nick $host $hand $chan $chan1 add.7 [blacktools:getlevelname 4 $hand]
+	return
+}
+if {[matchattr $hand -|M $chan] && ($level == [string tolower [blacktools:getlevelname 3 $hand]])} {
+	blacktools:tell $nick $host $hand $chan $chan1 add.8 [blacktools:getlevelname 3 $hand]
+	return
+}
+
+if {[string equal -nocase $level [blacktools:getlevelname 3 $hand]]} { 
+	set flags "-|olM"
+if {[validuser $user]} {
+	set check_global [check:global $user]
+if {$check_global != "0"} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.isowner "$user $check_global"
+	return
+}
+if {[matchattr $user m|- $chan] && [matchattr $hand -|M $chan]} { 
+	blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
+	return
+}
+if {[matchattr $user -|M $chan] && [matchattr $hand -|M $chan]} { 
+	blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
+	return
+}
+if {[matchattr $user n|- $chan] && [matchattr $hand n|- $chan]} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
+	return
+}
+if {[matchattr $user m|- $chan] && [matchattr $hand m|- $chan] && (![matchattr $hand n|- $chan])} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
+	return 
+}
+if {[matchattr $user n|- $chan] && [matchattr $hand m|- $chan]} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
+	return
+}
+if {[matchattr $user o|- $chan] && [matchattr $hand -|M $chan]} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
+	return
+}
+if {[matchattr $user n|- $chan] && [matchattr $hand o|- $chan]} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
+	return
+}
+if {[matchattr $user m|- $chan] && [matchattr $hand o|- $chan]} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
+	return
+}
+if {[matchattr $user o|- $chan] && [matchattr $hand o|- $chan]} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
+	return
+}
+	chattr $user -|-qolSOHAMV $chan
+	chattr $user $flags $chan
+	setuser $user XTRA CHANMODIF($chan) $time:$hand
+	blacktools:tell $nick $host $hand $chan $chan1 add.19 "$show_user [blacktools:getlevelname 3 $hand]"
+} else {
+	adduser $user $uhost
+	set user [check:handle $user $nick $host $hand $chan $chan1]
+	chattr $user -|-SOHAMV $chan
+	chattr $user $flags $chan
+	setuser $user XTRA CHANMODIF($chan) $time:$hand
+	blacktools:tell $nick $host $hand $chan $chan1 add.10 "$show_user $uhost"
+	blacktools:tell $nick $host $hand $chan $chan1 add.19 "$show_user [blacktools:getlevelname 3 $hand]"
+	}
+} elseif {[string equal -nocase $level [blacktools:getlevelname 4 $hand]]} {
+	set flags "-|olA"
+ if {[validuser $user]} {
+	set check_global [check:global $user]
+if {$check_global != "0"} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.isowner "$user $check_global"
+	return
+}
+	set get_status_access [check:access $nick $host $hand $chan $chan1 $user]
+if {$get_status_access == "1"} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
+	return
+}
+	chattr $user -|-qolSHOAMV $chan
+	chattr $user $flags $chan
+	setuser $user XTRA CHANMODIF($chan) $time:$hand
+	blacktools:tell $nick $host $hand $chan $chan1 add.19 "$show_user [blacktools:getlevelname 4 $hand]"
+} else {
+	adduser $user $uhost
+	set user [check:handle $user $nick $host $hand $chan $chan1]
+	chattr $user -|-qolSHOAMV $chan
+	chattr $user $flags $chan 
+	setuser $user XTRA CHANMODIF($chan) $time:$hand
+	blacktools:tell $nick $host $hand $chan $chan1 add.10 "$show_user $uhost"
+	blacktools:tell $nick $host $hand $chan $chan1 add.19 "$show_user [blacktools:getlevelname 4 $hand]"
+	}
+} elseif {[string equal -nocase $level [blacktools:getlevelname 2 $hand]]} {
+	set flags "m|-"
+if {[matchattr $hand n]} {
+if {[validuser $user]} { 
+	set get_status_access [check:access $nick $host $hand $chan $chan1 $user]
+if {$get_status_access == "1"} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
+	return
+}
+	chattr $user -omjlptxq|-qolSHOAMV $chan
+	chattr $user $flags
+	setuser $user XTRA CHANMODIF(GLOBAL) $time:$hand
+	blacktools:tell $nick $host $hand $chan $chan1 add.20 "$show_user [blacktools:getlevelname 2 $hand]"
+} else {
+	adduser $user $uhost
+	set user [check:handle $user $nick $host $hand $chan $chan1]
+	chattr $user -|-qolSHOAMV $chan
+	chattr $user $flags 
+	setuser $user XTRA CHANMODIF(GLOBAL) $time:$hand
+	blacktools:tell $nick $host $hand $chan $chan1 add.10 "$show_user $uhost"
+	blacktools:tell $nick $host $hand $chan $chan1 add.20 "$show_user [blacktools:getlevelname 2 $hand]"
+		}
+	}
+} elseif {[string equal -nocase $level [blacktools:getlevelname 8 $hand]]} {
+	set flags "o|-"
+if {[matchattr $hand nm]} {
+if {[validuser $user]} { 
+	set get_status_access [check:access $nick $host $hand $chan $chan1 $user]
+if {$get_status_access == "1"} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
+	return
+}
+	chattr $user -omjlptxq|-qolSHOAMV $chan
+	chattr $user $flags
+	setuser $user XTRA CHANMODIF(GLOBAL) $time:$hand
+	blacktools:tell $nick $host $hand $chan $chan1 add.20 "$show_user [blacktools:getlevelname 8 $hand]"
+} else {
+	adduser $user $uhost
+	set user [check:handle $user $nick $host $hand $chan $chan1]
+	chattr $user -|-qolSHOAMV $chan
+	chattr $user $flags 
+	setuser $user XTRA CHANMODIF(GLOBAL) $time:$hand
+	blacktools:tell $nick $host $hand $chan $chan1 add.10 "$show_user $uhost"
+	blacktools:tell $nick $host $hand $chan $chan1 add.20 "$show_user [blacktools:getlevelname 8 $hand]"
+		}
+	}
+} elseif {[string equal -nocase $level [blacktools:getlevelname 5 $hand]]} {
+	set flags "-|olO"
+if {[validuser $user]} { 
+	set check_global [check:global $user]
+if {$check_global != "0"} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.isowner "$user $check_global"
+	return
+}
+	set get_status_access [check:access $nick $host $hand $chan $chan1 $user]
+if {$get_status_access == "1"} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
+	return
+}
+	chattr $user -|-qolSHOAMV $chan
+	chattr $user $flags $chan 
+	setuser $user XTRA CHANMODIF($chan) $time:$hand
+	blacktools:tell $nick $host $hand $chan $chan1 add.19 "$show_user [blacktools:getlevelname 5 $hand]"
+} else {
+	adduser $user $uhost
+	set user [check:handle $user $nick $host $hand $chan $chan1]
+	chattr $user -|-qolSHOAMV $chan
+	chattr $user $flags $chan 
+	setuser $user XTRA CHANMODIF($chan) $time:$hand
+	blacktools:tell $nick $host $hand $chan $chan1 add.10 "$show_user $uhost"
+	blacktools:tell $nick $host $hand $chan $chan1 add.19 "$show_user [blacktools:getlevelname 5 $hand]"
+	}
+} elseif {[string equal -nocase $level [blacktools:getlevelname 7 $hand]]} {
+	set flags "-|H"
+if {[validuser $user]} { 
+	set check_global [check:global $user]
+if {$check_global != "0"} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.isowner "$user $check_global"
+	return
+}
+	set get_status_access [check:access $nick $host $hand $chan $chan1 $user]
+if {$get_status_access == "1"} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
+	return
+}
+	chattr $user -|-qHolSOAMV $chan
+	chattr $user $flags $chan 
+	setuser $user XTRA CHANMODIF($chan) $time:$hand
+	blacktools:tell $nick $host $hand $chan $chan1 add.19 "$show_user [blacktools:getlevelname 7 $hand]"
+} else {
+	adduser $user $uhost
+	set user [check:handle $user $nick $host $hand $chan $chan1]
+	chattr $user -|-qolHSOAMV $chan
+	chattr $user $flags $chan 
+	setuser $user XTRA CHANMODIF($chan) $time:$hand
+	blacktools:tell $nick $host $hand $chan $chan1 add.10 "$show_user $uhost"
+	blacktools:tell $nick $host $hand $chan $chan1 add.19 "$show_user [blacktools:getlevelname 7 $hand]"
+	}
+} elseif {[string equal -nocase $level [blacktools:getlevelname 6 $hand]]} {
+	set flags "-|olV"
+if {[validuser $user]} { 
+	set check_global [check:global $user]
+if {$check_global != "0"} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.isowner "$user $check_global"
+	return
+}	
+	set get_status_access [check:access $nick $host $hand $chan $chan1 $user]
+if {$get_status_access == "1"} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
+	return
+}
+	chattr $user -|-qolSHOAMV $chan	
+	chattr $user $flags $chan
+	setuser $user XTRA CHANMODIF($chan) $time:$hand
+	blacktools:tell $nick $host $hand $chan $chan1 add.19 "$show_user [blacktools:getlevelname 6 $hand]"
+} else {
+	adduser $user $uhost
+	set user [check:handle $user $nick $host $hand $chan $chan1]
+	chattr $user -|-qolSHOAMV $chan
+	chattr $user $flags $chan 
+	setuser $user XTRA CHANMODIF($chan) $time:$hand
+
+	blacktools:tell $nick $host $hand $chan $chan1 add.10 "$show_user $uhost"
+	blacktools:tell $nick $host $hand $chan $chan1 add.19 "$show_user [blacktools:getlevelname 6 $hand]"
+							
+				}
+			} else {
+if {$type == "0"} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr "$cmd"
+	return
+}
+if {$type == "1"} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr_nick "$cmd"
+	return
+			}
+		}
+	}
+}
+
+############################## delacc ################################
+
+proc delacc:process {nick host hand chan chan1 user type} {
+global botnick black
+	set cmd_status [btcmd:status $chan $hand "delacc" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+if {[matchattr $hand q]} { blacktools:tell $nick $host $hand $chan $chan1 gl.glsuspend none
+	return
+}
+if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
+	return
+}
+
+if {$user == ""} {
+	switch $type {
+	0 {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr "delacc"
+	}
+	1 {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr_nick "delacc"
+	}
+	2 {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr_priv "delacc"
+		}
+	}
+	return
+}
+
+if {![validchan $chan]} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr "delacc"
+	return
+}
+
+if {$user != ""} {
+	set show_user $user
+if {[onchan $user $chan] && ![validuser $user]} {
+	set user [nick2hand $user]
+}
+	set get_status_access [check:access $nick $host $hand $chan $chan1 $user]
+
+if {$get_status_access == "1"} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
+	return
+}
+
+if {[matchattr $hand n|- $chan]} {
+if {[matchattr $user mo]} {
+if {[matchattr $user n|- $chan] && [matchattr $hand n|- $chan]} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
+	return
+}
+
+if {[validuser $user]} { 
+if {[matchattr $user m]} {
+	blacktools:tell $nick $host $hand $chan $chan1 delacc.2 $show_user
+} elseif {[matchattr $user o]} {
+	blacktools:tell $nick $host $hand $chan $chan1 delacc.4 $show_user
+}
+		chattr $user -moagjlptxq
+} else { blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none }
+	return
+	}
+} elseif {[matchattr $hand m]} {
+if {[matchattr $user o]} {
+if {[matchattr $user m|- $chan] && [matchattr $hand m|- $chan]} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
+	return
+}
+
+if {[validuser $user]} { 
+	chattr $user -oagjlptxq
+	blacktools:tell $nick $host $hand $chan $chan1 delacc.4 $show_user
+} else { blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none }
+	return
+	}
+}
+	
+if {![matchattr $user -|OAMVH $chan]} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.noaccess none
+	return
+}
+
+if {[validuser $user]} { 
+	chattr $user -|-qolSgaOAMVHf $chan
+	blacktools:tell $nick $host $hand $chan $chan1 delacc.1 $show_user
+			} else { blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none }
+	}
+}
+
+############################## del #####################################
+
+proc del:process {nick host hand chan chan1 args type} {
+global botnick black
+	set cmd_status [btcmd:status $chan $hand "del" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+if {[matchattr $hand q]} { blacktools:tell $nick $host $hand $chan $chan1 gl.glsuspend none
+	return
+}
+if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
+	return
+}
+
+if {$args == ""} {
+	switch $type {
+	0 {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr "del"
+	}
+	1 {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr_nick "del"
+	}
+	2 {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr_priv "del"
+		}
+	}
+	return
+} 
+
+foreach user $args {
+	set show_user $user
+if {$user != ""} {
+if {$host != "prv"} {
+if {[onchan $user $chan] && ![validuser $user]} {
+	set user [nick2hand $user]
+	}
+}
+	set get_status_access [check:access $nick $host $hand $chan $chan1 $user]
+
+if {$get_status_access == "1"} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
+	continue
+}
+
+if {[validuser $user]} { 
+if {[matchattr $hand -|MA $chan]} {
+foreach c [channels] {
+	if {![string equal -nocase $c $chan]} {
+	if {[matchattr $user nmo|HAMOVSo $c]} {
+	blacktools:tell $nick $host $hand $chan $chan1 del.2 $show_user
+	continue
+			}
+		}
+	}
+}
+	deluser $user
+	notes:remove:ondelete $user
+	s:remove:ondelete $user
+	blacktools:tell $nick $host $hand $chan $chan1 del.1 $show_user
+			} else { blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none }
+		}
+	}
+}
+
+
+################################ addhost #############################
+
+proc addhost:process {nick host hand chan chan1 user hosts type} {
+global black botnick
+	set cmd_status [btcmd:status $chan $hand "addhost" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+if {[matchattr $hand q]} { blacktools:tell $nick $host $hand $chan $chan1 gl.glsuspend none
+	return
+}
+if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
+	return
+}
+	set found_it 0
+	set found_user ""
+	set show_user $user
+	set show_hosts $hosts
+if {$user == ""} {
+	switch $type {
+	0 {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr "addhost"
+	}
+	1 {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr_nick "addhost"
+	}
+	2 {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr_priv "addhost"
+		}
+	}
+	return
+}
+
+if {$host != "prv"} {
+if {[onchan $user $chan] && ![validuser $user]} {
+	set user [nick2hand $user]
+	}
+}
+
+	set get_status_access [check:access $nick $host $hand $chan $chan1 $user]
+
+if {$get_status_access == "1"} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
+	return
+}
+
+foreach u [userlist] {
+	set h [getuser $u hosts]
+foreach hs $h {
+if {[string match -nocase [split $hs] $hosts]} {
+	set found_it 1
+	set found_user $u
+		}
+	}
+}
+
+if {[validuser $user]} {
+if {$found_it == "1"} {
+	blacktools:tell $nick $host $hand $chan $chan1 addhost.1 "[split $found_user] $show_hosts"
+	return
+}
+	setuser $user HOSTS $hosts
+	blacktools:tell $nick $host $hand $chan $chan1 addhost.2 "$show_user $show_hosts"
+	} else { blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none }
+}
+
+############################### delhost ############################
+
+proc delhost:process {nick host hand chan chan1 user hosts type} {
+global black botnick
+	set cmd_status [btcmd:status $chan $hand "delhost" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+if {[matchattr $hand q]} { blacktools:tell $nick $host $hand $chan $chan1 gl.glsuspend none
+	return
+}
+if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
+	return
+}
+	set show_user $user
+	set show_hosts $hosts
+if {$user == ""} {
+	switch $type {
+	0 {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr "delhost"
+	}
+	1 {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr_nick "delhost"
+	}
+	2 {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr_priv "delhost"
+		}
+	}
+	return
+}
+
+if {$host != "prv"} {
+if {[onchan $user $chan] && ![validuser $user]} {
+	set user [nick2hand $user]
+	}
+}
+
+	set get_status_access [check:access $nick $host $hand $chan $chan1 $user]
+
+if {$get_status_access == "1"} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
+	return
+}
+
+if {[validuser $user]} {
+	set hhost [getuser $user hosts]
+foreach hhost $hhost {
+if {[string match -nocase [split $hhost] $hosts]} {
+	set foundhost 1
+	}
+}
+
+if {![info exists foundhost]} {
+	blacktools:tell $nick $host $hand $chan $chan1 delhost.1 "$show_user $show_hosts"
+	return
+}
+	delhost $user $hosts
+	blacktools:tell $nick $host $hand $chan $chan1 delhost.2 "$show_user $show_hosts"
+		} else { 
+	blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none
+	}
+}
+
+############################### chuser ############################
+
+proc chuser:process {nick host hand chan chan1 user chandle type} {
+global botnick black
+	set cmd_status [btcmd:status $chan $hand "chuser" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set owner_user $user
+	set owner_chandle $chandle
+	set show_user $user
+	set show_chandle $chandle
+if {[matchattr $hand q]} { blacktools:tell $nick $host $hand $chan $chan1 gl.glsuspend none
+	return
+}
+if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
+	return
+}
+
+if {$user == ""} {
+	switch $type {
+	0 {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr "chuser"
+	}
+	1 {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr_nick "chuser"
+	}
+	2 {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr_priv "chuser"
+		}
+	}
+	return
+}
+
+if {[onchan $user $chan] && ![validuser $user]} {
+	set user [nick2hand $user]
+}
+
+	set get_status_access [check:access $nick $host $hand $chan $chan1 $user]
+
+if {$get_status_access == "1"} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
+	return
+}
+
+if {[matchattr $hand -|M $chan] && ![matchattr $user -|ASOV $chan]} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.noaccess none 
+	return
+}
+
+if {[validuser $chandle]} {
+	blacktools:tell $nick $host $hand $chan $chan1 chuser.3 none
+return
+}
+
+if {[validuser $user]} {
+	chhandle $user $chandle
+	blacktools:tell $nick $host $hand $chan $chan1 chuser.1 "$show_user $show_chandle"
+	} else {blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none }
+}
+
+############################ userlist #############################
+
+proc userlist:execute {hand host level chan chan1 nick type} {
+global black botnick
+	set cmd_status [btcmd:status $chan $hand "userlist" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
+if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
+	set gl 0
+if {[matchattr $hand q]} { blacktools:tell $nick $host $hand $chan $chan1 gl.glsuspend none
+	return
+}
+if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
+	return
+}
+if {$level == ""} {
+	switch $type {
+	0 {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr "userlist"
+	}
+	1 {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr_nick "userlist"
+	}
+	2 {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr_priv "userlist"
+		}
+	}
+	return
+}
+if {[string equal -nocase $level [blacktools:getlevelname 3 $hand]]} {
+    set flags "-|M"
+    set numar [llength [userlist $flags $chan]]
+    set list [userlist $flags $chan]
+foreach user [wordwrap [join $list " "] 250 ,] {
+if {$list == ""} { set user "N/A" }
+	userlist:details $nick $host $hand $chan $chan1 [blacktools:getlevelname 3 $hand] $user $gl
+	}
+} elseif {[string equal -nocase $level [blacktools:getlevelname 4 $hand]]} {
+	set flags "-|A"
+	set numar [llength [userlist $flags $chan]]
+	set list [userlist $flags $chan]
+foreach user [wordwrap [join $list " "] 250 ,] {
+if {$list == ""} { set user "N/A" }
+	userlist:details $nick $host $hand $chan $chan1 [blacktools:getlevelname 4 $hand] $user $gl
+	}
+} elseif {[string equal -nocase $level [blacktools:getlevelname 7 $hand]]} {
+	set flags "-|H"
+	set list [userlist $flags $chan]
+    set numar [llength [userlist $flags $chan]]
+foreach user [wordwrap [join $list " "] 250 ,] {
+if {$list == ""} { set user "N/A" } 
+	userlist:details $nick $host $hand $chan $chan1 [blacktools:getlevelname 7 $hand] $user $gl
+	}
+} elseif {[string equal -nocase $level [blacktools:getlevelname 5 $hand]]} {
+	set flags "-|O"
+    set list [userlist $flags $chan]
+    set numar [llength [userlist $flags $chan]]
+foreach user [wordwrap [join $list " "] 250 ,] {
+if {$list == ""} { set user "N/A" }
+	userlist:details $nick $host $hand $chan $chan1 [blacktools:getlevelname 5 $hand] $user $gl
+	}
+} elseif {[string equal -nocase $level [blacktools:getlevelname 2 $hand]]} {
+if {[matchattr $hand nmo]} {
+	set gl 1
+	set bossflags "n|-"
+	set ownerflags "m|-"
+	set listbossowner [userlist $bossflags]
+	set listowner [userlist $ownerflags]
+foreach user $listbossowner {
+if {[lsearch -exact $listowner $user] > -1} {
+	set pos [lsearch -exact	$listowner $user]
+	set listowner [lreplace $listowner $pos $pos]
+	}
+}
+if {$listowner == ""} { set listowner "N/A" }
+	userlist:details $nick $host $hand $chan $chan1 [blacktools:getlevelname 1 $hand] $listbossowner $gl
+	userlist:details $nick $host $hand $chan $chan1 [blacktools:getlevelname 2 $hand] $listowner $gl
+	}
+} elseif {[string equal -nocase $level [blacktools:getlevelname 8 $hand]]} {
+if {[matchattr $hand nmo]} {
+	set gl 1
+	set bossflags "n|-"
+	set ownerflags "m|-"
+	set masterflags "o|-"
+	set listbossowner [userlist $bossflags]
+	set listowner [userlist $ownerflags]
+	set listmaster [userlist $masterflags]
+foreach user $listbossowner {
+if {[lsearch -exact $listmaster $user] > -1} {
+	set pos [lsearch -exact	$listmaster $user]
+	set listmaster [lreplace $listmaster $pos $pos]
+	}
+}
+foreach user $listowner {
+if {[lsearch -exact $listmaster $user] > -1} {
+	set pos [lsearch -exact	$listmaster $user]
+	set listmaster [lreplace $listmaster $pos $pos]
+	}
+}
+if {$listmaster == ""} { set listmaster "N/A" }
+	userlist:details $nick $host $hand $chan $chan1 [blacktools:getlevelname 8 $hand] $listmaster $gl
+	}
+} elseif {[string equal -nocase $level [blacktools:getlevelname 6 $hand]]} {
+set flags "-|V"
+    set numar [llength [userlist $flags $chan]]
+    set list [userlist $flags $chan]
+foreach user [wordwrap [join $list " "] 250 ,] {
+if {$list == ""} { set user "N/A" }
+	userlist:details $nick $host $hand $chan $chan1 [blacktools:getlevelname 6 $hand] $user $gl
+	}
+} elseif {[string equal -nocase $level "all"]} {
+array set flgc [list]	
+	set flags "-|MHAVO"
+	set list [userlist $flags $chan]
+	set numar [llength [userlist $flags $chan]]
+foreach user $list {
+if {[matchattr $user -|M $chan]} {
+	lappend flgc([blacktools:getlevelname 3 $hand]) $user
+} elseif {[matchattr $user -|A $chan]} { 
+	lappend flgc([blacktools:getlevelname 4 $hand]) $user
+} elseif {[matchattr $user -|O $chan]} {
+	lappend flgc([blacktools:getlevelname 5 $hand]) $user
+} elseif {[matchattr $user -|V $chan]} {
+	lappend flgc([blacktools:getlevelname 6 $hand]) $user
+} elseif {[matchattr $user -|H $chan]} {
+	lappend flgc([blacktools:getlevelname 7 $hand]) $user
+	}
+}
+
+	blacktools:tell $nick $host $hand $chan $chan1 userlist.2 $numar
+foreach flw [array names flgc] {
+	foreach user [wordwrap [join $flgc($flw) " "] 250 ,] {
+	userlist:details $nick $host $hand $chan $chan1 $flw $user $gl
+				}
+			}
+		} else {
+if {$type == "0"} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr "userlist"
+	return
+}
+if {$type == "1"} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr_nick "userlist"
+	return
+		}
+	}		
+}
+
+proc userlist:details {nick host hand chan chan1 access usernames gl} {
+	global black
+if {![info exists onchan]} {
+	set onchan ""
+}
+
+if {![info exists the_usernames]} {
+	set the_usernames ""
+}
+
+foreach user [split $usernames] {
+if {$host != "prv"} {
+	foreach n [chanlist $chan] {
+	set id [nick2hand $n]
+
+if {[string equal -nocase $id $user]} {
+	lappend the_usernames "$user/\002$n\002\[[userlist:check_mode $user $chan]\]"
+	lappend onchan $user
+			}
+		}
+	}
+if {[lsearch -exact [string tolower $onchan] [string tolower $user]] == -1} {
+	lappend the_usernames "$user\[[userlist:check_mode $user $chan]\]"
+	}
+}
+if {$usernames == "-"} {
+	blacktools:tell $nick $host $hand $chan $chan1 userlist.1 "\[\002$access\002\] $usernames"
+	return
+}
+	blacktools:tell $nick $host $hand $chan $chan1 userlist.1 "\[\002$access\002\] [join $the_usernames]"
+}
+
+proc userlist:check_mode {user chan} {
+	global black
+if {[matchattr $user a]} {
+	return "+o all"
+	}
+if {[matchattr $user g]} {
+	return "+v all"
+	}
+if {[matchattr $user -|a $chan]} {
+	return "+o"
+	}
+if {[matchattr $user -|g $chan]} {
+	return "+v"
+	}
+}
+
+############################### info ############################
+
+proc info:process:info_return {nick host hand chan chan1 user} {
+	global black
+	set show_user $user
+	set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
+if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
+	blacktools:tell $nick $host $hand $chan $chan1 info.11 "$show_user"
+if {[matchattr $hand nmo]} {
+foreach c [channels] {
+if {[matchattr $user -|H $c]} { 
+	set fl [blacktools:getlevelname 7 $hand]
+	lappend flg($fl) $c
+} elseif {[matchattr $user -|V $c]} { 
+	set fl [blacktools:getlevelname 6 $hand]
+	lappend flg($fl) $c
+} elseif {[matchattr $user -|O $c]} { 
+	set fl [blacktools:getlevelname 5 $hand]
+	lappend flg($fl) $c
+} elseif {[matchattr $user -|A $c]} {
+	set fl [blacktools:getlevelname 4 $hand]
+	lappend flg($fl) $c
+} elseif {[matchattr $user -|M $c]} {
+	set fl [blacktools:getlevelname 3 $hand]
+	lappend flg($fl) $c 
+	}
+}
+foreach cf [array names flg] {
+lappend exit \002[join $flg($cf) ", "]\002 ($cf)
+	}
+}
+
+if {![info exists exit]} { set exit "N/A"}
+
+	set lastseen [getuser $user LASTON $chan]
+	set hosts [getuser $user hosts]
+
+if {$lastseen == ""} {
+	set lastseen "N/A"
+} else {
+	set lastseen [clock format $lastseen -format %D-%H:%M:%S]
+}
+if {[matchattr $hand mno]} {
+	set laston [getuser $user laston]
+	set lastseen [lindex $laston 0]
+	set lastchan [lindex $laston 1]
+if {$laston == ""} {
+	set lastseen "N/A"
+	set lastchan "N/A"
+} else {
+	set lastseen [clock format $lastseen -format %D-%H:%M:%S]
+}
+	blacktools:tell $nick $host $hand $chan $chan1 info.10 "$lastseen $lastchan"
+} else {
+	blacktools:tell $nick $host $hand $chan $chan1 info.5 $lastseen
+}
+	blacktools:tell $nick $host $hand $chan $chan1 info.6 $hosts
+if {![matchattr $user nmo|- $chan] && [matchattr $hand nmo|- $chan] && ($exit != "N/A")} {
+	blacktools:tell $nick $host $hand $chan $chan1 info.8 "[join $exit]"
+	}
+}
+
+proc info:process:chan {nick host hand chan chan1} {
+	global black botnick
+	set cmd_status [btcmd:status $chan $hand "info" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+if {[matchattr $hand q]} { blacktools:tell $nick $host $hand $chan $chan1 gl.glsuspend none
+	return
+}
+if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
+	return
+}
+if {![validchan $chan]} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.nocmem $chan
+	return
+}
+	set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
+if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
+	set status "OK"
+	set modes [channel get $chan chanmode]
+	set manager [userlist -|M $chan]
+	if {$manager == ""} { set manager "N/A" }
+	set topic [join [topic:return $chan]]
+	set url [setting:get $chan url]
+if {[setting:get $chan jointime] == ""} {
+	set jointime "N/A"
+	set jointime_2 "N/A"
+} else {
+	set jointime [clock format [setting:get $chan jointime] -format %D-%H:%M:%S]
+	set jointime_2 [return_time $getlang [expr [unixtime] - [setting:get $chan jointime]]]
+}
+
+	set joincount [setting:get $chan joincount]
+if {$joincount == ""} {set joincount 0}
+	set nr_user [llength [chanlist $chan]]
+	set nr_ban [llength [blacktools:banlist $chan]]
+	set nr_user_ac 0
+foreach user [chanlist $chan] {
+	set handle [nick2hand $user]
+if {[matchattr $handle -|OgaAHMNV $chan]} {
+	set nr_user_ac [expr $nr_user_ac + 1]
+	}
+}
+	set file [open $black(seen_file) "r"]
+	set database [read -nonewline $file]
+	set data [split $database "\n"]
+	close $file
+	set nr_seen [llength [lsearch -all [string tolower $data] [string tolower "* $chan *"]]]
+
+	blacktools:tell $nick $host $hand $chan $chan1 info.15 "$chan $modes"
+	blacktools:tell $nick $host $hand $chan $chan1 info.16 "$manager"
+
+if {[channel get $chan inactive]} {
+	set found_it 1
+if {[info exists black(abuse:$chan)]} {
+if {$black(abuse:$chan) == "1"} {
+	set text [black:color:set "" $black(say.$getlang.info.29)]
+	set status "$text"
+	} elseif {$black(abuse:$chan) == "3"} {
+	set text [black:color:set "" $black(say.$getlang.info.27)]
+	set status "$text"
+	} elseif {$black(abuse:$chan) == "2"} {
+	set text [black:color:set "" $black(say.$getlang.info.28)]
+	set status "$text"
+	} elseif {$black(abuse:$chan) == "4"} {
+	set text [black:color:set "" $black(say.$getlang.info.26)]
+	set status "$text"
+	} elseif {$black(abuse:$chan) == "5"} {
+	set text [black:color:set "" $black(say.$getlang.info.35)]
+	set status "$text"
+	}
+} else {
+	set text [black:color:set "" $black(say.$getlang.info.22)]
+	set status "$text"
+	}
+}
+if {![info exist found_it]} {
+if {![onchan $botnick $chan]} {
+	set found_it 1
+if {[info exists black(abuse:$chan)]} {
+if {$black(abuse:$chan) == "1"} {
+	set text [black:color:set "" $black(say.$getlang.info.33)]
+	set status "$text"
+	} elseif {$black(abuse:$chan) == "3"} {
+	set text [black:color:set "" $black(say.$getlang.info.31)]
+	set status "$text"
+	} elseif {$black(abuse:$chan) == "2"} {
+	set text [black:color:set "" $black(say.$getlang.info.32)]
+	set status "$text"
+	} elseif {$black(abuse:$chan) == "4"} {
+	set text [black:color:set "" $black(say.$getlang.info.30)]
+	set status "$text"
+	} elseif {$black(abuse:$chan) == "5"} {
+	set text [black:color:set "" $black(say.$getlang.info.34)]
+	set status "$text"
+	} 
+} else {
+	set text [black:color:set "" $black(say.$getlang.info.23)]
+	set status "$text"
+		}
+	}
+}
+
+if {![info exist found_it]} {
+if {![botisop $chan]} {
+	set text [black:color:set "" $black(say.$getlang.info.24)]
+	set status "$text"
+		}
+	}
+if {$status != "OK"} {
+	blacktools:tell $nick $host $hand $chan $chan1 info.19 "$status"
+}
+if {$topic != ""} {
+	blacktools:tell $nick $host $hand $chan $chan1 info.17 "$topic"
+}
+if {$url != ""} {
+	blacktools:tell $nick $host $hand $chan $chan1 info.18 "$url"
+}
+	blacktools:tell $nick $host $hand $chan $chan1 info.20 "$jointime $jointime_2"
+
+	blacktools:tell $nick $host $hand $chan $chan1 info.21 "$joincount $nr_user $nr_user_ac $nr_ban $nr_seen"
+}
+
+proc info:process:host {nick host hand chan chan1 get_host} {
+	global black
+	set users ""
+foreach user [userlist] {
+foreach h [getuser $user hosts] {
+if {[string match -nocase $get_host $h]} {
+	set found_host 1
+	lappend users $user
+		}
+	}	
+}
+	set users [lsort -unique $users]
+	set user_num [llength $users]
+if {![info exists found_host]} {
+	return 0
+}
+if {$user_num == 1} {
+	info:process:info_return $nick $host $hand $chan $chan1 [join $users]
+	return 1
+}
+
+if {$user_num > 1 && $user_num < 11} {
+	blacktools:tell $nick $host $hand $chan $chan1 info.12 "$user_num $users"
+	blacktools:tell $nick $host $hand $chan $chan1 info.14 none
+	return 1
+}
+
+if {$user_num > 10} {
+	blacktools:tell $nick $host $hand $chan $chan1 info.13 "$user_num"
+	return 1
+	}
+}
+
+proc info:process {nick host hand chan chan1 user type} {
+global botnick black
+	set cmd_status [btcmd:status $chan $hand "info" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+if {[matchattr $hand q]} { blacktools:tell $nick $host $hand $chan $chan1 gl.glsuspend none
+	return
+}
+if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
+	return
+}
+	set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
+if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
+	set show_user $user
+	set time [ctime [unixtime]]
+	array set flg [list]
+
+if {$user == ""} {
+switch $type {
+	0 {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr "info"
+	}
+	1 {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr_nick "info"
+	}
+	2 {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr_priv "info"
+		}
+	}
+	return
+}
+
+if {[matchattr $hand nmo] && ($host == "prv") && (![regexp {^[&#]} $chan])} {
+foreach chan [channels] {
+if {[onchan $user $chan]} {
+	set handle [nick2hand $user]
+		}
+	}
+} else {
+if {[onchan $user $chan]} {
+	set handle [nick2hand $user]
+	}
+}
+
+if {[info exists handle]} {
+if {[validuser $handle]} {
+	set user $handle
+	}
+}
+
+if {[regexp {\*} $user]} {
+if {[matchattr $hand nmo]} {
+	set check [info:process:host $nick $host $hand $chan $chan1 $user]
+if {$check == "0"} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.hostnotexist $user
+		}
+	return
+	}
+}
+
+if {![validuser $user]} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none 
+	return
+}
+
+if {(![matchattr $user nmago|OwgaAHSMNV $chan]) && [matchattr $hand mno]} { 
+	info:process:info_return $nick $host $hand $chan $chan1 $user
+	return
+}
+
+if {![matchattr $user nmgao|OwgaAHSMNV $chan]} { 
+	blacktools:tell $nick $host $hand $chan $chan1 gl.noaccess none  
+	return
+}
+
+if {[matchattr $hand nmo|- $chan]} {
+foreach c [channels] {
+if {[matchattr $user -|H $c]} { 
+	set fl [blacktools:getlevelname 7 $hand]
+	lappend flg($fl) $c
+} elseif {[matchattr $user -|V $c]} { 
+	set fl [blacktools:getlevelname 6 $hand]
+	lappend flg($fl) $c
+} elseif {[matchattr $user -|O $c]} { 
+	set fl [blacktools:getlevelname 5 $hand]
+	lappend flg($fl) $c
+} elseif {[matchattr $user -|A $c]} {
+	set fl [blacktools:getlevelname 4 $hand]
+	lappend flg($fl) $c
+} elseif {[matchattr $user -|M $c]} {
+	set fl [blacktools:getlevelname 3 $hand]
+	lappend flg($fl) $c 
+	}
+}
+foreach cf [array names flg] {
+lappend exit \002[join $flg($cf) ", "]\002 ($cf)
+	}
+}
+
+if {![info exists exit]} { set exit "N/A"}
+
+	set cflags [chattr $user | $chan]
+if {[matchattr $user a]} {
+	set automode_gl "OP"
+} elseif {[matchattr $user g]} {
+	set automode_gl "VOICE"
+} else {
+	set automode_gl "N/A"
+}
+
+if {[matchattr $user -|V $chan]} { set flags [blacktools:getlevelname 6 $hand] } elseif {[matchattr $user -|O $chan]} { set flags [blacktools:getlevelname 5 $hand] } elseif {[matchattr $user -|A $chan]} { set flags [blacktools:getlevelname 4 $hand] } elseif {[matchattr $user -|H $chan]} { set flags [blacktools:getlevelname 7 $hand] } else { set flags "\002N/A\002" }
+if {[matchattr $user n|- $chan]} { set flags [blacktools:getlevelname 1 $hand] } elseif {[matchattr $user m|- $chan]} { set flags [blacktools:getlevelname 2 $hand] } elseif {[matchattr $user o|- $chan]} { set flags [blacktools:getlevelname 8 $hand]} elseif {[matchattr $user -|M $chan]} { set flags [blacktools:getlevelname 3 $hand] } elseif {$cflags == "-|-"} { blacktools:tell $nick $host $hand $chan $chan1 info.18 "NONE" } 
+
+if {[matchattr $user -|a $chan]} {
+	set automode "OP"
+} elseif {[matchattr $user -|g $chan]} {
+	set automode "VOICE"
+} else {
+	set automode "N/A"
+}
+
+if {[matchattr $user -|q $chan]} {
+	set suspended 1
+} else {
+	set suspended 0
+}
+	set getflags [getflags $user $chan]
+if {![string equal -nocase $show_user $user]} {
+	blacktools:tell $nick $host $hand $chan $chan1 info.1 "$show_user\[[black:color 1 $hand $user]\] $flags"
+} else {
+	blacktools:tell $nick $host $hand $chan $chan1 info.1 "$show_user $flags"
+}
+	
+if {$automode_gl != "N/A"} {
+if {[matchattr $user mnaog]} {
+if {$getflags != ""} {
+	blacktools:tell $nick $host $hand $chan $chan1 info.25 "* $automode_gl\[all\] $getflags $user"
+	} else {
+	blacktools:tell $nick $host $hand $chan $chan1 info.2 "* $automode_gl\[all\] $user"	
+}
+} else {
+if {$getflags != ""} {
+	blacktools:tell $nick $host $hand $chan $chan1 info.25 "$chan $automode_gl\[all\] $getflags $user"
+	} else {
+	blacktools:tell $nick $host $hand $chan $chan1 info.2 "$chan $automode_gl\[all\] $user"
+	}
+}
+		} else {
+if {[matchattr $user mno]} {
+if {$getflags != ""} {
+	blacktools:tell $nick $host $hand $chan $chan1 info.25 "* $automode $getflags $user"
+	} else {
+	blacktools:tell $nick $host $hand $chan $chan1 info.2 "* $automode $user"
+}
+	} else {
+if {$getflags != ""} {	
+	blacktools:tell $nick $host $hand $chan $chan1 info.25 "$chan $automode $getflags $user"
+	} else {
+	blacktools:tell $nick $host $hand $chan $chan1 info.2 "$chan $automode $user"
+			}
+		}	
+	}
+	set extra "CHANMODIF($chan)"
+	set get_chan $chan
+if {[matchattr $user mno]} {
+	set extra "CHANMODIF(GLOBAL)"
+	set get_chan "GLOBAL"
+}
+	set file [open $black(s_file) "r"]
+	set database [read -nonewline $file]
+	close $file
+	set data [split $database "\n"]
+foreach line $data {
+	set read_chan [lindex [split $line] 0]
+	set read_user [lindex [split $line] 1]
+if {[string equal -nocase $read_chan $get_chan] && [string equal -nocase $read_user $user]} {
+	set read_time [lindex [split $line] 2]
+	
+if {[unixtime] > $read_time} {
+	set read_time [expr [unixtime] - $read_time]
+} else {
+	set read_time [expr $read_time - [unixtime]]
+}
+	set read_time [return_time_2 $getlang $read_time]
+	
+if {$read_time == 0} {
+	continue
+}
+	set split_readtime [split $read_time " "]
+	set days [lindex $split_readtime 0]
+	set the_time [lindex $split_readtime 1]
+	set read_level [lindex [split $line] 4]
+	set read_reason [lrange [split $line] 5 end]
+if {[string equal -nocase $get_chan "GLOBAL"]} {
+	blacktools:tell $nick $host $hand $chan $chan1 info.9 "$read_time $read_level $read_reason"
+			} else {
+	blacktools:tell $nick $host $hand $chan $chan1 info.7 "$read_time $read_level $read_reason"
+			}
+		}
+	}
+
+if {[getuser $user INFO] != ""} {
+	blacktools:tell $nick $host $hand $chan $chan1 info.3 "[getuser $user INFO]"
+}
+	set lastmodify [getuser $user XTRA $extra]
+if {$lastmodify != ""} {
+	set split_last [split $lastmodify ":"]
+	set lastmodif_time [lindex $split_last 0]
+	set lastmodif_time [clock format $lastmodif_time -format %D-%H:%M:%S]
+	set lastmodif_hand [join [lindex [split $split_last] 1]]
+} else {
+	set date [getuser $user XTRA LASTMODIFDATE]
+	set last [getuser $user XTRA LASTMODIFBY]
+	set lastmodif_time $date
+	set lastmodif_hand $last
+}
+
+if {($lastmodif_time == "") && ($lastmodif_hand == "")} {
+	set lastmodif_time "N/A"
+	set lastmodif_hand "N/A"
+}
+
+	set lastseen [getuser $user LASTON $chan]
+	set hosts [getuser $user hosts]
+
+if {$lastseen == ""} {
+	set lastseen "N/A"
+} else {
+	set lastseen [clock format $lastseen -format %D-%H:%M:%S]
+}
+	blacktools:tell $nick $host $hand $chan $chan1 info.4 "$lastmodif_hand $lastmodif_time"
+if {[matchattr $hand mno]} {
+	set laston [getuser $user laston]
+	set lastseen [lindex $laston 0]
+	set lastchan [lindex $laston 1]
+if {$laston == ""} {
+	set lastseen "N/A"
+	set lastchan "N/A"
+} else {
+	set lastseen [clock format $lastseen -format %D-%H:%M:%S]
+}
+	blacktools:tell $nick $host $hand $chan $chan1 info.10 "$lastseen $lastchan"
+} else {
+	blacktools:tell $nick $host $hand $chan $chan1 info.5 $lastseen
+}
+	blacktools:tell $nick $host $hand $chan $chan1 info.6 $hosts
+if {[matchattr $hand nmo|- $chan] || [string equal -nocase $user $hand]} {
+if {[getsettings $user] != ""} {
+	blacktools:tell $nick $host $hand $chan $chan1 info.36 [join [getsettings $user] " ; "]
+	}
+}
+if {![matchattr $user nmo|- $chan] && [matchattr $hand nmo|- $chan] && ($exit != "N/A")} {
+	blacktools:tell $nick $host $hand $chan $chan1 info.8 "[join $exit]"
+	}
+}
+
+proc getsettings {user} {
+	global black
+	set output ""
+	set settings "OUTPUT_LANG OUTPUT_TYPE autoinvite mychan mychar OUTPUT_COLORS"
+foreach setting [string toupper $settings] {
+	set get [getuser $user XTRA $setting]
+if {$get != ""} {
+if {$setting == "OUTPUT_COLORS"} {
+	set setting "COLORS"
+}
+if {$setting == "OUTPUT_TYPE"} {
+	set setting "OUTPUT"
+	switch $get {
+	0 {
+	set get "NOTICE"
+	}
+	1 {
+	set get "CHAN"
+	}
+	2 {
+	set get "MSG"
+			}
+		}
+	}
+if {$setting == "OUTPUT_LANG"} {
+	set setting "LANG"
+	set get [string toupper $get]
+}
+if {$setting == "AUTOINVITE"} {
+	switch $get {
+	1 {
+	set get "ON"
+		}
+	0 {
+	set get "OFF"
+					}
+				}
+			}
+	lappend output "$setting\[[join $get ","]\]"
+		}
+	}
+	return $output
+}
+
+proc getflags {user chan} {
+	global black
+	set flags ""
+if {[matchattr $user -|f $chan]} {	
+	lappend flags "f"
+}
+if {[matchattr $user -|w $chan]} {	
+	lappend flags "w"
+}
+if {[matchattr $user -|P $chan]} {	
+	lappend flags "P"
+}
+	return [join $flags ""]
+}
+
+################################# s ###############################
+
+proc s:process {nick host hand chan chan1 user type suspend_time suspend_reason} {
+global botnick black
+	set cmd_status [btcmd:status $chan $hand "s" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set show_user $user
+	set suspend_time $suspend_time
+	set show_suspend_reason $suspend_reason
+	set flags "-|q"
+	set gl_flags "+q"
+	set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
+if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
+	set unixtime [unixtime]
+if {[matchattr $hand q]} { blacktools:tell $nick $host $hand $chan $chan1 gl.glsuspend none
+	return
+}
+if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
+	return
+}
+if {$user == ""} {
+switch $type {
+	0 {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr "s"
+	}
+	1 {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr_nick "s"
+	}
+	2 {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr_priv "s"
+		}
+	}
+	return
+}
+
+if {![validchan $chan]} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
+	return
+}
+
+if {![validuser $user]} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none
+	return
+}
+
+if {[matchattr $user -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 s.1 $show_user
+	return
+}
+
+if {![matchattr $user nmo|OASMNV $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.noaccess none
+	return
+}
+	set get_status_access [check:access $nick $host $hand $chan $chan1 $user]
+if {$get_status_access == "1"} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
+	return
+}
+if {![regexp {^[0-9]} $suspend_time]} {
+	set suspend_time $black(s:default_time)
+}
+
+if {$suspend_reason == ""} {
+	set suspend_reason $black(say.$getlang.s.3)
+}
+	
+	set get_time [expr [time_return_minute $suspend_time] * 60]
+	set get_time [expr $unixtime + $get_time]
+
+if {[matchattr $hand n] && [matchattr $user m]} {
+	chattr $user $gl_flags
+	setuser $user XTRA CHANMODIF(GLOBAL) $get_time:$hand
+	set current_flags [s:process:getlevel $hand $chan]
+	set s_add [s:process:add $nick $hand "GLOBAL" $chan1 $user $get_time $hand $suspend_reason]
+if {$s_add == "1"} {
+	blacktools:tell $nick $host $hand $chan $chan1 s.5 $show_user
+	}
+	return
+} elseif {[matchattr $hand n] && [matchattr $user o] && ![matchattr $user m]} {
+	chattr $user $gl_flags
+	setuser $user XTRA CHANMODIF(GLOBAL) $get_time:$hand
+	set current_flags [s:process:getlevel $hand $chan]
+	set s_add [s:process:add $nick $hand "GLOBAL" $chan1 $user $get_time $hand $suspend_reason]
+if {$s_add == "1"} {
+	blacktools:tell $nick $host $hand $chan $chan1 s.5 $show_user
+	}
+	return
+} elseif {[matchattr $hand m] && [matchattr $user o] && ![matchattr $user m]} {
+	chattr $user $gl_flags
+	setuser $user XTRA CHANMODIF(GLOBAL) $get_time:$hand
+	set current_flags [s:process:getlevel $hand $chan]
+	set s_add [s:process:add $nick $hand "GLOBAL" $chan1 $user $get_time $hand $suspend_reason]
+if {$s_add == "1"} {
+	blacktools:tell $nick $host $hand $chan $chan1 s.5 $show_user
+	}
+	return
+}
+	chattr $user $flags $chan
+	setuser $user XTRA CHANMODIF($chan) $get_time:$hand
+	set current_flags [s:process:getlevel $hand $chan]
+	set s_add [s:process:add $nick $hand $chan $chan1 $user $get_time $hand $suspend_reason]
+if {$s_add == "1"} {
+	blacktools:tell $nick $host $hand $chan $chan1 s.2 $show_user
+	}
+}
+
+proc s:process:add {nick hand chan chan1 user suspend_time bywho reason} {
+	global black username
+	set current_level [s:process:getlevel $bywho $chan]
+	set not_allowed 0
+	set found_timer 0
+	set found_entry 0
+	set lin 0
+	set file [open $black(s_file) "r"]
+	set database [read -nonewline $file]
+	close $file
+	set data [split $database "\n"]
+foreach line $data {
+	set lin [expr $lin + 1]
+	set get_channel [lindex [split $line] 0]
+	set get_username [lindex [split $line] 1]
+	set get_bywho [lindex [split $line] 3]
+if {[string equal -nocase $get_channel $chan] && [string equal -nocase $get_username $user]} {
+	set found_entry 1
+	set get_level [lindex [split $line] 4]
+	set not_allowed [s:process:allow $get_level $current_level]
+	}
+}
+if {$not_allowed == "0" && $found_entry == 1} {
+	set num [expr $lin - 1]
+	set delete [lreplace $data $num $num]
+	set files [open $black(s_file) "w"]
+	puts $files [join $delete "\n"]
+	close $files
+
+	set file [open $black(s_file) "r"]
+	set data [read -nonewline $file]
+	close $file
+if {$data == ""} {
+	set file [open $black(s_file) "w"]
+	close $file
+	}
+}
+
+if {$not_allowed == "1"} {
+	blacktools:tell $nick "" $hand $chan $chan1 s.4 $user
+	return 0
+} else {
+	set who "$chan $user $suspend_time $bywho $current_level $reason"
+	set file [open $black(s_file) "a"]
+	puts $file $who
+	close $file
+foreach tmr [timers] {
+if {[string match "*s:process:timer*" [join [lindex $tmr 1]]]} {
+	set found_timer 1
+	}	 
+}
+if {$found_timer == "0"} {
+	timer 1 s:process:timer
+}
+	return 1
+	}
+}
+
+proc s:process:getlevel {hand chan} {
+	global black
+if {[matchattr $hand n]} {
+	set current_flags "BOSS-OWNER"
+} elseif {[matchattr $hand m]} {
+	set current_flags "OWNER"
+} elseif {[matchattr $hand o]} { 
+	set current_flags "MASTER" 
+} elseif {[matchattr $hand -|M $chan]} { 
+	set current_flags "MANAGER"
+} elseif {[matchattr $hand -|A $chan]} { 
+	set current_flags "ADMIN"
+	}
+	return $current_flags
+}
+
+proc s:process:allow {get_level current_level} {
+	global black
+if {[string equal -nocase $get_level "BOSS-OWNER"] && [string equal -nocase $current_level "OWNER"]} {
+	return 1			
+				} elseif {[string equal -nocase $get_level "BOSS-OWNER"] && [string equal -nocase $current_level "MANAGER"]} {
+	return 1			
+				} elseif {[string equal -nocase $get_level "BOSS-OWNER"] && [string equal -nocase $current_level "ADMIN"]} {
+	return 1			
+				} elseif {[string equal -nocase $get_level "OWNER"] && [string equal -nocase $current_level "MANAGER"]} {
+	return 1			
+				} elseif {[string equal -nocase $get_level "OWNER"] && [string equal -nocase $current_level "ADMIN"]} {
+	return 1			
+				} elseif {[string equal -nocase $get_level "MANAGER"] && [string equal -nocase $current_level "ADMIN"]} {
+	return 1
+	}
+	return 0
+}
+
+################################## us ################################
+
+proc us:process {nick host hand chan chan1 user type} {
+global botnick black
+set cmd_status [btcmd:status $chan $hand "us" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+if {[matchattr $hand q]} { blacktools:tell $nick $host $hand $chan $chan1 gl.glsuspend none
+	return
+}
+if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
+	return
+}
+	set show_user $user
+	set get_time [unixtime]
+	set flags "-|-q"
+	set gl_flags "-q"
+
+
+if {$user == ""} {
+switch $type {
+	0 {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr "us"
+	}
+	1 {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr_nick "us"
+	}
+	2 {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr_priv "us"
+		}
+	}
+	return
+}
+
+if {![validchan $chan]} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
+	return
+}
+
+if {![validuser $user]} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none
+	return
+}
+if {![matchattr $user nmo|OASMNV $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.noaccess none
+	return
+}
+if {![matchattr $user q|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 us.1 $show_user
+	return
+}
+	set get_status_access [check:access $nick $host $hand $chan $chan1 $user]
+
+if {$get_status_access == "1"} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
+	return
+}
+
+if {[matchattr $hand n] && [matchattr $user m]} {
+	setuser $user XTRA CHANMODIF(GLOBAL) $get_time:$hand
+	set type2 "1"
+	set inf [us:process:remove $chan $user $type2]
+} elseif {[matchattr $hand n] && [matchattr $user o] && ![matchattr $user m]} {
+	setuser $user XTRA CHANMODIF(GLOBAL) $get_time:$hand
+	set type2 "1"
+	set inf [us:process:remove $chan $user $type2]
+}  elseif {[matchattr $hand m] && [matchattr $user o] && ![matchattr $user m]} {
+	setuser $user XTRA CHANMODIF(GLOBAL) $get_time:$hand
+	set type2 "1"
+	set inf [us:process:remove $chan $user $type2]
+
+} else {
+	set type2 "0"
+	set inf [us:process:remove $chan $user $type]
+	setuser $user XTRA CHANMODIF($chan) $get_time:$hand
+}
+if {$inf == "1"} {
+if {$type2 == "1"} {
+	blacktools:tell $nick $host $hand $chan $chan1 us.3 $show_user
+		} else {
+	blacktools:tell $nick $host $hand $chan $chan1 us.2 $show_user
+		}	
+	}
+}
+
+proc us:process:remove {chan user type} {
+	global black
+	set flags "-|-q"
+	set gl_flags "-q"
+	set get_user [string map [list \[ {\[} \] {\]} \? {\?} \\ {\\}] $user]
+	set file [open $black(s_file) "r"]
+	set database [read -nonewline $file]
+	close $file
+	set data [split $database "\n"]
+if {$type == "1"} {
+	set i [lsearch -glob -nocase $data "* $get_user *"]
+} else {
+	set i [lsearch -glob -nocase $data "$chan $get_user *"]
+}
+if {$i > -1} {
+	set line [lindex $data $i]
+	set suspend_chan [lindex [split $line] 0]
+	set suspend_user [lindex [split $line] 1]
+if {[string equal -nocase $suspend_chan "GLOBAL"]} {
+if {$suspend_user != "" && $suspend_chan != ""} {
+	chattr $suspend_user $gl_flags
+}
+} else {
+if {$suspend_user != "" && $suspend_chan != ""} {
+	chattr $suspend_user $flags $suspend_chan
+			}
+		}
+	set delete [lreplace $data $i $i]
+	set file [open $black(s_file) "w"] 
+	puts $file [join $delete "\n"]
+	close $file
+	
+	set file [open $black(s_file) "r"]
+	set data [read -nonewline $file]
+	close $file
+if {$data == ""} {
+	set file [open $black(s_file) "w"]
+	close $file
+		}
+	return 1
+	}
+return 0
+}
+
+############################# auto #################################
+
+proc auto:join {nick host hand chan} {
+	global black
+if {[matchattr $hand a|a $chan]} {
+if {[matchattr $hand q|q $chan]} {
+	return
+}
+	pushmode $chan +o $nick
+}	
+
+if {[matchattr $hand g|g $chan]} {
+if {[matchattr $hand q|q $chan]} {
+	return
+}
+	pushmode $chan +v $nick
+	}	
+}
+
+proc auto:process {nick host hand chan chan1 user option global type} {
+	global black
+	set cmd_status [btcmd:status $chan $hand "auto" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+if {[matchattr $hand q]} { blacktools:tell $nick $host $hand $chan $chan1 gl.glsuspend none
+	return
+}
+if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
+	return
+}
+	set show_user $user
+if {[onchan $user $chan] && ![validuser $user]} {
+	set user [nick2hand $user]
+	
+}	
+
+if {$user == "" || ![regexp {^[+ -]} $option]} {
+switch $type {
+	0 {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr "auto"
+	}
+	1 {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr_nick "auto"
+	}
+	2 {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr_priv "auto"
+		}
+	}
+	return 0
+}
+
+set verify [string trim $option {"+","-"}]
+
+if {[string equal -nocase $verify "o"] || [string equal -nocase $verify "v"]} {
+if {[onchan $user $chan] && ![validuser $user]} {
+	set user [nick2hand $user]
+}
+
+if {![validuser $user]} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none	
+	return	
+}
+
+	set get_status_access [check:access $nick $host $hand $chan $chan1 $user]
+if {$get_status_access == "1"} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
+	return
+	}
+}
+
+if {[string equal -nocase "$global" "global"] && [matchattr $hand nm]} {
+
+if {[string equal -nocase $option "+o"]} {
+if {[matchattr $user g]} {
+	chattr $user -g
+}
+	chattr $user +a
+	blacktools:tell $nick $host $hand $chan $chan1 auto.12 $show_user
+}
+
+if {[string equal -nocase $option "-o"]} {
+	chattr $user -a
+	blacktools:tell $nick $host $hand $chan $chan1 auto.20 $show_user
+}
+
+if {[string equal -nocase $option "+v"]} {
+if {[matchattr $user a]} {
+	chattr $user -a
+}
+	chattr $user +g
+	blacktools:tell $nick $host $hand $chan $chan1 auto.13 $show_user
+}
+
+if {[string equal -nocase $option "-v"]} {
+	chattr $user -g
+	blacktools:tell $nick $host $hand $chan $chan1 auto.21 $show_user
+}
+	return
+}
+
+if {![matchattr $user -|MAOV $chan]} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.noaccess none
+	return
+}
+
+if {[string equal -nocase $option "+o"]} {
+if {[matchattr $user -|g $chan]} {
+	chattr $user -|-g $chan
+}
+	chattr $user -|a $chan
+	blacktools:tell $nick $host $hand $chan $chan1 auto.10 $show_user
+}
+
+if {[string equal -nocase $option "-o"]} {
+	chattr $user -|-a $chan
+	blacktools:tell $nick $host $hand $chan $chan1 auto.18 $show_user
+}
+
+if {[string equal -nocase $option "+v"]} {
+if {[matchattr $user -|a $chan]} {
+	chattr $user -|-a $chan
+}
+	chattr $user -|g $chan
+	blacktools:tell $nick $host $hand $chan $chan1 auto.11 $show_user
+}
+
+if {[string equal -nocase $option "-v"]} {
+	chattr $user -|-g $chan
+	blacktools:tell $nick $host $hand $chan $chan1 auto.19 $show_user
+	}
+}
+
+##############
+#########################################################################
+##   END                                                               ##
+#########################################################################

+ 2061 - 0
BlackTools2.5.1/BlackTools/Commands/BT.ChanCmds.tcl

@@ -0,0 +1,2061 @@
+#########################################################################
+##          BlackTools - The Ultimate Channel Control Script           ##
+##                    One TCL. One smart Eggdrop                       ##
+#########################################################################
+##########################   CHAN CMDS TCL   ############################
+#########################################################################
+##						                       ##
+##     BlackTools  : http://blacktools.tclscripts.net	               ##
+##     Bugs report : http://www.tclscripts.net/	                       ##
+##     Online Help : irc://irc.undernet.org/tcl-help 	               ##
+##                   #TCL-HELP / UnderNet                              ##
+##                   You can ask in english or romanian                ##
+##					                               ##
+#########################################################################
+
+proc comand:chan {nick host hand chan arg} {
+global botnick wordsdir sdir black seendir count server uptime {server-online} version lastbind
+	set cmd_chan [lindex [split $arg] 0]
+if {[isbotnick $nick]} { return }
+
+	set split_cmd [split $cmd_chan ""]
+	set char [lindex $split_cmd 0]
+	set cmd [join [lrange $split_cmd 1 end] ""]
+	set return [blacktools:mychar $char $hand]
+if {$return == "0"} {
+		return
+}
+switch -exact -- [string tolower $cmd] {
+
+report {
+	set type 0
+	set w [lindex [split $arg] 1]
+	set message [join [lrange [split $arg] 2 end]]
+	set chan1 $chan
+if {[regexp {^[&#]} $w]} {
+	set chan $w
+	set w [lindex [split $arg] 2]
+	set message [join [lrange [split $arg] 3 end]]
+}
+if {[matchattr $hand mno|MAO $chan]} {
+	return
+}
+	report:process $nick $char $hand $chan $chan1 $type $w $message
+}
+
+anunt {
+if {[matchattr $hand nmo|M $chan]} {
+	set type 0
+	set chan1 "$chan"
+	set who [lindex [split $arg] 1]
+	set message [join [lrange [split $arg] 2 end]]
+	set number [lindex [split $arg] 2]
+if {[regexp {^[&#]} $who] && [matchattr $hand nmo|M $who]} {
+	set chan $who
+	set who [lindex [split $arg] 2]
+	set message [join [lrange [split $arg] 3 end]]
+	set number [lindex [split $arg] 3]
+		}
+	anunt:process $nick $char $hand $chan $chan1 $who $message $number $type
+	}
+}
+
+link {
+if {[matchattr $hand nm]} {
+	set type 0
+	set channels [join [lrange [split $arg] 1 end]]
+	set what [lindex [split $arg] 1]
+	set delchan [lindex [split $arg] 2]
+	set chan1 $chan
+	link:process $nick $char $hand $chan $chan1 $type $what $channels $delchan
+	}
+}
+
+note {
+if {[matchattr $hand nmo|MAOV $chan]} {
+	set who [lindex [split $arg] 1]
+	set note [join [lrange [split $arg] 1 end]]
+	set number [lindex [split $arg] 2]
+	set user_send [lindex [split $arg] 2]
+	set note_send [join [lrange [split $arg] 3 end]]
+	set type 0
+	set chan1 $chan
+	note:process $nick $char $hand $chan $chan1 $who $note $user_send $note_send $number $type
+	}
+}
+
+q {
+if {[matchattr $hand nmo|MAOV $chan]} {
+	set otherchan 0
+	set who [lindex [split $arg] 1]
+	set next [lindex [split $arg] 2]
+	set quote [join [lrange [split $arg] 1 end]]
+if {$who == "*"} {
+	set who [lindex [split $arg] 2]
+	set quote [join [lrange [split $arg] 1 end]]
+}
+if {[regexp {^[\[]} $who]} {
+	set who [lindex [split $arg] 2]
+	set quote [join [lrange [split $arg] 1 end]]
+if {$who == "*"} {
+	set who [lindex [split $arg] 3]
+	set quote [join [lrange [split $arg] 1 end]]
+	}
+}
+	set type 0
+	set chan1 $chan
+if {[regexp {^[&#]} $who] && [matchattr $hand nmo|AOMV $who]} {
+	set otherchan 1
+	set chan "$who"
+	set who [lindex [split $arg] 2]
+	set next [lindex [split $arg] 3]
+	set quote [join [lrange [split $arg] 2 end]]
+if {$who == "*"} {
+	set who [lindex [split $arg] 3]
+	set quote [join [lrange [split $arg] 2 end]]
+}
+if {[regexp {^[\[]} $who]} {
+	set who [lindex [split $arg] 3]
+	set quote [join [lrange [split $arg] 2 end]]
+if {$who == "*"} {
+	set who [lindex [split $arg] 4]
+	set quote [join [lrange [split $arg] 2 end]]
+		}
+	}
+}
+if {$otherchan == "1"} {
+	quote:process $nick "$char:chan" $hand $chan $chan1 $type $who $quote [lrange [split $arg] 2 end] $next
+	} else {
+	quote:process $nick "$char:chan" $hand $chan $chan1 $type $who $quote [lrange [split $arg] 1 end] $next
+		}
+	}
+}
+
+enable {
+if {[matchattr $hand nmo|M $chan]} {
+	set what [lindex [split $arg] 1]
+	set user [lindex [split $arg] 2]
+	set chan1 "$chan"
+	set type 0
+if {[regexp {^[&#]} $what] && [matchattr $hand nmo|M $what]} {
+	set chan "$what"
+	set what [lindex [split $arg] 2]
+	set user [lindex [split $arg] 3]
+}
+	enable:process $nick $char $hand $chan $chan1 $type $what $user
+	}
+}
+
+disable {
+if {[matchattr $hand nmo|M $chan]} {
+	set what [lindex [split $arg] 1]
+	set user [lindex [split $arg] 2]
+	set chan1 "$chan"
+	set type 0
+if {[regexp {^[&#]} $what] && [matchattr $hand nmo|M $what]} {
+	set chan "$what"
+	set what [lindex [split $arg] 2]
+	set user [lindex [split $arg] 3]
+}
+	disable:process $nick $char $hand $chan $chan1 $type $what $user
+	}
+}
+
+securemode {
+if {[matchattr $hand nmo|M $chan]} {
+	set type 0
+	set chan1 "$chan"
+	set why [lindex [split $arg] 1]
+	set except [join [lrange [split $arg] 2 end]]
+	set number [lindex [split $arg] 2]
+if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
+	set chan "$why"
+	set why [lindex [split $arg] 2]
+	set except [join [lrange [split $arg] 3 end]]
+	set number [lindex [split $arg] 3]
+}
+	prot:module:process $nick $char $hand $chan $chan1 $why $except $type $number "securemode"
+	}
+}
+
+cp {
+if {[matchattr $hand nm]} {
+	set type 0
+	set chan1 $chan
+	set what [lindex [split $arg] 1]
+	set from [lindex [split $arg] 2]
+	set to [lindex [split $arg] 3]
+	cp:process $nick $char $hand $chan $chan1 $type $what $from $to
+	}
+}
+
+banstats {
+if {[matchattr $hand nmo|AOM $chan]} {
+	set next [lindex [split $arg] 1]
+	set cmd ""
+	set type 0
+	set chan1 "$chan"
+if {[string equal -nocase $next "reset"]} {
+	set cmd "reset"
+}
+if {[string equal -nocase $next "total"]} {
+	set next [lindex [split $arg] 2]
+	set cmd "total"
+}
+if {[regexp {^[&#]} $next] && [matchattr $hand nmo|MAO $next]} {
+	set chan $next
+	set next [lindex [split $arg] 2]
+if {[string equal -nocase $next "reset"]} {
+	set cmd "reset"
+}
+if {[string equal -nocase $next "total"]} {
+	set next [lindex [split $arg] 3]
+	set cmd "total"
+	}
+}
+	banstats:process $nick $char $hand $chan $chan1 $cmd $type $next
+	}
+}
+
+troll {
+if {[matchattr $hand nmo|AOM $chan]} {
+	set tr [lindex [split $arg] 1]
+	set chan1 "$chan"
+	set type 0
+if {[regexp {^[&#]} $tr] && [matchattr $hand nmo|MAO $tr]} {
+	set chan "$tr"
+	set tr [lindex [split $arg] 2]
+}
+	userhost:act $tr $nick $hand $char $chan $chan1 $type "1440" "troll" "" "0"
+	}
+}
+
+guestnick {
+if {[matchattr $hand nmo|M $chan]} {
+	set who [lindex [split $arg] 1]
+	set modul "guestnick"
+	set type 0
+	set chan1 $chan
+	set gnick [join [lrange [split $arg] 2 end]]
+	set number [lindex [split $arg] 2]
+if {[regexp {^[&#]} $who] && [matchattr $hand nmo|M $who]} {
+	set who [lindex [split $arg] 2]
+	set gnick [join [lrange [split $arg] 3 end]]
+	set number [lindex [split $arg] 3]
+		}
+	guestnick:process $nick $char $hand $chan $chan1 $who $gnick $type $number $modul
+	}
+}
+
+badhost {
+if {[matchattr $hand nmo|M $chan]} {
+	set type 0
+	set chan1 "$chan"
+	set why [lindex [split $arg] 1]
+	set badh [join [lrange [split $arg] 2 end]]
+	set number [lindex [split $arg] 2]
+if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
+	set chan "$why"
+	set why [lindex [split $arg] 2]
+	set badh [join [lrange [split $arg] 3 end]]
+	set number [lindex [split $arg] 3]
+}
+	prot:module:process $nick $char $hand $chan $chan1 $why $badh $type $number "badhost"
+	}
+}
+
+badrealname {
+if {[matchattr $hand nmo|M $chan]} {
+	set type 0
+	set chan1 "$chan"
+	set why [lindex [split $arg] 1]
+	set badf [join [lrange [split $arg] 2 end]]
+	set number [lindex [split $arg] 2]
+if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
+	set chan "$why"
+	set why [lindex [split $arg] 2]
+	set badf [join [lrange [split $arg] 3 end]]
+	set number [lindex [split $arg] 3]
+}
+	prot:module:process $nick $char $hand $chan $chan1 $why $badf $type $number "badrealname"
+	}
+}
+
+badquitpart {
+if {[matchattr $hand nmo|M $chan]} {
+	set type 0
+	set chan1 "$chan"
+	set why [lindex [split $arg] 1]
+	set badq [join [lrange [split $arg] 2 end]]
+	set number [lindex [split $arg] 2]
+if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
+	set chan "$why"
+	set why [lindex [split $arg] 2]
+	set badq [join [lrange [split $arg] 3 end]]
+	set number [lindex [split $arg] 3]
+}
+	prot:module:process $nick $char $hand $chan $chan1 $why $badq $type $number "badquitpart"
+	}
+}
+
+
+badident {
+if {[matchattr $hand nmo|M $chan]} {
+	set type 0
+	set chan1 "$chan"
+	set why [lindex [split $arg] 1]
+	set badi [join [lrange [split $arg] 2 end]]
+	set number [lindex [split $arg] 2]
+if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
+	set chan "$why"
+	set why [lindex [split $arg] 2]
+	set badi [join [lrange [split $arg] 3 end]]
+	set number [lindex [split $arg] 3]
+}
+	prot:module:process $nick $char $hand $chan $chan1 $why $badi $type $number "badident"
+	}
+}
+
+
+badnick {
+if {[matchattr $hand nmo|M $chan]} {
+	set type 0
+	set chan1 "$chan"
+	set why [lindex [split $arg] 1]
+	set badn [join [lrange [split $arg] 2 end]]
+	set number [lindex [split $arg] 2]
+if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
+	set chan "$why"
+	set why [lindex [split $arg] 2]
+	set badn [join [lrange [split $arg] 3 end]]
+	set number [lindex [split $arg] 3]
+}
+	prot:module:process $nick $char $hand $chan $chan1 $why $badn $type $number "badnick"
+	}
+}
+
+
+badword {
+if {[matchattr $hand nmo|M $chan]} {
+	set type 0
+	set chan1 "$chan"
+	set why [lindex [split $arg] 1]
+	set badw [join [lrange [split $arg] 2 end]]
+	set number [lindex [split $arg] 2]
+if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
+	set chan "$why"
+	set why [lindex [split $arg] 2]
+	set badw [join [lrange [split $arg] 3 end]]
+	set number [lindex [split $arg] 3]
+}
+	prot:module:process $nick $char $hand $chan $chan1 $why $badw $type $number "badword"
+	}
+}
+
+
+unset {
+if {[matchattr $hand nmo|M $chan]} {
+	set setting [lindex [split $arg] 1]
+	set chan1 $chan
+	set type 0
+if {[regexp {^[&#]} $setting] && [matchattr $hand nmo|M $setting]} {
+	set chan $setting
+	set setting [lindex [split $arg] 2]
+	}
+if {[string equal -nocase $setting "global"] && [matchattr $hand nm]} {
+	set setting [lindex [split $arg] 2]
+foreach c [channels] {
+	unset:process $nick $char $hand $c $chan1 $setting $type
+			}
+		return
+	}
+	unset:process $nick $char $hand $chan $chan1 $setting $type
+	}
+}
+
+greet {
+if {[matchattr $hand nmo|M $chan]} {
+	set who [lindex [split $arg] 1]
+	set modul "greet"
+	set type 0
+	set chan1 $chan
+	set greet [join [lrange [split $arg] 2 end]]
+if {[regexp {^[&#]} $who] && [matchattr $hand nmo|M $who]} {
+	set chan $who
+	set who [lindex [split $arg] 2]
+	set greet [join [lrange [split $arg] 3 end]]
+	}
+	othermodule:process $nick $char $hand $chan $chan1 $who $greet $type $modul	
+	}
+}
+
+leave {
+if {[matchattr $hand nmo|M $chan]} {
+	set who [lindex [split $arg] 1]
+	set modul "leave"
+	set type 0
+	set chan1 $chan
+	set leave [join [lrange [split $arg] 2 end]]
+if {[regexp {^[&#]} $who] && [matchattr $hand nmo|M $who]} {
+	set chan $who
+	set who [lindex [split $arg] 2]
+	set leave [join [lrange [split $arg] 3 end]]
+	}
+	othermodule:process $nick $char $hand $chan $chan1 $who $leave $type $modul		
+	}
+}
+
+topic {
+if {[matchattr $hand nmo|M $chan]} {
+	set who [lindex [split $arg] 1]
+	set modul "topic"
+	set type 0
+	set chan1 $chan
+	set topic [join [lrange [split $arg] 2 end]]
+if {[regexp {^[&#]} $who] && [matchattr $hand nmo|M $who]} {
+	set chan $who
+	set who [lindex [split $arg] 2]
+	set topic [join [lrange [split $arg] 3 end]]
+}
+	othermodule:process $nick $char $hand $chan $chan1 $who $topic $type $modul	
+	}
+}
+
+vr {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set vr [lindex [split $arg] 1]
+	set chan1 "$chan"
+	set type 0
+if {[regexp {^[&#]} $vr] && [matchattr $hand nmo|MAO $vr]} {
+	set chan "$vr"
+	set vr [lindex [split $arg] 2]
+}
+foreach c [channels] {
+	set backchan [join [setting:get $c backchan]]
+if {[string match -nocase $chan $backchan]} {
+	set chan "$c"
+	}
+}
+	userhost:act $vr $nick $hand $char $chan $chan1 $type $black(vr:bantime) "vr" "" "0"
+	}
+}
+
+dr {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set drone [lindex [split $arg] 1]
+	set type 0
+	set chan1 "$chan"
+if {[regexp {^[&#]} $drone] && [matchattr $hand nmo|OMA $drone]} {
+	set chan "$drone"
+	set drone [lindex [split $arg] 2]
+}
+foreach c [channels] {
+	set backchan [join [setting:get $c backchan]]
+if {[string match -nocase $chan $backchan]} {
+	set chan "$c"
+	}
+}
+	userhost:act $drone $nick $hand $char $chan $chan1 $type $black(dr:bantime) "dr" "" "0"
+	}
+}
+
+bot {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set bot [lindex [split $arg] 1]
+	set type 0
+	set chan1 "$chan"
+if {[regexp {^[&#]} $bot] && [matchattr $hand nmo|OMA $bot]} {
+	set chan "$bot"
+	set bot [lindex [split $arg] 2]
+}
+foreach c [channels] {
+	set backchan [join [setting:get $c backchan]]
+if {[string match -nocase $chan $backchan]} {
+	set chan "$c"
+	}
+}
+	userhost:act $bot $nick "$hand:bot" $char $chan $chan1 $type $black(bot:bantime) "bot" "" "0"
+	}
+}
+
+n {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set badnick [lindex [split $arg] 1]
+	set type 0
+	set chan1 "$chan"
+if {[regexp {^[&#]} $badnick] && [matchattr $hand nmo|MAO $badnick]} {
+	set chan "$badnick"
+	set badnick [lindex [split $arg] 2]
+}
+if {[setting:get $chan nextshortcmd]} {
+	nextpublic:process $nick $char $hand $chan $chan1 $badnick
+	return
+}
+if {[regexp {\*} $badnick]} {
+	blacktools:tell $nick $char $hand $chan $chan1 gl.instr "n"
+	return
+}
+if {$badnick == ""} {
+	blacktools:tell $nick $char $hand $chan $chan1 gl.instr "n"
+	return
+}
+foreach c [channels] {
+	set backchan [join [setting:get $c backchan]]
+if {[string match -nocase $chan $backchan]} {
+	set chan "$c"
+	}
+}
+	bancmds:process $badnick $badnick $nick $hand $char $chan $chan1 $type $black(n:bantime) "n" "" "0"
+	}
+}
+
+id {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set badident [lindex [split $arg] 1]
+	set handle [nick2hand $badident]
+	set type 0
+	set chan1 "$chan"
+if {[regexp {^[&#]} $badident] && [matchattr $hand nmo|OMA $badident]} {
+	set chan "$badident"
+	set badident [lindex [split $arg] 2]
+}
+foreach c [channels] {
+	set backchan [join [setting:get $c backchan]]
+if {[string match -nocase $chan $backchan]} {
+	set chan "$c"
+	}
+}
+	userhost:act $badident $nick $hand $char $chan $chan1 $type $black(id:bantime) "id" "" "0"
+	}
+}
+
+spam {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set spammer [lindex [split $arg] 1]
+	set type 0
+	set chan1 "$chan"
+if {[regexp {^[&#]} $spammer] && [matchattr $hand nmo|OMA $spammer]} {
+	set chan "$spammer"
+	set spammer [lindex [split $arg] 2]
+}
+foreach c [channels] {
+	set backchan [join [setting:get $c backchan]]
+if {[string match -nocase $chan $backchan]} {
+	set chan "$c"
+	}
+}
+	userhost:act $spammer $nick $hand $char $chan $chan1 $type $black(spam:bantime) "spam" "" "0"
+	}
+}
+
+bw {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set badw [lindex [split $arg] 1]
+	set type 0
+	set chan1 "$chan"
+if {[regexp {^[&#]} $badw] && [matchattr $hand nmo|OMA $badw]} {
+	set chan "$badw"
+	set badw [lindex [split $arg] 2]
+}
+foreach c [channels] {
+	set backchan [join [setting:get $c backchan]]
+if {[string match -nocase $chan $backchan]} {
+	set chan "$c"
+	}
+}
+	userhost:act $badw $nick $hand $char $chan $chan1 $type $black(bw:bantime) "bw" "" "0"
+	}
+}
+
+mb {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set badd [lindex [split $arg] 1]
+	set reason [join [lrange [split $arg] 2 end]]
+	set type 0
+	set chan1 "$chan"
+if {[regexp {^[&#]} $badd] && [matchattr $hand nmo|OMA $badw]} {
+	set chan "$badd"
+	set badd [lindex [split $arg] 2]
+	set reason [join [lrange [split $arg] 3 end]]
+}
+foreach c [channels] {
+	set backchan [join [setting:get $c backchan]]
+if {[string match -nocase $chan $backchan]} {
+	set chan "$c"
+	}
+}
+	userhost:act $badd $nick $hand $char $chan $chan1 $type $black(mb:bantime) "mb" $reason "0"
+	}
+}
+
+
+black {
+if {[matchattr $hand nmo|MA $chan]} {
+	set blackb [lindex [split $arg] 1]
+	set reason [join [lrange [split $arg] 2 end]]
+	set type 0
+	set chan1 "$chan"
+if {[regexp {^[&#]} $blackb] && [matchattr $hand nmo|MA $blackb]} {
+	set chan "$blackb"
+	set blackb [lindex [split $arg] 2]
+	set reason [join [lrange [split $arg] 3 end]]
+}
+foreach c [channels] {
+	set backchan [join [setting:get $c backchan]]
+if {[string match -nocase $chan $backchan]} {
+	set chan "$c"
+	}
+}
+	userhost:act $blackb $nick $hand $char $chan $chan1 $type "0" "black" $reason "0"
+	}
+}
+
+bl {
+if {[matchattr $hand nmo|MA $chan]} {
+	set blackb [lindex [split $arg] 1]
+	set reason [join [lrange [split $arg] 2 end]]
+	set type 0
+	set chan1 "$chan"
+if {[regexp {^[&#]} $blackb] && [matchattr $hand nmo|MA $blackb]} {
+	set chan "$blackb"
+	set blackb [lindex [split $arg] 2]
+	set reason [join [lrange [split $arg] 3 end]]
+}
+foreach c [channels] {
+	set backchan [join [setting:get $c backchan]]
+if {[string match -nocase $chan $backchan]} {
+	set chan "$c"
+	}
+}
+	userhost:act $blackb $nick $hand $char $chan $chan1 $type "0" "black" $reason "0"
+	}
+}
+
+b {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set no_time 0
+	set type 0
+	set gl 0
+	set link 0
+	set chan1 "$chan"
+	set level ""
+	set b [lindex [split $arg] 1]
+if {[setting:get $chan nextshortcmd]} {
+	noidlepublic:process $nick $char $hand $chan $chan1 $b 0
+	return
+}
+	set tm [lindex [split $arg] 2]
+	set global [lindex [split $arg] 3]
+	set reason [join [lrange [split $arg] 4 end]]
+	set return_time [time_return_minute $tm]
+if {$return_time == "-1"} {
+	set global [lindex [split $arg] 2]
+	set reason [join [lrange [split $arg] 3 end]]
+}
+if {[regexp {^[&#]} $b] && [matchattr $hand nmo|MAO $b]} {
+	set chan $b
+	set b [lindex [split $arg] 2]
+	set tm [lindex [split $arg] 3]
+	set global [lindex [split $arg] 4]
+	set reason [join [lrange [split $arg] 5 end]]
+	set return_time [time_return_minute $tm]
+if {$return_time == "-1"} {
+	set global [lindex [split $arg] 3]
+	set reason [join [lrange [split $arg] 4 end]]
+}
+if {[regexp {^[-]} $tm]} {
+	set level [blacktools:check:levelban $hand $chan $tm]
+	set reason [join [lrange [split $arg] 5 end]]
+	set tm [lindex [split $arg] 4]
+	set return_time [time_return_minute $tm]
+if {$return_time == "-1"} {
+	set tm [lindex [split $arg] 3]
+	set reason [join [lrange [split $arg] 4 end]]
+		} 
+} elseif {[string equal -nocase "$global" "global"] && [matchattr $hand nm]} {
+	set gl 1
+	set tm [lindex [split $arg] 3]
+	set reason [join [lrange [split $arg] 5 end]]
+	set return_time [time_return_minute $tm]
+if {$return_time == "-1"} {
+	set reason [join [lrange [split $arg] 4 end]]
+			} 
+	} else {
+if {$return_time == "-1"} {
+	set reason [join [lrange [split $arg] 3 end]]
+	} else {
+	set reason [join [lrange [split $arg] 4 end]]
+		}
+	}
+} else {
+if {[regexp {^[-]} $tm]} {
+	set levelban 1
+	set level [blacktools:check:levelban $hand $chan $tm]
+	set reason [join [lrange [split $arg] 4 end]]
+	set tm [lindex [split $arg] 3]
+	set return_time [time_return_minute $tm]
+if {$return_time == "-1"} {
+	set tm [lindex [split $arg] 2]
+	set reason [join [lrange [split $arg] 3 end]]
+		} 
+} elseif {[string equal -nocase "$global" "global"] && [matchattr $hand nm]} {
+	set gl 1
+	set tm [lindex [split $arg] 2]
+	set reason [join [lrange [split $arg] 4 end]]
+	set return_time [time_return_minute $tm]
+if {$return_time == "-1"} {
+	set reason [join [lrange [split $arg] 3 end]]
+			} 
+	} elseif {[string equal -nocase "$global" "link"] && [matchattr $hand nm]} {
+	set link 1
+	set tm [lindex [split $arg] 2]
+	set reason [join [lrange [split $arg] 4 end]]
+	set return_time [time_return_minute $tm]
+if {$return_time == "-1"} {
+	set reason [join [lrange [split $arg] 3 end]]
+			} 
+	} else {
+if {$return_time == "-1"} {
+	set reason [join [lrange [split $arg] 2 end]]
+	} else {
+	set reason [join [lrange [split $arg] 3 end]]
+		}
+	}
+}
+if {($return_time > "20160" || $return_time == "0")  && [matchattr $hand -|OS $chan]} {
+	blacktools:tell $nick $char $hand $chan $chan1 b.6 none
+	return
+}
+if {$return_time == "-1"} {
+	set return_time $black(b:bantime)
+}
+if {[llength $level] > "1"} {
+	blacktools:tell $nick $char $hand $chan $chan1 gl.invalidlevel [string map {"0" ""} $level]
+	return
+}
+foreach c [channels] {
+	set backchan [join [setting:get $c backchan]]
+if {[string match -nocase $chan $backchan]} {
+	set chan "$c"
+	}
+}
+if {$level != ""} {
+	userhost:act $b $nick "$hand:$level" $char $chan $chan1 $type $return_time "b" $reason $gl
+} else {
+if {$link == "1"} {
+	foreach c [link:chan:get $chan] {
+	userhost:act $b $nick "$hand" $char $c $chan1 $type $return_time "b" $reason "2"
+	}
+	userhost:act $b $nick "$hand" $char $chan $chan1 $type $return_time "b" $reason "2"
+	return
+}
+	userhost:act $b $nick "$hand" $char $chan $chan1 $type $return_time "b" $reason $gl
+		}
+	}
+}
+
+
+stick {
+if {[matchattr $hand nmo|M $chan]} {
+	set stickb [lindex [split $arg] 1]
+	set tm [lindex [split $arg] 2]
+	set return_time [time_return_minute $tm]
+if {$return_time == "-1"} {
+	set reason [join [lrange [split $arg] 2 end]]
+} else {
+	set tm [lindex [split $arg] 3]
+	set reason [join [lrange [split $arg] 3 end]]
+}
+	set type 0
+	set chan1 "$chan"
+if {[regexp {^[&#]} $stickb] && [matchattr $hand nmo|MA $stickb]} {
+	set chan "$stickb"
+	set stickb [lindex [split $arg] 2]
+	set tm [lindex [split $arg] 3]
+	set return_time [time_return_minute $tm]
+if {$return_time == "-1"} {
+	set reason [join [lrange [split $arg] 3 end]]
+} else {
+	set tm [lindex [split $arg] 4]
+	set reason [join [lrange [split $arg] 4 end]] 
+	}
+}
+if {($return_time > "20160" || $return_time == "0")  && [matchattr $hand -|OS $stickb]} {
+	blacktools:tell $nick $char $hand $chan $chan1 b.6 none
+	return
+}
+
+if {$return_time == "-1"} {
+	set return_time $black(stick:bantime)
+}
+foreach c [channels] {
+	set backchan [join [setting:get $c backchan]]
+if {[string match -nocase $chan $backchan]} {
+	set chan "$c"
+	}
+}
+	userhost:act $stickb $nick $hand $char $chan $chan1 $type $return_time "stick" $reason "0"
+	}
+}
+
+ub {
+if {[matchattr $hand nmo|MAO $chan]} {
+	set ban [lindex [split $arg] 1]
+	set why [lindex [split $arg] 2]
+	set type 0
+	set chan1 "$chan"
+if {[regexp {^[&#]} $ban] && [matchattr $hand nmo|MAO $ban]} {
+	set chan "$ban"
+	set ban [lindex [split $arg] 2]
+	set why [lindex [split $arg] 3]
+}
+if {[regexp {^[0-9]} $ban]} {
+	set cmd "ub:id"
+} else {
+	set cmd "ub"
+}
+foreach c [channels] {
+	set backchan [join [setting:get $c backchan]]
+if {[string match -nocase $chan $backchan]} {
+	set chan "$c"
+	}
+}
+if {[string equal -nocase $why "global"] && [matchattr $hand nm]} {
+	ub:process $ban $ban $nick $hand $char $chan $chan1 $type "1" $cmd "" ""
+} elseif {[string equal -nocase $why "link"] && [matchattr $hand nm]} {
+	ub:process $ban $ban $nick $hand $char $chan $chan1 $type "" "ub" "" "1"
+} else {
+	ub:process $ban $ban $nick $hand $char $chan $chan1 $type "" $cmd "" ""
+		}
+	}
+}
+
+sb {
+if {[matchattr $hand nmo|MAO $chan]} {
+	set bhost [lindex [split $arg] 1]
+	set what [lindex [split $arg] 2]
+	set type 0
+	set chan1 "$chan"
+if {[regexp {^[&#]} $bhost] && [matchattr $hand nmo|MAO $bhost]} {
+	set chan "$bhost"
+	set bhost [lindex [split $arg] 2]
+	set what [lindex [split $arg] 3]
+	}
+foreach c [channels] {
+	set backchan [join [setting:get $c backchan]]
+if {[string match -nocase $chan $backchan]} {
+	set chan "$c"
+	}
+}
+if {$bhost != ""} {
+if {[regexp {^[0-9]} $bhost]} {
+	sb:process $bhost $what $nick $hand $char $chan $chan1 $type "sb" "2"
+	return
+}
+if {![validchan $chan]} {
+	blacktools:tell $nick $char $hand $chan $chan1 gl.novalidchan none
+	return
+}
+if {[onchan $bhost $chan]} {
+	set bhost "$bhost![getchanhost $bhost $chan]"
+	sb:process $bhost $what $nick $hand $char $chan $chan1 $type "sb" "1"
+	return
+}
+
+if {[regexp {\*} $bhost]} {
+	sb:process $bhost $what $nick $hand $char $chan $chan1 $type "sb" "1"
+	return
+}
+	sb:process $bhost $what $nick $hand $char $chan $chan1 $type "sb" ""
+
+		} else { sb:process $bhost $what $nick $hand $char $chan $chan1 $type "sb" ""}
+	}
+}
+
+banlist {
+if {[matchattr $hand nmo|AOM $chan]} {
+	set user [lindex [split $arg] 1]
+	set next [lindex [split $arg] 2]
+	set type 0
+	set chan1 "$chan"
+if {[regexp {^[&#]} $user] && [matchattr $hand nmo|MASO $user]} {
+	set chan "$user"
+	set user [lindex [split $arg] 2]
+	set next [lindex [split $arg] 3]
+		}
+foreach c [channels] {
+	set backchan [join [setting:get $c backchan]]
+if {[string match -nocase $chan $backchan]} {
+	set chan "$c"
+	}
+}
+	banlist:process $nick $char $hand $chan $chan1 $user $type "banlist" $next
+	}
+}
+
+r {
+if {[matchattr $hand nmo|MAO $chan]} {
+	set c [lindex [split $arg] 1]
+	set chan1 $chan
+if {$c != "" && [matchattr $hand nmo|AMO $c]} {
+	topic:refresh $nick $char $hand $c $chan1 $arg
+	return
+		}
+	topic:refresh $nick $char $hand $chan $chan1 $arg
+	}
+}
+
+egg {
+if {[matchattr $hand nm|- $chan]} {
+	set why [lindex [split $arg] 1]
+	set result [join [lrange [split $arg] 2 end]]
+	set chan1 $chan
+	set type2 0
+	egg:process $why $type2 $result $nick $hand $char $chan $chan1 
+	}
+}
+
+man {
+if {[matchattr $hand nmo|MAOV $chan]} {
+	set command [lindex [split $arg] 1]
+	set type 0
+	set chan1 $chan
+	man:process $nick $char $hand $chan $chan1 $type $command
+	}
+}
+
+auto {
+if {[matchattr $hand nmo|MA $chan]} {
+	set type 0
+	set chan1 "$chan"
+	set option [lindex [split $arg] 1]
+	set user [lindex [split $arg] 2]
+	set global [lindex [split $arg] 3]
+if {[regexp {^[&#]} $option] && [matchattr $hand nmo|MA $option] && ![string equal -nocase $global "-global"]} {
+	set chan "$option"
+	set option [lindex [split $arg] 2]
+	set user [lindex [split $arg] 3]
+	set global [lindex [split $arg] 4]
+		}
+	auto:process $nick $char $hand $chan $chan1 $user $option $global $type 
+	}
+}
+
+
+antipub {
+if {[matchattr $hand nmo|M $chan]} {
+	set type 0
+	set chan1 "$chan"
+	set why [lindex [split $arg] 1]
+	set except [join [lrange [split $arg] 2 end]]
+	set number [lindex [split $arg] 2]
+if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
+	set chan "$why"
+	set why [lindex [split $arg] 2]
+	set except [join [lrange [split $arg] 3 end]]
+	set number [lindex [split $arg] 3]
+}
+	prot:module:process $nick $char $hand $chan $chan1 $why $except $type $number "antipub"
+	}
+}
+
+private {
+if {[matchattr $hand nmo|M $chan]} {
+	set type 0
+	set chan1 "$chan"
+	set why [lindex [split $arg] 1]
+	set user [lindex [split $arg] 2]
+if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $chan]} {
+	set chan "$why"
+	set why [lindex [split $arg] 2]
+	set user [lindex [split $arg] 3]
+		}
+	private:process $nick $char $hand $chan $chan1 $why $user $type
+	}
+}
+
+tcl {
+if {[matchattr $hand n]} {
+	set type 0
+	set chan1 "$chan"
+	set the_script [lindex [split $arg] 2]
+	set who [lindex [split $arg] 1]
+	tcl:process $nick $char $hand $chan $chan1 $type $the_script $who
+	}
+}
+
+h {
+if {[matchattr $hand nmo|MSOAV $chan]} {
+	set chan1 "$chan"
+	set type 0
+	set command [lindex [split $arg] 1]
+	
+if {[setting:get $chan nextshortcmd]} {
+	helpedpublic:process $nick $char $hand $chan $chan1 $command 0
+	return
+}
+	h:process $nick $char $hand $chan $chan1 $command $type
+	}
+}
+
+ignore {
+if {[matchattr $hand nmo|M $chan]} {
+	set chan1 "$chan"
+	set type 0
+	set what [lindex [split $arg] 1]
+	set mask [lindex [split $arg] 2]
+	set time [lindex [split $arg] 3]	
+	set reason [join [lrange [split $arg] 4 end]]
+if {![regexp {^[0-9]} $time]} {
+	set reason [join [lrange [split $arg] 3 end]]
+		}
+	ignore:process $nick $char $hand $chan $chan1 $what $mask $time $reason $type
+	}
+}
+
+
+idle {
+if {[matchattr $hand nmo|M $chan]} {
+	set type 0
+	set chan1 "$chan"
+	set why [lindex [split $arg] 1]
+	set user [lindex [split $arg] 2]
+	set host [lindex [split $arg] 3]
+if {[regexp {^[&#]} $why] && [matchattr $hand nmo|- $why]} {
+	set chan "$why"
+	set why [lindex [split $arg] 2]
+	set user [lindex [split $arg] 3]
+	set host [lindex [split $arg] 4]
+		}
+	antidle:process $why $type $user $char $nick $hand $chan $chan1
+	}
+}
+
+version {
+if {[matchattr $hand nmo|MASOV $chan]} {
+	set cmd_status [btcmd:status $chan $hand "version" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set chan1 "$chan"
+	version:process $nick $char $hand $chan $chan1
+	}
+}
+
+activ {
+if {[matchattr $hand nmo|MAOV $chan]} {
+	set type 0
+	set chan1 "$chan"
+	set user [lindex [split $arg] 1]
+	set option [lindex [split $arg] 2]
+if {[regexp {^[&#]} $user] && [matchattr $hand nmo|MAOV $user]} {
+	set chan "$user"
+	set user [lindex [split $arg] 2]
+	set option [lindex [split $arg] 3]
+}
+	activ:process $nick $char $hand $chan $chan1 $user $option $type
+	}
+}
+
+chat {
+if {[matchattr $hand nm]} {
+	set cmd_status [btcmd:status $chan $hand "chat" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set chan1 $chan
+	*ctcp:CHAT $nick $char $hand $botnick CHAT $arg
+	blacktools:tell $nick $char $hand $chan $chan1 chat.1 none
+	} 
+}
+
+seen {
+	set type 0
+	set wseen [lindex [split $arg] 1]
+	set chan1 "$chan"
+if {[regexp {^[&#]} $wseen]} {
+	set chan1 "$chan"
+	set chan "$wseen"
+	set wseen [lindex [split $arg] 2]
+	}
+	seen:process $nick $char $hand $chan $chan1 $wseen $type
+}
+
+limit {
+if {[matchattr $hand nmo|M $chan]} {
+	set why [lindex [split $arg] 1]
+	set lm [lindex [split $arg] 2]
+	set type 0
+	set chan1 "$chan"
+if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
+	set chan "$why"
+	set why [lindex [split $arg] 2]
+	set lm [lindex [split $arg] 3]
+		}
+	limit:process $nick $char $hand $chan $chan1 $why $lm $type
+	}
+}
+
+bt {
+if {[matchattr $hand nm]} {
+	set chan1 "$chan"
+	set type 0
+	set who [lindex [split $arg] 1]
+	set message [join [lrange [split $arg] 2 end]]
+	set number [lindex [split $arg] 2]
+	broadcast:process $nick $char $hand $chan $chan1 $who $message $number $type
+	}
+}
+
+badchan {
+if {[matchattr $hand nmo|M $chan]} {
+	set why [lindex [split $arg] 1]
+	set type1 0
+	set chan1 "$chan"
+	set bdchan [lindex [split $arg] 2]
+	set type [lindex [split $arg] 3]
+	set reason [join [lrange [split $arg] 3 end]]
+if {[string equal -nocase $type "global"]} {
+	set reason [join [lrange [split $arg] 4 end]]
+}
+if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
+	set chan "$why"
+	set why [lindex [split $arg] 2]
+	set bdchan [lindex [split $arg] 3]
+	set type [lindex [split $arg] 4]
+	set reason [join [lrange [split $arg] 4 end]]
+if {[string equal -nocase $type "global"]} {
+	set reason [join [lrange [split $arg] 5 end]]
+	}
+}
+	badchan:process $nick $char $hand $chan $chan1 $why $bdchan $type1 $type $reason
+	}
+}
+
+us {
+if {[matchattr $hand nmo|MA $chan]} {
+	set type 0
+	set chan1 "$chan"
+	set users [lindex [split $arg] 1]
+if {[regexp {^[&#]} $users] && [matchattr $hand nmo|MA $users]} {
+	set chan "$users"
+	set users [lindex [split $arg] 2]
+		}
+	us:process $nick $char $hand $chan $chan1 $users $type
+	}
+} 
+
+s {
+if {[matchattr $hand nmo|MA $chan]} {
+	set type 0
+	set chan1 "$chan"
+	set user [lindex [split $arg] 1]
+	set suspend_time [lindex [split $arg] 2]
+	set suspend_reason [join [lrange [split $arg] 3 end]]
+if {![regexp {^[0-9]} $suspend_time]} {
+	set suspend_reason [join [lrange [split $arg] 2 end]]
+}
+if {[regexp {^[&#]} $user] && [matchattr $hand nmo|MA $user]} {
+	set chan "$user"
+	set user [lindex [split $arg] 2]
+	set suspend_time [lindex [split $arg] 3]
+	set suspend_reason [join [lrange [split $arg] 4 end]]
+if {![regexp {^[0-9]} $suspend_time]} {
+	set suspend_reason [join [lrange [split $arg] 3 end]]
+}
+		}
+	s:process $nick $char $hand $chan $chan1 $user $type $suspend_time $suspend_reason
+	}
+}
+
+info {
+if {[matchattr $hand nmo|MASOV $chan]} {
+	set user [lindex [split $arg] 1]
+	set type 0
+	set chan1 "$chan"
+if {[regexp {^[&#]} $user] && [matchattr $hand nmo|MASO $user] && ([lindex [split $arg] 2] == "")} {
+	set chan $user
+	info:process:chan $nick $char $hand $chan $chan1
+	return
+}
+
+if {[regexp {^[&#]} $user] && [matchattr $hand nmo|MASOV $chan]} {
+	set chan "$user"
+	set user [lindex [split $arg] 2]
+}
+	info:process $nick $char $hand $chan $chan1 $user $type
+	}
+}
+
+channels {
+if {[matchattr $hand nmo]} {
+	set chan1 "$chan"
+	channels:process $nick $char $hand $chan $chan1
+	}
+}
+
+
+userlist {
+if {[matchattr $hand nmo|MASOV $chan]} {
+	set level [lindex [split $arg] 1]
+	set type 0
+	set chan1 "$chan"
+if {[regexp {^[&#]} $level] && [matchattr $hand nmo|MASOV $level]} {
+	set chan "$level"
+	set level [lindex [split $arg] 2]
+if {![validchan $chan]} {
+	blacktools:tell $nick $char $hand $chan $chan1 gl.novalidchan none
+	return
+	}
+} 
+	userlist:execute $hand $char $level $chan $chan1 $nick $type
+	}
+}
+
+chuser {
+if {[matchattr $hand nmo|M $chan]} {
+	set user [lindex [split $arg] 1]
+	set type 0	
+	set chan1 "$chan"
+	set chandle [lindex [split $arg] 2]
+	chuser:process $nick $char $hand $chan $chan1 $user $chandle $type
+	}
+}
+
+
+delhost {
+if {[matchattr $hand nmo|MA $chan]} {
+	set user [lindex [split $arg] 1]
+	set type 0
+	set chan1 "$chan"
+	set hosts [join [lrange [split $arg] 2 end]]
+	delhost:process $nick $char $hand $chan $chan1 $user $hosts $type
+	}
+}
+
+addhost {
+if {[matchattr $hand nmo|MA $chan]} {
+	set type 0
+	set chan1 "$chan"
+	set user [lindex [split $arg] 1]
+	set hosts [join [lrange [split $arg] 2 end]]
+	addhost:process $nick $char $hand $chan $chan1 $user $hosts $type
+	}
+}
+
+del {
+if {[matchattr $hand nmo|M $chan]} {
+	set args [lrange [split $arg] 1 end]
+	set type 0
+	set chan1 "$chan"
+	del:process $nick $char $hand $chan $chan1 $args $type
+	}
+}
+
+
+delacc {
+if {[matchattr $hand nmo|MA $chan]} {
+	set args [lrange [split $arg] 1 end]
+	set type 0
+	set chan1 "$chan"
+	set c [lindex [split $arg] 1]
+if {[regexp {^[&#]} $c] && [matchattr $hand nmo|AM $c]} {
+	set chan "$c"
+	set args [lrange [split $arg] 2 end]
+}
+foreach user $args {
+	delacc:process $nick $char $hand $chan $chan1 $user $type
+		}
+	}
+}
+
+adduser {
+if {[matchattr $hand nmo|MA $chan]} {
+	set level [lindex [split $arg] 1]
+	set args [lrange [split $arg] 2 end]
+	set type 0
+	set chan1 "$chan"
+if {[regexp {^[&#]} $level] && [matchattr $hand nmo|MA $level]} {
+	set chan "$level"
+	set level [lindex [split $arg] 2]
+	set args [lrange [split $arg] 3 end]
+}
+if {![validchan $chan]} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
+	return
+}
+if {$args != ""} {
+foreach user $args {
+if {$user != ""} {
+	set handle [nick2hand $user]
+if {![onchan $user $chan] && ![validuser $user]} { 
+	blacktools:tell $nick $char $hand $chan $chan1 gl.usernotonchan $user
+	return
+}
+	set hosts [getchanhost $user $chan]
+	set uhost [return_mask $black(addusermask) $hosts $user]
+	add:process $user $uhost $handle $level $hand $char $chan $chan1 $nick $type "adduser"
+				}
+			}
+		} else { add:process "" "" "" $level $hand $char $chan $chan1 $nick $type "adduser" }
+	}
+}
+
+add {
+if {[matchattr $hand nmo|MA $chan]} {
+	set level [lindex [split $arg] 1]
+	set type 0
+	set chan1 "$chan"
+	set args [lrange [split $arg] 2 end]
+	set handle ""
+	set uhost ""
+if {[regexp {^[&#]} $level] && [matchattr $hand nmo|MA $level]} {
+	set chan "$level"
+	set level [lindex [split $arg] 2]
+	set args [lrange [split $arg] 3 end]
+}
+if {$args != ""} {
+foreach user $args {
+if {$user != ""} {
+if {![string is alnum $user]} {
+	blacktools:tell $nick $char $hand $chan $chan1 add.18 none
+	continue
+}
+	add:process $user $uhost $handle $level $hand $char $chan $chan1 $nick $type "add"
+				}
+			}
+		} else {  add:process "" $uhost $handle $level $hand $char $chan $chan1 $nick $type "add" }	
+	}
+}
+
+unsuspend {
+if {[matchattr $hand nmo]} {
+	set cmd_status [btcmd:status $chan $hand "unsuspend" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set chans [lindex [split $arg] 1]
+	set chan1 "$chan"
+if {$chans == ""} {blacktools:tell $nick $char $hand $chan $chan1 gl.instr_nick "unsuspend"
+	return
+}
+
+if {![regexp {^[&#]} $chans]} {
+	blacktools:tell $nick $char $hand $chan $chan1 gl.novalidchan none
+	return
+}
+ 
+if {![validchan $chans]} { blacktools:tell $nick $char $hand $chan $chan1 gl.novalidchan none
+	return
+}
+
+if {![channel get $chans inactive]} {
+	blacktools:tell $nick $char $hand $chan $chan1 unsuspend.3 $chans
+	return
+}
+	channel set $chans -inactive
+	blacktools:tell $nick $char $hand $chan $chan1 unsuspend.4 $chans
+	}
+}
+
+suspend {
+if {[matchattr $hand nmo]} {
+	set cmd_status [btcmd:status $chan $hand "suspend" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set chans [lindex [split $arg] 1]
+	set reason [join [lrange [split $arg] 2 end]]
+	set chan1 "$chan"
+if {$chans == ""} {blacktools:tell $nick $char $hand $chan $chan1 gl.instr_nick "suspend"
+	return
+}
+if {![regexp {^[&#]} $chans]} {
+	blacktools:tell $nick $char $hand $chan $chan1 gl.novalidchan none
+	return
+}
+if {![validchan $chans]} { blacktools:tell $nick $char $hand $chan $chan1 gl.novalidchan none
+	return
+}
+
+if {[channel get $chans inactive]} {
+	blacktools:tell $nick $char $hand $chan $chan1 suspend.3 $chans 
+	return
+}
+	channel set $chans +inactive
+if {$reason == ""} { set reason "N/A" }
+	suspendchan:note $hand $chans $reason
+	blacktools:tell $nick $char $hand $chan $chan1 suspend.4 $chans 
+	}
+}
+
+delchan {
+if {[matchattr $hand nmo]} {
+	set cmd_status [btcmd:status $chan $hand "delchan" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set chans [lindex [split $arg] 1]
+	set reason [join [lrange [split $arg] 2 end]]
+	set chan1 "$chan"
+if {$chans == ""} {
+	blacktools:tell $nick $char $hand $chan $chan1 gl.instr_nick "delchan"
+	return
+}
+if {![regexp {^[&#]} $chans]} {
+	blacktools:tell $nick $char $hand $chan $chan1 gl.novalidchan none 
+	return
+} 
+
+if {![validchan $chans]} { blacktools:tell $nick $char $hand $chan $chan1 gl.novalidchan none
+	return
+}
+
+	set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
+if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
+
+if {!($black(homechan) == "") && ![string equal -nocase $black(homechan) "#no_home_chan"]} {
+if {[string equal -nocase $chans $black(homechan)]} {
+	blacktools:tell $nick $char $hand $chan $chan1 delchan.5 $chans
+	return
+	}
+}
+	channel remove $chans
+	delchan:all $chans
+if {$reason == ""} { set reason "N/A" }
+	delchan:note $hand $chans $reason
+	blacktools:tell $nick $char $hand $chan $chan1 delchan.3 $chans
+	}
+}
+
+addchan {
+if {[matchattr $hand nmo]} {
+	set cmd_status [btcmd:status $chan $hand "addchan" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set chans [lindex [split $arg] 1]
+	set key [lindex [split $arg] 2]
+	set chan1 $chan
+if {$chans == ""} {
+	blacktools:tell $nick $char $hand $chan $chan1 gl.instr_nick "addchan"
+	return
+}
+if {![regexp {^[&#]} $chans]} {	
+	blacktools:tell $nick $char $hand $chan $chan1 gl.novalidchan none
+	return
+} 
+
+if {[validchan $chans]} {
+	blacktools:tell $nick $char $hand $chan $chan1 addchan.2 $chans
+	return
+} else {
+	channel add $chans
+	blacktools:tell $nick $char $hand $chan $chan1 addchan.3 $chans
+if {$key != ""} {
+	putquick "JOIN $chans :$key"
+	channel set $chans chanmode "+ntk $key"
+			}		
+		}
+	}
+}
+
+die {
+if {[matchattr $hand nm]} {
+	set cmd_status [btcmd:status $chan $hand "die" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set chan1 "$chan"
+	set reason [join [lrange [split $arg] 1 end]]
+	set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
+if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
+	blacktools:tell $nick $char $hand $chan $chan1 die.1 none
+if {$reason == ""} {
+	set text [black:color:set "" $black(say.$getlang.die.2)]
+	set reply [join $text]
+	set reason $reply
+}
+	utimer 3 [list die $reason]
+	}
+}
+
+jump {
+if {[matchattr $hand nm]} {
+	set cmd_status [btcmd:status $chan $hand "jump" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set chan1 "$chan"
+	set serv [lindex [split $arg] 1]
+if {$serv == ""} {
+	blacktools:tell $nick $char $hand $chan $chan1 jump.1 "..."
+	utimer 3 [list jump]
+} else {
+	blacktools:tell $nick $char $hand $chan $chan1 jump.1 "\002$serv\002"
+	utimer 3 [list jump $serv]
+		}	
+	}
+}
+
+save {
+if {[matchattr $hand nm]} {
+	set cmd_status [btcmd:status $chan $hand "save" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set chan1 "$chan"
+	blacktools:tell $nick $char $hand $chan $chan1 save.1 none
+	save
+	}
+}
+
+restart {
+if {[matchattr $hand nm]} {
+	set cmd_status [btcmd:status $chan $hand "restart" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set chan1 "$chan"
+	blacktools:tell $nick $char $hand $chan $chan1 restart.1 none
+	utimer 3 [list restart]
+	}
+}
+
+rehash {
+if {[matchattr $hand nm]} {
+	set cmd_status [btcmd:status $chan $hand "rehash" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set chan1 "$chan"
+	blacktools:tell $nick $char $hand $chan $chan1 rehash.1 none
+	rehash
+	}
+}
+
+nick {
+if {[matchattr $hand nm]} {
+	set thenick [lindex [split $arg] 1]
+	set chan1 $chan
+	set type 0
+	tempnick:process $thenick $nick $char $hand $chan $chan1 $type
+	}
+}
+
+msg {
+if {[matchattr $hand nmo|- $chan]} {
+	set who [lindex [split $arg] 1]	
+	set chan1 "$chan"
+	set type 0
+	set msg [join [lrange [split $arg] 2 end]]
+	msg:process $nick $char $hand $chan $chan1 $who $msg $type
+	}
+}
+
+omsg {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set who [lindex [split $arg] 1]	
+	set chan1 "$chan"
+	set type 0
+	set msg [join [lrange [split $arg] 2 end]]
+if {![regexp {^[&#]} $who] && ![string equal -nocase $who "all"]} {
+	set msg [join [lrange [split $arg] 1 end]]
+	set who $chan
+}
+	omsg:process $nick $char $hand $chan $chan1 $who $msg $type
+	}
+}
+
+set {
+if {[matchattr $hand nmo|M $chan]} {
+	set flags [lindex [split $arg] 1]
+	set type [join [lrange [split $arg] 2 end]]
+	set type1 0
+	set chan1 "$chan"
+if {[regexp {^[&#]} $flags] && [matchattr $hand nmo|M $flags]} {
+	set chan "$flags"
+	set flags [lindex [split $arg] 2]
+	set type [join [lrange [split $arg] 3 end]]
+}
+if {[matchattr $hand mn]} {
+if {[string equal -nocase "global" $flags]} {
+	set chan "$flags"
+	set flags [lindex [split $arg] 2]
+	set type [join [lrange [split $arg] 3 end]]
+	foreach c [channels] {
+	set:process $nick $char $hand $c $chan1 $flags $type $type1	
+		}
+		return
+	}
+}
+	set:process $nick $char $hand $chan $chan1 $flags $type $type1
+	}
+}
+
+mode {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set modes [lindex [split $arg] 1]
+	set hosts [lindex [split $arg] 2]
+	set type 0
+	set chan1 "$chan"
+if {[regexp {^[&#]} $modes] && [matchattr $hand nmo|OMA $modes]} {
+	set chan "$modes"
+	set modes [lindex [split $arg] 2]
+	set hosts [lindex [split $arg] 3]
+		}
+	mode:process $nick $char $hand $chan $chan1 $modes $type $hosts
+	}
+}
+
+cycle {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set reason [join [lrange [split $arg] 1 end]]	
+	set c [lindex [split $arg] 1]
+	set chan1 "$chan"
+if {[regexp {^[&#]} $c] && [matchattr $hand nmo|OMA $c]} {
+	set chan "$c"
+	set reason [join [lrange [split $arg] 2 end]]
+}
+	cycle:process $nick $char $hand $chan $chan1 $reason
+	}
+}
+
+purge {
+if {[matchattr $hand -|M $chan]} {
+	set c [lindex [split $arg] 1]
+	set reason [join [lrange [split $arg] 1 end]]
+	set chan1 "$chan"
+if {[regexp {^[&#]} $c] && [matchattr $hand -|M $c]} {
+	set chan "$c"
+	set reason [join [lrange [split $arg] 2 end]]
+}
+if {$reason == ""} {
+	blacktools:tell $nick $char $hand $chan $chan1 purge.1 none
+	return
+}
+	purge:process $nick $char $hand $chan $chan1 $reason
+	}
+}
+
+broadcast {
+if {[matchattr $hand nm]} {
+	set text [join [lrange [split $arg] 1 end]]	
+	set chan1 "$chan"
+	set type 0
+	broadcast:cmd:process $nick $char $hand $chan $chan1 $text $type
+	}
+}
+
+act {
+if {[matchattr $hand nmo|MA $chan]} {
+	set text [join [lrange [split $arg] 1 end]]
+	set c [lindex [split $arg] 1]
+	set type 0
+	set chan1 "$chan"
+if {[regexp {^[&#]} $c] && [matchattr $hand nmo|AM $c]} {
+	set chan "$c"
+	set text [join [lrange [split $arg] 2 end]]
+}
+	act:process $nick $char $hand $chan $chan1 $text $type
+	}
+}
+
+say {
+if {[matchattr $hand nmo|MA $chan]} {
+	set text [join [lrange [split $arg] 1 end]]
+	set c [lindex [split $arg] 1]
+	set type 0
+	set chan1 "$chan"
+if {[regexp {^[&#]} $c] && [matchattr $hand nmo|MA $c]} {
+	set chan "$c"
+	set text [join [lrange [split $arg] 2 end]]
+}
+	say:process $nick $char $hand $chan $chan1 $text $type
+	}
+}
+
+v {
+if {[matchattr $hand nmo|VOMA $chan]} {
+	set voicex [join [lrange [split $arg] 1 end]]
+	set c [lindex [split $arg] 1]
+	set chan1 "$chan"
+if {[regexp {^[&#]} $c] && [matchattr $hand nmo|VOMA $c]} {
+	set chan "$c"
+	set voicex [join [lrange [split $arg] 2 end]]
+}
+	v:process $nick $char $hand $chan $chan1 $voicex
+	}
+}
+
+ho {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set hopex [join [lrange [split $arg] 1 end]]
+	set c [lindex [split $arg] 1]
+	set chan1 "$chan"
+if {[regexp {^[&#]} $c] && [matchattr $hand nmo|OMA $c]} {
+	set chan "$c"
+	set hopex [join [lrange [split $arg] 2 end]]
+		}
+	ho:process $nick $char $hand $chan $chan1 $hopex
+	}
+}
+
+o {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set opex [join [lrange [split $arg] 1 end]]
+	set c [lindex [split $arg] 1]
+	set chan1 "$chan"
+if {[regexp {^[&#]} $c] && [matchattr $hand nmo|OMA $c]} {
+	set chan "$c"
+	set opex [join [lrange [split $arg] 2 end]]
+		}
+	o:process $nick $char $hand $chan $chan1 $opex
+	}
+}
+
+uptime {
+if {[matchattr $hand nmo]} {
+	set cmd_status [btcmd:status $chan $hand "uptime" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
+if {[matchattr $hand q]} { blacktools:tell $nick $char $hand $chan $chan1 gl.glsuspend none
+	return
+}
+if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $char $hand $chan $chan1 gl.suspend none
+	return
+}
+if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
+	set chan1 "$chan"
+	set up [return_time_2 $getlang [expr [unixtime] - $uptime]]
+	set on [return_time_2 $getlang [expr [unixtime] - ${server-online}]]
+	catch {exec uptime} shelluptime
+	set file [open $black(uptime_file) "r"]
+	set data [read -nonewline $file]
+	close $file
+if {$data == ""} {
+	set read_maxup "-"
+	set read_maxon "-"
+} else {
+	set read_maxup [return_time_2 $getlang [lindex [split $data] 0]]
+	set read_maxon [return_time_2 $getlang [lindex [split $data] 1]]
+}
+	blacktools:tell $nick $char $hand $chan $chan1 maxup.1 "$up $read_maxup"
+	blacktools:tell $nick $char $hand $chan $chan1 maxon.1 "$on $read_maxon"
+	blacktools:tell $nick $char $hand $chan $chan1 uptime.2 $shelluptime
+	blacktools:tell $nick $char $hand $chan $chan1 uptime.3 $server
+	}
+}
+
+status {
+if {[matchattr $hand nmo|- $chan]} {
+	status:process $nick $char $hand $chan
+	}
+}
+
+t {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set topics [join [lrange [split $arg] 1 end]]
+	set type 0
+	set chan1 "$chan"
+if {[regexp {^[&#]} $topics] && [matchattr $hand nmo|OMA $topics]} {
+	set chan "$topics"	
+	set topics [join [lrange [split $arg] 2 end]]
+		}
+	t:process $nick $char $hand $chan $chan1 $topics $type
+	}
+}
+
+k {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set knick [lindex [split $arg] 1]
+	set type 0
+	set reason [join [lrange [split $arg] 2 end]]
+	set handle [nick2hand $knick]
+	set chan1 "$chan"
+if {[regexp {^[&#]} $knick] && [matchattr $hand nmo|MAO $knick]} {
+	set chan "$knick"
+	set knick [lindex [split $arg] 2]
+	set reason [join [lrange [split $arg] 3 end]]
+}
+foreach c [channels] {
+	set backchan [join [setting:get $c backchan]]
+if {[string match -nocase $chan $backchan]} {
+	set chan "$c"
+	}
+}
+if {$knick != ""} {
+	k:process $knick $nick $hand $char $reason $chan $chan1 $type
+		} else {k:process $knick $nick $hand $char $reason $chan $chan1 $type}
+	}
+}
+
+w {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set wnick [lindex [split $arg] 1]
+	set type 0
+	set handle [nick2hand $wnick]
+	set chan1 "$chan"
+if {[regexp {^[&#]} $wnick] && [matchattr $hand nmo|MAO $wnick]} {
+	set chan "$wnick"
+	set wnick [lindex [split $arg] 2]
+}
+foreach c [channels] {
+	set backchan [join [setting:get $c backchan]]
+if {[string match -nocase $chan $backchan]} {
+	set chan "$c"
+	}
+}
+if {$wnick != ""} {
+	w:process $wnick $nick $hand $char $chan $chan1 $type
+		} else { w:process $wnick $nick $hand $char $chan $chan1 $type }
+	}
+}
+
+ungag {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set gagger [lindex [split $arg] 1]
+	set type 0
+	set chan1 "$chan"
+if {[regexp {^[&#]} $gagger] && [matchattr $hand nmo|MAO $gagger]} {
+	set chan "$gagger"
+	set gagger [lindex [split $arg] 2]
+}
+
+foreach c [channels] {
+	set backchan [join [setting:get $c backchan]]
+if {[string match -nocase $chan $backchan]} {
+	set chan "$c"
+	}
+}
+
+if {$gagger != ""} {
+	ungag:process $gagger $nick $hand $char $chan $chan1 $type
+		} else { ungag:process $gagger $nick $hand $char $chan $chan1 $type }
+	}
+}
+
+gag {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set gagger [lindex [split $arg] 1]
+	set time [lindex [split $arg] 2]
+	set reason [join [lrange [split $arg] 3 end]]
+	set type 0
+	set handle [nick2hand $gagger]
+	set chan1 "$chan"
+	set return_time [time_return_minute $time]
+if {$return_time == "-1"} {
+	set reason [lrange [split $arg] 2 end]
+	set time [setting:get $chan gag-bantime]
+if {$time == ""} {
+	set time $black(gag:bantime)
+	}
+}
+if {[regexp {^[&#]} $gagger] && [matchattr $hand nmo|MAO $gagger]} {
+	set chan "$gagger"
+	set gagger [lindex [split $arg] 2]
+	set time [lindex [split $arg] 3]
+	set reason [join [lrange [split $arg] 4 end]]
+	set return_time [time_return_minute $time]
+if {$return_time == "-1"} {
+	set reason [lrange [split $arg] 3 end]
+	set time [setting:get $chan gag-bantime]
+if {$time == ""} {
+	set time $black(gag:bantime)
+		}
+	}
+}
+
+foreach c [channels] {
+	set backchan [join [setting:get $c backchan]]
+if {[string match -nocase $chan $backchan]} {
+	set chan "$c"
+	}
+}
+
+if {$gagger != ""} {
+	gag:process $gagger $time $reason $nick "$hand:GAG" $char $chan $chan1 $type
+	} else { gag:process $gagger $time $reason $nick $hand $char $chan $chan1 $type }
+	}
+}
+
+show {
+if {[matchattr $hand nmo|M $chan]} {
+	set wich [lindex [split $arg] 1]
+	set type 0
+	set chan1 "$chan"
+if {[regexp {^[&#]} $wich] && [matchattr $hand nmo|M $wich]} {
+	set chan "$wich"
+	set wich [lindex [split $arg] 2]	
+		}
+	show:process $nick $char $hand $chan $chan1 $wich $type
+	}
+}
+
+clonescan {
+if {[matchattr $hand nmo|MAO $chan]} {
+	set why [lindex [split $arg] 1]
+	set type 0
+if {[matchattr $hand nmo|M $chan] && ($why != "") && ![regexp {^[&#]} $why]} {
+	set chan1 "$chan"
+	set clone [join [lrange [split $arg] 2 end]]
+	set number [lindex [split $arg] 2]
+if {[regexp {^[&#]} $why]} {
+	set chan "$why"
+	set why [lindex [split $arg] 2]
+	set clone [join [lrange [split $arg] 3 end]]
+	set number [lindex [split $arg] 3]
+}
+	prot:module:process $nick $char $hand $chan $chan1 $why $clone $type $number "clonescan"
+	return
+}
+	set c [lindex [split $arg] 1]
+	set type 0
+	set chan1 "$chan"
+if {[regexp {^[&#]} $c] && [matchattr $hand nmo|M $c]} {
+	set chan "$c"
+}
+	scanner:process $nick $char $hand $chan $chan1 $type
+	}
+}
+
+topwords {
+if {[matchattr $hand nmo|AOMV $chan]} {
+	set next [lindex [split $arg] 1]
+	set cmd ""
+	set type 0
+	set chan1 "$chan"
+if {[string equal -nocase $next "reset"] && [matchattr $hand nmo|M $chan]} {
+	set cmd "reset"
+}
+if {[string equal -nocase $next "total"]} {
+	set next [lindex [split $arg] 2]
+	set cmd "total"
+}
+if {[string equal -nocase $next "add"] && [matchattr $hand nmo|M $next]} {
+	set next [lindex [split $arg] 2]
+	set cmd "add"
+}
+if {[string equal -nocase $next "del"] && [matchattr $hand nmo|M $next]} {
+	set next [lindex [split $arg] 2]
+	set cmd "del"
+}
+if {[regexp {^[&#]} $next] && [matchattr $hand nmo|MAOV $next]} {
+	set chan $next
+	set next [lindex [split $arg] 2]
+if {[string equal -nocase $next "reset"] && [matchattr $hand nmo|M $next]} {
+	set cmd "reset"
+}
+if {[string equal -nocase $next "total"]} {
+	set next [lindex [split $arg] 3]
+	set cmd "total"
+	}
+if {[string equal -nocase $next "add"] && [matchattr $hand nmo|M $next]} {
+	set next [lindex [split $arg] 3]
+	set cmd "add"
+	}
+if {[string equal -nocase $next "del"] && [matchattr $hand nmo|M $next]} {
+	set next [lindex [split $arg] 3]
+	set cmd "del"
+			}
+		}
+	topwords:process $nick $char $hand $chan $chan1 $cmd $type $next
+	}	
+}
+
+myset {
+if {[matchattr $hand nmo|VAOM $chan]} {
+	set type 0
+	set chan1 "$chan"	
+	set flags [lindex [split $arg] 1]
+	set typez [lindex [split $arg] 2]
+	set chan2 [lindex [split $arg] 3]
+	set arg [join [lrange [split $arg] 2 end]]
+	myset:process $nick $char $hand $chan $chan1 $flags $typez $type $chan2 $arg
+	}
+}
+
+timer {
+if {[matchattr $hand nm]} {
+	set chan1 $chan
+	set cmd [lindex [split $arg] 1]
+	set pid [lindex [split $arg] 2]
+	set timer_args [join [lrange [split $arg] 3 end]]
+	set type 0
+	timer:process $nick $char $hand $chan $chan1 $cmd $pid $timer_args $type
+	}
+}
+
+i {
+if {[matchattr $hand nmo|VAOM $chan]} {
+	set type 0
+	set chan1 "$chan"
+	set inick [lindex [split $arg] 1]
+if {[regexp {^[&#]} $inick] && [matchattr $hand nmo|VAOM $inick]} {
+	set chan "$inick"
+	set inick [lindex [split $arg] 2]
+}
+	i:process $nick $char $hand $chan $chan1 $inick $type
+	}
+}
+
+badword {
+if {[matchattr $hand nmo|M $chan]} {
+	set why [lindex [split $arg] 1]
+	set type 0
+	set chan1 "$chan"
+	set bdword [join [lrange [split $arg] 2 end]]
+	set bdnumber [lindex [split $arg] 2]
+if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
+	set chan "$why"
+	set why [lindex [split $arg] 2]
+	set bdnumber [lindex [split $arg] 3]
+	set bdword [join [lrange [split $arg] 3 end]]
+		}
+	antibadword:command:process $nick $char $hand $chan $chan1 $why $bdword $bdnumber $type
+	}
+}
+
+next {
+if {[matchattr $hand nmo|MAO $chan]} {
+	set option [lindex [split $arg] 1]
+	set chan1 $chan
+		nextpublic:process $nick $char $hand $chan $chan1 $option
+	}
+}
+
+helped {
+if {[matchattr $hand nmo|MAO $chan]} {
+	set user [lindex [split $arg] 1]
+	set chan1 $chan
+	set type 0
+	helpedpublic:process $nick $char $hand $chan $chan1 $user $type
+	}
+}
+
+noidle {
+if {[matchattr $hand nmo|MAO $chan]} {
+	set user [lindex [split $arg] 1]
+	set chan1 $chan
+	set type 0
+	noidlepublic:process $nick $char $hand $chan $chan1 $user $type
+	}
+}
+
+skip {
+if {[matchattr $hand nmo|MAO $chan]} {
+	set user [lindex [split $arg] 1]
+	set chan1 $chan
+	set type 0
+	skippublic:process $nick $char $hand $chan $chan1 $user	$type
+			}
+		}		
+	}
+}
+
+##############
+#########################################################################
+##   END                                                               ##
+#########################################################################

+ 1922 - 0
BlackTools2.5.1/BlackTools/Commands/BT.MeCmds.tcl

@@ -0,0 +1,1922 @@
+#########################################################################
+##          BlackTools - The Ultimate Channel Control Script           ##
+##                    One TCL. One smart Eggdrop                       ##
+#########################################################################
+###########################   ME CMDS TCL   #############################
+#########################################################################
+##						                       ##
+##     BlackTools  : http://blacktools.tclscripts.net	               ##
+##     Bugs report : http://www.tclscripts.net/	                       ##
+##     Online Help : irc://irc.undernet.org/tcl-help 	               ##
+##                   #TCL-HELP / UnderNet                              ##
+##                   You can ask in english or romanian                ##
+##					                               ##
+#########################################################################
+
+proc comand:pubme {nick host hand chan arg} {
+global botnick wordsdir sdir black seendir count server uptime {server-online} version lastbind
+	set bnick [lindex [split $arg] 0]
+	set what [lindex [split $arg] 1]
+if {[isbotnick $nick]} { return }
+if {[isbotnick $bnick]} {
+switch -exact -- [string tolower $what] {
+
+report {
+	set type "1"
+	set w [lindex [split $arg] 2]
+	set message [join [lrange [split $arg] 3 end]]
+	set chan1 $chan
+if {[regexp {^[&#]} $w]} {
+	set chan $w
+	set w [lindex [split $arg] 3]
+	set message [join [lrange [split $arg] 4 end]]
+}
+if {[matchattr $hand mno|MAO $chan]} {
+	return
+}
+	report:process $nick $host $hand $chan $chan1 $type $w $message
+}
+
+anunt {
+if {[matchattr $hand nmo|M $chan]} {
+	set type 1
+	set chan1 "$chan"
+	set who [lindex [split $arg] 2]
+	set message [join [lrange [split $arg] 3 end]]
+	set number [lindex [split $arg] 3]
+if {[regexp {^[&#]} $who] && [matchattr $hand nmo|M $who]} {
+	set chan $who
+	set who [lindex [split $arg] 3]
+	set message [join [lrange [split $arg] 4 end]]
+	set number [lindex [split $arg] 4]
+		}
+	anunt:process $nick $host $hand $chan $chan1 $who $message $number $type
+	}
+}
+
+link {
+if {[matchattr $hand nm]} {
+	set type 1
+	set channels [join [lrange [split $arg] 2 end]]
+	set what [lindex [split $arg] 2]
+	set delchan [lindex [split $arg] 3]
+	set chan1 $chan
+	link:process $nick $host $hand $chan $chan1 $type $what $channels $delchan
+	}
+}
+
+note {
+if {[matchattr $hand nmo|MAOV $chan]} {
+	set who [lindex [split $arg] 2]
+	set note [join [lrange [split $arg] 2 end]]
+	set number [lindex [split $arg] 3]
+	set user_send [lindex [split $arg] 3]
+	set note_send [join [lrange [split $arg] 4 end]]
+	set type 1
+	set chan1 $chan
+	note:process $nick $host $hand $chan $chan1 $who $note $user_send $note_send $number $type
+	}
+}
+
+q {
+if {[matchattr $hand nmo|MAOV $chan]} {
+	set otherchan 0
+	set who [lindex [split $arg] 2]
+	set next [lindex [split $arg] 3]
+	set quote [join [lrange [split $arg] 2 end]]
+if {$who == "*"} {
+	set who [lindex [split $arg] 3]
+	set quote [join [lrange [split $arg] 2 end]]
+}
+if {[regexp {^[\[]} $who]} {
+	set who [lindex [split $arg] 3]
+	set quote [join [lrange [split $arg] 2 end]]
+if {$who == "*"} {
+	set who [lindex [split $arg] 4]
+	set quote [join [lrange [split $arg] 2 end]]
+	}
+}
+	set type 1
+	set chan1 $chan
+if {[regexp {^[&#]} $who] && [matchattr $hand nmo|AOMV $who]} {
+	set otherchan 1
+	set chan "$who"
+	set who [lindex [split $arg] 3]
+	set next [lindex [split $arg] 4]
+	set quote [join [lrange [split $arg] 3 end]]
+if {$who == "*"} {
+	set who [lindex [split $arg] 4]
+	set quote [join [lrange [split $arg] 3 end]]
+}
+if {[regexp {^[\[]} $who]} {
+	set who [lindex [split $arg] 4]
+	set quote [join [lrange [split $arg] 3 end]]
+if {$who == "*"} {
+	set who [lindex [split $arg] 5]
+	set quote [join [lrange [split $arg] 3 end]]
+		}
+	}
+}
+if {$otherchan == "1"} {
+	quote:process $nick "chan" $hand $chan $chan1 $type $who $quote [lrange [split $arg] 3 end] $next
+	} else {
+	quote:process $nick "chan" $hand $chan $chan1 $type $who $quote [lrange [split $arg] 2 end] $next
+		}
+	}
+}
+
+enable {
+if {[matchattr $hand nmo|M $chan]} {
+	set what [lindex [split $arg] 2]
+	set user [lindex [split $arg] 3]
+	set chan1 "$chan"
+	set type "1"
+if {[regexp {^[&#]} $what] && [matchattr $hand nmo|M $what]} {
+	set chan "$what"
+	set what [lindex [split $arg] 3]
+	set user [lindex [split $arg] 4]
+}
+	enable:process $nick $host $hand $chan $chan1 $type $what $user
+	}
+}
+
+disable {
+if {[matchattr $hand nmo|M $chan]} {
+	set what [lindex [split $arg] 2]
+	set user [lindex [split $arg] 3]
+	set chan1 "$chan"
+	set type "1"
+if {[regexp {^[&#]} $what] && [matchattr $hand nmo|M $what]} {
+	set chan "$what"
+	set what [lindex [split $arg] 3]
+	set user [lindex [split $arg] 4]
+}
+	disable:process $nick $host $hand $chan $chan1 $type $what $user
+	}
+}
+
+securemode {
+if {[matchattr $hand nmo|M $chan]} {
+	set type 1
+	set chan1 "$chan"
+	set why [lindex [split $arg] 2]
+	set except [join [lrange [split $arg] 3 end]]
+	set number [lindex [split $arg] 3]
+if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
+	set chan "$why"
+	set why [lindex [split $arg] 3]
+	set except [join [lrange [split $arg] 4 end]]
+	set number [lindex [split $arg] 4]
+}
+	prot:module:process $nick $host $hand $chan $chan1 $why $except $type $number "securemode"
+	}
+}
+
+cp {
+if {[matchattr $hand nm]} {
+	set type 1
+	set chan1 $chan
+	set what [lindex [split $arg] 2]
+	set from [lindex [split $arg] 3]
+	set to [lindex [split $arg] 4]
+	cp:process $nick $host $hand $chan $chan1 $type $what $from $to
+	}
+}
+
+banstats {
+if {[matchattr $hand nmo|AOM $chan]} {
+	set next [lindex [split $arg] 2]
+	set cmd ""
+	set type 1
+	set chan1 "$chan"
+if {[string equal -nocase $next "reset"]} {
+	set cmd "reset"
+}
+if {[string equal -nocase $next "total"]} {
+	set next [lindex [split $arg] 3]
+	set cmd "total"
+}
+if {[regexp {^[&#]} $next] && [matchattr $hand nmo|MAO $next]} {
+	set chan $next
+	set next [lindex [split $arg] 3]
+if {[string equal -nocase $next "reset"]} {
+	set cmd "reset"
+}
+if {[string equal -nocase $next "total"]} {
+	set next [lindex [split $arg] 4]
+	set cmd "total"
+	}
+}
+	banstats:process $nick $host $hand $chan $chan1 $cmd $type $next
+	}
+}
+
+troll {
+if {[matchattr $hand nmo|AOM $chan]} {
+	set tr [lindex [split $arg] 2]
+	set chan1 "$chan"
+	set type "1"
+if {[regexp {^[&#]} $tr] && [matchattr $hand nmo|MAO $tr]} {
+	set chan "$tr"
+	set tr [lindex [split $arg] 3]
+}
+	userhost:act $tr $nick $hand $host $chan $chan1 $type "1440" "troll" "" "0"
+	}
+}
+
+guestnick {
+if {[matchattr $hand nmo|M $chan]} {
+	set who [lindex [split $arg] 2]
+	set modul "guestnick"
+	set type 1
+	set chan1 $chan
+	set gnick [join [lrange [split $arg] 3 end]]
+	set number [lindex [split $arg] 3]
+if {[regexp {^[&#]} $who] && [matchattr $hand nmo|M $who]} {
+	set who [lindex [split $arg] 3]
+	set gnick [join [lrange [split $arg] 4 end]]
+	set number [lindex [split $arg] 4]
+		}
+	guestnick:process $nick $host $hand $chan $chan1 $who $gnick $type $number $modul
+	}
+}
+
+badhost {
+if {[matchattr $hand nmo|M $chan]} {
+	set type 1
+	set chan1 "$chan"
+	set why [lindex [split $arg] 2]
+	set badh [join [lrange [split $arg] 3 end]]
+	set number [lindex [split $arg] 3]
+if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
+	set chan "$why"
+	set why [lindex [split $arg] 3]
+	set badh [join [lrange [split $arg] 4 end]]
+	set number [lindex [split $arg] 4]
+}
+	prot:module:process $nick $host $hand $chan $chan1 $why $badh $type $number "badhost"
+	}
+}
+
+badrealname {
+if {[matchattr $hand nmo|M $chan]} {
+	set type 1
+	set chan1 "$chan"
+	set why [lindex [split $arg] 2]
+	set badf [join [lrange [split $arg] 3 end]]
+	set number [lindex [split $arg] 3]
+if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
+	set chan "$why"
+	set why [lindex [split $arg] 3]
+	set badf [join [lrange [split $arg] 4 end]]
+	set number [lindex [split $arg] 4]
+}
+	prot:module:process $nick $host $hand $chan $chan1 $why $badf $type $number "badrealname"
+	}
+}
+
+badquitpart {
+if {[matchattr $hand nmo|M $chan]} {
+	set type 1
+	set chan1 "$chan"
+	set why [lindex [split $arg] 2]
+	set badq [join [lrange [split $arg] 3 end]]
+	set number [lindex [split $arg] 3]
+if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
+	set chan "$why"
+	set why [lindex [split $arg] 3]
+	set badq [join [lrange [split $arg] 4 end]]
+	set number [lindex [split $arg] 4]
+}
+	prot:module:process $nick $host $hand $chan $chan1 $why $badq $type $number "badquitpart"
+	}
+}
+
+
+badident {
+if {[matchattr $hand nmo|M $chan]} {
+	set type 1
+	set chan1 "$chan"
+	set why [lindex [split $arg] 2]
+	set badi [join [lrange [split $arg] 3 end]]
+	set number [lindex [split $arg] 3]
+if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
+	set chan "$why"
+	set why [lindex [split $arg] 3]
+	set badi [join [lrange [split $arg] 4 end]]
+	set number [lindex [split $arg] 4]
+}
+	prot:module:process $nick $host $hand $chan $chan1 $why $badi $type $number "badident"
+	}
+}
+
+
+badnick {
+if {[matchattr $hand nmo|M $chan]} {
+	set type 1
+	set chan1 "$chan"
+	set why [lindex [split $arg] 2]
+	set badn [join [lrange [split $arg] 3 end]]
+	set number [lindex [split $arg] 3]
+if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
+	set chan "$why"
+	set why [lindex [split $arg] 3]
+	set badn [join [lrange [split $arg] 4 end]]
+	set number [lindex [split $arg] 4]
+}
+	prot:module:process $nick $host $hand $chan $chan1 $why $badn $type $number "badnick"
+	}
+}
+
+
+badword {
+if {[matchattr $hand nmo|M $chan]} {
+	set type 1
+	set chan1 "$chan"
+	set why [lindex [split $arg] 2]
+	set badw [join [lrange [split $arg] 3 end]]
+	set number [lindex [split $arg] 3]
+if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
+	set chan "$why"
+	set why [lindex [split $arg] 3]
+	set badw [join [lrange [split $arg] 4 end]]
+	set number [lindex [split $arg] 4]
+}
+	prot:module:process $nick $host $hand $chan $chan1 $why $badw $type $number "badword"
+	}
+}
+
+
+unset {
+if {[matchattr $hand nmo|M $chan]} {
+	set setting [lindex [split $arg] 2]
+	set chan1 $chan
+	set type 1
+if {[regexp {^[&#]} $setting] && [matchattr $hand nmo|M $setting]} {
+	set chan $setting
+	set setting [lindex [split $arg] 3]
+	}
+if {[string equal -nocase $setting "global"] && [matchattr $hand nm]} {
+	set setting [lindex [split $arg] 3]
+foreach c [channels] {
+	unset:process $nick $host $hand $c $chan1 $setting $type
+			}
+		return
+	}
+	unset:process $nick $host $hand $chan $chan1 $setting $type
+	}
+}
+
+greet {
+if {[matchattr $hand nmo|M $chan]} {
+	set who [lindex [split $arg] 2]
+	set modul "greet"
+	set type 1
+	set chan1 $chan
+	set greet [join [lrange [split $arg] 3 end]]
+if {[regexp {^[&#]} $who] && [matchattr $hand nmo|M $who]} {
+	set chan $who
+	set who [lindex [split $arg] 3]
+	set greet [join [lrange [split $arg] 4 end]]
+	}
+	othermodule:process $nick $host $hand $chan $chan1 $who $greet $type $modul	
+	}
+}
+
+leave {
+if {[matchattr $hand nmo|M $chan]} {
+	set who [lindex [split $arg] 2]
+	set modul "leave"
+	set type 1
+	set chan1 $chan
+	set leave [join [lrange [split $arg] 3 end]]
+if {[regexp {^[&#]} $who] && [matchattr $hand nmo|M $who]} {
+	set chan $who
+	set who [lindex [split $arg] 3]
+	set leave [join [lrange [split $arg] 4 end]]
+	}
+	othermodule:process $nick $host $hand $chan $chan1 $who $leave $type $modul		
+	}
+}
+
+topic {
+if {[matchattr $hand nmo|M $chan]} {
+	set who [lindex [split $arg] 2]
+	set modul "topic"
+	set type 0
+	set chan1 $chan
+	set topic [join [lrange [split $arg] 3 end]]
+if {[regexp {^[&#]} $who] && [matchattr $hand nmo|M $who]} {
+	set chan $who
+	set who [lindex [split $arg] 3]
+	set topic [join [lrange [split $arg] 4 end]]
+}
+	othermodule:process $nick $host $hand $chan $chan1 $who $topic $type $modul	
+	}
+}
+
+vr {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set vr [lindex [split $arg] 2]
+	set chan1 "$chan"
+	set type "1"
+if {[regexp {^[&#]} $vr] && [matchattr $hand nmo|MAO $vr]} {
+	set chan "$vr"
+	set vr [lindex [split $arg] 3]
+}
+	userhost:act $vr $nick $hand $host $chan $chan1 $type $black(vr:bantime) "vr" "" "0"
+	}
+}
+
+dr {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set drone [lindex [split $arg] 2]
+	set type "1"
+	set chan1 "$chan"
+if {[regexp {^[&#]} $drone] && [matchattr $hand nmo|OMA $drone]} {
+	set chan "$drone"
+	set drone [lindex [split $arg] 3]
+}
+	userhost:act $drone $nick $hand $host $chan $chan1 $type $black(dr:bantime) "dr" "" "0"
+	}
+}
+
+bot {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set bot [lindex [split $arg] 2]
+	set type 1
+	set chan1 "$chan"
+if {[regexp {^[&#]} $bot] && [matchattr $hand nmo|OMA $bot]} {
+	set chan "$bot"
+	set bot [lindex [split $arg] 3]
+}
+	userhost:act $bot $nick "$hand:bot" $host $chan $chan1 $type $black(bot:bantime) "bot" "" "0"
+	}
+}
+
+n {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set badnick [lindex [split $arg] 2]
+	set type 1
+	set chan1 "$chan"
+if {[regexp {^[&#]} $badnick] && [matchattr $hand nmo|MAO $badnick]} {
+	set chan "$badnick"
+	set badnick [lindex [split $arg] 3]
+}
+if {[regexp {\*} $badnick]} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr_nick "n"
+	return
+}
+if {$badnick == ""} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr_nick "n"
+	return
+}
+	bancmds:process $badnick $badnick $nick $hand $host $chan $chan1 $type $black(n:bantime) "n" "" "0"
+	}
+}
+
+id {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set badident [lindex [split $arg] 2]
+	set handle [nick2hand $badident]
+	set type 1
+	set chan1 "$chan"
+if {[regexp {^[&#]} $badident] && [matchattr $hand nmo|OMA $badident]} {
+	set chan "$badident"
+	set badident [lindex [split $arg] 3]
+}
+	userhost:act $badident $nick $hand $host $chan $chan1 $type $black(id:bantime) "id" "" "0"
+	}
+}
+
+spam {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set spammer [lindex [split $arg] 2]
+	set type 1
+	set chan1 "$chan"
+if {[regexp {^[&#]} $spammer] && [matchattr $hand nmo|OMA $spammer]} {
+	set chan "$spammer"
+	set spammer [lindex [split $arg] 3]
+}
+	userhost:act $spammer $nick $hand $host $chan $chan1 $type $black(spam:bantime) "spam" "" "0"
+	}
+}
+
+bw {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set badw [lindex [split $arg] 2]
+	set type 1
+	set chan1 "$chan"
+if {[regexp {^[&#]} $badw] && [matchattr $hand nmo|OMA $badw]} {
+	set chan "$badw"
+	set badw [lindex [split $arg] 3]
+}
+	userhost:act $badw $nick $hand $host $chan $chan1 $type $black(bw:bantime) "bw" "" "0"
+	}
+}
+
+mb {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set badd [lindex [split $arg] 2]
+	set reason [join [lrange [split $arg] 3 end]]
+	set type 1
+	set chan1 "$chan"
+if {[regexp {^[&#]} $badd] && [matchattr $hand nmo|OMA $badw]} {
+	set chan "$badd"
+	set badd [lindex [split $arg] 3]
+	set reason [join [lrange [split $arg] 4 end]]
+}
+	userhost:act $badd $nick $hand $host $chan $chan1 $type $black(mb:bantime) "mb" $reason "0"
+	}
+}
+
+
+black {
+if {[matchattr $hand nmo|MA $chan]} {
+	set blackb [lindex [split $arg] 2]
+	set reason [join [lrange [split $arg] 3 end]]
+	set type 1
+	set chan1 "$chan"
+if {[regexp {^[&#]} $blackb] && [matchattr $hand nmo|MA $blackb]} {
+	set chan "$blackb"
+	set blackb [lindex [split $arg] 3]
+	set reason [join [lrange [split $arg] 4 end]]
+}
+	userhost:act $blackb $nick $hand $host $chan $chan1 $type "0" "black" $reason "0"
+	}
+}
+
+bl {
+if {[matchattr $hand nmo|MA $chan]} {
+	set blackb [lindex [split $arg] 2]
+	set reason [join [lrange [split $arg] 3 end]]
+	set type 1
+	set chan1 "$chan"
+if {[regexp {^[&#]} $blackb] && [matchattr $hand nmo|MA $blackb]} {
+	set chan "$blackb"
+	set blackb [lindex [split $arg] 3]
+	set reason [join [lrange [split $arg] 4 end]]
+}
+	userhost:act $blackb $nick $hand $host $chan $chan1 $type "0" "black" $reason "0"
+	}
+}
+
+b {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set no_time 0
+	set type 1
+	set gl 0
+	set link 0
+	set chan1 "$chan"
+	set level ""
+	set b [lindex [split $arg] 2]
+	set tm [lindex [split $arg] 3]
+	set global [lindex [split $arg] 4]
+	set reason [join [lrange [split $arg] 5 end]]
+	set return_time [time_return_minute $tm]
+if {$return_time == "-1"} {
+	set global [lindex [split $arg] 3]
+	set reason [join [lrange [split $arg] 4 end]]
+}
+if {[regexp {^[&#]} $b] && [matchattr $hand nmo|MAO $b]} {
+	set chan $b
+	set b [lindex [split $arg] 3]
+	set tm [lindex [split $arg] 4]
+	set global [lindex [split $arg] 5]
+	set reason [join [lrange [split $arg] 6 end]]
+	set return_time [time_return_minute $tm]
+if {$return_time == "-1"} {
+	set global [lindex [split $arg] 4]
+	set reason [join [lrange [split $arg] 5 end]]
+}
+if {[regexp {^[-]} $tm]} {
+	set level [blacktools:check:levelban $hand $chan $tm]
+	set reason [join [lrange [split $arg] 6 end]]
+	set tm [lindex [split $arg] 5]
+	set return_time [time_return_minute $tm]
+if {$return_time == "-1"} {
+	set tm [lindex [split $arg] 4]
+	set reason [join [lrange [split $arg] 5 end]]
+		} 
+} elseif {[string equal -nocase "$global" "global"] && [matchattr $hand nm]} {
+	set gl 1
+	set tm [lindex [split $arg] 4]
+	set reason [join [lrange [split $arg] 6 end]]
+	set return_time [time_return_minute $tm]
+if {$return_time == "-1"} {
+	set reason [join [lrange [split $arg] 5 end]]
+			} 
+	} else {
+if {$return_time == "-1"} {
+	set reason [join [lrange [split $arg] 4 end]]
+	} else {
+	set reason [join [lrange [split $arg] 5 end]]
+		}
+	}
+} else {
+if {[regexp {^[-]} $tm]} {
+	set levelban 1
+	set level [blacktools:check:levelban $hand $chan $tm]
+	set reason [join [lrange [split $arg] 5 end]]
+	set tm [lindex [split $arg] 4]
+	set return_time [time_return_minute $tm]
+if {$return_time == "-1"} {
+	set tm [lindex [split $arg] 3]
+	set reason [join [lrange [split $arg] 4 end]]
+		} 
+} elseif {[string equal -nocase "$global" "global"] && [matchattr $hand nm]} {
+	set gl 1
+	set tm [lindex [split $arg] 3]
+	set reason [join [lrange [split $arg] 5 end]]
+	set return_time [time_return_minute $tm]
+if {$return_time == "-1"} {
+	set reason [join [lrange [split $arg] 4 end]]
+			} 
+	} elseif {[string equal -nocase "$global" "link"] && [matchattr $hand nm]} {
+	set link 1
+	set tm [lindex [split $arg] 3]
+	set reason [join [lrange [split $arg] 5 end]]
+	set return_time [time_return_minute $tm]
+if {$return_time == "-1"} {
+	set reason [join [lrange [split $arg] 4 end]]
+			} 
+	} else {
+if {$return_time == "-1"} {
+	set reason [join [lrange [split $arg] 3 end]]
+	} else {
+	set reason [join [lrange [split $arg] 4 end]]
+		}
+	}
+}
+if {($return_time > "20160" || $return_time == "0")  && [matchattr $hand -|OS $chan]} {
+	blacktools:tell $nick $host $hand $chan $chan1 b.6 none
+	return
+}
+if {$return_time == "-1"} {
+	set return_time $black(b:bantime)
+}
+if {[llength $level] > "1"} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.invalidlevel [string map {"0" ""} $level]
+	return
+}
+	
+if {$level != ""} {
+	userhost:act $b $nick "$hand:$level" $host $chan $chan1 $type $return_time "b" $reason $gl
+} else {
+if {$link == "1"} {
+	foreach c [link:chan:get $chan] {
+	userhost:act $b $nick "$hand" $host $c $chan1 $type $return_time "b" $reason "2"
+	}
+	userhost:act $b $nick "$hand" $host $chan $chan1 $type $return_time "b" $reason "2"
+	return
+}
+	userhost:act $b $nick "$hand" $host $chan $chan1 $type $return_time "b" $reason $gl
+		}
+	}
+}
+
+
+stick {
+if {[matchattr $hand nmo|M $chan]} {
+	set stickb [lindex [split $arg] 2]
+	set tm [lindex [split $arg] 3]
+	set return_time [time_return_minute $tm]
+if {$return_time == "-1"} {
+	set reason [join [lrange [split $arg] 3 end]]
+} else {
+	set tm [lindex [split $arg] 4]
+	set reason [join [lrange [split $arg] 4 end]]
+}
+	set type 1
+	set chan1 "$chan"
+if {[regexp {^[&#]} $stickb] && [matchattr $hand nmo|MA $stickb]} {
+	set chan "$stickb"
+	set stickb [lindex [split $arg] 3]
+	set tm [lindex [split $arg] 4]
+	set return_time [time_return_minute $tm]
+if {$return_time == "-1"} {
+	set reason [join [lrange [split $arg] 4 end]]
+} else {
+	set tm [lindex [split $arg] 5]
+	set reason [join [lrange [split $arg] 5 end]] 
+	}
+}
+if {($return_time > "20160" || $return_time == "0")  && [matchattr $hand -|OS $stickb]} {
+	blacktools:tell $nick $host $hand $chan $chan1 b.6 none
+	return
+}
+
+if {$return_time == "-1"} {
+	set return_time $black(stick:bantime)
+}
+	userhost:act $stickb $nick $hand $host $chan $chan1 $type $return_time "stick" $reason "0"
+	}
+}
+
+ub {
+if {[matchattr $hand nmo|MAO $chan]} {
+	set ban [lindex [split $arg] 2]
+	set why [lindex [split $arg] 3]
+	set type 1	
+	set chan1 "$chan"
+if {[regexp {^[&#]} $ban] && [matchattr $hand nmo|MAO $ban]} {
+	set chan "$ban"
+	set ban [lindex [split $arg] 3]
+	set why [lindex [split $arg] 4]
+}
+if {[regexp {^[0-9]} $ban]} {
+	set cmd "ub:id"
+} else {
+	set cmd "ub"
+}
+if {[string equal -nocase $why "global"] && [matchattr $hand nm]} {
+	ub:process $ban $ban $nick $hand $host $chan $chan1 $type "1" $cmd "" ""
+} elseif {[string equal -nocase $why "link"] && [matchattr $hand nm]} {
+	ub:process $ban $ban $nick $hand $host $chan $chan1 $type "" "ub" "" "1"
+} else {
+	ub:process $ban $ban $nick $hand $host $chan $chan1 $type "" $cmd "" ""
+		}
+	}
+}
+
+sb {
+if {[matchattr $hand nmo|MAO $chan]} {
+	set bhost [lindex [split $arg] 2]
+	set what [lindex [split $arg] 3]
+	set type 1
+	set chan1 "$chan"
+if {[regexp {^[&#]} $bhost] && [matchattr $hand nmo|MAO $bhost]} {
+	set chan "$bhost"
+	set bhost [lindex [split $arg] 3]
+	set what [lindex [split $arg] 4]
+	}
+if {$bhost != ""} {
+if {[regexp {^[0-9]} $bhost]} {
+	sb:process $bhost $what $nick $hand $host $chan $chan1 $type "sb" "2"
+	return
+}
+if {![validchan $chan]} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
+	return
+}
+if {[onchan $bhost $chan]} {
+	set bhost "$bhost![getchanhost $bhost $chan]"
+	sb:process $bhost $what $nick $hand $host $chan $chan1 $type "sb" "1"
+	return
+}
+
+if {[regexp {\*} $bhost]} {
+	sb:process $bhost $what $nick $hand $host $chan $chan1 $type "sb" "1"
+	return
+}
+	sb:process $bhost $what $nick $hand $host $chan $chan1 $type "sb" ""
+
+		} else { sb:process $bhost $what $nick $hand $host $chan $chan1 $type "sb" ""}
+	}
+}
+
+banlist {
+if {[matchattr $hand nmo|AOM $chan]} {
+	set user [lindex [split $arg] 2]
+	set next [lindex [split $arg] 3]
+	set type 1
+	set chan1 "$chan"
+if {[regexp {^[&#]} $user] && [matchattr $hand nmo|MASO $user]} {
+	set chan "$user"
+	set user [lindex [split $arg] 3]
+	set next [lindex [split $arg] 4]
+		}
+banlist:process $nick $host $hand $chan $chan1 $user $type "banlist" $next
+	}
+}
+
+r {
+if {[matchattr $hand nmo|MAO $chan]} {
+	set c [lindex [split $arg] 2]
+	set chan1 $chan
+if {$c != "" && [matchattr $hand nmo|AMO $c]} {
+	topic:refresh $nick $host $hand $c $chan1 $arg
+	return
+		}
+	topic:refresh $nick $host $hand $chan $chan1 $arg
+	}
+}
+
+egg {
+if {[matchattr $hand nm|- $chan]} {
+	set why [lindex [split $arg] 2]
+	set result [join [lrange [split $arg] 3 end]]
+	set chan1 $chan
+	set type2 1
+	egg:process $why $type2 $result $nick $hand $host $chan $chan1 
+	}
+}
+
+man {
+if {[matchattr $hand nmo|MAOV $chan]} {
+	set command [lindex [split $arg] 2]
+	set type 1
+	set chan1 $chan
+	man:process $nick $host $hand $chan $chan1 $type $command
+	}
+}
+
+auto {
+if {[matchattr $hand nmo|MA $chan]} {
+	set type 1
+	set chan1 "$chan"
+	set option [lindex [split $arg] 2]
+	set user [lindex [split $arg] 3]
+	set global [lindex [split $arg] 4]
+if {[regexp {^[&#]} $option] && [matchattr $hand nmo|MA $option] && ![string equal -nocase $global "-global"]} {
+	set chan "$option"
+	set option [lindex [split $arg] 3]
+	set user [lindex [split $arg] 4]
+	set global [lindex [split $arg] 5]
+		}
+	auto:process $nick $host $hand $chan $chan1 $user $option $global $type 
+	}
+}
+
+
+antipub {
+if {[matchattr $hand nmo|M $chan]} {
+	set type 1
+	set chan1 "$chan"
+	set why [lindex [split $arg] 2]
+	set except [join [lrange [split $arg] 3 end]]
+	set number [lindex [split $arg] 3]
+if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
+	set chan "$why"
+	set why [lindex [split $arg] 3]
+	set except [join [lrange [split $arg] 4 end]]
+	set number [lindex [split $arg] 4]
+}
+	prot:module:process $nick $host $hand $chan $chan1 $why $except $type $number "antipub"
+	}
+}
+
+private {
+if {[matchattr $hand nmo|M $chan]} {
+	set type 1
+	set chan1 "$chan"
+	set why [lindex [split $arg] 2]
+	set user [lindex [split $arg] 3]
+if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $chan]} {
+	set chan "$why"
+	set why [lindex [split $arg] 3]
+	set user [lindex [split $arg] 4]
+		}
+private:process $nick $host $hand $chan $chan1 $why $user $type
+	}
+}
+
+tcl {
+if {[matchattr $hand n]} {
+	set type 1
+	set chan1 "$chan"
+	set the_script [lindex [split $arg] 3]
+	set who [lindex [split $arg] 2]
+	tcl:process $nick $host $hand $chan $chan1 $type $the_script $who
+	}
+}
+
+h {
+if {[matchattr $hand nmo|MSOAV $chan]} {
+	set chan1 "$chan"
+	set type 1
+	set command [lindex [split $arg] 2]
+	h:process $nick $host $hand $chan $chan1 $command $type
+	}
+}
+
+ignore {
+if {[matchattr $hand nmo|M $chan]} {
+	set chan1 "$chan"
+	set type 1
+	set what [lindex [split $arg] 2]
+	set mask [lindex [split $arg] 3]
+	set time [lindex [split $arg] 4]	
+	set reason [join [lrange [split $arg] 5 end]]
+if {![regexp {^[0-9]} $time]} {
+	set reason [join [lrange [split $arg] 4 end]]
+		}
+	ignore:process $nick $host $hand $chan $chan1 $what $mask $time $reason $type
+	}
+}
+
+
+idle {
+if {[matchattr $hand nmo|M $chan]} {
+	set type 1
+	set chan1 "$chan"
+	set why [lindex [split $arg] 2]
+	set user [lindex [split $arg] 3]
+	set host [lindex [split $arg] 4]
+if {[regexp {^[&#]} $why] && [matchattr $hand nmo|- $why]} {
+	set chan "$why"
+	set why [lindex [split $arg] 3]
+	set user [lindex [split $arg] 4]
+	set host [lindex [split $arg] 5]
+		}
+	antidle:process $why $type $user $host $nick $hand $chan $chan1
+	}
+}
+
+version {
+if {[matchattr $hand nmo|MASOV $chan]} {
+set chan1 "$chan"
+version:process $nick $host $hand $chan $chan1
+	}
+}
+
+activ {
+if {[matchattr $hand nmo|MAOV $chan]} {
+	set type 1
+	set chan1 "$chan"
+	set user [lindex [split $arg] 2]
+	set option [lindex [split $arg] 3]
+if {[regexp {^[&#]} $user] && [matchattr $hand nmo|MAOV $user]} {
+	set chan "$user"
+	set user [lindex [split $arg] 3]
+	set option [lindex [split $arg] 4]
+}
+	activ:process $nick $host $hand $chan $chan1 $user $option $type
+	}
+}
+
+chat {
+if {[matchattr $hand nm]} {
+	set cmd_status [btcmd:status $chan $hand "chat" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set chan1 $chan
+	*ctcp:CHAT $nick $host $hand $botnick CHAT $arg
+	blacktools:tell $nick $host $hand $chan $chan1 chat.1 none
+	} 
+}
+
+seen {
+	set type 1
+	set wseen [lindex [split $arg] 2]
+	set chan1 "$chan"
+if {[regexp {^[&#]} $wseen]} {
+	set chan1 "$chan"
+	set chan "$wseen"
+	set wseen [lindex [split $arg] 3]
+	}
+	seen:process $nick $host $hand $chan $chan1 $wseen $type
+}
+
+limit {
+if {[matchattr $hand nmo|M $chan]} {
+	set why [lindex [split $arg] 2]
+	set lm [lindex [split $arg] 3]
+	set type 1
+	set chan1 "$chan"
+if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
+	set chan "$why"
+	set why [lindex [split $arg] 3]
+	set lm [lindex [split $arg] 4]
+		}
+	limit:process $nick $host $hand $chan $chan1 $why $lm $type
+	}
+}
+
+bt {
+if {[matchattr $hand nm]} {
+	set chan1 "$chan"
+	set type 0
+	set who [lindex [split $arg] 2]
+	set message [join [lrange [split $arg] 3 end]]
+	set number [lindex [split $arg] 3]
+	broadcast:process $nick $host $hand $chan $chan1 $who $message $number $type
+	}
+}
+
+badchan {
+if {[matchattr $hand nmo|M $chan]} {
+	set why [lindex [split $arg] 2]
+	set type1 1
+	set chan1 "$chan"
+	set bdchan [lindex [split $arg] 3]
+	set type [lindex [split $arg] 4]
+	set reason [join [lrange [split $arg] 4 end]]
+if {[string equal -nocase $type "global"]} {
+	set reason [join [lrange [split $arg] 5 end]]
+}
+if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
+	set chan "$why"
+	set why [lindex [split $arg] 3]
+	set bdchan [lindex [split $arg] 4]
+	set type [lindex [split $arg] 5]
+	set reason [join [lrange [split $arg] 5 end]]
+if {[string equal -nocase $type "global"]} {
+	set reason [join [lrange [split $arg] 6 end]]
+	}
+}
+	badchan:process $nick $host $hand $chan $chan1 $why $bdchan $type1 $type $reason
+	}
+}
+
+us {
+if {[matchattr $hand nmo|MA $chan]} {
+	set type 1
+	set chan1 "$chan"
+	set users [lindex [split $arg] 2]
+if {[regexp {^[&#]} $users] && [matchattr $hand nmo|MA $users]} {
+	set chan "$users"
+	set users [lindex [split $arg] 3]
+		}
+	us:process $nick $host $hand $chan $chan1 $users $type
+	}
+} 
+
+s {
+if {[matchattr $hand nmo|MA $chan]} {
+	set type 1
+	set chan1 "$chan"
+	set user [lindex [split $arg] 2]
+	set suspend_time [lindex [split $arg] 3]
+	set suspend_reason [join [lrange [split $arg] 4 end]]
+if {![regexp {^[0-9]} $suspend_time]} {
+	set suspend_reason [join [lrange [split $arg] 3 end]]
+}
+if {[regexp {^[&#]} $user] && [matchattr $hand nmo|MA $user]} {
+	set chan "$user"
+	set user [lindex [split $arg] 3]
+	set suspend_time [lindex [split $arg] 4]
+	set suspend_reason [join [lrange [split $arg] 5 end]]
+if {![regexp {^[0-9]} $suspend_time]} {
+	set suspend_reason [join [lrange [split $arg] 4 end]]
+}
+		}
+	s:process $nick $host $hand $chan $chan1 $user $type $suspend_time $suspend_reason
+	}
+}
+
+info {
+if {[matchattr $hand nmo|MASOV $chan]} {
+	set user [lindex [split $arg] 2]
+	set type 1
+	set chan1 "$chan"
+if {[regexp {^[&#]} $user] && [matchattr $hand nmo|MASO $user] && ([lindex [split $arg] 3] == "")} {
+	set chan $user
+	info:process:chan $nick $host $hand $chan $chan1
+	return
+}
+
+if {[regexp {^[&#]} $user] && [matchattr $hand nmo|MASOV $chan]} {
+	set chan "$user"
+	set user [lindex [split $arg] 3]
+}
+	info:process $nick $host $hand $chan $chan1 $user $type
+	}
+}
+
+channels {
+if {[matchattr $hand nmo]} {
+	set chan1 "$chan"
+	channels:process $nick $host $hand $chan $chan1
+	}
+}
+
+
+userlist {
+if {[matchattr $hand nmo|MASOV $chan]} {
+	set level [lindex [split $arg] 2]
+	set type 1
+	set chan1 "$chan"
+if {[regexp {^[&#]} $level] && [matchattr $hand nmo|MASOV $level]} {
+	set chan "$level"
+	set level [lindex [split $arg] 3]
+if {![validchan $chan]} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
+	return
+	}
+} 
+	userlist:execute $hand $host $level $chan $chan1 $nick $type
+	}
+}
+
+chuser {
+if {[matchattr $hand nmo|M $chan]} {
+	set user [lindex [split $arg] 2]
+	set type 1	
+	set chan1 "$chan"
+	set chandle [lindex [split $arg] 3]
+	chuser:process $nick $host $hand $chan $chan1 $user $chandle $type
+	}
+}
+
+
+delhost {
+if {[matchattr $hand nmo|MA $chan]} {
+	set user [lindex [split $arg] 2]
+	set type 1
+	set chan1 "$chan"
+	set hosts [join [lrange [split $arg] 3 end]]
+	delhost:process $nick $host $hand $chan $chan1 $user $hosts $type
+	}
+}
+
+addhost {
+if {[matchattr $hand nmo|MA $chan]} {
+	set type 1
+	set chan1 "$chan"
+	set user [lindex [split $arg] 2]
+	set hosts [join [lrange [split $arg] 3 end]]
+	addhost:process $nick $host $hand $chan $chan1 $user $hosts $type
+	}
+}
+
+del {
+if {[matchattr $hand nmo|M $chan]} {
+	set args [lrange [split $arg] 2 end]
+	set type 1
+	set chan1 "$chan"
+	del:process $nick $host $hand $chan $chan1 $args $type
+	}
+}
+
+
+delacc {
+if {[matchattr $hand nmo|MA $chan]} {
+	set args [lrange [split $arg] 2 end]
+	set type 1
+	set chan1 "$chan"
+	set c [lindex [split $arg] 2]
+if {[regexp {^[&#]} $c] && [matchattr $hand nmo|AM $c]} {
+	set chan "$c"
+	set args [lrange [split $arg] 3 end]
+}
+foreach user $args {
+	delacc:process $nick $host $hand $chan $chan1 $user $type
+		}
+	}
+}
+
+adduser {
+if {[matchattr $hand nmo|MA $chan]} {
+	set level [lindex [split $arg] 2]
+	set args [lrange [split $arg] 3 end]
+	set type 1
+	set chan1 "$chan"
+if {[regexp {^[&#]} $level] && [matchattr $hand nmo|MA $level]} {
+	set chan "$level"
+	set level [lindex [split $arg] 3]
+	set args [lrange [split $arg] 4 end]
+}
+if {![validchan $chan]} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
+	return
+}
+if {$args != ""} {
+foreach user $args {
+if {$user != ""} {
+	set handle [nick2hand $user]
+if {![onchan $user $chan] && ![validuser $user]} { 
+	blacktools:tell $nick $host $hand $chan $chan1 gl.usernotonchan $user
+	return
+}
+	set hosts [getchanhost $user $chan]
+	set uhost [return_mask $black(addusermask) $hosts $user]
+	add:process $user $uhost $handle $level $hand $host $chan $chan1 $nick $type "adduser"
+				}
+			}
+		} else { add:process "" "" "" $level $hand $host $chan $chan1 $nick $type "adduser" }
+	}
+}
+
+add {
+if {[matchattr $hand nmo|MA $chan]} {
+	set level [lindex [split $arg] 2]
+	set type 1
+	set chan1 "$chan"
+	set args [lrange [split $arg] 3 end]
+	set handle ""
+	set uhost ""
+if {[regexp {^[&#]} $level] && [matchattr $hand nmo|MA $level]} {
+	set chan "$level"
+	set level [lindex [split $arg] 3]
+	set args [lrange [split $arg] 4 end]
+}
+if {$args != ""} {
+foreach user $args {
+if {$user != ""} {
+if {![string is alnum $user]} {
+	blacktools:tell $nick $host $hand $chan $chan1 add.18 none
+	continue
+}
+	add:process $user $uhost $handle $level $hand $host $chan $chan1 $nick $type "add"
+				}
+			}
+		} else {  add:process "" $uhost $handle $level $hand $host $chan $chan1 $nick $type "add" }	
+	}
+}
+
+unsuspend {
+if {[matchattr $hand nmo]} {
+	set cmd_status [btcmd:status $chan $hand "unsuspend" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set chans [lindex [split $arg] 2]
+	set chan1 "$chan"
+if {$chans == ""} {blacktools:tell $nick $host $hand $chan $chan1 gl.instr_nick "unsuspend"
+	return
+}
+
+if {![regexp {^[&#]} $chans]} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
+	return
+}
+ 
+if {![validchan $chans]} { blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
+	return
+}
+
+if {![channel get $chans inactive]} {
+	blacktools:tell $nick $host $hand $chan $chan1 unsuspend.3 $chans
+	return
+}
+	channel set $chans -inactive
+	blacktools:tell $nick $host $hand $chan $chan1 unsuspend.4 $chans
+	}
+}
+
+suspend {
+if {[matchattr $hand nmo]} {
+	set cmd_status [btcmd:status $chan $hand "suspend" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set chans [lindex [split $arg] 2]
+	set reason [join [lrange [split $arg] 3 end]]
+	set chan1 "$chan"
+if {$chans == ""} {blacktools:tell $nick $host $hand $chan $chan1 gl.instr_nick "suspend"
+	return
+}
+if {![regexp {^[&#]} $chans]} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
+	return
+}
+if {![validchan $chans]} { blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
+	return
+}
+
+if {[channel get $chans inactive]} {
+	blacktools:tell $nick $host $hand $chan $chan1 suspend.3 $chans 
+	return
+}
+	channel set $chans +inactive
+if {$reason == ""} { set reason "N/A" }
+	suspendchan:note $hand $chans $reason	
+	blacktools:tell $nick $host $hand $chan $chan1 suspend.4 $chans 
+	}
+}
+
+delchan {
+if {[matchattr $hand nmo]} {
+	set cmd_status [btcmd:status $chan $hand "delchan" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set chans [lindex [split $arg] 2]
+	set reason [join [lrange [split $arg] 3 end]]
+	set chan1 "$chan"
+if {$chans == ""} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr_nick "delchan"
+	return
+}
+if {![regexp {^[&#]} $chans]} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none 
+	return
+} 
+
+if {![validchan $chans]} { blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
+	return
+}
+
+	set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
+if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
+
+if {!($black(homechan) == "") && ![string equal -nocase $black(homechan) "#no_home_chan"]} {
+if {[string equal -nocase $chans $black(homechan)]} {
+	blacktools:tell $nick $host $hand $chan $chan1 delchan.5 $chans
+	return
+	}
+}
+	channel remove $chans
+	delchan:all $chans
+if {$reason == ""} { set reason "N/A" }
+	delchan:note $hand $chans $reason
+	blacktools:tell $nick $host $hand $chan $chan1 delchan.3 $chans
+	}
+}
+
+addchan {
+if {[matchattr $hand nmo]} {
+	set cmd_status [btcmd:status $chan $hand "addchan" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set chans [lindex [split $arg] 2]
+	set key [lindex [split $arg] 3]
+	set chan1 $chan
+if {$chans == ""} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.instr_nick "addchan"
+	return
+}
+if {![regexp {^[&#]} $chans]} {	
+	blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
+	return
+} 
+
+if {[validchan $chans]} {
+	blacktools:tell $nick $host $hand $chan $chan1 addchan.2 $chans
+	return
+} else {
+	channel add $chans
+	blacktools:tell $nick $host $hand $chan $chan1 addchan.3 $chans
+if {$key != ""} {
+	putquick "JOIN $chans :$key"
+	channel set $chans chanmode "+ntk $key"
+			}		
+		}
+	}
+}
+
+die {
+if {[matchattr $hand nm]} {
+	set cmd_status [btcmd:status $chan $hand "die" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set chan1 "$chan"
+	set reason [join [lrange [split $arg] 2 end]]
+	set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
+if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
+	blacktools:tell $nick $host $hand $chan $chan1 die.1 none
+if {$reason == ""} {
+	set text [black:color:set "" $black(say.$getlang.die.2)]
+	set reply [join $text]
+	set reason $reply
+}
+	utimer 3 [list die $reason]
+	}
+}
+
+jump {
+if {[matchattr $hand nm]} {
+	set cmd_status [btcmd:status $chan $hand "jump" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set chan1 "$chan"
+	set serv [lindex [split $arg] 2]
+if {$serv == ""} {
+	blacktools:tell $nick $host $hand $chan $chan1 jump.1 "..."
+	utimer 3 [list jump]
+} else {
+	blacktools:tell $nick $host $hand $chan $chan1 jump.1 "\002$serv\002"
+	utimer 3 [list jump $serv]
+		}	
+	}
+}
+
+save {
+if {[matchattr $hand nm]} {
+	set cmd_status [btcmd:status $chan $hand "save" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set chan1 "$chan"
+	blacktools:tell $nick $host $hand $chan $chan1 save.1 none
+	save
+	}
+}
+
+restart {
+if {[matchattr $hand nm]} {
+	set cmd_status [btcmd:status $chan $hand "restart" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set chan1 "$chan"
+	blacktools:tell $nick $host $hand $chan $chan1 restart.1 none
+	utimer 3 [list restart]
+	}
+}
+
+rehash {
+if {[matchattr $hand nm]} {
+	set cmd_status [btcmd:status $chan $hand "rehash" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set chan1 "$chan"
+	blacktools:tell $nick $host $hand $chan $chan1 rehash.1 none
+	rehash
+	}
+}
+
+nick {
+if {[matchattr $hand nm]} {
+	set thenick [lindex [split $arg] 2]
+	set chan1 $chan
+	set type 1
+	tempnick:process $thenick $nick $host $hand $chan $chan1 $type
+	}
+}
+
+msg {
+if {[matchattr $hand nmo|- $chan]} {
+	set who [lindex [split $arg] 2]	
+	set chan1 "$chan"
+	set type 1
+	set msg [join [lrange [split $arg] 3 end]]
+	msg:process $nick $host $hand $chan $chan1 $who $msg $type
+	}
+}
+
+omsg {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set who [lindex [split $arg] 2]	
+	set chan1 "$chan"
+	set type 1
+	set msg [join [lrange [split $arg] 3 end]]
+if {![regexp {^[&#]} $who] && ![string equal -nocase $who "all"]} {
+	set msg [join [lrange [split $arg] 2 end]]
+	set who $chan
+}
+	omsg:process $nick $host $hand $chan $chan1 $who $msg $type
+	}
+}
+
+
+set {
+if {[matchattr $hand nmo|M $chan]} {
+	set flags [lindex [split $arg] 2]
+	set type [join [lrange [split $arg] 3 end]]
+	set type1 1
+	set chan1 "$chan"
+if {[regexp {^[&#]} $flags] && [matchattr $hand nmo|M $flags]} {
+	set chan "$flags"
+	set flags [lindex [split $arg] 3]
+	set type [join [lrange [split $arg] 4 end]]
+}
+if {[matchattr $hand mn]} {
+if {[string equal -nocase "global" $flags]} {
+	set chan "$flags"
+	set flags [lindex [split $arg] 3]
+	set type [join [lrange [split $arg] 4 end]]
+	foreach c [channels] {
+	set:process $nick $host $hand $c $chan1 $flags $type $type1	
+		}
+		return
+	}
+}
+	set:process $nick $host $hand $chan $chan1 $flags $type $type1
+	}
+}
+
+mode {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set modes [lindex [split $arg] 2]
+	set hosts [lindex [split $arg] 3]	
+	set type 1
+	set chan1 "$chan"
+if {[regexp {^[&#]} $modes] && [matchattr $hand nmo|OMA $modes]} {
+	set chan "$modes"
+	set modes [lindex [split $arg] 3]
+	set hosts [lindex [split $arg] 4]
+		}
+	mode:process $nick $host $hand $chan $chan1 $modes $type $hosts
+	}
+}
+
+cycle {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set reason [join [lrange [split $arg] 2 end]]	
+	set c [lindex [split $arg] 2]
+	set chan1 "$chan"
+if {[regexp {^[&#]} $c] && [matchattr $hand nmo|OMA $c]} {
+	set chan "$c"
+	set reason [join [lrange [split $arg] 3 end]]
+}
+	cycle:process $nick $host $hand $chan $chan1 $reason
+	}
+}
+
+purge {
+if {[matchattr $hand -|M $chan]} {
+	set c [lindex [split $arg] 2]
+	set reason [join [lrange [split $arg] 2 end]]
+	set chan1 "$chan"
+if {[regexp {^[&#]} $c] && [matchattr $hand -|M $c]} {
+	set chan "$c"
+	set reason [join [lrange [split $arg] 3 end]]
+}
+if {$reason == ""} {
+	blacktools:tell $nick $host $hand $chan $chan1 purge.1 none
+	return
+}
+	purge:process $nick $host $hand $chan $chan1 $reason
+	}
+}
+
+broadcast {
+if {[matchattr $hand nm]} {
+	set text [join [lrange [split $arg] 2 end]]	
+	set chan1 "$chan"
+	set type 1
+	broadcast:cmd:process $nick $host $hand $chan $chan1 $text $type
+	}
+}
+
+act {
+if {[matchattr $hand nmo|MA $chan]} {
+	set text [join [lrange [split $arg] 2 end]]
+	set c [lindex [split $arg] 2]
+	set type 1
+	set chan1 "$chan"
+if {[regexp {^[&#]} $c] && [matchattr $hand nmo|AM $c]} {
+	set chan "$c"
+	set text [join [lrange [split $arg] 3 end]]
+}
+	act:process $nick $host $hand $chan $chan1 $text $type
+	}
+}
+
+say {
+if {[matchattr $hand nmo|MA $chan]} {
+	set text [join [lrange [split $arg] 2 end]]
+	set c [lindex [split $arg] 2]
+	set type 1
+	set chan1 "$chan"
+if {[regexp {^[&#]} $c] && [matchattr $hand nmo|MA $c]} {
+	set chan "$c"
+	set text [join [lrange [split $arg] 3 end]]
+}
+	say:process $nick $host $hand $chan $chan1 $text $type
+	}
+}
+
+v {
+if {[matchattr $hand nmo|VOMA $chan]} {
+	set voicex [join [lrange [split $arg] 2 end]]
+	set c [lindex [split $arg] 2]
+	set chan1 "$chan"
+if {[regexp {^[&#]} $c] && [matchattr $hand nmo|VOMA $c]} {
+	set chan "$c"
+	set voicex [join [lrange [split $arg] 3 end]]
+}
+	v:process $nick $host $hand $chan $chan1 $voicex
+	}
+}
+
+ho {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set hopex [join [lrange [split $arg] 2 end]]
+	set c [lindex [split $arg] 2]
+	set chan1 "$chan"
+if {[regexp {^[&#]} $c] && [matchattr $hand nmo|OMA $c]} {
+	set chan "$c"
+	set hopex [join [lrange [split $arg] 3 end]]
+		}
+	ho:process $nick $host $hand $chan $chan1 $hopex
+	}
+}
+
+o {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set opex [join [lrange [split $arg] 2 end]]
+	set c [lindex [split $arg] 2]
+	set chan1 "$chan"
+if {[regexp {^[&#]} $c] && [matchattr $hand nmo|OMA $c]} {
+	set chan "$c"
+	set opex [join [lrange [split $arg] 3 end]]
+		}
+	o:process $nick $host $hand $chan $chan1 $opex
+	}
+}
+
+uptime {
+if {[matchattr $hand nmo]} {
+	set cmd_status [btcmd:status $chan $hand "uptime" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
+if {[matchattr $hand q]} { blacktools:tell $nick $host $hand $chan $chan1 gl.glsuspend none
+	return
+}
+if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
+	return
+}
+if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
+	set chan1 "$chan"
+	set up [return_time_2 $getlang [expr [unixtime] - $uptime]]
+	set on [return_time_2 $getlang [expr [unixtime] - ${server-online}]]
+	catch {exec uptime} shelluptime
+	set file [open $black(uptime_file) "r"]
+	set data [read -nonewline $file]
+	close $file
+if {$data == ""} {
+	set read_maxup "-"
+	set read_maxon "-"
+} else {
+	set read_maxup [return_time_2 $getlang [lindex [split $data] 0]]
+	set read_maxon [return_time_2 $getlang [lindex [split $data] 1]]
+}
+	blacktools:tell $nick $host $hand $chan $chan1 maxup.1 "$up $read_maxup"
+	blacktools:tell $nick $host $hand $chan $chan1 maxon.1 "$on $read_maxon"
+	blacktools:tell $nick $host $hand $chan $chan1 uptime.2 $shelluptime
+	blacktools:tell $nick $host $hand $chan $chan1 uptime.3 $server
+	}
+}
+
+status {
+if {[matchattr $hand nmo|- $chan]} {
+	status:process $nick $host $hand $chan
+	}
+}
+
+t {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set topics [join [lrange [split $arg] 2 end]]
+	set type 1
+	set chan1 "$chan"
+if {[regexp {^[&#]} $topics] && [matchattr $hand nmo|OMA $topics]} {
+	set chan "$topics"	
+	set topics [join [lrange [split $arg] 3 end]]
+		}
+	t:process $nick $host $hand $chan $chan1 $topics $type
+	}
+}
+
+k {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set knick [lindex [split $arg] 2]
+	set type 1
+	set reason [join [lrange [split $arg] 3 end]]
+	set handle [nick2hand $knick]
+	set chan1 "$chan"
+if {[regexp {^[&#]} $knick] && [matchattr $hand nmo|MAO $knick]} {
+	set chan "$knick"
+	set knick [lindex [split $arg] 3]
+	set reason [join [lrange [split $arg] 4 end]]
+}
+if {$knick != ""} {
+	k:process $knick $nick $hand $host $reason $chan $chan1 $type
+		} else {k:process $knick $nick $hand $host $reason $chan $chan1 $type}
+	}
+}
+
+w {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set wnick [lindex [split $arg] 2]
+	set type 1
+	set handle [nick2hand $wnick]
+	set chan1 "$chan"
+if {[regexp {^[&#]} $wnick] && [matchattr $hand nmo|MAO $wnick]} {
+	set chan "$wnick"
+	set wnick [lindex [split $arg] 3]
+}
+if {$wnick != ""} {
+	w:process $wnick $nick $hand $host $chan $chan1 $type
+		} else { w:process $wnick $nick $hand $host $chan $chan1 $type }
+	}
+}
+
+ungag {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set gagger [lindex [split $arg] 2]
+	set type 0
+	set chan1 "$chan"
+if {[regexp {^[&#]} $gagger] && [matchattr $hand nmo|MAO $gagger]} {
+	set chan "$gagger"
+	set gagger [lindex [split $arg] 3]
+}
+if {$gagger != ""} {
+	ungag:process $gagger $nick $hand $host $chan $chan1 $type
+	} else { ungag:process $gagger $nick $hand $host $chan $chan1 $type }
+	}
+}
+
+gag {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set gagger [lindex [split $arg] 2]
+	set time [lindex [split $arg] 3]
+	set reason [join [lrange [split $arg] 4 end]]
+	set type 1
+	set handle [nick2hand $gagger]
+	set chan1 "$chan"
+	set return_time [time_return_minute $time]
+if {$return_time == "-1"} {
+	set reason [lrange [split $arg] 3 end]
+	set time [setting:get $chan gag-bantime]
+if {$time == ""} {
+	set time $black(gag:bantime)
+	}
+}
+if {[regexp {^[&#]} $gagger] && [matchattr $hand nmo|MAO $gagger]} {
+	set chan "$gagger"
+	set gagger [lindex [split $arg] 3]
+	set time [lindex [split $arg] 4]
+	set reason [join [lrange [split $arg] 5 end]]
+	set return_time [time_return_minute $time]
+if {$return_time == "-1"} {
+	set reason [lrange [split $arg] 4 end]
+	set time [setting:get $chan gag-bantime]
+if {$time == ""} {
+	set time $black(gag:bantime)
+		}
+	}
+}
+if {$gagger != ""} {
+	gag:process $gagger $time $reason $nick "$hand:GAG" $host $chan $chan1 $type
+	} else { gag:process $gagger $time $reason $nick $hand $host $chan $chan1 $type }
+	}
+}
+
+show {
+if {[matchattr $hand nmo|M $chan]} {
+	set wich [lindex [split $arg] 2]
+	set type 1
+	set chan1 "$chan"
+if {[regexp {^[&#]} $wich] && [matchattr $hand nmo|M $wich]} {
+	set chan "$wich"
+	set wich [lindex [split $arg] 3]	
+		}
+	show:process $nick $host $hand $chan $chan1 $wich $type
+	}
+}
+
+clonescan {
+if {[matchattr $hand nmo|MAO $chan]} {
+	set why [lindex [split $arg] 2]
+	set type 1
+if {[matchattr $hand nmo|M $chan] && ($why != "") && ![regexp {^[&#]} $why]} {
+	set chan1 "$chan"
+	set clone [join [lrange [split $arg] 3 end]]
+	set number [lindex [split $arg] 3]
+if {[regexp {^[&#]} $why]} {
+	set chan "$why"
+	set why [lindex [split $arg] 3]
+	set clone [join [lrange [split $arg] 4 end]]
+	set number [lindex [split $arg] 4]
+}
+	prot:module:process $nick $host $hand $chan $chan1 $why $clone $type $number "clonescan"
+	return
+}
+	set c [lindex [split $arg] 2]
+	set type 0
+	set chan1 "$chan"
+if {[regexp {^[&#]} $c] && [matchattr $hand nmo|M $c]} {
+	set chan "$c"
+}
+	scanner:process $nick $host $hand $chan $chan1 $type
+	}
+}
+
+topwords {
+if {[matchattr $hand nmo|AOMV $chan]} {
+	set next [lindex [split $arg] 2]
+	set cmd ""
+	set type 1
+	set chan1 "$chan"
+if {[string equal -nocase $next "reset"] && [matchattr $hand nmo|M $chan]} {
+	set cmd "reset"
+}
+if {[string equal -nocase $next "total"]} {
+	set next [lindex [split $arg] 3]
+	set cmd "total"
+}
+if {[string equal -nocase $next "add"] && [matchattr $hand nmo|M $next]} {
+	set next [lindex [split $arg] 3]
+	set cmd "add"
+}
+if {[string equal -nocase $next "del"] && [matchattr $hand nmo|M $next]} {
+	set next [lindex [split $arg] 3]
+	set cmd "del"
+}
+if {[regexp {^[&#]} $next] && [matchattr $hand nmo|MAOV $next]} {
+	set chan $next
+	set next [lindex [split $arg] 3]
+if {[string equal -nocase $next "reset"] && [matchattr $hand nmo|M $next]} {
+	set cmd "reset"
+}
+if {[string equal -nocase $next "total"]} {
+	set next [lindex [split $arg] 4]
+	set cmd "total"
+	}
+if {[string equal -nocase $next "add"] && [matchattr $hand nmo|M $next]} {
+	set next [lindex [split $arg] 4]
+	set cmd "add"
+	}
+if {[string equal -nocase $next "del"] && [matchattr $hand nmo|M $next]} {
+	set next [lindex [split $arg] 4]
+	set cmd "del"
+			}
+		}
+	topwords:process $nick $host $hand $chan $chan1 $cmd $type $next
+	}	
+}
+
+myset {
+if {[matchattr $hand nmo|VAOM $chan]} {
+	set type 1
+	set chan1 "$chan"	
+	set flags [lindex [split $arg] 2]
+	set typez [lindex [split $arg] 3]
+	set chan2 [lindex [split $arg] 4]
+	set arg [join [lrange [split $arg] 3 end]]
+	myset:process $nick $host $hand $chan $chan1 $flags $typez $type $chan2 $arg
+	}
+}
+
+timer {
+if {[matchattr $hand nm]} {
+	set chan1 $chan
+	set cmd [lindex [split $arg] 2]
+	set pid [lindex [split $arg] 3]
+	set timer_args [join [lrange [split $arg] 4 end]]
+	set type 1
+	timer:process $nick $host $hand $chan $chan1 $cmd $pid $timer_args $type
+	}
+}
+
+i {
+if {[matchattr $hand nmo|VAOM $chan]} {
+	set type 1
+	set chan1 "$chan"
+	set inick [lindex [split $arg] 2]
+if {[regexp {^[&#]} $inick] && [matchattr $hand nmo|VAOM $inick]} {
+	set chan "$inick"
+	set inick [lindex [split $arg] 3]
+}
+	i:process $nick $host $hand $chan $chan1 $inick $type
+	}
+}
+
+badword {
+if {[matchattr $hand nmo|M $chan]} {
+	set why [lindex [split $arg] 2]
+	set type 1
+	set chan1 "$chan"
+	set bdword [join [lrange [split $arg] 3 end]]
+	set bdnumber [lindex [split $arg] 3]
+if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
+	set chan "$why"
+	set why [lindex [split $arg] 3]
+	set bdnumber [lindex [split $arg] 4]
+	set bdword [join [lrange [split $arg] 4 end]]
+		}
+	antibadword:command:process $nick $host $hand $chan $chan1 $why $bdword $bdnumber $type
+	}
+}
+next {
+if {[matchattr $hand nmo|MAO $chan]} {
+	set option [lindex [split $arg] 2]
+	set chan1 $chan
+		nextpublic:process $nick $host $hand $chan $chan1 $option
+	}
+}
+
+helped {
+if {[matchattr $hand nmo|MAO $chan]} {
+	set user [lindex [split $arg] 2]
+	set chan1 $chan
+	set type 1
+	helpedpublic:process $nick $host $hand $chan $chan1 $user $type
+	}
+}
+
+noidle {
+if {[matchattr $hand nmo|MAO $chan]} {
+	set user [lindex [split $arg] 2]
+	set chan1 $chan
+	set type 1
+	noidlepublic:process $nick $host $hand $chan $chan1 $user $type
+	}
+}
+
+skip {
+if {[matchattr $hand nmo|MAO $chan]} {
+	set user [lindex [split $arg] 2]
+	set chan1 $chan
+	set type 1
+	skippublic:process $nick $host $hand $chan $chan1 $user	$type
+				}
+			}		
+		}
+	}
+}
+
+##############
+#########################################################################
+##   END                                                               ##
+#########################################################################

+ 2134 - 0
BlackTools2.5.1/BlackTools/Commands/BT.PrvCmds.tcl

@@ -0,0 +1,2134 @@
+#########################################################################
+##          BlackTools - The Ultimate Channel Control Script           ##
+##                    One TCL. One smart Eggdrop                       ##
+#########################################################################
+#######################   PRIVMSG CMDS TCL   ############################
+#########################################################################
+##						                       ##
+##     BlackTools  : http://blacktools.tclscripts.net	               ##
+##     Bugs report : http://www.tclscripts.net/	                       ##
+##     Online Help : irc://irc.undernet.org/tcl-help 	               ##
+##                   #TCL-HELP / UnderNet                              ##
+##                   You can ask in english or romanian                ##
+##					                               ##
+#########################################################################
+
+proc command:pubpriv {nick host hand arg} {
+	global black server uptime {server-online} botnick userfile
+	set cmd [lindex [split $arg] 0]
+	set chan [lindex [split $arg] 1]
+	set check_code [join [lrange [split $arg] 2 end]]
+	set chan1 $nick
+	set found_access 0
+	set mychan_use 0
+if {![regexp {^[&#]} $chan]} {
+if {[validuser $hand]} {
+	set mychan [join [string tolower [getuser $hand XTRA MYCHAN]]]
+if {[validchan $mychan] && [matchattr $hand nmo|OVMA $mychan] && ![string equal -nocase $cmd "unbanme"]} {
+	set chan [string tolower $mychan]
+	set mychan_use 1
+		}
+	}
+}
+
+switch [string tolower $cmd] {
+
+report {
+
+	set type 2
+	set what [lindex [split $arg] 2]
+	set message [join [lrange [split $arg] 3 end]]
+if {$mychan_use == "1"} {
+	set what [lindex [split $arg] 1]
+	set message [join [lrange [split $arg] 2 end]]
+}
+	set chan1 $chan
+if {[matchattr $hand mno|MAO $chan]} {
+	return
+}
+	report:process $nick "prv" $hand $chan $chan1 $type $what $message
+}
+
+idle {
+if {[matchattr $hand nmo|M $chan]} {
+	set type 2
+	set chan1 "$chan"	
+	set why [lindex [split $arg] 2]
+	set user [lindex [split $arg] 3]
+	set host [lindex [split $arg] 4]
+if {$mychan_use == "1"} {
+	set why [lindex [split $arg] 1]
+	set user [lindex [split $arg] 2]
+	set host [lindex [split $arg] 3]
+}
+	antidle:process $why $type $user "prv" $nick $hand $chan $chan1
+	}
+}
+
+
+link {
+if {[matchattr $hand nmo]} {
+	set type 2
+	set channels [join [lrange [split $arg] 1 end]]
+	set what [lindex [split $arg] 1]
+	set delchan [lindex [split $arg] 2]
+	set chan1 $chan
+	link:process $nick "prv" $hand $chan $chan1 $type $what $channels $delchan
+	}
+}
+
+note {
+	set found_access 0
+foreach c [channels] {
+if {[matchattr $hand nmo|MAOV $c]} {
+	set found_access 1
+	}
+}
+if {$found_access == "1"} {
+	set type 2
+	set chan1 $chan
+	set who [lindex [split $arg] 1]
+	set note [join [lrange [split $arg] 1 end]]
+	set number [lindex [split $arg] 2]
+	set user_send [lindex [split $arg] 2]
+	set note_send [join [lrange [split $arg] 3 end]]
+	note:process $nick "prv" $hand $chan $chan1 $who $note $user_send $note_send $number $type
+	}
+}
+
+q {
+if {[matchattr $hand nmo|MAOV $chan]} {
+if {$mychan_use == "1"} {
+	set who [lindex [split $arg] 1]
+	set next [lindex [split $arg] 2]
+	set quote [join [lrange [split $arg] 1 end]]
+if {$who == "*"} {
+	set who [lindex [split $arg] 2]
+	set quote [join [lrange [split $arg] 1 end]]
+}
+if {[regexp {^[\[]} $who]} {
+	set who [lindex [split $arg] 2]
+	set quote [join [lrange [split $arg] 1 end]]
+if {$who == "*"} {
+	set who [lindex [split $arg] 3]
+	set quote [join [lrange [split $arg] 1 end]]
+		}
+	}
+} else {
+	set who [lindex [split $arg] 2]
+	set next [lindex [split $arg] 3]
+	set quote [join [lrange [split $arg] 2 end]]
+if {$who == "*"} {
+	set who [lindex [split $arg] 3]
+	set quote [join [lrange [split $arg] 2 end]]
+}
+if {[regexp {^[\[]} $who]} {
+	set who [lindex [split $arg] 3]
+	set quote [join [lrange [split $arg] 2 end]]
+if {$who == "*"} {
+	set who [lindex [split $arg] 4]
+	set quote [join [lrange [split $arg] 2 end]]
+		}
+	}
+}
+	set type 2
+	set chan1 $chan
+if {$mychan_use == "1"} {
+	quote:process $nick "prv" $hand $chan $chan1 $type $who $quote [lrange [split $arg] 1 end] $next
+	} else {
+	quote:process $nick "prv" $hand $chan $chan1 $type $who $quote [lrange [split $arg] 2 end] $next
+		}
+	}
+}
+
+check {
+if {![validchan $chan]} {
+	return
+}
+if {[setting:get $chan securemode] == "0"} {
+	return
+}
+if {![botisop $chan] && ![setting:get $chan xonly]} {
+	return
+}
+	
+if {![info exists black(securecode:$nick:$chan)]} {
+	return
+}
+	set chanmode [getchanmode $chan]
+if {[string match -nocase "*D*" $chanmode] && [string match -nocase "*m*" $chanmode]} {
+if {[string equal -nocase $check_code $black(securecode:$nick:$chan)]} {
+		set lang [setting:get $chan lang]
+if {$lang == ""} { set lang [string tolower $black(default_lang)] }
+if {[setting:get $chan xonly]} {
+	putserv "PRIVMSG $black(chanserv) :voice $nick $chan"
+	set replace(%chan%) $chan
+	set replace(%msg.1%) $nick
+	set message [string map [array get replace] $black(say.$lang.securemode.2)]
+	putserv "PRIVMSG $nick :$message"
+if {[info exists black(secure:$chan:allowlist)]} {
+if {[lsearch -exact [string tolower $black(secure:$chan:allowlist)]  [string tolower $host]] < 0} {
+	lappend black(secure:$chan:allowlist) $host
+	}
+} else { lappend black(secure:$chan:allowlist) $host }
+		} else {
+	putserv "MODE $chan +v $nick"
+	set replace(%chan%) $chan
+	set replace(%msg.1%) $nick
+	set message [string map [array get replace] $black(say.$lang.securemode.2)]
+	putserv "PRIVMSG $nick :$message"
+if {[info exists black(secure:$chan:allowlist)]} {
+if {[lsearch -exact [string tolower $black(secure:$chan:allowlist)]  [string tolower $host]] < 0} {
+	lappend black(secure:$chan:allowlist) $host
+						}
+					} else { lappend black(secure:$chan:allowlist) $host }
+if {[info exists black(securecode:$nick:$chan)]} {
+	unset black(securecode:$nick:$chan)
+				}
+if {[lsearch -exact [string tolower $black(secure:$chan:list)]  [string tolower $nick]] > -1} {
+	set position [lsearch -exact [string tolower $black(secure:$chan:list)] [string tolower $nick]]
+	set black(secure:$chan:list) [lreplace $black(secure:$chan:list) $position $position]
+				}
+			}
+		}
+	}
+}
+
+voiceme {
+if {![validchan $chan]} {
+	return
+}
+if {[setting:get $chan voiceme]} {
+
+if {![botisop $chan] && ![setting:get $chan xonly]} {
+	return
+}
+if {![onchan $nick $chan]} {
+	return
+}
+
+if {[isop $nick $chan] || [isvoice $nick $chan]} {
+	return
+}
+
+if {[setting:get $chan onlyonmode] && ![info exists black(voiceme:stat:$chan)]} {
+	return
+}
+if {[isvoice $nick $chan]} {
+	blacktools:tell $nick "prv" $hand $chan $chan1 voiceme.4 none
+	return
+}
+
+if {[setting:get $chan nologged]} {
+		set code [join [lrange [split $arg] 2 end]]
+if {$code == ""} {
+	set black(voicemecode:$chan) [string toupper [bot:setcode]]
+	blacktools:tell $nick "prv" $hand $chan $chan1 voiceme.5 $black(voicemecode:$chan)
+foreach tmr [utimers] {
+if {[string match "*unset black(voicemecode:$chan)*" [join [lindex $tmr 1]]]} {
+	killutimer [lindex $tmr 2]
+			}	
+		}
+	utimer 60 [list unset black(voicemecode:$chan)]
+	return
+}
+
+if {![info exists black(voicemecode:$chan)]} {
+	return
+}
+
+if {[string equal -nocase $code $black(voicemecode:$chan)]} {
+if {[setting:get $chan xonly] && [onchan $black(chanserv) $chan]} {	
+	putserv "PRIVMSG $black(chanserv) :voice $chan $nick"
+	blacktools:tell $nick "prv" $hand $chan $chan1 voiceme.3 none
+		} else {
+	putserv "MODE $chan +v $nick"
+	blacktools:tell $nick "prv" $hand $chan $chan1 voiceme.3 none
+		}
+	}
+} else {
+	putserv "WHOIS $nick"
+	set ::vnick $nick
+	set ::vchan $chan
+	set ::vhand $hand
+	set ::vhost $host
+	bind RAW - 330 voiceme:logged
+	bind RAW - 307 voiceme:identified
+		}
+	}
+}
+
+unbanme {
+
+if {![regexp {^[&#]} $chan]} {
+	return
+}
+
+if {![validchan $chan]} {
+	return
+}
+if {![botisop $chan] && ![setting:get $chan xonly]} {
+	return
+}
+	set found_ban 0
+foreach b [blacktools:banlist $chan] {
+	set read_chan [lindex [split $b] 2]
+if {[string equal -nocase $read_chan $chan]} {
+	set read_host [lindex [split $b] 3]
+	set real_read_host [string map [list \[ {\[} \] {\]} \? {\?} \\ {\\}] $read_host]
+if {[string match -nocase $real_read_host "$nick!$host"] || [string match -nocase "$nick!$host" $real_read_host]} {
+	set read_bot [lindex [split $b] 7]
+if {$read_bot == 3} {
+	set found_ban 1
+			}
+		}
+	}
+}
+
+if {$found_ban == "0"} {
+	return
+}
+	set code [join [lrange [split $arg] 2 end]]
+
+if {$code == ""} {
+	set black(botcode:$chan) [string toupper [bot:setcode]]
+	blacktools:tell $nick "prv" $hand $chan $chan1 bot.6 $black(botcode:$chan)
+foreach tmr [utimers] {
+if {[string match "*unset black(botcode:$chan)*" [join [lindex $tmr 1]]]} {
+	killutimer [lindex $tmr 2]
+			}	
+		}
+	utimer 60 [list unset black(botcode:$chan)]
+	return
+}
+
+if {![info exists black(botcode:$chan)]} {
+	return
+}
+if {[string equal -nocase $code $black(botcode:$chan)]} {
+foreach b [blacktools:banlist $chan] {
+	set read_chan [lindex [split $b] 2]
+	set read_host [lindex [split $b] 3]
+	set real_read_host [string map [list \[ {\[} \] {\]} \? {\?} \\ {\\}] $read_host]
+if {[string match -nocase $real_read_host "$nick!$host"]} {
+	set read_bot [lindex [split $b] 7]
+if {$read_bot == 3} {
+if {[ischanban $read_host $chan] && [botisop $chan]} {
+	pushmode $chan -b $read_host
+							}
+if {[setting:get $chan xonly] || [setting:get $chan xtools]} {
+	putquick "PRIVMSG $black(chanserv) :unban $chan $read_host"
+						}
+	blacktools:auto:remove $read_host $chan
+	blacktools:tell $nick "prv" $hand $chan $chan1 bot.7 none
+				}
+			}
+		}
+	}
+}
+
+enable {
+if {[matchattr $hand nmo|M $chan]} {
+	set what [lindex [split $arg] 2]
+	set user [lindex [split $arg] 3]
+if {$mychan_use == "1"} {
+	set what [lindex [split $arg] 1]
+	set user [lindex [split $arg] 2]
+}
+	set chan1 "$chan"
+	set type "2"
+	enable:process $nick "prv" $hand $chan $chan1 $type $what $user
+	}
+}
+
+disable {
+if {[matchattr $hand nmo|M $chan]} {
+	set what [lindex [split $arg] 2]
+	set user [lindex [split $arg] 3]
+if {$mychan_use == "1"} {
+	set what [lindex [split $arg] 1]
+	set user [lindex [split $arg] 2]
+}
+	set chan1 "$chan"
+	set type "2"
+	disable:process $nick "prv" $hand $chan $chan1 $type $what $user
+	}
+}
+
+dr {
+if {[matchattr $hand nmo|OSMA $chan]} {
+	set drone [lindex [split $arg] 2]
+if {$mychan_use == "1"} {
+	set drone [lindex [split $arg] 1]
+}
+	set type 2
+	set chan1 "$chan"
+	userhost:act $drone $nick $hand "prv" $chan $chan1 $type $black(dr:bantime) "dr" "" "0"
+	}
+}
+
+bot {
+if {[matchattr $hand nmo|OSMA $chan]} {
+	set bot [lindex [split $arg] 2]
+if {$mychan_use == "1"} {
+	set bot [lindex [split $arg] 1]
+}
+	set type 2
+	set chan1 "$chan"
+	userhost:act $bot $nick "$hand:bot" "prv" $chan $chan1 $type $black(bot:bantime) "bot" "" "0"
+	}
+}
+
+n {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set badnick [lindex [split $arg] 2]
+if {$mychan_use == "1"} {
+	set badnick [lindex [split $arg] 1]
+}
+	set type 0
+	set chan1 "$chan"
+	
+if {[setting:get $chan nextshortcmd]} {
+	nextpublic:process $nick "prv" $hand $chan $chan1 $badnick
+	return
+}
+
+if {[regexp {\*} $badnick]} {
+	blacktools:tell $nick "prv" $hand $chan $chan1 gl.instr_priv "n"
+	return
+}
+if {$badnick == ""} {
+	blacktools:tell $nick "prv" $hand $chan $chan1 gl.instr_priv "n"
+	return
+		}
+	bancmds:process $badnick $badnick $nick $hand "prv" $chan $chan1 $type $black(n:bantime) "n" "" "0"
+	}
+}
+
+id {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set badident [lindex [split $arg] 2]
+if {$mychan_use == "1"} {
+	set badident [lindex [split $arg] 1]
+}
+	set handle [nick2hand $badident]
+	set type 2
+	set chan1 "$chan"
+	userhost:act $badident $nick $hand "prv" $chan $chan1 $type $black(id:bantime) "id" "" "0"
+	}
+}
+
+spam {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set spammer [lindex [split $arg] 2]
+if {$mychan_use == "1"} {
+	set spammer [lindex [split $arg] 1]
+}
+	set type 2
+	set chan1 "$chan"
+	userhost:act $spammer $nick $hand "prv" $chan $chan1 $type $black(spam:bantime) "spam" "" "0"
+	}
+}
+
+
+bw {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set badw [lindex [split $arg] 2]
+if {$mychan_use == "1"} {
+	set badw [lindex [split $arg] 1]
+}
+	set type 2
+	set chan1 "$chan"
+	userhost:act $badw $nick $hand "prv" $chan $chan1 $type $black(bw:bantime) "bw" "" "0"
+	}
+}
+
+mb {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set badd [lindex [split $arg] 2]
+	set reason [join [lrange [split $arg] 3 end]]
+if {$mychan_use == "1"} {
+	set badd [lindex [split $arg] 1]
+	set reason [join [lrange [split $arg] 2 end]]
+}
+	set type 2
+	set chan1 "$chan"
+	userhost:act $badd $nick $hand "prv" $chan $chan1 $type $black(mb:bantime) "mb" $reason "0"
+	}
+}
+
+black {
+if {[matchattr $hand nmo|MA $chan]} {
+	set blackb [lindex [split $arg] 2]
+	set reason [join [lrange [split $arg] 3 end]]
+if {$mychan_use == "1"} {
+	set blackb [lindex [split $arg] 1]
+	set reason [join [lrange [split $arg] 2 end]]
+}
+	set type 2
+	set chan1 "$chan"
+	userhost:act $blackb $nick $hand "prv" $chan $chan1 $type "0" "black" $reason "0"
+	}
+}
+
+bl {
+if {[matchattr $hand nmo|MA $chan]} {
+	set blackb [lindex [split $arg] 2]
+	set reason [join [lrange [split $arg] 3 end]]
+if {$mychan_use == "1"} {
+	set blackb [lindex [split $arg] 1]
+	set reason [join [lrange [split $arg] 2 end]]
+}
+	set type 2
+	set chan1 "$chan"
+	userhost:act $blackb $nick $hand "prv" $chan $chan1 $type "0" "black" $reason "0"
+	}
+}
+
+b {
+if {[matchattr $hand nmo|MAO $chan]} {
+	set no_chan 0
+	set type 2
+	set gl 0
+	set link 0
+	set chan1 "$chan"
+	set level ""
+	set b [lindex [split $arg] 2]
+	set tm [lindex [split $arg] 3]
+	set global [lindex [split $arg] 4]
+	set reason [join [lrange [split $arg] 5 end]]
+	set return_time [time_return_minute $tm]
+if {$return_time == "-1"} {
+	set global [lindex [split $arg] 3]
+	set reason [join [lrange [split $arg] 4 end]]
+}
+if {![regexp {^[&#]} $chan]} {
+	set no_chan 1
+	set b [lindex [split $arg] 1]
+	set tm [lindex [split $arg] 2]
+	set global [lindex [split $arg] 3]
+	set reason [join [lrange [split $arg] 4 end]]
+	set return_time [time_return_minute $tm]
+if {$return_time == "-1"} {
+	set global [lindex [split $arg] 2]
+	set reason [join [lrange [split $arg] 3 end]]
+	}	
+}
+if {$mychan_use == "1"} {
+	set b [lindex [split $arg] 1]
+	set tm [lindex [split $arg] 2]
+	set global [lindex [split $arg] 3]
+	set reason [join [lrange [split $arg] 4 end]]
+	set return_time [time_return_minute $tm]
+if {$return_time == "-1"} {
+	set global [lindex [split $arg] 2]
+	set reason [join [lrange [split $arg] 3 end]]
+}
+if {[regexp {^[-]} $tm]} {
+	set level [blacktools:check:levelban $hand $chan $tm]
+	set reason [join [lrange [split $arg] 4 end]]
+	set tm [lindex [split $arg] 3]
+	set return_time [time_return_minute $tm]
+if {$return_time == "-1"} {
+	set tm [lindex [split $arg] 2]
+	set reason [join [lrange [split $arg] 3 end]]
+		} 
+} elseif {[string equal -nocase "$global" "global"] && [matchattr $hand nm]} {
+	set gl 1
+	set tm [lindex [split $arg] 2]
+	set reason [join [lrange [split $arg] 4 end]]
+	set return_time [time_return_minute $tm]
+if {$return_time == "-1"} {
+	set reason [join [lrange [split $arg] 3 end]]
+			} 
+} elseif {[string equal -nocase "$global" "link"] && [matchattr $hand nm]} {
+	set link 1
+	set tm [lindex [split $arg] 2]
+	set reason [join [lrange [split $arg] 4 end]]
+	set return_time [time_return_minute $tm]
+if {$return_time == "-1"} {
+	set reason [join [lrange [split $arg] 3 end]]
+			}
+if {$no_chan == "1"} {
+	set b [lindex [split $arg] 1]
+	set tm [lindex [split $arg] 2]
+	set global [lindex [split $arg] 3]
+	set reason [join [lrange [split $arg] 4 end]]
+	set return_time [time_return_minute $tm]
+if {$return_time == "-1"} {
+	set global [lindex [split $arg] 2]
+	set reason [join [lrange [split $arg] 3 end]]
+			}
+		}				
+	} else {
+if {$return_time == "-1"} {
+	set reason [join [lrange [split $arg] 2 end]]
+	} else {
+	set reason [join [lrange [split $arg] 3 end]]
+		}
+	}
+} else {
+if {[regexp {^[-]} $tm]} {
+	set level [blacktools:check:levelban $hand $chan $tm]
+	set reason [join [lrange [split $arg] 5 end]]
+	set tm [lindex [split $arg] 4]
+	set return_time [time_return_minute $tm]
+if {$return_time == "-1"} {
+	set tm [lindex [split $arg] 3]
+	set reason [join [lrange [split $arg] 4 end]]
+		} 
+} elseif {[string equal -nocase "$global" "global"] && [matchattr $hand nm]} {
+	set gl 1
+	set tm [lindex [split $arg] 3]
+	set reason [join [lrange [split $arg] 5 end]]
+	set return_time [time_return_minute $tm]
+if {$return_time == "-1"} {
+	set reason [join [lrange [split $arg] 4 end]]
+			}
+if {$no_chan == "1"} {
+	set b [lindex [split $arg] 1]
+	set tm [lindex [split $arg] 2]
+	set global [lindex [split $arg] 3]
+	set reason [join [lrange [split $arg] 4 end]]
+	set return_time [time_return_minute $tm]
+if {$return_time == "-1"} {
+	set global [lindex [split $arg] 2]
+	set reason [join [lrange [split $arg] 3 end]]
+		}
+	}			
+} elseif {[string equal -nocase "$global" "link"] && [matchattr $hand nm]} {
+	set link 1
+	set tm [lindex [split $arg] 3]
+	set reason [join [lrange [split $arg] 5 end]]
+	set return_time [time_return_minute $tm]
+if {$return_time == "-1"} {
+	set reason [join [lrange [split $arg] 4 end]]
+			}
+if {$no_chan == "1"} {
+	set b [lindex [split $arg] 1]
+	set tm [lindex [split $arg] 2]
+	set global [lindex [split $arg] 3]
+	set reason [join [lrange [split $arg] 4 end]]
+	set return_time [time_return_minute $tm]
+if {$return_time == "-1"} {
+	set global [lindex [split $arg] 2]
+	set reason [join [lrange [split $arg] 3 end]]
+			}
+		}				
+	} else {
+if {$return_time == "-1"} {
+	set reason [join [lrange [split $arg] 3 end]]
+	} else {
+	set reason [join [lrange [split $arg] 4 end]]
+		}
+	}
+}
+	
+if {[setting:get $chan nextshortcmd]} {
+	noidlepublic:process $nick "prv" $hand $chan $chan1 $b 0
+	return
+}
+
+if {($return_time > "20160" || $return_time == "0")  && [matchattr $hand -|OS $b]} {
+	blacktools:tell $nick "prv" $hand $chan $chan1 b.6 none
+	return
+}
+if {$return_time == "-1"} {
+	set return_time $black(b:bantime)
+}
+if {[llength $level] > "1"} {
+	blacktools:tell $nick "prv" $hand $chan $chan1 gl.invalidlevel [string map {"0" ""} $level]
+	return
+}
+	
+if {$level != ""} {
+	userhost:act $b $nick "$hand:$level" "prv" $chan $chan1 $type $return_time "b" $reason $gl
+} else {
+if {$link == "1"} {
+	foreach c [link:get] {
+	userhost:act $b $nick "$hand" "prv" $c $chan1 $type $return_time "b" $reason "2"
+	}
+	return
+}
+	userhost:act $b $nick "$hand" "prv" $chan $chan1 $type $return_time "b" $reason $gl
+		}
+	}
+}
+
+stick {
+if {[matchattr $hand nmo|M $chan]} {
+	set stickb [lindex [split $arg] 2]
+	set tm [lindex [split $arg] 3]
+if {$mychan_use == "1"} {
+	set stickb [lindex [split $arg] 1]
+	set tm [lindex [split $arg] 2]
+}
+	set return_time [time_return_minute $tm]
+if {$return_time == "-1"} {
+	set reason [join [lrange [split $arg] 3 end]]
+if {$mychan_use == "1"} {
+	set reason [join [lrange [split $arg] 2 end]]
+	}
+} else {
+	set tm [lindex [split $arg] 4]
+	set reason [join [lrange [split $arg] 4 end]]
+if {$mychan_use == "1"} {
+	set tm [lindex [split $arg] 3]
+	set reason [join [lrange [split $arg] 3 end]]
+	}
+}
+	set type 2
+	set chan1 "$chan"
+if {($return_time > "20160" || $return_time == "0")  && [matchattr $hand -|OS $stickb]} {
+	blacktools:tell $nick "prv" $hand $chan $chan1 b.6 none
+	return
+}
+
+if {$return_time == "-1"} {
+	set return_time $black(stick:bantime)
+}
+	userhost:act $stickb $nick $hand "prv" $chan $chan1 $type $return_time "stick" $reason "0"
+	}
+}
+
+ub {
+if {[matchattr $hand nmo|MAO $chan]} {
+	set ban [lindex [split $arg] 1]
+	set why [lindex [split $arg] 2]
+if {[regexp {^[&#]} $ban]} { 
+	set ban [lindex [split $arg] 2]
+	set why [lindex [split $arg] 3]
+}
+	set type 2
+	set chan1 "$chan"
+if {[regexp {^[0-9]} $ban]} {
+	set cmd "ub:id"
+} else {
+	set cmd "ub"
+}
+if {[string equal -nocase $why "global"] && [matchattr $hand nm]} {
+	ub:process $ban $ban $nick $hand "prv" $chan $chan1 $type "1" $cmd "" ""
+} elseif {[string equal -nocase $why "link"] && [matchattr $hand nm]} {
+	ub:process $ban $ban $nick $hand "prv" $chan $chan1 $type "" "ub" "" "1"
+} else {
+	ub:process $ban $ban $nick $hand "prv" $chan $chan1 $type "" $cmd "" ""
+		}
+	}
+}
+
+k {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set knick [lindex [split $arg] 2]
+	set type 2
+	set reason [join [lrange [split $arg] 3 end]]
+if {$mychan_use == "1"} {
+	set knick [lindex [split $arg] 1]
+	set reason [join [lrange [split $arg] 2 end]]
+}
+	set handle [nick2hand $knick]
+	set chan1 "$chan"
+if {$knick != ""} {
+	k:process $knick $nick $hand "prv" $reason $chan $chan1 $type
+		} else {k:process $knick $nick $hand "prv" $reason $chan $chan1 $type}
+	}
+}
+
+w {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set wnick [lindex [split $arg] 2]
+if {$mychan_use == "1"} {
+	set wnick [lindex [split $arg] 1]
+}
+	set type 2
+	set handle [nick2hand $wnick]
+	set chan1 "$chan"
+if {$wnick != ""} {
+	w:process $wnick $nick $hand "prv" $chan $chan1 $type
+		} else { w:process $wnick $nick $hand "prv" $chan $chan1 $type }
+	}
+}
+
+ungag {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set gagger [lindex [split $arg] 2]
+if {$mychan_use == "1"} {
+	set gagger [lindex [split $arg] 1]
+}
+	set type 2
+	set chan1 "$chan"
+if {$gagger != ""} {
+	ungag:process $gagger $nick $hand "prv" $chan $chan1 $type
+	} else { ungag:process $gagger $nick $hand "prv" $chan $chan1 $type }
+	}
+}
+
+gag {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set gagger [lindex [split $arg] 2]
+	set time [lindex [split $arg] 3]
+	set reason [join [lrange [split $arg] 4 end]]
+if {$mychan_use == "1"} {
+	set gagger [lindex [split $arg] 1]
+	set time [lindex [split $arg] 2]
+	set reason [join [lrange [split $arg] 3 end]]
+}
+	set type 2
+	set handle [nick2hand $gagger]
+	set chan1 "$chan"
+	set return_time [time_return_minute $time]
+if {$return_time == "-1"} {
+	set reason [join [lrange [split $arg] 3 end]]
+	set time [setting:get $chan gag-bantime]
+if {$time == ""} {
+	set time $black(gag:bantime)
+	}
+}
+
+if {$gagger != ""} {
+	gag:process $gagger $time $reason $nick "$hand:GAG" "prv" $chan $chan1 $type
+		} else { gag:process $gagger $time $reason $nick $hand "prv" $chan $chan1 $type }
+	}
+}
+
+show {
+if {[matchattr $hand nmo|M $chan]} {
+	set wich [lindex [split $arg] 2]
+if {$mychan_use == "1"} {
+	set wich [lindex [split $arg] 1]
+}
+	set type 2
+	set chan1 "$chan"
+	show:process $nick "prv" $hand $chan $chan1 $wich $type
+	}
+}
+
+clonescan {
+if {[matchattr $hand nmo|MA $chan]} {
+	set why [lindex [split $arg] 2]
+	set type 2
+	set chan1 "$chan"
+if {[regexp {^[&#]} $chan] && [matchattr $hand nmo|M $chan] && ($why != "")} {
+	set chan1 "$chan"
+	set clone [join [lrange [split $arg] 3 end]]
+	set number [lindex [split $arg] 3]
+	prot:module:process $nick "prv" $hand $chan $chan1 $chan $clone $type $number "clonescan"
+	return
+		}
+	scanner:process $nick "prv" $hand $chan $chan1 $type
+	}
+}
+
+sb {
+if {[matchattr $hand nmo|MAO $chan]} {
+	set bhost [lindex [split $arg] 2]
+	set what [lindex [split $arg] 3]
+if {$mychan_use == "1"} {
+	set bhost [lindex [split $arg] 1]
+	set what [lindex [split $arg] 2]
+}
+	set type 2
+	set chan1 "$chan"
+if {$bhost != ""} {
+if {[regexp {^[0-9]} $bhost]} {
+	sb:process $bhost $what $nick $hand "prv" $chan $chan1 $type "sb" "2"
+	return
+}
+if {![validchan $chan]} {
+	blacktools:tell $nick "prv" $hand $chan $chan1 gl.novalidchan none
+	return
+}
+if {[onchan $bhost $chan]} {
+	set bhost "$bhost![getchanhost $bhost $chan]"
+	sb:process $bhost $what $nick $hand "prv" $chan $chan1 $type "sb" "1"
+	return
+}
+
+if {[regexp {\*} $bhost]} {
+	sb:process $bhost $what $nick $hand "prv" $chan $chan1 $type "sb" "1"
+	return
+}
+	sb:process $bhost $what $nick $hand "prv" $chan $chan1 $type "sb" ""
+
+		} else { sb:process $bhost $what $nick $hand "prv" $chan $chan1 $type "sb" ""}
+	}
+}
+
+banlist {
+if {[matchattr $hand nmo|AOM $chan]} {
+	set user [lindex [split $arg] 2]
+	set next [lindex [split $arg] 3]
+if {$mychan_use == "1"} {
+	set user [lindex [split $arg] 1]
+	set next [lindex [split $arg] 2]
+}
+if {[string equal -nocase $chan "global"]} {
+	set user $chan
+}
+	set type 2
+	set chan1 "$chan"
+	banlist:process $nick "prv" $hand $chan $chan1 $user $type "banlist" $next
+	}
+}
+
+r {
+if {[matchattr $hand nmo|MAO $chan]} {
+	set c [lindex [split $arg] 1]
+	set chan1 $chan
+if {$c != "" && [matchattr $hand nmo|AMO $c]} {
+	topic:refresh $nick "prv" $hand $c $chan1 $arg
+	return
+}
+	topic:refresh $nick "prv" $hand $chan $chan1 $arg
+	}
+}
+
+egg {
+if {[matchattr $hand nm]} {
+	set why [lindex [split $arg] 1]
+	set type2 2
+	set result [join [lrange [split $arg] 2 end]]
+	egg:process $why $type2 $result $nick $hand "prv" $chan $chan1
+	}
+}
+
+man {
+if {[matchattr $hand nmo|MASOV $chan]} {
+	set command [lindex [split $arg] 1]
+	set type 0
+	man:process $nick $host $hand $chan $chan1 $type $command
+	}
+}
+
+auto {
+if {[matchattr $hand nmo|MA $chan]} {
+	set type 0
+	set option [lindex [split $arg] 2]
+	set user [lindex [split $arg] 3]
+	set gl [lindex [split $arg] 4]
+if {$mychan_use == "1"} {
+	set option [lindex [split $arg] 1]
+	set user [lindex [split $arg] 2]
+	set gl [lindex [split $arg] 3]
+}
+	auto:process $nick "prv" $hand $chan $chan1 $user $option $gl $type 
+	}
+}
+
+version {
+if {[matchattr $hand nmo|MASOV $chan]} {
+	version:process $nick $host $hand $chan $chan1
+	}
+}
+
+seen {
+if {[matchattr $hand nmo|MAOV $chan]} {
+	set type 2
+if {[matchattr $hand nmo]} {
+	set s [lindex [split $arg] 1]
+if {[regexp {^[&#]} $s]} {
+	set s [lindex [split $arg] 2]
+	}
+		} else {
+if {![regexp {^[&#]} $chan]} {
+	blacktools:tell $nick "prv" $hand $chan $chan1 gl.instr_priv "seen"
+	return
+}
+	set s [lindex [split $arg] 2]
+if {$mychan_use == "1"} {
+	set s [lindex [split $arg] 1]
+	}
+}
+	seen:process $nick "$host:prv" $hand $chan $chan1 $s $type
+	}
+}
+
+channels {
+if {[matchattr $hand nmo]} {
+	set chan1 "$nick"
+	channels:process $nick "prv" $hand $chan $chan1
+	}
+}
+
+userlist {
+if {[matchattr $hand nmo|MAOV $chan]} {
+	set type 2
+	set chan1 $nick
+	set level [lindex [split $arg] 2]
+if {$mychan_use == "1"} {
+	set level [lindex [split $arg] 1]
+}
+if {[string equal -nocase $chan "owner"] && [matchattr $hand nmo]} {
+	userlist:execute $hand "prv" $chan $chan $chan1 $nick $type
+	return
+}
+	userlist:execute $hand "prv" $level $chan $chan1 $nick $type
+	}
+}
+
+chuser {
+if {[matchattr $hand nmo|M $chan]} {
+	set user [lindex [split $arg] 1]
+	set chandle [lindex [split $arg] 2]
+	set type 2
+	set chan1 "$nick"
+	chuser:process $nick "prv" $hand $chan $chan1 $user $chandle $type
+	}
+}
+
+securemode {
+if {[matchattr $hand nmo|M $chan]} {
+	set type 2
+	set chan1 "$chan"
+	set why [lindex [split $arg] 2]
+	set except [join [lrange [split $arg] 3 end]]
+	set number [lindex [split $arg] 3]
+if {$mychan_use == "1"} {
+	set why [lindex [split $arg] 1]
+	set except [join [lrange [split $arg] 2 end]]
+	set number [lindex [split $arg] 2]
+		}
+	prot:module:process $nick "prv" $hand $chan $chan1 $why $except $type $number "securemode"
+	}
+}
+
+delhost {
+if {[matchattr $hand nmo|MA $chan]} {
+	set user [lindex [split $arg] 1]
+	set type 2
+	set chan1 "$chan"
+	set hosts [join [lrange [split $arg] 2 end]]
+	delhost:process $nick "prv" $hand $chan $chan1 $user $hosts $type
+	}
+}
+
+addhost {
+if {[matchattr $hand nmo|MA $chan]} {
+	set type 2
+	set chan1 "$chan"
+	set user [lindex [split $arg] 1]
+	set hosts [join [lrange [split $arg] 2 end]]
+	addhost:process $nick "prv" $hand $chan $chan1 $user $hosts $type
+	}
+}
+
+del {
+if {[matchattr $hand nmo|M $chan]} {
+	set args [lrange [split $arg] 1 end]
+	set type 2
+	set chan1 "$chan"
+	del:process $nick "prv" $hand $chan $chan1 $args $type
+	}
+}
+
+delacc {
+if {[matchattr $hand nmo|MA $chan]} {
+	set args [lrange [split $arg] 2 end]
+if {$mychan_use == "1"} {
+	set args [lrange [split $arg] 1 end]
+}
+	set type 2
+	set chan1 "$chan"
+foreach user $args {
+	delacc:process $nick "prv" $hand $chan $chan1 $user $type
+		}
+	}
+}
+
+
+add {
+if {[matchattr $hand nmo|MA $chan]} {
+	set level [lindex [split $arg] 2]
+	set type 2
+	set args [lrange [split $arg] 3 end]
+	set c [lindex [split $arg] 3]
+if {$mychan_use == "1"} {
+	set level [lindex [split $arg] 1]
+	set args [lrange [split $arg] 2 end]
+	set c [lindex [split $arg] 2]
+}
+	set chan1 "$chan"
+	set handle ""
+	set uhost ""
+if {$args != ""} {
+foreach user $args {
+if {$user != ""} {
+if {![regexp  {^[a-zA-Z0-9]} $user]} {
+	blacktools:tell $nick "prv" $hand $chan $chan1 add.18 none
+	continue
+}
+	add:process $user $uhost $handle $level $hand "prv" $chan $chan1 $nick $type "add"
+				}
+			}
+		} else {  add:process "" $uhost $handle $level $hand "prv" $chan $chan1 $nick $type "add" }	
+	}
+}
+
+adduser {
+if {[matchattr $hand nmo|MA $chan]} {
+	set level [lindex [split $arg] 2]
+	set args [lrange [split $arg] 3 end]
+	set c [lindex [split $arg] 3]
+if {$mychan_use == "1"} {
+	set level [lindex [split $arg] 1]
+	set args [lrange [split $arg] 2 end]
+	set c [lindex [split $arg] 2]
+}
+	set type 2
+	set chan1 "$chan"
+if {![validchan $chan]} {
+	blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
+	return
+}
+if {$args != ""} {
+foreach user $args {
+if {$user != ""} {
+	set handle [nick2hand $user]
+if {![onchan $user $chan] && ![validuser $user]} { 
+	blacktools:tell $nick "prv" $hand $chan $chan1 gl.usernotonchan $user
+	return
+}
+	set hosts [getchanhost $user $chan]
+	set uhost [return_mask $black(addusermask) $hosts $user]
+	add:process $user $uhost $handle $level $hand "prv" $chan $chan1 $nick $type "adduser"
+				}
+			}
+		} else { add:process "" "" "" $level $hand "prv" $chan $chan1 $nick $type "adduser" }
+	}
+}
+
+suspend {
+if {[matchattr $hand nmo]} {
+	set reason [join [lrange [split $arg] 2 end]]
+	set cmd_status [btcmd:status $chan $hand "suspend" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set chan1 "$chan"
+if {$chan == ""} {blacktools:tell $nick "prv" $hand $chan $chan1 gl.instr_priv "suspend"
+	return
+}
+if {![regexp {^[&#]} $chan]} {
+	blacktools:tell $nick "prv" $hand $chan $chan1 gl.novalidchan none
+	return
+}
+if {![validchan $chan]} { blacktools:tell $nick "prv" $hand $chan $chan1 gl.novalidchan none
+	return
+}
+
+if {[channel get $chan inactive]} {
+	blacktools:tell $nick "prv" $hand $chan $chan1 suspend.3 $chan
+	return
+}
+	channel set $chan +inactive
+if {$reason == ""} { set reason "N/A" }
+	suspendchan:note $hand $chan $reason
+	blacktools:tell $nick "prv" $hand $chan $chan1 suspend.4 $chan
+	}
+}
+
+unsuspend {
+if {[matchattr $hand nmo]} {
+	set cmd_status [btcmd:status $chan $hand "unsuspend" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set chan1 "$chan"
+if {$chan == ""} {blacktools:tell $nick "prv" $hand $chan $chan1 gl.instr_priv "unsuspend"
+	return
+}
+
+if {![regexp {^[&#]} $chan]} {
+	blacktools:tell $nick "prv" $hand $chan $chan1 gl.novalidchan none
+	return
+}
+ 
+if {![validchan $chan]} { blacktools:tell $nick "prv" $hand $chan $chan1 gl.novalidchan none
+	return
+}
+
+if {![channel get $chan inactive]} {
+	blacktools:tell $nick "prv" $hand $chan $chan1 unsuspend.3 $chan
+	return
+}
+	channel set $chan -inactive
+	blacktools:tell $nick "prv" $hand $chan $chan1 unsuspend.4 $chan
+	}
+}
+
+delchan {
+if {[matchattr $hand nmo]} {
+		set reason [join [lrange [split $arg] 2 end]]
+	set cmd_status [btcmd:status $chan $hand "delchan" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set chan1 "$chan"
+if {$chan == ""} {blacktools:tell $nick "prv" $hand $chan $chan1 gl.instr_priv "delchan"
+	return
+}
+if {![regexp {^[&#]} $chan]} {
+	blacktools:tell $nick "prv" $hand $chan $chan1 gl.novalidchan none 
+	return
+} 
+
+if {![validchan $chan]} { blacktools:tell $nick "prv" $hand $chan $chan1 gl.novalidchan none
+	return
+}
+	set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
+if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
+
+if {!($black(homechan) == "") && ![string equal -nocase $black(homechan) "#no_home_chan"]} {
+if {[string equal -nocase $chan $black(homechan)]} {
+	blacktools:tell $nick "prv" $hand $chan $chan1 delchan.5 $chan
+	return
+	}
+}
+	channel remove $chan
+	delchan:all $chan
+if {$reason == ""} { set reason "N/A" }
+	delchan:note $hand $chan $reason
+	blacktools:tell $nick "prv" $hand $chan $chan1 delchan.3 $chan
+	}
+}
+
+addchan {
+if {[matchattr $hand nmo]} {
+	set cmd_status [btcmd:status $chan $hand "addchan" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set key [lindex [split $arg] 2]
+	set chan1 "$chan"
+if {$chan == ""} {
+	blacktools:tell $nick "prv" $hand $chan $chan1 gl.instr_priv "addchan"
+	return
+}
+
+if {![regexp {^[&#]} $chan]} {	
+	blacktools:tell $nick "prv" $hand $chan $chan1 gl.novalidchan none
+	return
+} 
+
+if {[validchan $chan]} {
+	blacktools:tell $nick "prv" $hand $chan $chan1 addchan.2 $chan
+	return
+} else {
+	channel add $chan
+	blacktools:tell $nick "prv" $hand $chan $chan1 addchan.3 $chan
+if {$key != ""} {
+	putquick "JOIN $chan :$key"
+	channel set $chan chanmode "+ntk $key"
+			}		
+		}
+	}
+}
+
+die {
+if {[matchattr $hand nm]} {
+	set cmd_status [btcmd:status $chan $hand "die" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set chan1 "$chan"
+	set reason [join [lrange [split $arg] 1 end]]
+	set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
+if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
+	blacktools:tell $nick "prv" $hand $chan $chan1 die.1 none
+if {$reason == ""} {
+	set text [black:color:set "" $black(say.$getlang.die.2)]
+	set reply [join $text]
+	set reason $reply
+}
+	utimer 3 [list die $reason]
+	}
+}
+
+jump {
+if {[matchattr $hand nm]} {
+	set cmd_status [btcmd:status $chan $hand "jump" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+set chan1 "$chan"
+set serv [lindex [split $arg] 1]
+if {$serv == ""} {
+	blacktools:tell $nick "prv" $hand $chan $chan1 jump.1 "..."
+	utimer 3 [list jump]
+} else {
+	blacktools:tell $nick "prv" $hand $chan $chan1 jump.1 "\002$serv\002"
+	utimer 3 [list jump $serv]
+		}	
+	}
+}
+
+save {
+if {[matchattr $hand nm]} {
+	set cmd_status [btcmd:status $chan $hand "save" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set chan1 "$chan"
+	blacktools:tell $nick "prv" $hand $chan $chan1 save.1 none
+	save
+	}
+}
+
+restart {
+if {[matchattr $hand nm]} {
+	set cmd_status [btcmd:status $chan $hand "restart" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set chan1 "$chan"
+	blacktools:tell $nick "prv" $hand $chan $chan1 restart.1 none
+	utimer 3 [list restart]
+	}
+}
+
+
+rehash {
+if {[matchattr $hand nm]} {
+	set cmd_status [btcmd:status $chan $hand "rehash" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set chan1 "$chan"
+	blacktools:tell $nick "prv" $hand $chan $chan1 rehash.1 none
+	rehash
+	}
+}
+
+nick {
+if {[matchattr $hand nm]} {
+	set thenick [lindex [split $arg] 1]
+	set chan1 $chan
+	set type 2
+	tempnick:process $thenick $nick "prv" $hand $chan $chan1 $type
+	}
+}
+
+msg {
+if {[matchattr $hand nmo]} {
+	set who [lindex [split $arg] 1]	
+	set chan1 "$chan"
+	set type 2
+	set msg [join [lrange [split $arg] 2 end]]
+	msg:process $nick "prv" $hand $chan $chan1 $who $msg $type
+	}
+}
+
+omsg {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set who [lindex [split $arg] 2]	
+	set chan1 "$chan"
+	set type 2
+	set msg [join [lrange [split $arg] 3 end]]
+	omsg:process $nick "prv" $hand $chan $chan1 $who $msg $type
+	}
+}
+
+set {
+if {[matchattr $hand nmo|M $chan]} {
+	set flags [lindex [split $arg] 2]
+	set type [join [lrange [split $arg] 3 end]]
+if {$mychan_use == "1"} {
+	set flags [lindex [split $arg] 1]
+	set type [join [lrange [split $arg] 2 end]]
+}
+	set type1 2
+	set chan1 "$chan"
+if {[matchattr $hand mn]} {
+if {[string equal -nocase "global" $chan]} {
+	set chan "$flags"
+	foreach c [channels] {
+	set:process $nick "prv" $hand $c $chan1 $flags $type $type1	
+		}
+		return
+			}
+		}
+	set:process $nick "prv" $hand $chan $chan1 $flags $type $type1
+	}
+}
+
+
+mode {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set modes [lindex [split $arg] 2]
+	set hosts [lindex [split $arg] 3]
+if {$mychan_use == "1"} {
+	set modes [lindex [split $arg] 1]
+	set hosts [lindex [split $arg] 2]
+}
+	set type 2
+	set chan1 "$chan"
+	mode:process $nick "prv" $hand $chan $chan1 $modes $type $hosts
+	}
+}
+
+cycle {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set reason [join [lrange [split $arg] 2 end]]
+if {$mychan_use == "1"} {
+	set reason [join [lrange [split $arg] 1 end]]
+}
+	set chan1 "$chan"
+	cycle:process $nick "prv" $hand $chan $chan1 $reason
+	}
+}
+
+purge {
+if {[matchattr $hand -|M $chan]} {
+	set reason [join [lrange [split $arg] 2 end]]
+if {$mychan_use == "1"} {
+	set reason [join [lrange [split $arg] 1 end]]
+}
+	set chan1 "$chan"
+if {$reason == ""} {
+	blacktools:tell $nick "prv" $hand $chan $chan1 purge.1 none
+	return
+}
+	purge:process $nick "prv" $hand $chan $chan1 $reason
+	}
+}
+
+broadcast {
+if {[matchattr $hand nm]} {
+	set text [join [lrange [split $arg] 2 end]]	
+	set chan1 "$chan"
+	set type 2
+	broadcast:cmd:process $nick "prv" $hand $chan $chan1 $text $type
+	}
+}
+
+act {
+if {[matchattr $hand nmo|MA $chan]} {
+	set text [join [lrange [split $arg] 2 end]]
+	set c [lindex [split $arg] 2]
+if {$mychan_use == "1"} {
+	set text [join [lrange [split $arg] 1 end]]
+	set c [lindex [split $arg] 1]
+}
+	set type 2
+	set chan1 "$chan"
+	act:process $nick "prv" $hand $chan $chan1 $text $type
+	}
+}
+
+say {
+if {[matchattr $hand nmo|MA $chan]} {
+	set text [join [lrange [split $arg] 2 end]]
+	set c [lindex [split $arg] 2]
+if {$mychan_use == "1"} {
+	set text [join [lrange [split $arg] 1 end]]
+	set c [lindex [split $arg] 1]
+}
+	set type 2
+	set chan1 "$chan"
+	say:process $nick "prv" $hand $chan $chan1 $text $type
+	}
+}
+
+v {
+if {[matchattr $hand nmo|VOMA $chan]} {
+	set voicex [join [lrange [split $arg] 2 end]]
+if {$mychan_use == "1"} {
+	set voicex [join [lrange [split $arg] 1 end]]
+}
+	set chan1 "$chan"
+	v:process $nick "prv" $hand $chan $chan1 $voicex
+	}
+}
+
+ho {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set hopex [join [lrange [split $arg] 2 end]]
+if {$mychan_use == "1"} {
+	set hopex [join [lrange [split $arg] 1 end]]
+}
+	set chan1 "$chan"
+	ho:process $nick "prv" $hand $chan $chan1 $hopex
+	}
+}
+
+o {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set opex [join [lrange [split $arg] 2 end]]
+if {$mychan_use == "1"} {
+	set opex [join [lrange [split $arg] 1 end]]
+}
+	set chan1 "$chan"
+	o:process $nick "prv" $hand $chan $chan1 $opex
+	}
+}
+
+private {
+if {[matchattr $hand nmo|M $chan]} {
+	set type 2
+	set chan1 "$chan"
+	set why [lindex [split $arg] 2]
+	set user [lindex [split $arg] 3]
+if {$mychan_use == "1"} {
+	set why [lindex [split $arg] 1]
+	set user [lindex [split $arg] 2]
+}
+	private:process $nick "prv" $hand $chan $chan1 $why $user $type
+	}
+}
+
+myset {
+	foreach c [channels] {
+if {[matchattr $hand nmo|AOMV $c]} {
+	set chan $c
+	}
+}
+
+if {[regexp {^[&#]} $chan] && [validuser $hand]} {
+	set type 2
+	set chan1 "$chan"	
+	set flags [lindex [split $arg] 1]
+	set typez [lindex [split $arg] 2]
+	set chan2 [lindex [split $arg] 3]
+	set arg [join [lrange [split $arg] 2 end]]
+	myset:process $nick "prv" $hand $chan $chan1 $flags $typez $type $chan2 $arg
+	}
+}
+
+uptime {
+if {[matchattr $hand nmo]} {
+	set cmd_status [btcmd:status $chan $hand "uptime" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
+if {[matchattr $hand q]} { blacktools:tell $nick "prv" $hand $chan $chan1 gl.glsuspend none
+	return
+}
+if {[matchattr $hand -|q $chan]} { blacktools:tell $nick "prv" $hand $chan $chan1 gl.suspend none
+	return
+}
+if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
+	set chan1 "$chan"
+	set up [return_time_2 $getlang [expr [unixtime] - $uptime]]
+	set on [return_time_2 $getlang [expr [unixtime] - ${server-online}]]
+	catch {exec uptime} shelluptime
+	set file [open $black(uptime_file) "r"]
+	set data [read -nonewline $file]
+	close $file
+if {$data == ""} {
+	set read_maxup "-"
+	set read_maxon "-"
+} else {
+	set read_maxup [return_time_2 $getlang [lindex [split $data] 0]]
+	set read_maxon [return_time_2 $getlang [lindex [split $data] 1]]
+}
+	blacktools:tell $nick "prv" $hand $chan $chan1 maxup.1 "$up $read_maxup"
+	blacktools:tell $nick "prv" $hand $chan $chan1 maxon.1 "$on $read_maxon"
+	blacktools:tell $nick "prv" $hand $chan $chan1 uptime.2 $shelluptime
+	blacktools:tell $nick "prv" $hand $chan $chan1 uptime.3 $server
+	}
+}
+
+status {
+if {[matchattr $hand nmo]} {
+	status:process $nick "prv" $hand $chan
+	}
+}
+
+t {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set topics [join [lrange [split $arg] 2 end]]
+if {$mychan_use == "1"} {
+	set topics [join [lrange [split $arg] 1 end]]
+}
+	set type 2
+	set chan1 "$chan"
+	t:process $nick "prv" $hand $chan $chan1 $topics $type
+	}
+}
+
+tcl {
+if {[matchattr $hand n]} {
+	set type 2
+	set chan1 "$chan"
+	set the_script [lindex [split $arg] 2]
+	set who [lindex [split $arg] 1]
+	tcl:process $nick "prv" $hand $chan $chan1 $type $the_script $who
+	}
+}
+
+anunt {
+if {[matchattr $hand nmo|M $chan]} {
+	set type 2
+	set chan1 "$chan"
+	set who [lindex [split $arg] 2]
+	set message [join [lrange [split $arg] 3 end]]
+	set number [lindex [split $arg] 3]
+if {$mychan_use == "1"} {
+	set who [lindex [split $arg] 1]
+	set message [join [lrange [split $arg] 2 end]]
+	set number [lindex [split $arg] 2]
+}
+	anunt:process $nick "prv" $hand $chan $chan1 $who $message $number $type
+	}
+}
+
+h {
+if {[matchattr $hand nmo|MOAV $chan]} {
+	set chan1 "$chan"
+	set type 2
+	set command [lindex [split $arg] 1]
+if {[regexp {^[&#]} $command]} {
+	set chan $command
+	set command [lindex [split $arg] 2]
+}
+	h:process $nick "prv" $hand $chan $chan1 $command $type
+	}
+}
+
+cp {
+if {[matchattr $hand nm]} {
+	set type 2
+	set chan1 $chan
+	set what [lindex [split $arg] 1]
+	set from [lindex [split $arg] 2]
+	set to [lindex [split $arg] 3]
+	cp:process $nick "prv" $hand $chan $chan1 $type $what $from $to
+	}
+}
+
+banstats {
+if {[matchattr $hand nmo|AOM $chan]} {
+	set next [lindex [split $arg] 2]
+if {$mychan_use == "1"} {
+	set next [lindex [split $arg] 1]
+}
+	set cmd ""
+	set type 2
+	set chan1 "$chan"
+if {[string equal -nocase $next "reset"]} {
+	set cmd "reset"
+}
+if {[string equal -nocase $next "total"]} {
+	set next [lindex [split $arg] 3]
+if {$mychan_use == "1"} {
+	set next [lindex [split $arg] 2]
+}
+	set cmd "total"
+}
+	banstats:process $nick "prv" $hand $chan $chan1 $cmd $type $next
+	}
+}
+
+troll {
+if {[matchattr $hand nmo|AOM $chan]} {
+	set tr [lindex [split $arg] 2]
+if {$mychan_use == "1"} {
+	set tr [lindex [split $arg] 1]
+}
+	set chan1 "$chan"
+	set type 2
+	userhost:act $tr $nick $hand "prv" $chan $chan1 $type "1440" "troll" "" "0"
+	}
+}
+
+limit {
+if {[matchattr $hand nmo|M $chan]} {
+	set why [lindex [split $arg] 1]
+	set lm [lindex [split $arg] 2]
+	set type 2
+	set chan1 "$chan"
+if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
+	set chan "$why"
+	set why [lindex [split $arg] 2]
+	set lm [lindex [split $arg] 3]
+		}
+	limit:process $nick "prv" $hand $chan $chan1 $why $lm $type
+	}
+}
+
+bt {
+if {[matchattr $hand nm]} {
+	set chan1 "$chan"
+	set type 2
+	set who [lindex [split $arg] 1]
+	set message [join [lrange [split $arg] 2 end]]
+	set number [lindex [split $arg] 2]
+	broadcast:process $nick "prv" $hand $chan $chan1 $who $message $number $type
+	}
+}
+
+us {
+if {[matchattr $hand nmo|MA $chan]} {
+	set type 2
+	set chan1 "$chan"
+	set users [lindex [split $arg] 2]
+if {$mychan_use == "1"} {
+	set users [lindex [split $arg] 1]
+}
+	us:process $nick "prv" $hand $chan $chan1 $users $type
+	}
+}
+
+s {
+if {[matchattr $hand nmo|MA $chan]} {
+	set type 2
+	set chan1 "$chan"
+	set user [lindex [split $arg] 2]
+	set suspend_time [lindex [split $arg] 3]
+	set suspend_reason [join [lrange [split $arg] 4 end]]
+if {$mychan_use == "1"} {
+	set user [lindex [split $arg] 1]
+	set suspend_time [lindex [split $arg] 2]
+	set suspend_reason [join [lrange [split $arg] 3 end]]
+}
+if {![regexp {^[0-9]} $suspend_time]} {
+	set suspend_reason [join [lrange [split $arg] 3 end]]
+if {$mychan_use == "1"} {
+	set suspend_reason [join [lrange [split $arg] 2 end]]
+			}
+		}
+	s:process $nick "prv" $hand $chan $chan1 $user $type $suspend_time $suspend_reason
+	}
+}
+
+guestnick {
+if {[matchattr $hand nmo|M $chan]} {
+	set who [lindex [split $arg] 2]
+	set modul "guestnick"
+	set type 2
+	set chan1 $chan
+	set gnick [join [lrange [split $arg] 3 end]]
+	set number [lindex [split $arg] 3]
+if {$mychan_use == "1"} {
+	set who [lindex [split $arg] 1]
+	set gnick [join [lrange [split $arg] 2 end]]
+	set number [lindex [split $arg] 2]
+}
+	guestnick:process $nick "prv" $hand $chan $chan1 $who $gnick $type $number $modul
+	}
+}
+
+badhost {
+if {[matchattr $hand nmo|M $chan]} {
+	set type 2
+	set chan1 "$chan"
+	set why [lindex [split $arg] 2]
+	set badh [join [lrange [split $arg] 3 end]]
+	set number [lindex [split $arg] 3]
+if {$mychan_use == "1"} {
+	set why [lindex [split $arg] 1]
+	set badh [join [lrange [split $arg] 2 end]]
+	set number [lindex [split $arg] 2]
+}
+	prot:module:process $nick "prv" $hand $chan $chan1 $why $badh $type $number "badhost"
+	}
+}
+
+badrealname {
+if {[matchattr $hand nmo|M $chan]} {
+	set type 2
+	set chan1 "$chan"
+	set why [lindex [split $arg] 2]
+	set badf [join [lrange [split $arg] 3 end]]
+	set number [lindex [split $arg] 3]
+if {$mychan_use == "1"} {
+	set why [lindex [split $arg] 1]
+	set badf [join [lrange [split $arg] 2 end]]
+	set number [lindex [split $arg] 2]
+}
+	prot:module:process $nick "prv" $hand $chan $chan1 $why $badf $type $number "badrealname"
+	}
+}
+
+badquitpart {
+if {[matchattr $hand nmo|M $chan]} {
+	set type 2
+	set chan1 "$chan"
+	set why [lindex [split $arg] 2]
+	set badq [join [lrange [split $arg] 3 end]]
+	set number [lindex [split $arg] 3]
+if {$mychan_use == "1"} {
+	set why [lindex [split $arg] 1]
+	set badq [join [lrange [split $arg] 2 end]]
+	set number [lindex [split $arg] 2]
+}
+	prot:module:process $nick "prv" $hand $chan $chan1 $why $badq $type $number "badquitpart"
+	}
+}
+
+badident {
+if {[matchattr $hand nmo|M $chan]} {
+	set type 2
+	set chan1 "$chan"
+	set why [lindex [split $arg] 2]
+	set badi [join [lrange [split $arg] 3 end]]
+	set number [lindex [split $arg] 3]
+if {$mychan_use == "1"} {
+	set why [lindex [split $arg] 1]
+	set badi [join [lrange [split $arg] 2 end]]
+	set number [lindex [split $arg] 2]
+}
+	prot:module:process $nick "prv" $hand $chan $chan1 $why $badi $type $number "badident"
+	}
+}
+
+badnick {
+if {[matchattr $hand nmo|M $chan]} {
+	set type 2
+	set chan1 "$chan"
+	set why [lindex [split $arg] 2]
+	set badn [join [lrange [split $arg] 3 end]]
+	set number [lindex [split $arg] 3]
+if {$mychan_use == "1"} {
+	set why [lindex [split $arg] 1]
+	set badn [join [lrange [split $arg] 2 end]]
+	set number [lindex [split $arg] 2]
+}
+	prot:module:process $nick "prv" $hand $chan $chan1 $why $badn $type $number "badnick"
+	}
+}
+
+badword {
+if {[matchattr $hand nmo|M $chan]} {
+	set type 2
+	set chan1 "$chan"
+	set why [lindex [split $arg] 2]
+	set badw [join [lrange [split $arg] 3 end]]
+	set number [lindex [split $arg] 3]
+if {$mychan_use == "1"} {
+	set why [lindex [split $arg] 1]
+	set badw [join [lrange [split $arg] 2 end]]
+	set number [lindex [split $arg] 2]
+}
+	prot:module:process $nick "prv" $hand $chan $chan1 $why $badw $type $number "badword"
+	}
+}
+
+info {
+if {[matchattr $hand nmo|MAOV $chan]} {
+	set user [lindex [split $arg] 2]
+	set infouser [lindex [split $arg] 2]
+if {$mychan_use == "1"} {
+	set user [lindex [split $arg] 1]
+	set infouser [lindex [split $arg] 1]
+}
+if {![regexp {^[&#]} $chan]} {
+	set user $chan
+	}
+	set type 2
+	set chan1 "$chan"
+if {[regexp {^[&#]} $chan] && [matchattr $hand nmo|MAO $chan] && ($infouser == "")} {
+	info:process:chan $nick "prv" $hand $chan $chan1
+	return
+		}
+	info:process $nick "prv" $hand $chan $chan1 $user $type
+	}
+}
+
+antipub {
+if {[matchattr $hand nmo|M $chan]} {
+	set type 2
+	set chan1 "$chan"
+	set why [lindex [split $arg] 2]
+	set except [join [lrange [split $arg] 3 end]]
+	set number [lindex [split $arg] 3]
+if {$mychan_use == "1"} {
+	set why [lindex [split $arg] 1]
+	set except [join [lrange [split $arg] 2 end]]
+	set number [lindex [split $arg] 2]
+}
+	prot:module:process $nick "prv" $hand $chan $chan1 $why $except $type $number "antipub"
+	}
+}
+
+badchan {
+if {[matchattr $hand nmo|M $chan]} {
+	set why [lindex [split $arg] 2]
+	set type1 2
+	set chan1 "$chan"
+	set bdchan [lindex [split $arg] 3]
+	set type [lindex [split $arg] 4]
+	set reason [join [lrange [split $arg] 4 end]]
+if {[string equal -nocase $type "global"]} {
+	set reason [join [lrange [split $arg] 5 end]]
+	}
+if {$mychan_use == "1"} {
+	set why [lindex [split $arg] 1]
+	set bdchan [lindex [split $arg] 2]
+	set type [lindex [split $arg] 3]
+	set reason [join [lrange [split $arg] 3 end]]
+if {[string equal -nocase $type "global"]} {
+	set reason [join [lrange [split $arg] 4 end]]
+	}
+}
+if {![regexp {^[&#]} $chan] && [matchattr $hand nmo]} {
+	set why $chan
+	set bdchan [lindex [split $arg] 2]
+	set type [lindex [split $arg] 3]
+	set reason [join [lrange [split $arg] 3 end]]
+if {[string equal -nocase $type "global"]} {
+	set reason [join [lrange [split $arg] 4 end]]
+	}
+if {$mychan_use == "1"} {
+	set bdchan [lindex [split $arg] 1]
+	set type [lindex [split $arg] 2]
+	set reason [join [lrange [split $arg] 2 end]]
+if {[string equal -nocase $type "global"]} {
+	set reason [join [lrange [split $arg] 3 end]]
+		}
+	}
+}
+	badchan:process $nick "prv" $hand $chan $chan1 $why $bdchan $type1 $type $reason
+	}
+}
+
+unset {
+if {[matchattr $hand nmo|M $chan]} {
+	set setting [lindex [split $arg] 2]
+if {$mychan_use == "1"} {
+	set setting [lindex [split $arg] 1]
+}
+	set chan1 $chan
+	set type 2
+if {[string equal -nocase $setting "global"] && [matchattr $hand nm]} {
+	set setting [lindex [split $arg] 2]
+foreach c [channels] {
+	unset:process $nick "prv" $hand $c $chan1 $setting $type
+			}
+		return
+	}
+	unset:process $nick "prv" $hand $chan $chan1 $setting $type
+	}
+}
+
+greet {
+if {[matchattr $hand nmo|M $chan]} {
+	set who [lindex [split $arg] 2]
+	set modul "greet"
+	set type 2
+	set chan1 $chan
+	set greet [join [lrange [split $arg] 3 end]]
+if {$mychan_use == "1"} {
+	set who [lindex [split $arg] 1]
+	set greet [join [lrange [split $arg] 2 end]]
+}
+	othermodule:process $nick "prv" $hand $chan $chan1 $who $greet $type $modul	
+	}
+}
+
+leave {
+if {[matchattr $hand nmo|M $chan]} {
+	set who [lindex [split $arg] 2]
+	set modul "leave"
+	set type 2
+	set chan1 $chan
+	set leave [join [lrange [split $arg] 3 end]]
+if {$mychan_use == "1"} {
+	set who [lindex [split $arg] 1]
+	set leave [join [lrange [split $arg] 2 end]]
+}
+	othermodule:process $nick "prv" $hand $chan $chan1 $who $leave $type $modul		
+	}
+}
+
+topic {
+if {[matchattr $hand nmo|M $chan]} {
+	set who [lindex [split $arg] 2]
+	set modul "topic"
+	set type 2
+	set chan1 $chan
+	set topic [join [lrange [split $arg] 3 end]]
+if {$mychan_use == "1"} {
+	set who [lindex [split $arg] 1]
+	set topic [join [lrange [split $arg] 2 end]]
+}
+	othermodule:process $nick "prv" $hand $chan $chan1 $who $topic $type $modul	
+	}
+}
+
+vr {
+if {[matchattr $hand nmo|OMA $chan]} {
+	set vr [lindex [split $arg] 2]
+	set chan1 "$chan"
+	set type 2
+if {$mychan_use == "1"} {
+	set vr [lindex [split $arg] 1]
+}
+	userhost:act $vr $nick $hand "prv" $chan $chan1 $type $black(vr:bantime) "vr" "" "0"
+	}
+}
+
+timer {
+if {[matchattr $hand nm]} {
+	set chan1 $chan
+	set cmd [lindex [split $arg] 1]
+	set pid [lindex [split $arg] 2]
+	set timer_args [join [lrange [split $arg] 4 end]]
+	set type 2
+	timer:process $nick "prv" $hand $chan $chan1 $cmd $pid $timer_args $type
+	}
+}
+
+i {
+if {[matchattr $hand nmo|VAOM $chan]} {
+	set type 2
+	set chan1 "$chan"
+	set inick [lindex [split $arg] 2]
+if {$mychan_use == "1"} {
+	set inick [lindex [split $arg] 1]
+}
+if {[regexp {^[&#]} $inick] && [matchattr $hand nmo|VAOM $inick]} {
+	set chan "$inick"
+	set inick [lindex [split $arg] 3]
+}
+	i:process $nick "prv" $hand $chan $chan1 $inick $type
+	}
+}
+
+next {
+if {[matchattr $hand nmo|MAO $chan]} {
+	set option [lindex [split $arg] 2]
+if {$mychan_use == "1"} {
+	set option [lindex [split $arg] 1]
+}
+	set chan1 $chan
+		nextpublic:process $nick "prv" $hand $chan $chan1 $option
+	}
+}
+
+helped {
+if {[matchattr $hand nmo|MAO $chan]} {
+	set user [lindex [split $arg] 2]
+if {$mychan_use == "1"} {
+	set user [lindex [split $arg] 1]
+}
+	set chan1 $chan
+	set type 1
+	helpedpublic:process $nick "prv" $hand $chan $chan1 $user $type
+	}
+}
+
+noidle {
+if {[matchattr $hand nmo|MAO $chan]} {
+	set user [lindex [split $arg] 2]
+if {$mychan_use == "1"} {
+	set user [lindex [split $arg] 1]
+}
+	set chan1 $chan
+	set type 2
+	noidlepublic:process $nick "prv" $hand $chan $chan1 $user $type
+	}
+}
+
+skip {
+if {[matchattr $hand nmo|MAO $chan]} {
+	set user [lindex [split $arg] 2]
+if {$mychan_use == "1"} {
+	set user [lindex [split $arg] 1]
+}
+	set chan1 $chan
+	set type 2
+	skippublic:process $nick "prv" $hand $chan $chan1 $user	$type
+				}
+			}		
+
+activ {
+if {[matchattr $hand nmo|AOMV $chan]} {
+	set type 2
+	set chan1 "$chan"
+	set user [lindex [split $arg] 2]
+	set option [lindex [split $arg] 3]
+if {$mychan_use == "1"} {
+	set user [lindex [split $arg] 1]
+	set option [lindex [split $arg] 2]
+		}
+	activ:process $nick "prv" $hand $chan $chan1 $user $option $type
+	}
+}
+topwords {
+if {[matchattr $hand nmo|AOMV $chan]} {
+	set next [lindex [split $arg] 2]
+	set cmd ""
+	set type 2
+	set chan1 "$chan"
+if {$mychan_use == "1"} {
+	set next [lindex [split $arg] 1]
+}
+if {[string equal -nocase $next "reset"] && [matchattr $hand nmo|M $chan]} {
+	set cmd "reset"
+}
+if {[string equal -nocase $next "total"]} {
+	set next [lindex [split $arg] 3]
+if {$mychan_use == "1"} {
+	set next [lindex [split $arg] 2]
+}
+	set cmd "total"
+}
+if {[string equal -nocase $next "add"] && [matchattr $hand nmo|M $next]} {
+	set next [lindex [split $arg] 3]
+if {$mychan_use == "1"} {
+	set next [lindex [split $arg] 2]
+}
+	set cmd "add"
+}
+if {[string equal -nocase $next "del"] && [matchattr $hand nmo|M $next]} {
+	set next [lindex [split $arg] 3]
+if {$mychan_use == "1"} {
+	set next [lindex [split $arg] 2]
+}
+	set cmd "del"
+}
+	topwords:process $nick "prv" $hand $chan $chan1 $cmd $type $next
+	}	
+}
+
+ignore {
+if {[matchattr $hand nmo|M $chan]} {
+	set chan1 "$chan"
+	set type 2
+	set what [lindex [split $arg] 1]
+	set mask [lindex [split $arg] 2]
+	set time [lindex [split $arg] 3]	
+	set reason [join [lrange [split $arg] 4 end]]
+if {![regexp {^[0-9]} $time]} {
+	set reason [join [lrange [split $arg] 3 end]]
+}
+	ignore:process $nick "prv" $hand $chan $chan1 $what $mask $time $reason $type
+			}
+		}
+chat {
+if {[matchattr $hand nm]} {
+	set cmd_status [btcmd:status $chan $hand "chat" 0]
+if {$cmd_status == "1"} { 
+	return 
+}
+	set chan1 $chan
+	*ctcp:CHAT $nick $host $hand $botnick CHAT $arg
+	blacktools:tell $nick "prv" $hand $chan $chan1 chat.1 none
+			} 
+		}
+hello {
+if {![file exists $userfile]} {
+	blacktools:hello $nick $host $hand
+			}
+		}
+pass {
+if {[validuser $hand]} {
+	set pass [lindex [split $arg] 1]
+if {$pass == ""} {
+	return
+}
+if {[getuser $hand pass] != ""} {
+	return
+}
+	setuser $hand PASS $pass
+	blacktools:tell $nick "prv" $hand "" "" pass.1 $pass
+			}
+		}
+	}
+}
+
+##############
+#########################################################################
+##   END                                                               ##
+#########################################################################