All pastes #591083 Raw Edit

Something

public text v1 · immutable
#591083 ·published 2007-06-26 23:23 UTC
rendered paste body
#=========
#ALIASES: stealth/isstealth/stealthcheck/checkstealth/stealthinfo
bind pub - -stealth stealth
bind pub - -stealthcheck stealth
bind pub - -checkstealth stealth
bind pub - -stealthinfo stealth
bind pub - -isstealth stealth

proc stealth {nick uhost hand chan arg} {
	
	set howManyCurrently 0
	
	if {$chan != "#alt.binaries.games.xbox360"} {
		set errorMsg "Sorry $nick, -stealth is only available in #alt.binaries.games.xbox360"
	}
	
	set search [lrange $arg 0 e]
	set searchstring [string map {" " %} $search]
	set searchLen [string length [join $searchstring]]
	
	if {$searchstring == ""} {
		set errorMsg "You must specify keyword(s) to search for"
	} elseif {$searchLen < 2} {
		set errorMsg "Search keyword(s) must be at least 2 characters in length"
	}

	if {$errorMsg != ""} {
		displayErrorNotice $nick $uhost $hand $chan $errorMsg
	} else {
		sql selectdb releases
		
		set tableReleases [checkReleaseTable $chan]
		
		set howManyCurrently [sql "SELECT COUNT(*) FROM $tableReleases WHERE folder LIKE \"%$searchstring%\" OR filename LIKE \"%$searchstring%\" OR rlsgroup LIKE \"%$searchstring%\" OR rlsdate LIKE \"%$searchstring%\""]
		
		if {$howManyCurrently == 0} {
			set errorMsg "\0031\002No matches found, try making your search more generic"
		} elseif {$howManyCurrently <= 5} {
			putnow "NOTICE $nick :\0031\002$howManyCurrently matches found; displaying 1 to $howManyCurrently:"
		} elseif {$howManyCurrently >= 6} {
			putnow "NOTICE $nick :\002Your search found more than 5 results, visit \037http://abgx.net/filename/?ch=6&bin_search_type=folder&bin_max_results=25&bin_search=$searchstring\037 for a complete list"
			putnow "NOTICE $nick :\0031\002$howManyCurrently matches found; displaying 1-5:"
		}
		
		if {$errorMsg != ""} {
			displayErrorNotice $nick $uhost $hand $chan $errorMsg
		}
		
		set query "SELECT DISTINCT id, folder, region, stealth, rfUSA, rfEUR, rfJAP FROM $tableReleases WHERE folder LIKE \"%$searchstring%\" OR filename LIKE \"%$searchstring%\" OR rlsgroup LIKE \"%$searchstring%\" OR rlsdate LIKE \"%$searchstring%\" ORDER BY rlsdate DESC, id DESC LIMIT 5"
		
		foreach row [sql $query] {
			set id [lindex $row 0]
			set folder [lindex $row 1]
			set region [lindex $row 2]
			set stealth [lindex $row 3]
			set rfUSA [lindex $row 4]
			set rfEUR [lindex $row 5]
			set rfJAP [lindex $row 6]
			
			if {$stealth == "?"} {
				set stealth "Unknown"
			}
			
			putserv "NOTICE $nick :\[Stealth for iXtreme\: \002$stealth\002\] \($id\) $folder"
			
			set id ""; set folder ""; set region ""; set stealth ""; set rfUSA ""; set rfEUR ""; set rfJAP ""
		}
	}
}
#=========


#=========
#ALIASES: regions/region/regionfree/regioncheck/regionscheck/checkregion/checkregions/rf
bind pub - -regions regions
bind pub - -region regions
bind pub - -regioncheck regions
bind pub - -regionscheck regions
bind pub - -checkregion regions
bind pub - -checkregions regions
bind pub - -regionfree regions
bind pub - -regioninfo regions
bind pub - -rf regions

proc stealth {nick uhost hand chan arg} {
	
	set howManyCurrently 0
	
	if {$chan != "#alt.binaries.games.xbox360"} {
		set errorMsg "Sorry $nick, -regions is only available in #alt.binaries.games.xbox360"
	}
	
	set search [lrange $arg 0 e]
	set searchstring [string map {" " %} $search]
	set searchLen [string length [join $searchstring]]
	
	if {$searchstring == ""} {
		set errorMsg "You must specify keyword(s) to search for"
	} elseif {$searchLen < 2} {
		set errorMsg "Search keyword(s) must be at least 2 characters in length"
	}

	if {$errorMsg != ""} {
		displayErrorNotice $nick $uhost $hand $chan $errorMsg
	} else {
		sql selectdb releases
		
		set tableReleases [checkReleaseTable $chan]
		
		set howManyCurrently [sql "SELECT COUNT(*) FROM $tableReleases WHERE folder LIKE \"%$searchstring%\" OR filename LIKE \"%$searchstring%\" OR rlsgroup LIKE \"%$searchstring%\" OR rlsdate LIKE \"%$searchstring%\""]
		
		if {$howManyCurrently == 0} {
			set errorMsg "\0031\002No matches found, try making your search more generic"
		} elseif {$howManyCurrently <= 5} {
			putnow "NOTICE $nick :\0031\002$howManyCurrently matches found; displaying 1 to $howManyCurrently:"
		} elseif {$howManyCurrently >= 6} {
			putnow "NOTICE $nick :\002Your search found more than 5 results, visit \037http://abgx.net/filename/?ch=6&bin_search_type=folder&bin_max_results=25&bin_search=$searchstring\037 for a complete list"
			putnow "NOTICE $nick :\0031\002$howManyCurrently matches found; displaying 1-5:"
		}
		
		if {$errorMsg != ""} {
			displayErrorNotice $nick $uhost $hand $chan $errorMsg
		}
		
		set query "SELECT DISTINCT id, folder, region, stealth, rfUSA, rfEUR, rfJAP FROM $tableReleases WHERE folder LIKE \"%$searchstring%\" OR filename LIKE \"%$searchstring%\" OR rlsgroup LIKE \"%$searchstring%\" OR rlsdate LIKE \"%$searchstring%\" ORDER BY rlsdate DESC, id DESC LIMIT 5"
		
		foreach row [sql $query] {
			set id [lindex $row 0]
			set folder [lindex $row 1]
			set region [lindex $row 2]
			set stealth [lindex $row 3]
			set rfUSA [lindex $row 4]
			set rfEUR [lindex $row 5]
			set rfJAP [lindex $row 6]
			
			putserv "NOTICE $nick :\[Region-Compatibility - USA\: \002$rfUSA\002\  EUR\: \002$rfEUR\002\  JAP\: \002$rfJAP\002\] \($id\) $folder"
			
			set id ""; set folder ""; set region ""; set stealth ""; set rfUSA ""; set rfEUR ""; set rfJAP ""
		}
	}
}
#=========