on ^*:notice:*:?: {
if ($nick == HostServ) {
; Response to !pending
if (%hs_waiting == 1) {
if ($mid($1,1,1) == $chr(35)) {
var %rej = 0
var %banstring, %banreason
; Rule break: badwords
var %q = SELECT * FROM badwords
var %result = $sqlite_query(%db_vhost, %q)
while ($sqlite_fetch_row(%result, row)) {
; if ($lower($hget(row, word)) isin $lower($right($strip($3),-6))) {
if ($regex($lower($right($strip($3),-6)),/\b $+ $lower($hget(row, word)) $+ \b/i)) {
; Deny it
%rej = 1
%banstring = 4(Rejected: " $+ $hget(row, word) $+ " is in the badwords list)
%banreason = The phrase " $+ $hget(row, word) $+ " is not allowed in vHosts.
}
}
; Rule break: TLD
var %file = TLD.txt
.fopen fh %file
while (1) {
var %line = $fread(fh)
if ($fopen(fh).eof) {
break
}
var %word = $gettok(%line, 1, 9)
if ($lower($right($strip($3),$len(%word))) == $lower(%word)) {
; Deny it
%rej = 1
%banstring = 4(Rejected: TLD rule violation)
%banreason = vHost is in violation with our TLD rules. Please submit a vHost that does not utilize an official domain suffix.
}
}
.fclose fh
; Rule break: too early (7 day rule)
%q = SELECT * FROM approved WHERE LOWER(nick) = $lower($sqlite_qt($sqlite_escape_string($replace($right($strip($2),-5),$chr(44),$null))))
var %result = $sqlite_query(%db_vhost, %q)
if ($sqlite_num_rows(%result) > 0) {
sqlite_fetch_row %result row
if ($calc( $hget(row, date) + 604800) > $ctime) {
; Deny it
%rej = 1
%banstring = 4(Rejected: Less than 7 days since last vHost)
%banreason = You must wait at least 7 days between each vHost request.
}
}
; Rule break: banned
var %q = SELECT * FROM banned WHERE LOWER(nick) = $lower($sqlite_qt($sqlite_escape_string($replace($right($strip($2),-5),$chr(44),$null))))
var %result = $sqlite_query(%db_vhost, %q)
if ($sqlite_num_rows(%result) > 0) {
; Deny it
%rej = 1
%banstring = 4(Rejected: User is banned)
%banreason = You are banned from the vHost service.
}
msg #vhost $+ $chr(35) $+ $right($strip($1),-1) - Nick: $replace($right($strip($2),-5),$chr(44),$null) vHost: $right($strip($3),-6) $iif(%rej == 1, %banstring, $null) $+ $iif($eval($+(%,vvotec-,$replace($right($strip($2),-5),$chr(44),$null)),2) != $null, 7 $+ $chr(91) $+ Current vote: $iif($eval($+(%,vvote-,$replace($right($strip($2),-5),$chr(44),$null)),2) > 0, Yes, No) $+ $chr(93) $+ , $null) $+ $iif($eval($+(%,vvote-,$replace($right($strip($2),-5),$chr(44),$null)),2) == lock, 7[Locked] , $null)
if (%rej == 1) {
.hs reject $replace($right($strip($2),-5),$chr(44),$null) %banreason
}
else {
hadd -m hs_pending $right($strip($1),-1) $replace($right($strip($2),-5),$chr(44),$null)
}
inc %hs_waiting_count
}
else if ($1 == Displayed) {
if (%hs_waiting_count == 0) {
msg #vhost No records found.
}
else {
msg #vhost End of list.
}
set %hs_waiting 0
}
halt
}
}
else {
halt
}
}