############################
### AkickSync.tcl        ###
### Version 1.2          ###
### By Wcc               ###
### wcc@techmonkeys.org  ###
### http://dawg.dynu.com ###
### EFnet #|DAWG|Tcl     ###
############################

############################################################################
### Copyright © 2000 - 2001 |DAWG| Scripting Group. All rights reserved. ###
############################################################################

######################################################################
## This script synchronizes the bot's banlist with ChanServ's Akick ##
## list. When ChanServ sets a ban, it is added to the bot's banlist ##
## for that channel automatically.                                  ##
######################################################################

##############
## COMMANDS ##
############################################
## DCC ## .chanset <channel> +/-akicksync ##
######### Enables or disables Akick Sync  ##
######### for a channel.		  ##
############################################

##########################################################
## Just load the script, edit the settings, and rehash. ##
##########################################################

########################
# Make bans permanent? #
########################

set akicksync_setting(perm) 1

#######################################
# Set the ban reason for Akicks here. #
#######################################

set akicksync_setting(reason) "User has been banned from the channel."

####################
# Code begins here #
####################

if {![string match 1.6.* $version]} { putlog "\002AKICKSYNC:\002 \002WARNING:\002 This script is intended to run on eggdrop 1.6.x or later." }
if {[info tclversion] < 8.2} { putlog "\002AKICKSYNC:\002 \002WARNING:\002 This script is intended to run on Tcl Version 8.2 or later." }

setudef flag akicksync
bind mode - "* +b" akicksync_sync

proc akicksync_sync {nick uhost hand chan mode mask} {
	global akicksync_setting ban-time
	if {[isban $mask $chan] || ![string match [string tolower $nick] chanserv] || [lsearch -exact [channel info $chan] +akicksync] == -1} { return }
	newchanban $chan $mask AkickSync $akicksync_setting(reason) [expr ($akicksync_setting(perm))?0:${ban-time}]
}
putlog "\002AKICKSYNC:\002 AkickSync.tcl Version 1.2 by Wcc is loaded."