download ClanAvail1.4.tcl
Language: Tcl
Copyright: Copyright 2000 - 2002 |DAWG| Scripting Group. All rights reserved. ###
LOC: 148
Project Info
xbot4 - The version of X-Bot to supercede ... 2003(xbot4)
Server: Google
Type: svn
...\bin\Debug\xTclLib\scripts\
   _BotnetStats1.9.desc
   _cutetopics100.desc
   _dict109.desc
   _entity92.desc
   _hangman101.desc
   _infobottcl.desc
   _jesusbot1.0.desc
   _jIRCserv-0.02n.desc
   _Lusers.desc
   _mp3list100.desc
   _MsgLog1.1.desc
   _mysqlseen1.1.desc
   _newtopics.desc
   _no.spam.desc
   _quizgod.desc
   _serials100.desc
   _skool101.desc
   _Split4.1.desc
   _thehelper100.desc
   _topicmaster1.1.desc
   _trivia.desc
   _UltramodeNews10.desc
   _UndernetCS.desc
   _userquotes100.desc
   _Veed_0.2.desc
   _WebBanList1.1.desc
   _words100.desc
   _zipcodes100.desc
   abuse100.desc
   abuse100.tcl
   action.fix.desc
   action.fix.tcl
   activech100.desc
   activech100.tcl
   adbseen192.desc
   Adbseen192.tcl
   addban10-mbti.desc
   addban10-mbti.tcl
   added140.desc
   Added140.tcl
   addicted100.desc
   addicted100.tcl
   advert105.desc
   advert105.tcl
   alice120.desc
   alice120.tcl
   alltools.desc
   alltools.tcl
   antiidle-narf-0.3.desc
   antiidle-narf-0.3.tcl
   auth103.desc
   auth103.tcl
   autolimit102.desc
   autolimit102.tcl
   autooper.desc
   autooper.tcl
   av.pubmsg.desc
   av.pubmsg.tcl
   bancheck.desc
   bancheck.tcl
   BanCount1.1.desc
   BanCount1.1.tcl
   BanTools1.2.desc
   BanTools1.2.tcl
   bitchxirix.desc
   bitchxirix.tcl
   bot-solutions.3.0.desc
   bot-solutions.3.0.tcl
   botping.desc
   botping.tcl
   bwscript20.desc
   bwscript20.tcl
   chancheck100.desc
   chancheck100.tcl
   ChanMax1.2.desc
   ChanMax1.2.tcl
   ChanPeak1.3.desc
   ChanPeak1.3.tcl
   chanrelay.desc
   chanrelay.tcl
   ClanAvail1.4.desc
   ClanAvail1.4.tcl
   ClanBase1.1.desc
   ClanBase1.1.tcl
   cmd_resolve.desc
   cmd_resolve.tcl
   compat.desc
   compat.tcl
   CopyVoice1.3.desc
   CopyVoice1.3.tcl
   cracks100.desc
   cracks100.tcl
   DALnetNews1.1.desc
   DALnetNews1.1.tcl
   date1.3.desc
   date1.3.tcl
   DateToDay1.0.desc
   DateToDay1.0.tcl
   daystill102.desc
   daystill102.tcl
   dccwatch104.desc
   dccwatch104.tcl
   Decide1.2.desc
   Decide1.2.tcl
   decide100.desc
   decide100.tcl
   define.desc
   define.tcl
   delhost1.01.desc
   delhost1.01.tcl
   delivery101.desc
   delivery101.tcl
   Dictionary1.1.desc
   Dictionary1.1.tcl
   DieAuth2.1.desc
   DieAuth2.1.tcl
   Dns2.5.desc
   Dns2.5.tcl
   DomainWhois1.2.desc
   DomainWhois1.2.tcl
   EFnetNews1.1.desc
   EFnetNews1.1.tcl
   egg-fu.1.7.desc
   egg-fu.1.7.tcl
   eggpad.desc
   eggpad.tcl
   englishonly102.desc
   englishonly102.tcl
   filerelay0.4.desc
   filerelay0.4.tcl
   fluxlearn1.5a.desc
   fluxlearn1.5a.tcl
   flyby101.desc
   flyby101.tcl
   gamble100.desc
   gamble100.tcl
   gamestar1.4.desc
   gamestar1.4.tcl
   GBan1.4.desc
   GBan1.4.tcl
   getops-2.6.desc
   getops-2.6.tcl
   getops.desc
   getops.tcl
   greeter101.desc
   greeter101.tcl
   guard101.desc
   guard101.tcl
   heise1.4.desc
   heise1.4.tcl
   HostSpy1.8.desc
   HostSpy1.8.tcl
   HostTools1.5.desc
   HostTools1.5.tcl
   HTMLOpVote2.0.desc
   HTMLOpVote2.0.tcl
   ident.desc
   ident.tcl
   ieXbeta1.1.desc
   ieXbeta1.1.tcl
   ilc100.desc
   ilc100.tcl
   infoegg-v1-3.desc
   infoegg-v1-3.tcl
   insult101.desc
   insult101.tcl
   inv.desc
   inv.tcl
   irco-fuckem.desc
   irco-fuckem.tcl
   irco-muh.desc
   irco-muh.tcl
   irco-psybnc.desc
   irco-psybnc.tcl
   irco-scanport.desc
   irco-scanport.tcl
   irco-soundkick.desc
   irco-soundkick.tcl
   irco-wingateban.desc
   irco-wingateban.tcl
   kick100.desc
   kick100.tcl
   kickad100.desc
   kickad100.tcl
   KillLog2.5.desc
   KillLog2.5.tcl
   klined.desc
   klined.tcl
   lamer.desc
   lamer.tcl
   lanparty.desc
   lanparty.tcl
   limit-v1.1.desc
   limit-v1.1.tcl
   limitchan.desc
   limitchan.tcl
   LinkedBots1.2.desc
   LinkedBots1.2.tcl
   maxvisitors101.desc
   maxvisitors101.tcl
   mc.banchan.desc
   mc.banchan.tcl
   mc.spamcheck.desc
   mc.spamcheck.tcl
   megadeth100.desc
   megadeth100.tcl
   mIRCShitlist1.2.desc
   mIRCShitlist1.2.tcl
   moi.desc
   moi.tcl
   netlink107.desc
   netlink107.tcl
   NetStats1.2.desc
   NetStats1.2.tcl
   news.desc
   news.tcl
   news2html.desc
   news2html.tcl
   NoAccess1.1.desc
   NoAccess1.1.tcl
   noads108.desc
   noads108.tcl
   noawayactions1.03.desc
   noawayactions1.03.tcl
   NoColors1.2.desc
   NoColors1.2.tcl
   nocomics100.desc
   nocomics100.tcl
   NoFservs1.5.desc
   NoFservs1.5.tcl
   nosense2.desc
   nosense2.tcl
   notes2.desc
   notes2.tcl
   NoTriggers2.3.desc
   NoTriggers2.3.tcl
   oannouce100.desc
   oannouce100.tcl
   ok1.3.desc
   ok1.3.tcl
   opbegger103.desc
   opbegger103.tcl
   opkillsnn.desc
   opkillsnn.tcl
   OpNotice1.9.desc
   OpNotice1.9.tcl
   pa-trgt3_68.desc
   pa-trgt3_68.tcl
   passgen.desc
   passgen.tcl
   pcgames.desc
   pcgames.tcl
   pickakick102.desc
   pickakick102.tcl
   PortCheck2.2.desc
   PortCheck2.2.tcl
   postal101.desc
   postal101.tcl
   Pub.desc
   Pub.tcl
   pwf.desc
   pwf.tcl
   ques5.desc
   ques5.tcl
   ran.desc
   ran.tcl
   RandRead1.1.desc
   RandRead1.1.tcl
   randtopic2.04.desc
   randtopic2.04.tcl
   recruiters100.desc
   recruiters100.tcl
   released102.desc
   released102.tcl
   SearchPage.desc
   SearchPage.tcl
   sentinel.desc
   sentinel.tcl
   Services2.0.desc
   Services2.0.tcl
   sharereactor1.0.desc
   sharereactor1.0.tcl
   ShellTime1.6.desc
   ShellTime1.6.tcl
   ShellUptime1.0.desc
   ShellUptime1.0.tcl
   shortnews.desc
   shortnews.tcl
   showchans104.desc
   showchans104.tcl
   sound_dos-0.02a.desc
   sound_dos-0.02a.tcl
   Spod.desc
   Spod.tcl
   spymsg.desc
   spymsg.tcl
   StockQuote.desc
   StockQuote.tcl
   striptease104.desc
   striptease104.tcl
   SubChan2.0.desc
   SubChan2.0.tcl
   superbitch0.45.desc
   superbitch0.45.tcl
   sync1.2.desc
   sync1.2.tcl
   tan101.desc
   tan101.tcl
   tempc100.desc
   tempc100.tcl
   textsearch0.2.desc
   textsearch0.2.tcl
   TimeIdent1.0.desc
   TimeIdent1.0.tcl
   TimeMessage1.0.desc
   TimeMessage1.0.tcl
   TimeRehash1.0.desc
   TimeRehash1.0.tcl
   tool-lyrics.desc
   tool-lyrics.tcl
   top10.desc
   top10.tcl
   topiclock2.04.desc
   topiclock2.04.tcl
   topiclogger1.01.desc
   topiclogger1.01.tcl
   ucsx0.2.desc
   ucsx0.2.tcl
   uptime1.08.desc
   uptime1.08.tcl
   UrlGet1.4.desc
   UrlGet1.4.tcl
   userinfo.desc
   userinfo.tcl
   VerboseMail1.1.desc
   VerboseMail1.1.tcl
   Voice1.1.desc
   Voice1.1.tcl
   voiceallbut102.desc
   voiceallbut102.tcl
   voicebitch0.1.desc
   voicebitch0.1.tcl
   VoiceFservs1.3.desc
   VoiceFservs1.3.tcl
   vote1.14.desc
   vote1.14.tcl
   warn100.desc
   warn100.tcl
   weather3.3.1.desc
   weather3.3.1.tcl
   WebSiteStatus1.0.desc
   WebSiteStatus1.0.tcl
   Whatis1.5.desc
   Whatis1.5.tcl
   Whom1.0.desc
   Whom1.0.tcl
   winfuture.desc
   winfuture.tcl
   winident1.2.desc
   winident1.2.tcl
   worldtime.desc
   worldtime.tcl
   x-commands0.1.desc
   x-commands0.1.tcl
   zdnet1.1.desc
   zdnet1.1.tcl

##################################
### ClanAvail.tcl              ###
### Version 1.4                ###
### By Wcc                     ###
### wcc@techmonkeys.org        ###
### http://www.dawgtcl.com:81/ ###
### EFnet #|DAWG|Tcl           ###
##################################

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

#########################################################################
## This script stores availability details for clan wars. Users must   ##
## be authorized to use the commands. The bot will also automatically  ##
## change your channel's topic to the availability details of the next ##
## war.                                                                ##
#########################################################################

##############
## COMMANDS ##
##########################################################
## PUB ## !avail (Can be changed)                       ##
######### Sets you as available for the next war.       ##
######### --------------------------------------------- ##
######### !navail (Can be changed)                      ##
######### Sets you as not available for the next war.   ##
######### --------------------------------------------- ##
######### !maybe (Can be changed)                       ##
######### Sets you as maybe available for the next war. ##
######### --------------------------------------------  ##
######### !wardetails [details]                         ##
######### Shows the details for the next war.           ##
######### Availability is also shown, than cleared. If  ##
######### details are given, the war details will be    ##
######### set to the specified information.             ##
##########################################################
## MSG ## /msg <bot> auth <password>                    ##
######### Authorizes you to use commands.               ##
######### --------------------------------------------- ##
######### /msg <bot> deauth                             ##
######### De-authorizes you from using commands.        ##
##########################################################
## DCC ## .chanset <channel> +clantopic                 ##
######### Makes the bot set the topic of the specified  ##
######### channel to the details of the next war when   ##
######### information changes.                          ##
##########################################################

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

#################################################
# Set the flag required to use the script here. #
#################################################

set clanavail_setting(flag) "o|o"

#################################################################
# Set the command for setting yourself as maybe available here. #
#################################################################

set clanavail_setting(maybe) "!maybe"

###########################################################
# Set the command for setting yourself as available here. #
###########################################################

set clanavail_setting(avail) "!avail"

###############################################################
# Set the command for setting yourself as not available here. #
###############################################################

set clanavail_setting(navail) "!navail"

####################################################################
# When adding to the topic, should the war details be added to the #
# end of the topic or the beginning? (0 for beginning, 1 for end)  #
####################################################################

set clanavail_setting(end) 1

###################################
# Set the database filename here. #
###################################

set clanavail_setting(database) "./scripts/clanavail.db"

###################################################################
# Enable bold in topic and !wardetails? (Makes it easier to read) #
###################################################################

set clanavail_setting(bold) 1

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

if {$numversion < 1060800} { putlog "\002CLANAVAIL:\002 \002WARNING:\002 This script is intended to run on eggdrop 1.6.8 or later." }
if {[info tclversion] < 8.2} { putlog "\002CLANAVAIL:\002 \002WARNING:\002 This script is intended to run on Tcl Version 8.2 or later." }

bind pub $clanavail_setting(flag) !wardetails clanavail_showwar
bind pub $clanavail_setting(flag) $clanavail_setting(maybe) clanavail_maybe
bind pub $clanavail_setting(flag) $clanavail_setting(avail) clanavail_avail
bind pub $clanavail_setting(flag) $clanavail_setting(navail) clanavail_navail
bind msg - auth clanavail_auth
bind msg - deauth clanavail_deauth
bind part - * clanavail_deauth_part
bind sign - * clanavail_deauth_sign
bind splt - * clanavail_deauth_splt
setudef flag clantopic

proc clanavail_auth {nick uhost hand text} {
	if {![validuser $hand]} { putserv "NOTICE $nick :You are not a bot user." ; return }
	if {[string compare [lindex [set text [split $text]] 0] ""] == 0} { putserv "NOTICE $nick :Usage: /msg $::botnick auth <password>" ; return }
	if {![passwdok $hand [lindex $text 0]]} { putserv "NOTICE $nick :Invalid password." ; return }
	if {[matchattr $hand +Q]} { putserv "NOTICE $nick :You are already authorized." ; return }
	chattr $hand +Q
	putserv "NOTICE $nick :You are now authorized."
}
proc clanavail_deauth {nick uhost hand text} {
	if {![validuser $hand]} { putserv "NOTICE $nick :You are not a bot user." ; return }
	if {![matchattr $hand +Q]} { putserv "NOTICE $nick :You are not authorized." ; return }
	chattr $hand -Q
	putserv "NOTICE $nick :You are no longer authorized."
}
proc clanavail_deauth_sign {nick uhost hand chan text} {
	if {[validuser $hand] && [matchattr $hand +Q]} { chattr $hand -Q }
}
proc clanavail_deauth_part {nick uhost hand chan text} {
	if {![onchan $nick] && [validuser $hand] && [matchattr $hand +Q]} { chattr $hand -Q }
}
proc clanavail_deauth_splt {nick uhost hand chan} {
	if {[validuser $hand] && [matchattr $hand +Q]} { chattr $hand -Q }
}
proc clanavail_readarray {array file} {
	upvar $array ours
	if {[catch {open $file r} fd]} { return }
	if {[array exists ours]} { unset ours }
	foreach line [split [read $fd] \n] {
		if {[string range $line 0 2] != "%!%" || [scan [string range $line 3 end] "%\[^!!!\]!!!%s" name data] <= 0} { continue }
		if {![info exists data]} { set data "" }
		set ours($name) $data
	}
	close $fd
}
proc clanavail_savearray {array file} {
	upvar $array ours
	if {![array exists ours] || [catch {open $file w} fd]} { return }
	foreach entry [array names ours] { puts $fd "%!%$entry!!!$ours($entry)" }
	close $fd
}
if {![array exists clanavail_users] && [file exists $clanavail_setting(database)]} { clanavail_readarray clanavail_users $clanavail_setting(database) }
proc clanavail_showwar {nick uhost hand chan text} {
	if {![matchattr $hand +Q]} { putserv "NOTICE $nick :You are not authorized. Please type \"/msg $::botnick auth <password>\" to authorize yourself." ; return }
	if {$text == ""} {
		if {![info exists ::clanavail_users(/warinfo)]} { set ::clanavail_users(/warinfo) "None" }
		foreach {a b} [list users [clanavail_getavail] avail [lindex $users 0] navail [lindex $users 1] maybe [lindex $users 2]] { set $a $b }
		putserv "PRIVMSG $chan :[clanavail_bold "Next War: $::clanavail_users(/warinfo) Available: $avail Not Available: $navail Maybe Available: $maybe."]"
		catch { unset ::clanavail_users(/warinfo) }
		return
	}
	set ::clanavail_users(/warinfo) $text
	clanavail_do_topic
	putserv "NOTICE $nick :[clanavail_bold "Next War: $::clanavail_users(/warinfo)"]"
}
proc clanavail_avail {nick uhost hand chan text} {
	global clanavail_users
	if {![matchattr $hand +Q]} { putserv "NOTICE $nick :You are not authorized. Please type \"/msg $::botnick auth <password>\" to authorize yourself." ; return }
	if {[info exists clanavail_users($nick)] && [string match avail $clanavail_users($nick)]} { putserv "NOTICE $nick :You are already marked as available." ; return }
	set clanavail_users($nick) avail
	clanavail_savearray clanavail_users $::clanavail_setting(database)
	clanavail_do_topic
	putserv "NOTICE $nick :You are now marked as available."
}
proc clanavail_navail {nick uhost hand chan text} {
	global clanavail_users
	if {![matchattr $hand +Q]} { putserv "NOTICE $nick :You are not authorized. Please type \"/msg $::botnick auth <password>\" to authorize yourself." ; return }
	if {[info exists clanavail_users($nick)] && [string match navail $clanavail_users($nick)]} { putserv "NOTICE $nick :You are already marked as not available." ; return }
	set clanavail_users($nick) navail
	clanavail_savearray clanavail_users $::clanavail_setting(database)
	clanavail_do_topic
	putserv "NOTICE $nick :You are now marked as not available."
}
proc clanavail_maybe {nick uhost hand chan text} {
	global clanavail_users
	if {![matchattr $hand +Q]} { putserv "NOTICE $nick :You are not authorized. Please type \"/msg $::botnick auth <password>\" to authorize yourself." ; return }
	if {[info exists clanavail_users($nick)] && [string match maybe $clanavail_users($nick)]} { putserv "NOTICE $nick :You are already marked as maybe available." ; return }
	set clanavail_users($nick) maybe
	clanavail_savearray clanavail_users $::clanavail_setting(database)
	clanavail_do_topic
	putserv "NOTICE $nick :You are now marked as maybe available."
}
proc clanavail_do_topic {} {
	global clanavail_users
	foreach {a b} [list users [clanavail_getavail] avail [lindex $users 0] navail [lindex $users 1] maybe [lindex $users 2]] { set $a $b }
	if {![info exists clanavail_users(/warinfo)]} {	set clanavail_users(/warinfo) "None" }
	foreach c [channels] {
		if {![botisop $chan] || [lsearch -exact [channel info $chan] +chantopic] == -1} { continue }
		if {!$::clanavail_setting(end)} {
			if {[string match "*Next War:*Available:*Not Available:*Maybe Available:*. |*" [topic $chan]]} { set topic [string range [topic $chan] [expr [string first ". |" [topic $chan]] + 4] end] } { set topic [topic $chan] }
			set topic "[clanavail_bold "Next War: $clanavail_users(/warinfo) Available: $avail Not Available: $navail Maybe Available: $maybe."] | $topic"
		} {
			if {[string match "*| *Next War:*Available:*Not Available:*Maybe Available:*" [topic $chan]]} {
				if {$::clanavail_setting(bold)} { set topic [string range [topic $chan] 0 [expr [string first "| \002Next War:" [topic $chan]] - 2]] } { set topic [string range [topic $chan] 0 [expr [string first "| Next War:" [topic $chan]] - 2]] }
			} {
				set topic [topic $chan]
			}
			set topic "$topic | [clanavail_bold "Next War: $clanavail_users(/warinfo) Available: $avail Not Available: $navail Maybe Available: $maybe."]"
		}
		if {[string compare [topic $chan] $topic] != 0} { putserv "TOPIC $chan :$topic" }
	}
}
proc clanavail_bold {text} {
	if {$::clanavail_setting(bold)} {
		regsub -all -- " Not Available: "   $text " \002Not Available:\002 "   text
		regsub -all -- " Maybe Available: " $text " \002Maybe Available:\002 " text
		regsub -all -- " Available: "       $text " \002Available:\002 "       text
		regsub -all -- "Next War: "         $text "\002Next War:\002 "         text
	}
	return $text
}
proc clanavail_getavail {} {
	global clanavail_users
	foreach a [array names clanavail_users] {
		if {[string match $a /warinfo]} { continue }
		switch -- $clanavail_users($a) {
			"avail" { lappend avail $a, }
			"navail" { lappend navail $a, }
			"maybe" { lappend maybe $a, }
		}
	}
	foreach v {avail navail maybe} {
		if {![info exists $v]} { set $v None }
	}
	regsub -all -- "," [lindex $avail end]  "" end
	regsub -all -- "," [lindex $navail end] "" end2
	regsub -all -- "," [lindex $maybe end]  "" end3
	return "[list [lreplace $avail end end $end] [lreplace $navail end end $end2] [lreplace $maybe end end $end3]]"
}
putlog "\002CLANAVAIL:\002 ClanAvail.tcl Version 1.4 by Wcc is loaded."

About Koders | Resources | Downloads | Support | Black Duck | Submit Project | Terms of Service | DMCA | Privacy Policy | Site Map| Contact Us