; alias to check for valid channelmodes
; SYNTAX: $cmodes(<network>,<mode>)
; if a variable is set for this network, returns "$true" (if this mode is allowed), or "$false" (if not)
; if NO variable is found or a parameter is missing, returns "error"
; example "if ($cmodes($network,e) == $true) { -stuff- }
alias cmodes {
if (($isid) && ($2) && ($($+(%,cmodes.,$1),2))) {
return $iif(($2 isincs $v1),$true,$false)
}
else { return error }
}
; "on connect", parse the "versions" reply of the server (you'll always get this raw line on connect)
; and set the valid chanmodes to a cmode variable for this network (unsets automatically on exit)
RAW 5:*: {
if ($wildtok($1-,CHANMODES=*,1,32)) { set -e $+(%,cmodes.,$network) $gettok($v1,2,61) }
}
; on disconnect, unset the cmode-variable for this network
on *:disconnect: {
if ($($+(%,cmodes.,$network),2)) { unset $+(%,cmodes.,$network) }
}