Project

General

Profile

Bug #5072 ยป chghost.txt

Koragg KnightWolf, 06/15/2020 12:34 AM

 
;alias ircd included as RAW CHGHOST script/snippet makes use of it
alias ircd {
if ($status !== connected) { return 0 }
if ($1) { var %v = $ircd_find_by_network($1) }
else { var %v = $hget(IRCD,$server) }
return $iif(%v,$v1,0)
}
RAW 002:*: { hadd -m IRCD $server $8- }
alias -l ircd_find_by_network {
if (!$1) { return 0 }
var %t = $scon(0)
var %i = 1
while (%i <= %t) {
var %n = $scon(%i).network
var %s = $scon(%i).server
var %v = $hget(IRCD,%s)
if (%n == $1) && (%v) { return %v }
inc %i
}
return 0
}

;actual RAW CHGHOST script/snippet
RAW CHGHOST:*: {
var %full = $gettok($gettok($rawmsg,1,32),2-,33)
var %ident = $gettok(%full,1,64)
var %host = $gettok(%full,2,64)
if (!$2) && ($servervars(whox).key) && ($ircd != InspIRCd-2.0) {
if ($query($nick)) { echo -tc info $query($nick) $prefixsys $nick has changed host: ( $+ %ident $+ $chr(64) $+ %host $+ ) $+ $chr(32) $+ -> $+ $chr(32) $+ ( $+ $ial($nick).user $+ $chr(64) $+ $1 $+ ) $+ $chr(32) $+ $iif($ial($nick).account,$ial($nick).account,$chr(42)) $+ $chr(32) $+ $chr(58) $+ $realname }
var %t = $comchan($nick,0)
var %i = 1
while (%i <= %t) {
var %c = $comchan($nick,%i)
if (%c) { echo -tc info %c $prefixsys $nick has changed host: ( $+ %ident $+ $chr(64) $+ %host $+ ) $+ $chr(32) $+ -> $+ $chr(32) $+ ( $+ $ial($nick).user $+ $chr(64) $+ $1 $+ ) $+ $chr(32) $+ $iif($ial($nick).account,$ial($nick).account,$chr(42)) $+ $chr(32) $+ $chr(58) $+ $realname }
inc %i
}
}
if (!$2) && (!$severvars(whox).key) || ($ircd == InspIRCd-2.0) {
if ($query($nick)) { echo -tc info $query($nick) $prefixsys $nick has changed host: ( $+ %ident $+ $chr(64) $+ %host $+ ) $+ $chr(32) $+ -> $+ $chr(32) $+ ( $+ $ial($nick).user $+ $chr(64) $+ $1 $+ ) }
var %t = $comchan($nick,0)
var %i = 1
while (%i <= %t) {
var %c = $comchan($nick,%i)
if (%c) { echo -tc info %c $prefixsys $nick has changed host: ( $+ %ident $+ $chr(64) $+ %host $+ ) $+ $chr(32) $+ -> $+ $chr(32) $+ ( $+ $ial($nick).user $+ $chr(64) $+ $1 $+ ) }
inc %i
}
}
if ($2) && ($servervars(whox).key) && ($ircd != InspIRCd-2.0) {
if ($query($nick)) { echo -tc info $query($nick) $prefixsys $nick has changed host: ( $+ %ident $+ $chr(64) $+ %host $+ ) $+ $chr(32) $+ -> $+ $chr(32) $+ ( $+ $1 $+ $chr(64) $+ $2 $+ ) $+ $chr(32) $+ $iif($ial($nick).account,$ial($nick).account,$chr(42)) $+ $chr(32) $+ $chr(58) $+ $realname }
var %t = $comchan($nick,0)
var %i = 1
while (%i <= %t) {
var %c = $comchan($nick,%i)
if (%c) { echo -tc info %c $prefixsys $nick has changed host: ( $+ %ident $+ $chr(64) $+ %host $+ ) $+ $chr(32) $+ -> $+ $chr(32) $+ ( $+ $1 $+ $chr(64) $+ $2 $+ ) $+ $chr(32) $+ $iif($ial($nick).account,$ial($nick).account,$chr(42)) $+ $chr(32) $+ $chr(58) $+ $realname }
inc %i
}
}
if ($2) && (!$servervars(whox).key) || ($ircd == InspIRCd-2.0) {
if ($query($nick)) { echo -tc info $query($nick) $prefixsys $nick has changed host: ( $+ %ident $+ $chr(64) $+ %host $+ ) $+ $chr(32) $+ -> $+ $chr(32) $+ ( $+ $1 $+ $chr(64) $+ $2 $+ ) }
var %t = $comchan($nick,0)
var %i = 1
while (%i <= %t) {
var %c = $comchan($nick,%i)
if (%c) { echo -tc info %c $prefixsys $nick has changed host: ( $+ %ident $+ $chr(64) $+ %host $+ ) $+ $chr(32) $+ -> $+ $chr(32) $+ ( $+ $1 $+ $chr(64) $+ $2 $+ ) }
inc %i
}
}
}
    (1-1/1)