Difference between revisions of "Test2"

From Scriptwiki
Jump to: navigation, search
m
m (Removed test link.)
 
(31 intermediate revisions by 2 users not shown)
Line 101: Line 101:
 
   ; NOTE that the script ONLY works on networks supporting WHOX (ircu 2.10.* should work)
 
   ; NOTE that the script ONLY works on networks supporting WHOX (ircu 2.10.* should work)
 
   ; $1 is the network
 
   ; $1 is the network
   [[return]] $istokcs(QuakeNet UnderNet GameSurge HanIRC NetGamers OGameNet,$1,32)
+
   [[return]] [[$istokcs]](QuakeNet UnderNet GameSurge HanIRC NetGamers OGameNet,[[$1-|$1]],32)
 
  }
 
  }
 
   
 
   
Line 107: Line 107:
 
   ; For every network a check to see if a user has a site where his authname is in
 
   ; For every network a check to see if a user has a site where his authname is in
 
   ; $1 is the network, $2 is the site
 
   ; $1 is the network, $2 is the site
   [[If-Then-Else|if]] ($1 === QuakeNet) { [[return]] $iif(*.users.quakenet.org iswm $2,$true) }
+
   [[If-Then-Else|if]] ([[$1-|$1]] === QuakeNet) { [[return]] [[$iif]](*.users.quakenet.org iswm [[$1-|$2]],[[$true]]) }
   [[If-Then-Else|elseif]] ($1 === UnderNet) { [[return]] $iif(*.users.undernet.org iswm $2,$true) }
+
   [[If-Then-Else|elseif]] ([[$1-|$1]] === UnderNet) { [[return]] [[$iif]](*.users.undernet.org iswm [[$1-|$2]],[[$true]]) }
   [[If-Then-Else|elseif]] ($1 === GameSurge) { [[return]] $iif(*.*.GameSurge iswm $2,$true) }
+
   [[If-Then-Else|elseif]] ([[$1-|$1]] === GameSurge) { [[return]] [[$iif]](*.*.GameSurge iswm [[$1-|$2]],[[$true]]) }
   [[If-Then-Else|elseif]] ($1 === HanIRC) { [[return]] $iif(*.users.HanIRC.org iswm $2,$true) }
+
   [[If-Then-Else|elseif]] ([[$1-|$1]] === HanIRC) { [[return]] [[$iif]](*.users.HanIRC.org iswm [[$1-|$2]],[[$true]]) }
   [[If-Then-Else|elseif]] ($1 === NetGamers) { [[return]] $iif(*.users.netgamers.org iswm $2,$true) }
+
   [[If-Then-Else|elseif]] ([[$1-|$1]] === NetGamers) { [[return]] [[$iif]](*.users.netgamers.org iswm [[$1-|$2]],[[$true]]) }
   [[If-Then-Else|elseif]] ($1 === OGameNet) { [[return]] $iif(*.user.OGameNet iswm $2,$true) }
+
   [[If-Then-Else|elseif]] ([[$1-|$1]] === OGameNet) { [[return]] [[$iif]](*.user.OGameNet iswm [[$1-|$2]],[[$true]]) }
 
  }
 
  }
 
   
 
   
Line 118: Line 118:
 
   ; For every network the method to return the auth from the site
 
   ; For every network the method to return the auth from the site
 
   ; $1 is the network, $2 is the site
 
   ; $1 is the network, $2 is the site
   [[If-Then-Else|if]] ($1 === QuakeNet) { [[return]] $gettok($2,1,46) }
+
   [[If-Then-Else|if]] ([[$1-|$1]] === QuakeNet) { [[return]] [[$gettok]]([[$1-|$2]],1,46) }
   [[If-Then-Else|elseif]] ($1 === UnderNet) { [[return]] $gettok($2,1,46) }
+
   [[If-Then-Else|elseif]] ([[$1-|$1]] === UnderNet) { [[return]] [[$gettok]]([[$1-|$2]],1,46) }
   [[If-Then-Else|elseif]] ($1 === GameSurge) { [[return]] $gettok($2,1,46) }
+
   [[If-Then-Else|elseif]] ([[$1-|$1]] === GameSurge) { [[return]] [[$gettok]]([[$1-|$2]],1,46) }
   [[If-Then-Else|elseif]] ($1 === HanIRC) { [[return]] $gettok($2,1,46) }
+
   [[If-Then-Else|elseif]] ([[$1-|$1]] === HanIRC) { [[return]] [[$gettok]]([[$1-|$2]],1,46) }
   [[If-Then-Else|elseif]] ($1 === NetGamers) { [[return]] $gettok($2,1,46) }
+
   [[If-Then-Else|elseif]] ([[$1-|$1]] === NetGamers) { [[return]] [[$gettok]]([[$1-|$2]],1,46) }
   [[If-Then-Else|elseif]] ($1 === OGameNet) { [[return]] $gettok($2,1,46) }
+
   [[If-Then-Else|elseif]] ([[$1-|$1]] === OGameNet) { [[return]] [[$gettok]]([[$1-|$2]],1,46) }
 
  }
 
  }
 
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 130: Line 130:
 
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
  [[alias]] auth {
 
  [[alias]] auth {
   [[If-Then-Else|if]] (!$isid) { $iif($show,.auth,auth) $1- | [[return]] }
+
   [[If-Then-Else|if]] (![[$isid]]) { [[$iif]]([[$show]],.auth,auth) [[$1-|$1-]] | [[return]] }
   [[If-Then-Else|if]] ($1 == $null) || (($2 !== $null) && ((!$scid($2)) || (!$2))) { [[return]] }
+
   [[If-Then-Else|if]] ([[$1-|$1]] == [[$null]]) || (([[$1-|$2]] !== [[$null]]) && ((![[$scid]]([[$1-|$2]])) || (![[$1-|$2]]))) { [[return]] }
   [[return]] $hget(auths. $+ $iif($2 !== $null,$2,$cid),$1)
+
   [[return]] [[$hget]](auths. [[DollarPlus|$+]] [[$iif]]([[$1-|$2]] !== [[$null]],[[$1-|$2]],[[$cid]]),[[$1-|$1]])
 
  }
 
  }
 
   
 
   
Line 140: Line 140:
 
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTHUPDATE.NEXT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTHUPDATE.NEXT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
  [[alias]] authupdate.next {
 
  [[alias]] authupdate.next {
   [[Local_Variables|var]] %i = $0
+
   [[Local_Variables|var]] %i = [[$0]]
 
   [[while]] (%i) {
 
   [[while]] (%i) {
     [[Local_Variables|var]] %n = $gettok($1-,%i,32)
+
     [[Local_Variables|var]] %n = [[$gettok]]([[$1-|$1-]],%i,32)
     [[If-Then-Else|if]] (!$comchan(%n,1)) { .[[signal]] authupdate %n }
+
     [[If-Then-Else|if]] (![[$comchan]](%n,1)) { .[[signal]] authupdate %n }
 
     [[If-Then-Else|else]] { auth.n.add %n }
 
     [[If-Then-Else|else]] { auth.n.add %n }
 
     [[dec]] %i
 
     [[dec]] %i
 
   }
 
   }
   [[If-Then-Else|if]] (!$timer($cid $+ .auth_update.update)) { auth_update.update n }
+
   [[If-Then-Else|if]] (!$timer([[$cid]] [[DollarPlus|$+]] .auth_update.update)) { auth_update.update n }
 
   [[If-Then-Else|else]] {
 
   [[If-Then-Else|else]] {
     [[Local_Variables|var]] %d = $timer($cid $+ .auth_update.update).delay , %l = $timer($cid $+ .auth_update.update).secs
+
     [[Local_Variables|var]] %d = $timer([[$cid]] [[DollarPlus|$+]] .auth_update.update).delay , %l = $timer([[$cid]] [[DollarPlus|$+]] .auth_update.update).secs
     .[[timer]] $+ $cid $+ .auth_update.update 1 $iif($calc(%d - %l) < $next.wait,$calc($v2 - $v1),0) auth_update.update n
+
     .[[timer]] [[DollarPlus|$+]] [[$cid]] [[DollarPlus|$+]] .auth_update.update 1 [[$iif]]([[$calc]](%d - %l) < $next.wait,[[$calc]]($v2 - $v1),0) auth_update.update n
 
   }
 
   }
 
  }
 
  }
Line 159: Line 159:
 
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH_LOAD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH_LOAD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
  [[alias]] -l auth_load {
 
  [[alias]] -l auth_load {
   .[[timer]] $+ $cid $+ .auth_update.update 1 $delay.who auth_update.update
+
   .[[timer]] [[DollarPlus|$+]] [[$cid]] [[DollarPlus|$+]] .auth_update.update 1 $delay.who auth_update.update
   [[If-Then-Else|if]] ($hget(auths. $+ $cid)) { [[hfree]] $v1 }
+
   [[If-Then-Else|if]] ([[$hget]](auths. [[DollarPlus|$+]] [[$cid]])) { [[hfree]] $v1 }
   [[If-Then-Else|if]] ($hget(auths.l. $+ $cid)) { [[hfree]] $v1 }
+
   [[If-Then-Else|if]] ([[$hget]](auths.l. [[DollarPlus|$+]] [[$cid]])) { [[hfree]] $v1 }
   [[If-Then-Else|if]] ($hget(auths.q. $+ $cid)) { [[hfree]] $v1 }
+
   [[If-Then-Else|if]] ([[$hget]](auths.q. [[DollarPlus|$+]] [[$cid]])) { [[hfree]] $v1 }
   [[If-Then-Else|if]] ($hget(auths.n. $+ $cid)) { [[hfree]] $v1 }
+
   [[If-Then-Else|if]] ([[$hget]](auths.n. [[DollarPlus|$+]] [[$cid]])) { [[hfree]] $v1 }
   [[If-Then-Else|if]] ($hget(auths.u. $+ $cid)) { [[hfree]] $v1 }
+
   [[If-Then-Else|if]] ([[$hget]](auths.u. [[DollarPlus|$+]] [[$cid]])) { [[hfree]] $v1 }
   [[hmake]] auths. $+ $cid 200
+
   [[hmake]] auths. [[DollarPlus|$+]] [[$cid]] 200
   [[hmake]] auths.l. $+ $cid 200
+
   [[hmake]] auths.l. [[DollarPlus|$+]] [[$cid]] 200
   [[hmake]] auths.q. $+ $cid 200
+
   [[hmake]] auths.q. [[DollarPlus|$+]] [[$cid]] 200
   [[hmake]] auths.n. $+ $cid 100
+
   [[hmake]] auths.n. [[DollarPlus|$+]] [[$cid]] 100
   [[Local_Variables|var]] %i = $comchan($me,0)
+
   [[Local_Variables|var]] %i = [[$comchan]]([[$me]],0)
 
   [[while]] (%i) {
 
   [[while]] (%i) {
     [[Local_Variables|var]] %chan = $comchan($me,%i)
+
     [[Local_Variables|var]] %chan = [[$comchan]]([[$me]],%i)
     [[Local_Variables|var]] %j = $nick(%chan,0)
+
     [[Local_Variables|var]] %j = [[$nick_(nick)|$nick(]]%chan,0)
 
     [[while]] (%j) {
 
     [[while]] (%j) {
       auth.l.add.wid $chan(%chan).wid $nick(%chan,%j)
+
       auth.l.add.wid [[$chan_(window)|$chan(]]%chan).wid [[$nick_(nick)|$nick(]]%chan,%j)
 
       [[dec]] %j
 
       [[dec]] %j
 
     }
 
     }
Line 184: Line 184:
 
  [[alias]] -l auth_update.update {
 
  [[alias]] -l auth_update.update {
 
   [[Local_Variables|var]] %who
 
   [[Local_Variables|var]] %who
   [[If-Then-Else|if]] (!$hget(auths.u. $+ $cid)) {
+
   [[If-Then-Else|if]] (![[$hget]](auths.u. [[DollarPlus|$+]] [[$cid]])) {
     .[[timer]] $+ $cid $+ .auth_update.update off
+
     .[[timer]] [[DollarPlus|$+]] [[$cid]] [[DollarPlus|$+]] .auth_update.update off
     [[hmake]] auths.u. $+ $cid 200
+
     [[hmake]] auths.u. [[DollarPlus|$+]] [[$cid]] 200
 
     [[Local_Variables|var]] %who = $auth_update.who
 
     [[Local_Variables|var]] %who = $auth_update.who
 
     [[If-Then-Else|if]] (%who) {
 
     [[If-Then-Else|if]] (%who) {
       [[hadd]] auths.u. $+ $cid -mask %who $+ ,,, $+ 273
+
       [[hadd]] auths.u. [[DollarPlus|$+]] [[$cid]] -mask %who [[DollarPlus|$+]] ,,, [[DollarPlus|$+]] 273
       .[[timer]] $+ $cid $+ .auth_update.timeout 1 $calc($repeat.who * 2) auth_update.timeout
+
       .[[timer]] [[DollarPlus|$+]] [[$cid]] [[DollarPlus|$+]] .auth_update.timeout 1 [[$calc]]($repeat.who * 2) auth_update.timeout
       .quote WHO $hget(auths.u. $+ $cid,-mask) % $+ nat,273
+
       .quote WHO [[$hget]](auths.u. [[DollarPlus|$+]] [[$cid]],-mask) % [[DollarPlus|$+]] nat,273
 
     }
 
     }
 
     [[If-Then-Else|else]] {
 
     [[If-Then-Else|else]] {
       [[hfree]] auths.u. $+ $cid
+
       [[hfree]] auths.u. [[DollarPlus|$+]] [[$cid]]
       .[[timer]] $+ $cid $+ .auth_update.update 1 $$repeat.who auth_update.update
+
       .[[timer]] [[DollarPlus|$+]] [[$cid]] [[DollarPlus|$+]] .auth_update.update 1 $$repeat.who auth_update.update
 
     }
 
     }
 
   }
 
   }
 
   [[If-Then-Else|if]] (%who) { [[return]] updating }
 
   [[If-Then-Else|if]] (%who) { [[return]] updating }
   [[If-Then-Else|elseif]] ($hget(auths.u. $+ $cid)) { [[return]] already in progress }
+
   [[If-Then-Else|elseif]] ([[$hget]](auths.u. [[DollarPlus|$+]] [[$cid]])) { [[return]] already in progress }
 
   [[If-Then-Else|else]] { [[return]] nothing to update }
 
   [[If-Then-Else|else]] { [[return]] nothing to update }
 
  }
 
  }
Line 205: Line 205:
 
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH_UPDATE.TIMEOUT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH_UPDATE.TIMEOUT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
  [[alias]] -l auth_update.timeout {
 
  [[alias]] -l auth_update.timeout {
   [[hfree]] auths.u. $+ $cid
+
   [[hfree]] auths.u. [[DollarPlus|$+]] [[$cid]]
 
   auth_update.update
 
   auth_update.update
 
  }
 
  }
Line 214: Line 214:
 
  ; returns 127.1 23.2 <= means 127 nicks on comchan 1
 
  ; returns 127.1 23.2 <= means 127 nicks on comchan 1
 
  [[alias]] -l auth_update.sort {
 
  [[alias]] -l auth_update.sort {
   [[Local_Variables|var]] %i = $comchan($me,0) , %chans
+
   [[Local_Variables|var]] %i = [[$comchan]]([[$me]],0) , %chans
 
   [[while]] (%i) {
 
   [[while]] (%i) {
     [[Local_Variables|var]] %chans = %chans $nick($comchan($me,%i),0) $+ . $+ %i
+
     [[Local_Variables|var]] %chans = %chans [[$nick_(nick)|$nick(]][[$comchan]]([[$me]],%i),0) [[DollarPlus|$+]] . [[DollarPlus|$+]] %i
 
     [[dec]] %i
 
     [[dec]] %i
 
   }
 
   }
   [[return]] $sorttok(%chans,32,n)
+
   [[return]] [[$sorttok]](%chans,32,n)
 
  }
 
  }
 
   
 
   
Line 226: Line 226:
 
  ; returns #chan,#chan,nick,nick
 
  ; returns #chan,#chan,nick,nick
 
  [[alias]] -l auth_update.who {
 
  [[alias]] -l auth_update.who {
   [[Local_Variables|var]] %t = auths.u. $+ $cid , %t.l = auths.l. $+ $cid , %t.q = auths.q. $+ $cid , %t.n = auths.n. $+ $cid
+
   [[Local_Variables|var]] %t = auths.u. [[DollarPlus|$+]] [[$cid]] , %t.l = auths.l. [[DollarPlus|$+]] [[$cid]] , %t.q = auths.q. [[DollarPlus|$+]] [[$cid]] , %t.n = auths.n. [[DollarPlus|$+]] [[$cid]]
 
   [[Local_Variables|var]] %n.max = $max.who , %l.max = $len.who , %n.min = $minnicks.who , %ratio = $minratio.who
 
   [[Local_Variables|var]] %n.max = $max.who , %l.max = $len.who , %n.min = $minnicks.who , %ratio = $minratio.who
 
   [[Local_Variables|var]] %len , %n.nr , %chans , %nicks , %chans.go
 
   [[Local_Variables|var]] %len , %n.nr , %chans , %nicks , %chans.go
   [[If-Then-Else|if]] $hget(auths.n.temp) { [[hfree]] auths.n.temp }
+
   [[If-Then-Else|if]] [[$hget]](auths.n.temp) { [[hfree]] auths.n.temp }
 
   [[hmake]] auths.n.temp
 
   [[hmake]] auths.n.temp
   [[Local_Variables|var]] %n = $hget(%t.n,-firstnick)
+
   [[Local_Variables|var]] %n = [[$hget]](%t.n,-firstnick)
 
   [[while]] (%n) {
 
   [[while]] (%n) {
     [[inc]] %len $calc($len(%n) + 1)
+
     [[inc]] %len [[$calc]]([[$len]](%n) + 1)
 
     [[inc]] %n.nr
 
     [[inc]] %n.nr
     [[If-Then-Else|if]] (%n.nr > %n.max) || (%len > %l.max) { [[dec]] %n.nr | [[dec]] %len $calc($len(%n) + 1) | [[break]] }
+
     [[If-Then-Else|if]] (%n.nr > %n.max) || (%len > %l.max) { [[dec]] %n.nr | [[dec]] %len [[$calc]]([[$len]](%n) + 1) | [[break]] }
 
     [[hadd]] auths.n.temp %n 1
 
     [[hadd]] auths.n.temp %n 1
 
     [[hadd]] %t %n 1
 
     [[hadd]] %t %n 1
     [[Local_Variables|var]] %nicks = $addtok(%nicks,%n,44) , %n = $gettok($hget(%t.n,%n),2,32)
+
     [[Local_Variables|var]] %nicks = [[$addtok]](%nicks,%n,44) , %n = [[$gettok]]([[$hget]](%t.n,%n),2,32)
 
   }
 
   }
 
    
 
    
   [[Local_Variables|var]] %sorted = $auth_update.sort , %i = $numtok(%sorted,32) , %time = $calc($ctime - $queue.repeat.who)
+
   [[Local_Variables|var]] %sorted = $auth_update.sort , %i = [[$numtok]](%sorted,32) , %time = [[$calc]]([[$ctime]] - $queue.repeat.who)
 
   [[while]] (%i) {
 
   [[while]] (%i) {
     [[Local_Variables|var]] %comchan = $gettok($gettok(%sorted,%i,32),2,46) , %chan = $comchan($me,%comchan) , %id = $chan(%chan).wid $+ .
+
     [[Local_Variables|var]] %comchan = [[$gettok]]([[$gettok]](%sorted,%i,32),2,46) , %chan = [[$comchan]]([[$me]],%comchan) , %id = [[$chan_(window)|$chan(]]%chan).wid [[DollarPlus|$+]] .
     [[Local_Variables|var]] %n.c = $nick(%chan,0) , %left , %go
+
     [[Local_Variables|var]] %n.c = [[$nick_(nick)|$nick(]]%chan,0) , %left , %go
 
     [[If-Then-Else|if]] (%n.c > %n.max) { [[break]] }
 
     [[If-Then-Else|if]] (%n.c > %n.max) { [[break]] }
     [[If-Then-Else|if]] $hget(auths.temp) { [[hfree]] auths.temp }
+
     [[If-Then-Else|if]] [[$hget]](auths.temp) { [[hfree]] auths.temp }
 
     [[hmake]] auths.temp
 
     [[hmake]] auths.temp
     [[Local_Variables|var]] %n = $hget(%t.n,%id $+ -firstnick)
+
     [[Local_Variables|var]] %n = [[$hget]](%t.n,%id [[DollarPlus|$+]] -firstnick)
 
     [[while]] (%n) {
 
     [[while]] (%n) {
       [[If-Then-Else|if]] (!$hget(%t,%n)) || ($hget(auths.n.temp,%n)) { [[hadd]] auths.temp %n 1 | [[inc]] %left }
+
       [[If-Then-Else|if]] (![[$hget]](%t,%n)) || ([[$hget]](auths.n.temp,%n)) { [[hadd]] auths.temp %n 1 | [[inc]] %left }
       [[If-Then-Else|if]] (((%left >= %n.min) && ($calc(%left / %n.c) >= %ratio)) || (%left == %n.c)) { [[Local_Variables|var]] %go = 1 | [[break]] }
+
       [[If-Then-Else|if]] (((%left >= %n.min) && ([[$calc]](%left / %n.c) >= %ratio)) || (%left == %n.c)) { [[Local_Variables|var]] %go = 1 | [[break]] }
       [[Local_Variables|var]] %n = $gettok($hget(%t.n,%id $+ %n),2,32)
+
       [[Local_Variables|var]] %n = [[$gettok]]([[$hget]](%t.n,%id [[DollarPlus|$+]] %n),2,32)
 
     }
 
     }
     [[Local_Variables|var]] %n = $hget(%t.l,%id $+ -firstnick)
+
     [[Local_Variables|var]] %n = [[$hget]](%t.l,%id [[DollarPlus|$+]] -firstnick)
 
     [[while]] (%n) {
 
     [[while]] (%n) {
       [[If-Then-Else|if]] (!$hget(%t,%n)) && (!$hget(auths.temp,%n)) { [[inc]] %left }
+
       [[If-Then-Else|if]] (![[$hget]](%t,%n)) && (![[$hget]](auths.temp,%n)) { [[inc]] %left }
       [[If-Then-Else|if]] (((%left >= %n.min) && ($calc(%left / %n.c) >= %ratio)) || (%left == %n.c)) { [[Local_Variables|var]] %go = 1 | [[break]] }
+
       [[If-Then-Else|if]] (((%left >= %n.min) && ([[$calc]](%left / %n.c) >= %ratio)) || (%left == %n.c)) { [[Local_Variables|var]] %go = 1 | [[break]] }
       [[Local_Variables|var]] %n = $gettok($hget(%t.l,%id $+ %n),2,32)
+
       [[Local_Variables|var]] %n = [[$gettok]]([[$hget]](%t.l,%id [[DollarPlus|$+]] %n),2,32)
 
     }
 
     }
     [[Local_Variables|var]] %n = $hget(%t.q,%id $+ -firstnick)
+
     [[Local_Variables|var]] %n = [[$hget]](%t.q,%id [[DollarPlus|$+]] -firstnick)
 
     [[while]] (%n) {
 
     [[while]] (%n) {
       [[tokenize]] 32 $hget(%t.q,%id $+ %n)
+
       [[tokenize]] 32 [[$hget]](%t.q,%id [[DollarPlus|$+]] %n)
       [[If-Then-Else|if]] ($1 > %time) { [[break]] }
+
       [[If-Then-Else|if]] ([[$1-|$1]] > %time) { [[break]] }
       [[If-Then-Else|if]] (!$hget(%t,%n)) && (!$hget(auths.temp,%n)) { [[inc]] %left }
+
       [[If-Then-Else|if]] (![[$hget]](%t,%n)) && (![[$hget]](auths.temp,%n)) { [[inc]] %left }
       [[If-Then-Else|if]] (((%left >= %n.min) && ($calc(%left / %n.c) >= %ratio)) || (%left == %n.c)) { [[Local_Variables|var]] %go = 1 | [[break]] }
+
       [[If-Then-Else|if]] (((%left >= %n.min) && ([[$calc]](%left / %n.c) >= %ratio)) || (%left == %n.c)) { [[Local_Variables|var]] %go = 1 | [[break]] }
       [[Local_Variables|var]] %n = $3
+
       [[Local_Variables|var]] %n = [[$1-|$3]]
 
     }
 
     }
 
     [[If-Then-Else|if]] (!%go) { [[dec]] %i | [[continue]] }
 
     [[If-Then-Else|if]] (!%go) { [[dec]] %i | [[continue]] }
 
     [[Local_Variables|var]] %j = %n.c , %n.tmp = %n.nr , %l.tmp = %len , %chans.go = %chans.go %comchan
 
     [[Local_Variables|var]] %j = %n.c , %n.tmp = %n.nr , %l.tmp = %len , %chans.go = %chans.go %comchan
     [[inc]] %l.tmp $calc($len(%chan) + 1)
+
     [[inc]] %l.tmp [[$calc]]([[$len]](%chan) + 1)
 
     [[while]] (%j) {
 
     [[while]] (%j) {
       [[Local_Variables|var]] %n = $nick(%chan,%j)
+
       [[Local_Variables|var]] %n = [[$nick_(nick)|$nick(]]%chan,%j)
       [[If-Then-Else|if]] (!$hget(%t,%n)) { [[inc]] %n.tmp }
+
       [[If-Then-Else|if]] (![[$hget]](%t,%n)) { [[inc]] %n.tmp }
       [[If-Then-Else|if]] ($hget(auths.n.temp,%n)) { [[dec]] %l.tmp $calc($len(%n) + 1) }
+
       [[If-Then-Else|if]] ([[$hget]](auths.n.temp,%n)) { [[dec]] %l.tmp [[$calc]]([[$len]](%n) + 1) }
 
       [[dec]] %j
 
       [[dec]] %j
 
     }
 
     }
 
     [[If-Then-Else|if]] (%l.tmp > %l.max) || (%n.tmp > %n.max) { [[dec]] %i | [[continue]] }
 
     [[If-Then-Else|if]] (%l.tmp > %l.max) || (%n.tmp > %n.max) { [[dec]] %i | [[continue]] }
     [[Local_Variables|var]] %j = $nick(%chan,0)
+
     [[Local_Variables|var]] %j = [[$nick_(nick)|$nick(]]%chan,0)
 
     [[while]] (%j) {
 
     [[while]] (%j) {
       [[Local_Variables|var]] %n = $nick(%chan,%j)
+
       [[Local_Variables|var]] %n = [[$nick_(nick)|$nick(]]%chan,%j)
 
       [[hadd]] %t %n 1
 
       [[hadd]] %t %n 1
 
       [[hdel]] auths.n.temp %n
 
       [[hdel]] auths.n.temp %n
       [[Local_Variables|var]] %nicks = $remtok(%nicks,%n,1,44)
+
       [[Local_Variables|var]] %nicks = [[$remtok]](%nicks,%n,1,44)
 
       [[dec]] %j
 
       [[dec]] %j
 
     }
 
     }
     [[Local_Variables|var]] %len = %l.tmp , %n.nr = %n.tmp , %chans = $addtok(%chans,%chan,44)
+
     [[Local_Variables|var]] %len = %l.tmp , %n.nr = %n.tmp , %chans = [[$addtok]](%chans,%chan,44)
 
     [[dec]] %i
 
     [[dec]] %i
 
   }
 
   }
 
    
 
    
   [[Local_Variables|var]] %i = $comchan($me,0)
+
   [[Local_Variables|var]] %i = [[$comchan]]([[$me]],0)
 
   [[while]] (%i) {
 
   [[while]] (%i) {
     [[Local_Variables|var]] %chan = $comchan($me,%i)
+
     [[Local_Variables|var]] %chan = [[$comchan]]([[$me]],%i)
     [[If-Then-Else|if]] (($nick(%chan,0) > %n.max) || (!$istok(%chans.go,%i,32))) {
+
     [[If-Then-Else|if]] (([[$nick_(nick)|$nick(]]%chan,0) > %n.max) || (![[$istok]](%chans.go,%i,32))) {
       [[Local_Variables|var]] %id = $chan(%chan).wid $+ . , %n = $hget(%t.l,%id $+ -firstnick)
+
       [[Local_Variables|var]] %id = [[$chan_(window)|$chan(]]%chan).wid [[DollarPlus|$+]] . , %n = [[$hget]](%t.l,%id [[DollarPlus|$+]] -firstnick)
 
       [[while]] (%n) {
 
       [[while]] (%n) {
         [[If-Then-Else|if]] (!$hget(%t,%n)) {
+
         [[If-Then-Else|if]] (![[$hget]](%t,%n)) {
           [[inc]] %len $calc($len(%n) + 1)
+
           [[inc]] %len [[$calc]]([[$len]](%n) + 1)
 
           [[inc]] %n.nr
 
           [[inc]] %n.nr
 
           [[If-Then-Else|if]] (%n.nr > %n.max) || (%len > %l.max) { [[break]] }
 
           [[If-Then-Else|if]] (%n.nr > %n.max) || (%len > %l.max) { [[break]] }
 
           [[hadd]] %t %n 1
 
           [[hadd]] %t %n 1
           [[Local_Variables|var]] %nicks = $addtok(%nicks,%n,44)
+
           [[Local_Variables|var]] %nicks = [[$addtok]](%nicks,%n,44)
 
         }
 
         }
         [[Local_Variables|var]] %n = $gettok($hget(%t.l,%id $+ %n),2,32)
+
         [[Local_Variables|var]] %n = [[$gettok]]([[$hget]](%t.l,%id [[DollarPlus|$+]] %n),2,32)
 
       }
 
       }
 
       [[If-Then-Else|if]] (%n.nr > %n.max) || (%len > %l.max) { [[break]] }
 
       [[If-Then-Else|if]] (%n.nr > %n.max) || (%len > %l.max) { [[break]] }
       [[Local_Variables|var]] %n = $hget(%t.q,%id $+ -firstnick)
+
       [[Local_Variables|var]] %n = [[$hget]](%t.q,%id [[DollarPlus|$+]] -firstnick)
 
       [[while]] (%n) {
 
       [[while]] (%n) {
         [[tokenize]] 32 $hget(%t.q,%id $+ %n)
+
         [[tokenize]] 32 [[$hget]](%t.q,%id [[DollarPlus|$+]] %n)
         [[If-Then-Else|if]] ($1 > %time) { [[break]] }
+
         [[If-Then-Else|if]] ([[$1-|$1]] > %time) { [[break]] }
         [[If-Then-Else|if]] (!$hget(%t,%n)) {
+
         [[If-Then-Else|if]] (![[$hget]](%t,%n)) {
           [[inc]] %len $calc($len(%n) + 1)
+
           [[inc]] %len [[$calc]]([[$len]](%n) + 1)
 
           [[inc]] %n.nr
 
           [[inc]] %n.nr
 
           [[If-Then-Else|if]] (%n.nr > %n.max) || (%len > %l.max) { [[break]] }
 
           [[If-Then-Else|if]] (%n.nr > %n.max) || (%len > %l.max) { [[break]] }
 
           [[hadd]] %t %n 1
 
           [[hadd]] %t %n 1
           [[Local_Variables|var]] %nicks = $addtok(%nicks,%n,44)
+
           [[Local_Variables|var]] %nicks = [[$addtok]](%nicks,%n,44)
 
         }
 
         }
         [[Local_Variables|var]] %n = $3
+
         [[Local_Variables|var]] %n = [[$1-|$3]]
 
       }
 
       }
 
     }
 
     }
Line 323: Line 323:
 
     [[dec]] %i
 
     [[dec]] %i
 
   }
 
   }
   [[If-Then-Else|if]] $hget(auths.temp) { [[hfree]] auths.temp }
+
   [[If-Then-Else|if]] [[$hget]](auths.temp) { [[hfree]] auths.temp }
   [[If-Then-Else|if]] $hget(auths.n.temp) { [[hfree]] auths.n.temp }
+
   [[If-Then-Else|if]] [[$hget]](auths.n.temp) { [[hfree]] auths.n.temp }
   [[return]] $addtok(%chans,%nicks,44)
+
   [[return]] [[$addtok]](%chans,%nicks,44)
 
  }
 
  }
 
   
 
   
Line 333: Line 333:
 
  ; 354 Vliedel 273  L      0
 
  ; 354 Vliedel 273  L      0
 
  RAW 354:& 273 & &:{
 
  RAW 354:& 273 & &:{
   [[If-Then-Else|if]] ($comchan($3,1)) { auth_update.nick $3 $4 }
+
   [[If-Then-Else|if]] ([[$comchan]]([[$1-|$3]],1)) { auth_update.nick [[$1-|$3]] [[$1-|$4]] }
   [[If-Then-Else|elseif]] ($hget(auths.n. $+ $cid,$3)) { auth.n.rem $3 | .[[signal]] authupdate $3 }
+
   [[If-Then-Else|elseif]] ([[$hget]](auths.n. [[DollarPlus|$+]] [[$cid]],[[$1-|$3]])) { auth.n.rem [[$1-|$3]] | .[[signal]] authupdate [[$1-|$3]] }
 
   [[haltdef]]
 
   [[haltdef]]
 
  }
 
  }
Line 342: Line 342:
 
  ; 315 Vliedel  #vliedel,Rutix,fishbot  :End of /WHO list.
 
  ; 315 Vliedel  #vliedel,Rutix,fishbot  :End of /WHO list.
 
  RAW 315:& & end of /WHO list.: {
 
  RAW 315:& & end of /WHO list.: {
   [[If-Then-Else|if]] ($hget(auths.u. $+ $cid,-mask) == $2) {
+
   [[If-Then-Else|if]] ([[$hget]](auths.u. [[DollarPlus|$+]] [[$cid]],-mask) == [[$1-|$2]]) {
     [[hfree]] auths.u. $+ $cid
+
     [[hfree]] auths.u. [[DollarPlus|$+]] [[$cid]]
     .[[timer]] $+ $cid $+ .auth_update.timeout off
+
     .[[timer]] [[DollarPlus|$+]] [[$cid]] [[DollarPlus|$+]] .auth_update.timeout off
     .[[timer]] $+ $cid $+ .auth_update.update 1 $iif($hget(auths.n. $+ $cid,1).item,$next.wait,$repeat.who) auth_update.update
+
     .[[timer]] [[DollarPlus|$+]] [[$cid]] [[DollarPlus|$+]] .auth_update.update 1 [[$iif]]([[$hget]](auths.n. [[DollarPlus|$+]] [[$cid]],1).item,$next.wait,$repeat.who) auth_update.update
 
     [[haltdef]]
 
     [[haltdef]]
 
   }
 
   }
Line 353: Line 353:
 
  ; $1 = nick    $2 = auth
 
  ; $1 = nick    $2 = auth
 
  [[alias]] -l auth_update.nick {
 
  [[alias]] -l auth_update.nick {
   [[If-Then-Else|if]] ($hget(auths. $+ $cid,$1) != $2) {
+
   [[If-Then-Else|if]] ([[$hget]](auths. [[DollarPlus|$+]] [[$cid]],[[$1-|$1]]) != [[$1-|$2]]) {
     .[[signal]] authupdate.new $1 $2
+
     .[[signal]] authupdate.new [[$1-|$1]] [[$1-|$2]]
     auth.add $1 $2
+
     auth.add [[$1-|$1]] [[$1-|$2]]
 
   }
 
   }
   auth.l.rem $1
+
   auth.l.rem [[$1-|$1]]
   [[If-Then-Else|if]] ($2 == 0) { auth.q.add $1 }
+
   [[If-Then-Else|if]] ([[$1-|$2]] == 0) { auth.q.add [[$1-|$1]] }
   [[If-Then-Else|else]] { auth.q.rem $1 }
+
   [[If-Then-Else|else]] { auth.q.rem [[$1-|$1]] }
   [[If-Then-Else|if]] ($hget(auths.n. $+ $cid,$1)) { auth.n.rem $1 | .[[signal]] authupdate $1 $2 }
+
   [[If-Then-Else|if]] ([[$hget]](auths.n. [[DollarPlus|$+]] [[$cid]],[[$1-|$1]])) { auth.n.rem [[$1-|$1]] | .[[signal]] authupdate [[$1-|$1]] [[$1-|$2]] }
 
  }
 
  }
 
   
 
   
 
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; JOIN EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; JOIN EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
  on *:JOIN:#:{
 
  on *:JOIN:#:{
   [[If-Then-Else|if]] ($nick == $me) && ($used.network($network)) {
+
   [[If-Then-Else|if]] ([[$nick_(remote)|$nick]] == [[$me]]) && ($used.network([[$network]])) {
     [[If-Then-Else|if]] (!$hget(auths. $+ $cid)) { [[hmake]] auths. $+ $cid 200 }
+
     [[If-Then-Else|if]] (![[$hget]](auths. [[DollarPlus|$+]] [[$cid]])) { [[hmake]] auths. [[DollarPlus|$+]] [[$cid]] 200 }
     [[If-Then-Else|if]] (!$hget(auths.l. $+ $cid)) { [[hmake]] auths.l. $+ $cid 200 }
+
     [[If-Then-Else|if]] (![[$hget]](auths.l. [[DollarPlus|$+]] [[$cid]])) { [[hmake]] auths.l. [[DollarPlus|$+]] [[$cid]] 200 }
     [[If-Then-Else|if]] (!$hget(auths.q. $+ $cid)) { [[hmake]] auths.q. $+ $cid 200 }
+
     [[If-Then-Else|if]] (![[$hget]](auths.q. [[DollarPlus|$+]] [[$cid]])) { [[hmake]] auths.q. [[DollarPlus|$+]] [[$cid]] 200 }
     [[If-Then-Else|if]] (!$hget(auths.n. $+ $cid)) { [[hmake]] auths.n. $+ $cid 100 }
+
     [[If-Then-Else|if]] (![[$hget]](auths.n. [[DollarPlus|$+]] [[$cid]])) { [[hmake]] auths.n. [[DollarPlus|$+]] [[$cid]] 100 }
     [[If-Then-Else|if]] (!$timer($cid $+ .auth_update.update)) { .[[timer]] $+ $cid $+ .auth_update.update 1 $delay.who auth_update.update }
+
     [[If-Then-Else|if]] (!$timer([[$cid]] [[DollarPlus|$+]] .auth_update.update)) { .[[timer]] [[DollarPlus|$+]] [[$cid]] [[DollarPlus|$+]] .auth_update.update 1 $delay.who auth_update.update }
 
     [[return]]
 
     [[return]]
 
   }
 
   }
   [[If-Then-Else|if]] ($auth.site($network,$site)) { auth_update.nick $nick $auth.from.site($network,$site) | [[return]] }
+
   [[If-Then-Else|if]] ($auth.site([[$network]],$site)) { auth_update.nick [[$nick_(remote)|$nick]] $auth.from.site([[$network]],$site) | [[return]] }
   [[If-Then-Else|if]] ($hget(auths. $+ $cid,$nick) == $null) { auth.l.add.wid $chan($chan).wid $nick }
+
   [[If-Then-Else|if]] ([[$hget]](auths. [[DollarPlus|$+]] [[$cid]],[[$nick_(remote)|$nick]]) == [[$null]]) { auth.l.add.wid [[$chan_(window)|$chan(]][[$chan_(remote)|$chan]]).wid [[$nick_(remote)|$nick]] }
   [[If-Then-Else|elseif]] ($hget(auths. $+ $cid,$nick) == 0) {
+
   [[If-Then-Else|elseif]] ([[$hget]](auths. [[DollarPlus|$+]] [[$cid]],[[$nick_(remote)|$nick]]) == 0) {
     auth.q.add.wid $chan($chan).wid $nick
+
     auth.q.add.wid [[$chan_(window)|$chan(]][[$chan_(remote)|$chan]]).wid [[$nick_(remote)|$nick]]
     [[If-Then-Else|if]] (!$comchan($nick,2)) { auth.q.add.main $nick }
+
     [[If-Then-Else|if]] (![[$comchan]]([[$nick_(remote)|$nick]],2)) { auth.q.add.main [[$nick_(remote)|$nick]] }
 
   }
 
   }
   [[If-Then-Else|if]] ($hget(auths.n. $+ $cid,$nick)) { auth.n.add.wid $chan($2).wid $nick }
+
   [[If-Then-Else|if]] ([[$hget]](auths.n. [[DollarPlus|$+]] [[$cid]],[[$nick_(remote)|$nick]])) { auth.n.add.wid [[$chan_(window)|$chan(]][[$1-|$2]]).wid [[$nick_(remote)|$nick]] }
 
  }
 
  }
 
   
 
   
Line 386: Line 386:
 
  366 Vliedel #Help :End of /NAMES list
 
  366 Vliedel #Help :End of /NAMES list
 
  RAW 366:& & end of /names list.:{
 
  RAW 366:& & end of /names list.:{
   [[Local_Variables|var]] %i = $nick($2,0) , %t = auths. $+ $cid
+
   [[Local_Variables|var]] %i = [[$nick_(nick)|$nick(]][[$1-|$2]],0) , %t = auths. [[DollarPlus|$+]] [[$cid]]
 
   [[while]] (%i) {
 
   [[while]] (%i) {
     [[Local_Variables|var]] %n = $nick($2,%i)
+
     [[Local_Variables|var]] %n = [[$nick_(nick)|$nick(]][[$1-|$2]],%i)
     [[If-Then-Else|if]] ($hget(%t,%n) == $null) { auth.l.add.wid $chan($2).wid %n }
+
     [[If-Then-Else|if]] ([[$hget]](%t,%n) == [[$null]]) { auth.l.add.wid [[$chan_(window)|$chan(]][[$1-|$2]]).wid %n }
     [[If-Then-Else|elseif]] ($hget(%t,%n) == 0) {
+
     [[If-Then-Else|elseif]] ([[$hget]](%t,%n) == 0) {
       auth.q.add.wid $chan($2).wid %n
+
       auth.q.add.wid [[$chan_(window)|$chan(]][[$1-|$2]]).wid %n
       [[If-Then-Else|if]] (!$comchan(%n,2)) { auth.q.add.main %n }
+
       [[If-Then-Else|if]] (![[$comchan]](%n,2)) { auth.q.add.main %n }
 
     }
 
     }
     [[If-Then-Else|if]] ($hget(auths.n. $+ $cid,%n)) { auth.n.add.wid $chan($2).wid %n }
+
     [[If-Then-Else|if]] ([[$hget]](auths.n. [[DollarPlus|$+]] [[$cid]],%n)) { auth.n.add.wid [[$chan_(window)|$chan(]][[$1-|$2]]).wid %n }
 
     [[dec]] %i
 
     [[dec]] %i
 
   }
 
   }
Line 401: Line 401:
 
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PART EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PART EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
  on *:PART:#:{
 
  on *:PART:#:{
   [[If-Then-Else|if]] ($nick == $me) {
+
   [[If-Then-Else|if]] ([[$nick_(remote)|$nick]] == [[$me]]) {
     auth.rem.chan $chan
+
     auth.rem.chan [[$chan_(remote)|$chan]]
     auth.l.rem.chan.all $chan
+
     auth.l.rem.chan.all [[$chan_(remote)|$chan]]
     auth.q.rem.chan.all $chan
+
     auth.q.rem.chan.all [[$chan_(remote)|$chan]]
     auth.n.rem.chan.all $chan
+
     auth.n.rem.chan.all [[$chan_(remote)|$chan]]
 
   }
 
   }
 
   [[If-Then-Else|else]] {
 
   [[If-Then-Else|else]] {
     auth.l.rem.wid $chan($chan).wid $nick
+
     auth.l.rem.wid [[$chan_(window)|$chan(]][[$chan_(remote)|$chan]]).wid [[$nick_(remote)|$nick]]
     auth.q.rem.wid $chan($chan).wid $nick
+
     auth.q.rem.wid [[$chan_(window)|$chan(]][[$chan_(remote)|$chan]]).wid [[$nick_(remote)|$nick]]
     auth.n.rem.wid $chan($chan).wid $nick
+
     auth.n.rem.wid [[$chan_(window)|$chan(]][[$chan_(remote)|$chan]]).wid [[$nick_(remote)|$nick]]
     [[If-Then-Else|if]] (!$comchan($nick,2)) {
+
     [[If-Then-Else|if]] (![[$comchan]]([[$nick_(remote)|$nick]],2)) {
       auth.rem $nick
+
       auth.rem [[$nick_(remote)|$nick]]
       auth.q.rem.main $nick
+
       auth.q.rem.main [[$nick_(remote)|$nick]]
       auth.n.rem.main $nick
+
       auth.n.rem.main [[$nick_(remote)|$nick]]
 
     }
 
     }
     [[If-Then-Else|elseif]] ($auth.site($network,$site)) { auth_update.nick $nick $auth.from.site($network,$site) }
+
     [[If-Then-Else|elseif]] ($auth.site([[$network]],$site)) { auth_update.nick [[$nick_(remote)|$nick]] $auth.from.site([[$network]],$site) }
 
   }
 
   }
 
  }
 
  }
Line 422: Line 422:
 
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; KICK EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; KICK EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
  on *:KICK:#:{
 
  on *:KICK:#:{
   [[If-Then-Else|if]] ($knick == $me) {
+
   [[If-Then-Else|if]] ($knick == [[$me]]) {
     auth.rem.chan $chan
+
     auth.rem.chan [[$chan_(remote)|$chan]]
     auth.l.rem.chan.all $chan
+
     auth.l.rem.chan.all [[$chan_(remote)|$chan]]
     auth.q.rem.chan.all $chan
+
     auth.q.rem.chan.all [[$chan_(remote)|$chan]]
     auth.n.rem.chan.all $chan
+
     auth.n.rem.chan.all [[$chan_(remote)|$chan]]
 
   }
 
   }
 
   [[If-Then-Else|else]] {
 
   [[If-Then-Else|else]] {
     auth.l.rem.wid $chan($chan).wid $knick
+
     auth.l.rem.wid [[$chan_(window)|$chan(]][[$chan_(remote)|$chan]]).wid $knick
     auth.q.rem.wid $chan($chan).wid $knick
+
     auth.q.rem.wid [[$chan_(window)|$chan(]][[$chan_(remote)|$chan]]).wid $knick
     auth.n.rem.wid $chan($chan).wid $knick
+
     auth.n.rem.wid [[$chan_(window)|$chan(]][[$chan_(remote)|$chan]]).wid $knick
     [[If-Then-Else|if]] (!$comchan($knick,2)) {
+
     [[If-Then-Else|if]] (![[$comchan]]($knick,2)) {
 
       auth.rem $knick
 
       auth.rem $knick
 
       auth.q.rem.main $knick
 
       auth.q.rem.main $knick
 
       auth.n.rem.main $knick
 
       auth.n.rem.main $knick
 
     }
 
     }
     [[If-Then-Else|if]] ($auth.site($network,$site)) && ($comchan($nick,1)) { auth_update.nick $nick $auth.from.site($network,$site) }
+
     [[If-Then-Else|if]] ($auth.site([[$network]],$site)) && ([[$comchan]]([[$nick_(remote)|$nick]],1)) { auth_update.nick [[$nick_(remote)|$nick]] $auth.from.site([[$network]],$site) }
 
   }
 
   }
 
  }
 
  }
Line 443: Line 443:
 
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; QUIT EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; QUIT EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
  on *:QUIT:{
 
  on *:QUIT:{
   auth.rem $nick
+
   auth.rem [[$nick_(remote)|$nick]]
   auth.l.rem $nick
+
   auth.l.rem [[$nick_(remote)|$nick]]
   auth.q.rem $nick
+
   auth.q.rem [[$nick_(remote)|$nick]]
   auth.n.rem $nick
+
   auth.n.rem [[$nick_(remote)|$nick]]
 
  }
 
  }
 
   
 
   
 
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NICK EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NICK EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
  on *:NICK:{
 
  on *:NICK:{
   auth.nick $nick $newnick
+
   auth.nick [[$nick_(remote)|$nick]] $newnick
   auth.l.nick $nick $newnick
+
   auth.l.nick [[$nick_(remote)|$nick]] $newnick
   auth.q.nick $nick $newnick
+
   auth.q.nick [[$nick_(remote)|$nick]] $newnick
   auth.n.nick $nick $newnick
+
   auth.n.nick [[$nick_(remote)|$nick]] $newnick
   [[If-Then-Else|if]] ($auth.site($network,$site)) { auth_update.nick $newnick $auth.from.site($network,$site) }
+
   [[If-Then-Else|if]] ($auth.site([[$network]],$site)) { auth_update.nick $newnick $auth.from.site([[$network]],$site) }
 
  }
 
  }
 
   
 
   
 
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IAL-UPDATING EVENTS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IAL-UPDATING EVENTS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  on *:TEXT:*:*:{ [[If-Then-Else|if]] ($auth.site($network,$site)) && ($comchan($nick,1)) { auth_update.nick $nick $auth.from.site($network,$site) } }
+
  on *:TEXT:*:*:{ [[If-Then-Else|if]] ($auth.site([[$network]],$site)) && ([[$comchan]]([[$nick_(remote)|$nick]],1)) { auth_update.nick [[$nick_(remote)|$nick]] $auth.from.site([[$network]],$site) } }
  on *:ACTION:*:*:{ [[If-Then-Else|if]] ($auth.site($network,$site)) && ($comchan($nick,1)) { auth_update.nick $nick $auth.from.site($network,$site) } }
+
  on *:ACTION:*:*:{ [[If-Then-Else|if]] ($auth.site([[$network]],$site)) && ([[$comchan]]([[$nick_(remote)|$nick]],1)) { auth_update.nick [[$nick_(remote)|$nick]] $auth.from.site([[$network]],$site) } }
  on *:NOTICE:*:*:{ [[If-Then-Else|if]] ($auth.site($network,$site)) && ($comchan($nick,1)) { auth_update.nick $nick $auth.from.site($network,$site) } }
+
  on *:NOTICE:*:*:{ [[If-Then-Else|if]] ($auth.site([[$network]],$site)) && ([[$comchan]]([[$nick_(remote)|$nick]],1)) { auth_update.nick [[$nick_(remote)|$nick]] $auth.from.site([[$network]],$site) } }
  on *:RAWMODE:#:{ [[If-Then-Else|if]] ($auth.site($network,$site)) && ($comchan($nick,1)) { auth_update.nick $nick $auth.from.site($network,$site) } }
+
  on *:RAWMODE:#:{ [[If-Then-Else|if]] ($auth.site([[$network]],$site)) && ([[$comchan]]([[$nick_(remote)|$nick]],1)) { auth_update.nick [[$nick_(remote)|$nick]] $auth.from.site([[$network]],$site) } }
  on *:TOPIC:#:{ [[If-Then-Else|if]] ($auth.site($network,$site)) && ($comchan($nick,1)) { auth_update.nick $nick $auth.from.site($network,$site) } }
+
  on *:TOPIC:#:{ [[If-Then-Else|if]] ($auth.site([[$network]],$site)) && ([[$comchan]]([[$nick_(remote)|$nick]],1)) { auth_update.nick [[$nick_(remote)|$nick]] $auth.from.site([[$network]],$site) } }
  on *:INVITE:#:{ [[If-Then-Else|if]] ($auth.site($network,$site)) && ($comchan($nick,1)) { auth_update.nick $nick $auth.from.site($network,$site) } }
+
  on *:INVITE:#:{ [[If-Then-Else|if]] ($auth.site([[$network]],$site)) && ([[$comchan]]([[$nick_(remote)|$nick]],1)) { auth_update.nick [[$nick_(remote)|$nick]] $auth.from.site([[$network]],$site) } }
  [[CTCP]] *:*:*:{ [[If-Then-Else|if]] ($auth.site($network,$site)) && ($comchan($nick,1)) { auth_update.nick $nick $auth.from.site($network,$site) } }
+
  [[CTCP]] *:*:*:{ [[If-Then-Else|if]] ($auth.site([[$network]],$site)) && ([[$comchan]]([[$nick_(remote)|$nick]],1)) { auth_update.nick [[$nick_(remote)|$nick]] $auth.from.site([[$network]],$site) } }
  RAW 352:& & & & & & & & *: { [[If-Then-Else|if]] ($auth.site($network,$4)) && ($comchan($6,1)) { auth_update.nick $6 $auth.from.site($network,$4) } }
+
  RAW 352:& & & & & & & & *: { [[If-Then-Else|if]] ($auth.site([[$network]],[[$1-|$4]])) && ([[$comchan]]([[$1-|$6]],1)) { auth_update.nick [[$1-|$6]] $auth.from.site([[$network]],[[$1-|$4]]) } }
 
   
 
   
 
   
 
   
 
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DISCONNECT EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DISCONNECT EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
  on *:DISCONNECT:{
 
  on *:DISCONNECT:{
   [[If-Then-Else|if]] ($hget(auths.u $+ $cid)) { [[hfree]] $v1 }
+
   [[If-Then-Else|if]] ([[$hget]](auths.u [[DollarPlus|$+]] [[$cid]])) { [[hfree]] $v1 }
   [[If-Then-Else|if]] ($hget(auths. $+ $cid)) { [[hfree]] $v1 }
+
   [[If-Then-Else|if]] ([[$hget]](auths. [[DollarPlus|$+]] [[$cid]])) { [[hfree]] $v1 }
   [[If-Then-Else|if]] ($hget(auths.q. $+ $cid)) { [[hfree]] $v1 }
+
   [[If-Then-Else|if]] ([[$hget]](auths.q. [[DollarPlus|$+]] [[$cid]])) { [[hfree]] $v1 }
   [[If-Then-Else|if]] ($hget(auths.l. $+ $cid)) { [[hfree]] $v1 }
+
   [[If-Then-Else|if]] ([[$hget]](auths.l. [[DollarPlus|$+]] [[$cid]])) { [[hfree]] $v1 }
   [[If-Then-Else|if]] ($hget(auths.n. $+ $cid)) { [[hfree]] $v1 }
+
   [[If-Then-Else|if]] ([[$hget]](auths.n. [[DollarPlus|$+]] [[$cid]])) { [[hfree]] $v1 }
 
  }
 
  }
 
   
 
   
Line 511: Line 511:
 
  ; $1 = nick  $2 = auth
 
  ; $1 = nick  $2 = auth
 
  [[alias]] -l auth.add {
 
  [[alias]] -l auth.add {
   [[If-Then-Else|if]] (!$hget(auths. $+ $cid)) { [[return]] }
+
   [[If-Then-Else|if]] (![[$hget]](auths. [[DollarPlus|$+]] [[$cid]])) { [[return]] }
   [[hadd]] auths. $+ $cid $1 $2
+
   [[hadd]] auths. [[DollarPlus|$+]] [[$cid]] [[$1-|$1]] [[$1-|$2]]
 
  }
 
  }
 
   
 
   
Line 518: Line 518:
 
  ; $1 = nick
 
  ; $1 = nick
 
  [[alias]] -l auth.rem {
 
  [[alias]] -l auth.rem {
   [[If-Then-Else|if]] (!$hget(auths. $+ $cid)) { [[return]] }
+
   [[If-Then-Else|if]] (![[$hget]](auths. [[DollarPlus|$+]] [[$cid]])) { [[return]] }
   [[hdel]] auths. $+ $cid $1
+
   [[hdel]] auths. [[DollarPlus|$+]] [[$cid]] [[$1-|$1]]
 
  }
 
  }
 
   
 
   
Line 525: Line 525:
 
  ; $1 = chan
 
  ; $1 = chan
 
  [[alias]] -l auth.rem.chan {
 
  [[alias]] -l auth.rem.chan {
   [[If-Then-Else|if]] (!$hget(auths. $+ $cid)) { [[return]] }
+
   [[If-Then-Else|if]] (![[$hget]](auths. [[DollarPlus|$+]] [[$cid]])) { [[return]] }
   [[Local_Variables|var]] %i = $nick($1,0)
+
   [[Local_Variables|var]] %i = [[$nick_(nick)|$nick(]][[$1-|$1]],0)
 
   [[while]] (%i) {
 
   [[while]] (%i) {
     [[If-Then-Else|if]] (!$comchan($nick($1,%i),2)) { [[hdel]] auths. $+ $cid $nick($1,%i) }
+
     [[If-Then-Else|if]] (![[$comchan]]([[$nick_(nick)|$nick(]][[$1-|$1]],%i),2)) { [[hdel]] auths. [[DollarPlus|$+]] [[$cid]] [[$nick_(nick)|$nick(]][[$1-|$1]],%i) }
 
     [[dec]] %i
 
     [[dec]] %i
 
   }
 
   }
Line 536: Line 536:
 
  ; $1 = nick  $2 = newnick
 
  ; $1 = nick  $2 = newnick
 
  [[alias]] -l auth.nick {
 
  [[alias]] -l auth.nick {
   [[If-Then-Else|if]] ($hget(auths. $+ $cid,$1) !== $null) { [[hdel]] auths. $+ $cid $1 | [[hadd]] auths. $+ $cid $2 $v1 }
+
   [[If-Then-Else|if]] ([[$hget]](auths. [[DollarPlus|$+]] [[$cid]],[[$1-|$1]]) !== [[$null]]) { [[hdel]] auths. [[DollarPlus|$+]] [[$cid]] [[$1-|$1]] | [[hadd]] auths. [[DollarPlus|$+]] [[$cid]] [[$1-|$2]] $v1 }
 
  }
 
  }
 
   
 
   
Line 549: Line 549:
 
  ; $1 = wid  $2 = nick
 
  ; $1 = wid  $2 = nick
 
  [[alias]] -l auth.l.add.wid {
 
  [[alias]] -l auth.l.add.wid {
   [[Local_Variables|var]] %table = auths.l. $+ $cid
+
   [[Local_Variables|var]] %table = auths.l. [[DollarPlus|$+]] [[$cid]]
   [[If-Then-Else|if]] (!$hget(%table)) { [[return]] }
+
   [[If-Then-Else|if]] (![[$hget]](%table)) { [[return]] }
   [[Local_Variables|var]] %id = $1 $+ . ,  %lastnick = $hget(%table,%id $+ -lastnick)
+
   [[Local_Variables|var]] %id = [[$1-|$1]] [[DollarPlus|$+]] . ,  %lastnick = [[$hget]](%table,%id [[DollarPlus|$+]] -lastnick)
   [[If-Then-Else|if]] ($hget(%table,%id $+ $2)) { [[return]] }
+
   [[If-Then-Else|if]] ([[$hget]](%table,%id [[DollarPlus|$+]] [[$1-|$2]])) { [[return]] }
 
   [[If-Then-Else|if]] (%lastnick) {
 
   [[If-Then-Else|if]] (%lastnick) {
     [[hadd]] %table %id $+ $2 %lastnick 0
+
     [[hadd]] %table %id [[DollarPlus|$+]] [[$1-|$2]] %lastnick 0
     [[hadd]] %table %id $+ %lastnick $gettok($hget(%table,%id $+ %lastnick),1,32) $2
+
     [[hadd]] %table %id [[DollarPlus|$+]] %lastnick [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] %lastnick),1,32) [[$1-|$2]]
 
   }
 
   }
 
   [[If-Then-Else|else]] {
 
   [[If-Then-Else|else]] {
     [[hadd]] %table %id $+ $2 0 0
+
     [[hadd]] %table %id [[DollarPlus|$+]] [[$1-|$2]] 0 0
     [[hadd]] %table %id $+ -firstnick $2
+
     [[hadd]] %table %id [[DollarPlus|$+]] -firstnick [[$1-|$2]]
 
   }
 
   }
   [[hadd]] %table %id $+ -lastnick $2
+
   [[hadd]] %table %id [[DollarPlus|$+]] -lastnick [[$1-|$2]]
 
  }
 
  }
 
   
 
   
Line 567: Line 567:
 
  ; $1 = nick
 
  ; $1 = nick
 
  [[alias]] -l auth.l.rem {
 
  [[alias]] -l auth.l.rem {
   [[If-Then-Else|if]] (!$hget(auths.l. $+ $cid)) { [[return]] }
+
   [[If-Then-Else|if]] (![[$hget]](auths.l. [[DollarPlus|$+]] [[$cid]])) { [[return]] }
   [[Local_Variables|var]] %i = $comchan($1,0)
+
   [[Local_Variables|var]] %i = [[$comchan]]([[$1-|$1]],0)
 
   [[while]] (%i) {
 
   [[while]] (%i) {
     auth.l.rem.wid $chan($comchan($1,%i)).wid $1
+
     auth.l.rem.wid [[$chan_(window)|$chan(]][[$comchan]]([[$1-|$1]],%i)).wid [[$1-|$1]]
 
     [[dec]] %i
 
     [[dec]] %i
 
   }
 
   }
Line 578: Line 578:
 
  ; $1 = wid  $2 = nick
 
  ; $1 = wid  $2 = nick
 
  [[alias]] -l auth.l.rem.wid {
 
  [[alias]] -l auth.l.rem.wid {
   [[Local_Variables|var]] %table = auths.l. $+ $cid
+
   [[Local_Variables|var]] %table = auths.l. [[DollarPlus|$+]] [[$cid]]
   [[If-Then-Else|if]] (!$hget(%table)) { [[return]] }
+
   [[If-Then-Else|if]] (![[$hget]](%table)) { [[return]] }
   [[Local_Variables|var]] %id = $1 $+ . , %val = $hget(%table,%id $+ $2)
+
   [[Local_Variables|var]] %id = [[$1-|$1]] [[DollarPlus|$+]] . , %val = [[$hget]](%table,%id [[DollarPlus|$+]] [[$1-|$2]])
 
   [[If-Then-Else|if]] (!%val) { [[return]] }
 
   [[If-Then-Else|if]] (!%val) { [[return]] }
   [[Local_Variables|var]] %nick.l = $gettok(%val,1,32) , %nick.r = $gettok(%val,2,32)
+
   [[Local_Variables|var]] %nick.l = [[$gettok]](%val,1,32) , %nick.r = [[$gettok]](%val,2,32)
   [[hdel]] %table %id $+ $2
+
   [[hdel]] %table %id [[DollarPlus|$+]] [[$1-|$2]]
   [[If-Then-Else|if]] (%nick.l == 0) && (%nick.r == 0) { [[hdel]] %table %id $+ -lastnick | [[hdel]] %table %id $+ -firstnick | [[return]] }
+
   [[If-Then-Else|if]] (%nick.l == 0) && (%nick.r == 0) { [[hdel]] %table %id [[DollarPlus|$+]] -lastnick | [[hdel]] %table %id [[DollarPlus|$+]] -firstnick | [[return]] }
   [[If-Then-Else|if]] (%nick.l !== 0) { [[hadd]] %table %id $+ %nick.l $gettok($hget(%table,%id $+ %nick.l),1,32) %nick.r }
+
   [[If-Then-Else|if]] (%nick.l !== 0) { [[hadd]] %table %id [[DollarPlus|$+]] %nick.l [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] %nick.l),1,32) %nick.r }
   [[If-Then-Else|else]] { [[hadd]] %table %id $+ -firstnick %nick.r }
+
   [[If-Then-Else|else]] { [[hadd]] %table %id [[DollarPlus|$+]] -firstnick %nick.r }
   [[If-Then-Else|if]] (%nick.r !== 0) { [[hadd]] %table %id $+ %nick.r %nick.l $gettok($hget(%table,%id $+ %nick.r),2,32) }
+
   [[If-Then-Else|if]] (%nick.r !== 0) { [[hadd]] %table %id [[DollarPlus|$+]] %nick.r %nick.l [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] %nick.r),2,32) }
   [[If-Then-Else|else]] { [[hadd]] %table %id $+ -lastnick %nick.l }
+
   [[If-Then-Else|else]] { [[hadd]] %table %id [[DollarPlus|$+]] -lastnick %nick.l }
 
  }
 
  }
 
   
 
   
Line 594: Line 594:
 
  ; $1 = chan
 
  ; $1 = chan
 
  [[alias]] -l auth.l.rem.chan.all {
 
  [[alias]] -l auth.l.rem.chan.all {
   [[If-Then-Else|if]] (!$hget(auths.l. $+ $cid)) { [[return]] }
+
   [[If-Then-Else|if]] (![[$hget]](auths.l. [[DollarPlus|$+]] [[$cid]])) { [[return]] }
   [[hdel]] -w auths.l. $+ $cid $chan($1).wid $+ .*
+
   [[hdel]] -w auths.l. [[DollarPlus|$+]] [[$cid]] [[$chan_(window)|$chan(]][[$1-|$1]]).wid [[DollarPlus|$+]] .*
 
  }
 
  }
 
   
 
   
Line 601: Line 601:
 
  ; $1 = nick  $2 = newnick
 
  ; $1 = nick  $2 = newnick
 
  [[alias]] -l auth.l.nick {
 
  [[alias]] -l auth.l.nick {
   [[If-Then-Else|if]] ($1 == $2) { [[return]] }
+
   [[If-Then-Else|if]] ([[$1-|$1]] == [[$1-|$2]]) { [[return]] }
   [[Local_Variables|var]] %table = auths.l. $+ $cid
+
   [[Local_Variables|var]] %table = auths.l. [[DollarPlus|$+]] [[$cid]]
   [[If-Then-Else|if]] (!$hget(%table)) { [[return]] }
+
   [[If-Then-Else|if]] (![[$hget]](%table)) { [[return]] }
   [[Local_Variables|var]] %i = $comchan($2,0)
+
   [[Local_Variables|var]] %i = [[$comchan]]([[$1-|$2]],0)
 
   [[while]] (%i) {
 
   [[while]] (%i) {
     [[Local_Variables|var]] %id = $chan($comchan($2,%i)).wid $+ . , %val = $hget(%table,%id $+ $1)
+
     [[Local_Variables|var]] %id = [[$chan_(window)|$chan(]][[$comchan]]([[$1-|$2]],%i)).wid [[DollarPlus|$+]] . , %val = [[$hget]](%table,%id [[DollarPlus|$+]] [[$1-|$1]])
 
     [[If-Then-Else|if]] (%val) {
 
     [[If-Then-Else|if]] (%val) {
       [[hdel]] %table %id $+ $1
+
       [[hdel]] %table %id [[DollarPlus|$+]] [[$1-|$1]]
       [[hadd]] %table %id $+ $2 %val
+
       [[hadd]] %table %id [[DollarPlus|$+]] [[$1-|$2]] %val
       [[Local_Variables|var]] %nick.l = $gettok(%val,1,32) , %nick.r = $gettok(%val,2,32)
+
       [[Local_Variables|var]] %nick.l = [[$gettok]](%val,1,32) , %nick.r = [[$gettok]](%val,2,32)
       [[If-Then-Else|if]] (%nick.l !== 0) { [[hadd]] %table %id $+ %nick.l $gettok($hget(%table,%id $+ %nick.l),1,32) $2 }
+
       [[If-Then-Else|if]] (%nick.l !== 0) { [[hadd]] %table %id [[DollarPlus|$+]] %nick.l [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] %nick.l),1,32) [[$1-|$2]] }
       [[If-Then-Else|else]] { [[hadd]] %table %id $+ -firstnick $2 }
+
       [[If-Then-Else|else]] { [[hadd]] %table %id [[DollarPlus|$+]] -firstnick [[$1-|$2]] }
       [[If-Then-Else|if]] (%nick.r !== 0) { [[hadd]] %table %id $+ %nick.r $2 $gettok($hget(%table,%id $+ %nick.r),2,32) }
+
       [[If-Then-Else|if]] (%nick.r !== 0) { [[hadd]] %table %id [[DollarPlus|$+]] %nick.r [[$1-|$2]] [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] %nick.r),2,32) }
       [[If-Then-Else|else]] { [[hadd]] %table %id $+ -lastnick $2 }
+
       [[If-Then-Else|else]] { [[hadd]] %table %id [[DollarPlus|$+]] -lastnick [[$1-|$2]] }
 
     }
 
     }
 
     [[dec]] %i
 
     [[dec]] %i
Line 630: Line 630:
 
  ; $1 = nick
 
  ; $1 = nick
 
  [[alias]] -l auth.q.add {
 
  [[alias]] -l auth.q.add {
   [[If-Then-Else|if]] (!$hget(auths.q. $+ $cid)) { [[return]] }
+
   [[If-Then-Else|if]] (![[$hget]](auths.q. [[DollarPlus|$+]] [[$cid]])) { [[return]] }
   auth.q.add.main $1
+
   auth.q.add.main [[$1-|$1]]
   [[Local_Variables|var]] %i = $comchan($1,0)
+
   [[Local_Variables|var]] %i = [[$comchan]]([[$1-|$1]],0)
 
   [[while]] (%i) {
 
   [[while]] (%i) {
     auth.q.add.wid $chan($comchan($1,%i)).wid $1
+
     auth.q.add.wid [[$chan_(window)|$chan(]][[$comchan]]([[$1-|$1]],%i)).wid [[$1-|$1]]
 
     [[dec]] %i
 
     [[dec]] %i
 
   }
 
   }
Line 642: Line 642:
 
  ; $1 = wid  $2 = nick
 
  ; $1 = wid  $2 = nick
 
  [[alias]] -l auth.q.add.wid {
 
  [[alias]] -l auth.q.add.wid {
   [[Local_Variables|var]] %table = auths.q. $+ $cid
+
   [[Local_Variables|var]] %table = auths.q. [[DollarPlus|$+]] [[$cid]]
   [[If-Then-Else|if]] (!$hget(%table)) { [[return]] }
+
   [[If-Then-Else|if]] (![[$hget]](%table)) { [[return]] }
   [[Local_Variables|var]] %id = $1 $+ . , %ctime = $iif($hget(%table,$2) == $null,$ctime,$v1)
+
   [[Local_Variables|var]] %id = [[$1-|$1]] [[DollarPlus|$+]] . , %ctime = [[$iif]]([[$hget]](%table,[[$1-|$2]]) == [[$null]],[[$ctime]],$v1)
   auth.q.rem.wid $1 $2
+
   auth.q.rem.wid [[$1-|$1]] [[$1-|$2]]
   [[Local_Variables|var]] %lastnick = $hget(%table,%id $+ -lastnick)
+
   [[Local_Variables|var]] %lastnick = [[$hget]](%table,%id [[DollarPlus|$+]] -lastnick)
 
   [[If-Then-Else|if]] (!%lastnick) {
 
   [[If-Then-Else|if]] (!%lastnick) {
     [[hadd]] %table %id $+ $2 %ctime 0 0
+
     [[hadd]] %table %id [[DollarPlus|$+]] [[$1-|$2]] %ctime 0 0
     [[hadd]] %table %id $+ -firstnick $2
+
     [[hadd]] %table %id [[DollarPlus|$+]] -firstnick [[$1-|$2]]
     [[hadd]] %table %id $+ -lastnick $2
+
     [[hadd]] %table %id [[DollarPlus|$+]] -lastnick [[$1-|$2]]
 
     [[return]]
 
     [[return]]
 
   }
 
   }
   [[If-Then-Else|if]] (%ctime >= $hget(%table,%lastnick)) {
+
   [[If-Then-Else|if]] (%ctime >= [[$hget]](%table,%lastnick)) {
     [[hadd]] %table %id $+ $2 %ctime %lastnick 0
+
     [[hadd]] %table %id [[DollarPlus|$+]] [[$1-|$2]] %ctime %lastnick 0
     [[hadd]] %table %id $+ %lastnick $gettok($hget(%table,%id $+ %lastnick),1-2,32) $2
+
     [[hadd]] %table %id [[DollarPlus|$+]] %lastnick [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] %lastnick),1-2,32) [[$1-|$2]]
     [[hadd]] %table %id $+ -lastnick $2
+
     [[hadd]] %table %id [[DollarPlus|$+]] -lastnick [[$1-|$2]]
 
     [[return]]
 
     [[return]]
 
   }
 
   }
   [[Local_Variables|var]] %n = $hget(%table,%id $+ -firstnick) , %nick = $2
+
   [[Local_Variables|var]] %n = [[$hget]](%table,%id [[DollarPlus|$+]] -firstnick) , %nick = [[$1-|$2]]
 
   [[while]] (%n) {
 
   [[while]] (%n) {
     [[tokenize]] 32 $hget(%table,%id $+ %n)
+
     [[tokenize]] 32 [[$hget]](%table,%id [[DollarPlus|$+]] %n)
     [[If-Then-Else|if]] (%ctime <= $1) {
+
     [[If-Then-Else|if]] (%ctime <= [[$1-|$1]]) {
       [[hadd]] %table %id $+ %n $1 %nick $3
+
       [[hadd]] %table %id [[DollarPlus|$+]] %n [[$1-|$1]] %nick [[$1-|$3]]
       [[If-Then-Else|if]] ($2 == 0) {
+
       [[If-Then-Else|if]] ([[$1-|$2]] == 0) {
         [[hadd]] %table %id $+ %nick %ctime 0 %n
+
         [[hadd]] %table %id [[DollarPlus|$+]] %nick %ctime 0 %n
         [[hadd]] %table %id $+ -firstnick %nick
+
         [[hadd]] %table %id [[DollarPlus|$+]] -firstnick %nick
 
       }
 
       }
 
       [[If-Then-Else|else]] {
 
       [[If-Then-Else|else]] {
         [[hadd]] %table %id $+ %nick %ctime $2 %n
+
         [[hadd]] %table %id [[DollarPlus|$+]] %nick %ctime [[$1-|$2]] %n
         [[hadd]] %table %id $+ $2 $gettok($hget(%table,%id $+ $2),1-2,32) %nick
+
         [[hadd]] %table %id [[DollarPlus|$+]] [[$1-|$2]] [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] [[$1-|$2]]),1-2,32) %nick
 
       }
 
       }
 
       [[break]]
 
       [[break]]
 
     }
 
     }
     [[Local_Variables|var]] %n = $3
+
     [[Local_Variables|var]] %n = [[$1-|$3]]
 
   }
 
   }
 
  }
 
  }
Line 681: Line 681:
 
  ; $1 = nick
 
  ; $1 = nick
 
  [[alias]] -l auth.q.add.main {
 
  [[alias]] -l auth.q.add.main {
   [[If-Then-Else|if]] (!$hget(auths.q. $+ $cid)) { [[return]] }
+
   [[If-Then-Else|if]] (![[$hget]](auths.q. [[DollarPlus|$+]] [[$cid]])) { [[return]] }
   [[hadd]] auths.q. $+ $cid $1 $ctime
+
   [[hadd]] auths.q. [[DollarPlus|$+]] [[$cid]] [[$1-|$1]] [[$ctime]]
 
  }
 
  }
 
   
 
   
Line 688: Line 688:
 
  ; $1 = nick
 
  ; $1 = nick
 
  [[alias]] -l auth.q.rem {
 
  [[alias]] -l auth.q.rem {
   [[If-Then-Else|if]] (!$hget(auths.q. $+ $cid)) { [[return]] }
+
   [[If-Then-Else|if]] (![[$hget]](auths.q. [[DollarPlus|$+]] [[$cid]])) { [[return]] }
   [[Local_Variables|var]] %i = $comchan($1,0)
+
   [[Local_Variables|var]] %i = [[$comchan]]([[$1-|$1]],0)
 
   [[while]] (%i) {
 
   [[while]] (%i) {
     auth.q.rem.wid $chan($comchan($1,%i)).wid $1
+
     auth.q.rem.wid [[$chan_(window)|$chan(]][[$comchan]]([[$1-|$1]],%i)).wid [[$1-|$1]]
 
     [[dec]] %i
 
     [[dec]] %i
 
   }
 
   }
   auth.q.rem.main $1
+
   auth.q.rem.main [[$1-|$1]]
 
  }
 
  }
 
   
 
   
Line 700: Line 700:
 
  ; $1 = wid  $2 = nick
 
  ; $1 = wid  $2 = nick
 
  [[alias]] -l auth.q.rem.wid {
 
  [[alias]] -l auth.q.rem.wid {
   [[Local_Variables|var]] %table = auths.q. $+ $cid
+
   [[Local_Variables|var]] %table = auths.q. [[DollarPlus|$+]] [[$cid]]
   [[If-Then-Else|if]] (!$hget(%table)) { [[return]] }
+
   [[If-Then-Else|if]] (![[$hget]](%table)) { [[return]] }
   [[Local_Variables|var]] %id = $1 $+ . , %val = $hget(%table,%id $+ $2)
+
   [[Local_Variables|var]] %id = [[$1-|$1]] [[DollarPlus|$+]] . , %val = [[$hget]](%table,%id [[DollarPlus|$+]] [[$1-|$2]])
 
   [[If-Then-Else|if]] (!%val) { [[return]] }
 
   [[If-Then-Else|if]] (!%val) { [[return]] }
   [[Local_Variables|var]] %nick.l = $gettok(%val,2,32) , %nick.r = $gettok(%val,3,32)
+
   [[Local_Variables|var]] %nick.l = [[$gettok]](%val,2,32) , %nick.r = [[$gettok]](%val,3,32)
   [[hdel]] %table %id $+ $2
+
   [[hdel]] %table %id [[DollarPlus|$+]] [[$1-|$2]]
   [[If-Then-Else|if]] (%nick.l == 0) && (%nick.r == 0) { [[hdel]] %table %id $+ -lastnick | [[hdel]] %table %id $+ -firstnick | [[return]] }
+
   [[If-Then-Else|if]] (%nick.l == 0) && (%nick.r == 0) { [[hdel]] %table %id [[DollarPlus|$+]] -lastnick | [[hdel]] %table %id [[DollarPlus|$+]] -firstnick | [[return]] }
   [[If-Then-Else|if]] (%nick.l !== 0) { [[hadd]] %table %id $+ %nick.l $gettok($hget(%table,%id $+ %nick.l),1-2,32) %nick.r }
+
   [[If-Then-Else|if]] (%nick.l !== 0) { [[hadd]] %table %id [[DollarPlus|$+]] %nick.l [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] %nick.l),1-2,32) %nick.r }
   [[If-Then-Else|else]] { [[hadd]] %table %id $+ -firstnick %nick.r }
+
   [[If-Then-Else|else]] { [[hadd]] %table %id [[DollarPlus|$+]] -firstnick %nick.r }
   [[If-Then-Else|if]] (%nick.r !== 0) { [[hadd]] %table %id $+ %nick.r $gettok($hget(%table,%id $+ %nick.r),1,32) %nick.l $gettok($hget(%table,%id $+ %nick.r),3,32) }
+
   [[If-Then-Else|if]] (%nick.r !== 0) { [[hadd]] %table %id [[DollarPlus|$+]] %nick.r [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] %nick.r),1,32) %nick.l [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] %nick.r),3,32) }
   [[If-Then-Else|else]] { [[hadd]] %table %id $+ -lastnick %nick.l }
+
   [[If-Then-Else|else]] { [[hadd]] %table %id [[DollarPlus|$+]] -lastnick %nick.l }
 
  }
 
  }
 
   
 
   
Line 716: Line 716:
 
  ; $1 = nick
 
  ; $1 = nick
 
  [[alias]] -l auth.q.rem.main {
 
  [[alias]] -l auth.q.rem.main {
   [[If-Then-Else|if]] (!$hget(auths.q. $+ $cid)) { [[return]] }
+
   [[If-Then-Else|if]] (![[$hget]](auths.q. [[DollarPlus|$+]] [[$cid]])) { [[return]] }
   [[hdel]] auths.q. $+ $cid $1
+
   [[hdel]] auths.q. [[DollarPlus|$+]] [[$cid]] [[$1-|$1]]
 
  }
 
  }
 
   
 
   
Line 723: Line 723:
 
  ; $1 = chan
 
  ; $1 = chan
 
  [[alias]] -l auth.q.rem.chan.all {
 
  [[alias]] -l auth.q.rem.chan.all {
   [[Local_Variables|var]] %table = auths.q. $+ $cid
+
   [[Local_Variables|var]] %table = auths.q. [[DollarPlus|$+]] [[$cid]]
   [[If-Then-Else|if]] (!$hget(%table)) { [[return]] }
+
   [[If-Then-Else|if]] (![[$hget]](%table)) { [[return]] }
   [[hdel]] -w %table $chan($1).wid $+ .*
+
   [[hdel]] -w %table [[$chan_(window)|$chan(]][[$1-|$1]]).wid [[DollarPlus|$+]] .*
   [[Local_Variables|var]] %i = $nick($1,0)
+
   [[Local_Variables|var]] %i = [[$nick_(nick)|$nick(]][[$1-|$1]],0)
 
   [[while]] (%i) {
 
   [[while]] (%i) {
     [[If-Then-Else|if]] (!$comchan($nick($1,%i),2)) { [[hdel]] %table $nick($1,%i) }
+
     [[If-Then-Else|if]] (![[$comchan]]([[$nick_(nick)|$nick(]][[$1-|$1]],%i),2)) { [[hdel]] %table [[$nick_(nick)|$nick(]][[$1-|$1]],%i) }
 
     [[dec]] %i
 
     [[dec]] %i
 
   }
 
   }
Line 737: Line 737:
 
  ; $1 = nick  $2 = newnick
 
  ; $1 = nick  $2 = newnick
 
  [[alias]] -l auth.q.nick {
 
  [[alias]] -l auth.q.nick {
   [[If-Then-Else|if]] ($1 == $2) { [[return]] }
+
   [[If-Then-Else|if]] ([[$1-|$1]] == [[$1-|$2]]) { [[return]] }
   [[Local_Variables|var]] %table = auths.q. $+ $cid
+
   [[Local_Variables|var]] %table = auths.q. [[DollarPlus|$+]] [[$cid]]
   [[If-Then-Else|if]] (!$hget(%table)) { [[return]] }
+
   [[If-Then-Else|if]] (![[$hget]](%table)) { [[return]] }
   [[Local_Variables|var]] %i = $comchan($2,0)
+
   [[Local_Variables|var]] %i = [[$comchan]]([[$1-|$2]],0)
 
   [[while]] (%i) {
 
   [[while]] (%i) {
     [[Local_Variables|var]] %id = $chan($comchan($2,%i)).wid $+ . , %val = $hget(%table,%id $+ $1)
+
     [[Local_Variables|var]] %id = [[$chan_(window)|$chan(]][[$comchan]]([[$1-|$2]],%i)).wid [[DollarPlus|$+]] . , %val = [[$hget]](%table,%id [[DollarPlus|$+]] [[$1-|$1]])
 
     [[If-Then-Else|if]] (%val) {
 
     [[If-Then-Else|if]] (%val) {
       [[hdel]] %table %id $+ $1
+
       [[hdel]] %table %id [[DollarPlus|$+]] [[$1-|$1]]
       [[hadd]] %table %id $+ $2 %val
+
       [[hadd]] %table %id [[DollarPlus|$+]] [[$1-|$2]] %val
       [[Local_Variables|var]] %nick.l = $gettok(%val,2,32) , %nick.r = $gettok(%val,3,32)
+
       [[Local_Variables|var]] %nick.l = [[$gettok]](%val,2,32) , %nick.r = [[$gettok]](%val,3,32)
       [[If-Then-Else|if]] (%nick.l !== 0) { [[hadd]] %table %id $+ %nick.l $gettok($hget(%table,%id $+ %nick.l),1-2,32) $2 }
+
       [[If-Then-Else|if]] (%nick.l !== 0) { [[hadd]] %table %id [[DollarPlus|$+]] %nick.l [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] %nick.l),1-2,32) [[$1-|$2]] }
       [[If-Then-Else|else]] { [[hadd]] %table %id $+ -firstnick $2 }
+
       [[If-Then-Else|else]] { [[hadd]] %table %id [[DollarPlus|$+]] -firstnick [[$1-|$2]] }
       [[If-Then-Else|if]] (%nick.r !== 0) { [[hadd]] %table %id $+ %nick.r $gettok($hget(%table,%id $+ %nick.r),1,32) $2 $gettok($hget(%table,%id $+ %nick.r),3,32) }
+
       [[If-Then-Else|if]] (%nick.r !== 0) { [[hadd]] %table %id [[DollarPlus|$+]] %nick.r [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] %nick.r),1,32) [[$1-|$2]] [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] %nick.r),3,32) }
       [[If-Then-Else|else]] { [[hadd]] %table %id $+ -lastnick $2 }
+
       [[If-Then-Else|else]] { [[hadd]] %table %id [[DollarPlus|$+]] -lastnick [[$1-|$2]] }
 
     }
 
     }
 
     [[dec]] %i
 
     [[dec]] %i
 
   }
 
   }
   [[If-Then-Else|if]] ($hget(%table,$1) !== $null) { [[hdel]] %table $1 | [[hadd]] %table $2 $v1 }
+
   [[If-Then-Else|if]] ([[$hget]](%table,[[$1-|$1]]) !== [[$null]]) { [[hdel]] %table [[$1-|$1]] | [[hadd]] %table [[$1-|$2]] $v1 }
 
  }
 
  }
 
   
 
   
Line 767: Line 767:
 
  ; $1 = nick
 
  ; $1 = nick
 
  [[alias]] -l auth.n.add {
 
  [[alias]] -l auth.n.add {
   [[If-Then-Else|if]] (!$hget(auths.n. $+ $cid)) { [[return]] }
+
   [[If-Then-Else|if]] (![[$hget]](auths.n. [[DollarPlus|$+]] [[$cid]])) { [[return]] }
   auth.n.add.main $1
+
   auth.n.add.main [[$1-|$1]]
   [[Local_Variables|var]] %i = $comchan($1,0)
+
   [[Local_Variables|var]] %i = [[$comchan]]([[$1-|$1]],0)
 
   [[while]] (%i) {
 
   [[while]] (%i) {
     auth.n.add.wid $chan($comchan($1,%i)).wid $1
+
     auth.n.add.wid [[$chan_(window)|$chan(]][[$comchan]]([[$1-|$1]],%i)).wid [[$1-|$1]]
 
     [[dec]] %i
 
     [[dec]] %i
 
   }
 
   }
Line 779: Line 779:
 
  ; $1 = wid  $2 = nick
 
  ; $1 = wid  $2 = nick
 
  [[alias]] -l auth.n.add.wid {
 
  [[alias]] -l auth.n.add.wid {
   [[Local_Variables|var]] %table = auths.n. $+ $cid
+
   [[Local_Variables|var]] %table = auths.n. [[DollarPlus|$+]] [[$cid]]
   [[If-Then-Else|if]] (!$hget(%table)) { [[return]] }
+
   [[If-Then-Else|if]] (![[$hget]](%table)) { [[return]] }
   [[Local_Variables|var]] %id = $1 $+ . ,  %lastnick = $hget(%table,%id $+ -lastnick)
+
   [[Local_Variables|var]] %id = [[$1-|$1]] [[DollarPlus|$+]] . ,  %lastnick = [[$hget]](%table,%id [[DollarPlus|$+]] -lastnick)
   [[If-Then-Else|if]] ($hget(%table,%id $+ $2)) { [[return]] }
+
   [[If-Then-Else|if]] ([[$hget]](%table,%id [[DollarPlus|$+]] [[$1-|$2]])) { [[return]] }
 
   [[If-Then-Else|if]] (%lastnick) {
 
   [[If-Then-Else|if]] (%lastnick) {
     [[hadd]] %table %id $+ $2 %lastnick 0
+
     [[hadd]] %table %id [[DollarPlus|$+]] [[$1-|$2]] %lastnick 0
     [[hadd]] %table %id $+ %lastnick $gettok($hget(%table,%id $+ %lastnick),1,32) $2
+
     [[hadd]] %table %id [[DollarPlus|$+]] %lastnick [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] %lastnick),1,32) [[$1-|$2]]
 
   }
 
   }
 
   [[If-Then-Else|else]] {
 
   [[If-Then-Else|else]] {
     [[hadd]] %table %id $+ $2 0 0
+
     [[hadd]] %table %id [[DollarPlus|$+]] [[$1-|$2]] 0 0
     [[hadd]] %table %id $+ -firstnick $2
+
     [[hadd]] %table %id [[DollarPlus|$+]] -firstnick [[$1-|$2]]
 
   }
 
   }
   [[hadd]] %table %id $+ -lastnick $2
+
   [[hadd]] %table %id [[DollarPlus|$+]] -lastnick [[$1-|$2]]
 
  }
 
  }
 
   
 
   
Line 797: Line 797:
 
  ; $1 = nick
 
  ; $1 = nick
 
  [[alias]] -l auth.n.add.main {
 
  [[alias]] -l auth.n.add.main {
   [[Local_Variables|var]] %table = auths.n. $+ $cid
+
   [[Local_Variables|var]] %table = auths.n. [[DollarPlus|$+]] [[$cid]]
   [[If-Then-Else|if]] (!$hget(%table)) { [[return]] }
+
   [[If-Then-Else|if]] (![[$hget]](%table)) { [[return]] }
   [[Local_Variables|var]] %lastnick = $hget(%table,-lastnick)
+
   [[Local_Variables|var]] %lastnick = [[$hget]](%table,-lastnick)
   [[If-Then-Else|if]] ($hget(%table,$1)) { [[return]] }
+
   [[If-Then-Else|if]] ([[$hget]](%table,[[$1-|$1]])) { [[return]] }
 
   [[If-Then-Else|if]] (%lastnick) {
 
   [[If-Then-Else|if]] (%lastnick) {
     [[hadd]] %table $1 %lastnick 0
+
     [[hadd]] %table [[$1-|$1]] %lastnick 0
     [[hadd]] %table %lastnick $gettok($hget(%table,%lastnick),1,32) $1
+
     [[hadd]] %table %lastnick [[$gettok]]([[$hget]](%table,%lastnick),1,32) [[$1-|$1]]
 
   }
 
   }
 
   [[If-Then-Else|else]] {
 
   [[If-Then-Else|else]] {
     [[hadd]] %table $1 0 0
+
     [[hadd]] %table [[$1-|$1]] 0 0
     [[hadd]] %table -firstnick $1
+
     [[hadd]] %table -firstnick [[$1-|$1]]
 
   }
 
   }
   [[hadd]] %table -lastnick $1
+
   [[hadd]] %table -lastnick [[$1-|$1]]
 
  }
 
  }
 
   
 
   
Line 815: Line 815:
 
  ; $1 = nick
 
  ; $1 = nick
 
  [[alias]] -l auth.n.rem {
 
  [[alias]] -l auth.n.rem {
   [[If-Then-Else|if]] (!$hget(auths.n. $+ $cid)) { [[return]] }
+
   [[If-Then-Else|if]] (![[$hget]](auths.n. [[DollarPlus|$+]] [[$cid]])) { [[return]] }
   [[Local_Variables|var]] %i = $comchan($1,0)
+
   [[Local_Variables|var]] %i = [[$comchan]]([[$1-|$1]],0)
 
   [[while]] (%i) {
 
   [[while]] (%i) {
     auth.n.rem.wid $chan($comchan($1,%i)).wid $1
+
     auth.n.rem.wid [[$chan_(window)|$chan(]][[$comchan]]([[$1-|$1]],%i)).wid [[$1-|$1]]
 
     [[dec]] %i
 
     [[dec]] %i
 
   }
 
   }
   auth.n.rem.main $1
+
   auth.n.rem.main [[$1-|$1]]
 
  }
 
  }
 
   
 
   
Line 827: Line 827:
 
  ; $1 = wid  $2 = nick
 
  ; $1 = wid  $2 = nick
 
  [[alias]] -l auth.n.rem.wid {
 
  [[alias]] -l auth.n.rem.wid {
   [[Local_Variables|var]] %table = auths.n. $+ $cid
+
   [[Local_Variables|var]] %table = auths.n. [[DollarPlus|$+]] [[$cid]]
   [[If-Then-Else|if]] (!$hget(%table)) { [[return]] }
+
   [[If-Then-Else|if]] (![[$hget]](%table)) { [[return]] }
   [[Local_Variables|var]] %id = $1 $+ . , %val = $hget(%table,%id $+ $2)
+
   [[Local_Variables|var]] %id = [[$1-|$1]] [[DollarPlus|$+]] . , %val = [[$hget]](%table,%id [[DollarPlus|$+]] [[$1-|$2]])
 
   [[If-Then-Else|if]] (!%val) { [[return]] }
 
   [[If-Then-Else|if]] (!%val) { [[return]] }
   [[Local_Variables|var]] %nick.l = $gettok(%val,1,32) , %nick.r = $gettok(%val,2,32)
+
   [[Local_Variables|var]] %nick.l = [[$gettok]](%val,1,32) , %nick.r = [[$gettok]](%val,2,32)
   [[hdel]] %table %id $+ $2
+
   [[hdel]] %table %id [[DollarPlus|$+]] [[$1-|$2]]
   [[If-Then-Else|if]] (%nick.l == 0) && (%nick.r == 0) { [[hdel]] %table %id $+ -lastnick | [[hdel]] %table %id $+ -firstnick | [[return]] }
+
   [[If-Then-Else|if]] (%nick.l == 0) && (%nick.r == 0) { [[hdel]] %table %id [[DollarPlus|$+]] -lastnick | [[hdel]] %table %id [[DollarPlus|$+]] -firstnick | [[return]] }
   [[If-Then-Else|if]] (%nick.l !== 0) { [[hadd]] %table %id $+ %nick.l $gettok($hget(%table,%id $+ %nick.l),1,32) %nick.r }
+
   [[If-Then-Else|if]] (%nick.l !== 0) { [[hadd]] %table %id [[DollarPlus|$+]] %nick.l [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] %nick.l),1,32) %nick.r }
   [[If-Then-Else|else]] { [[hadd]] %table %id $+ -firstnick %nick.r }
+
   [[If-Then-Else|else]] { [[hadd]] %table %id [[DollarPlus|$+]] -firstnick %nick.r }
   [[If-Then-Else|if]] (%nick.r !== 0) { [[hadd]] %table %id $+ %nick.r %nick.l $gettok($hget(%table,%id $+ %nick.r),2,32) }
+
   [[If-Then-Else|if]] (%nick.r !== 0) { [[hadd]] %table %id [[DollarPlus|$+]] %nick.r %nick.l [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] %nick.r),2,32) }
   [[If-Then-Else|else]] { [[hadd]] %table %id $+ -lastnick %nick.l }
+
   [[If-Then-Else|else]] { [[hadd]] %table %id [[DollarPlus|$+]] -lastnick %nick.l }
 
  }
 
  }
 
   
 
   
Line 843: Line 843:
 
  ; $1 = nick
 
  ; $1 = nick
 
  [[alias]] -l auth.n.rem.main {
 
  [[alias]] -l auth.n.rem.main {
   [[Local_Variables|var]] %table = auths.n. $+ $cid
+
   [[Local_Variables|var]] %table = auths.n. [[DollarPlus|$+]] [[$cid]]
   [[If-Then-Else|if]] (!$hget(%table)) { [[return]] }
+
   [[If-Then-Else|if]] (![[$hget]](%table)) { [[return]] }
   [[Local_Variables|var]] %val = $hget(%table,$1)
+
   [[Local_Variables|var]] %val = [[$hget]](%table,[[$1-|$1]])
 
   [[If-Then-Else|if]] (!%val) { [[return]] }
 
   [[If-Then-Else|if]] (!%val) { [[return]] }
   [[Local_Variables|var]] %nick.l = $gettok(%val,1,32) , %nick.r = $gettok(%val,2,32)
+
   [[Local_Variables|var]] %nick.l = [[$gettok]](%val,1,32) , %nick.r = [[$gettok]](%val,2,32)
   [[hdel]] %table $1
+
   [[hdel]] %table [[$1-|$1]]
 
   [[If-Then-Else|if]] (%nick.l == 0) && (%nick.r == 0) { [[hdel]] %table -lastnick | [[hdel]] %table -firstnick | [[return]] }
 
   [[If-Then-Else|if]] (%nick.l == 0) && (%nick.r == 0) { [[hdel]] %table -lastnick | [[hdel]] %table -firstnick | [[return]] }
   [[If-Then-Else|if]] (%nick.l !== 0) { [[hadd]] %table %nick.l $gettok($hget(%table,%nick.l),1,32) %nick.r }
+
   [[If-Then-Else|if]] (%nick.l !== 0) { [[hadd]] %table %nick.l [[$gettok]]([[$hget]](%table,%nick.l),1,32) %nick.r }
 
   [[If-Then-Else|else]] { [[hadd]] %table -firstnick %nick.r }
 
   [[If-Then-Else|else]] { [[hadd]] %table -firstnick %nick.r }
   [[If-Then-Else|if]] (%nick.r !== 0) { [[hadd]] %table %nick.r %nick.l $gettok($hget(%table,%nick.r),2,32) }
+
   [[If-Then-Else|if]] (%nick.r !== 0) { [[hadd]] %table %nick.r %nick.l [[$gettok]]([[$hget]](%table,%nick.r),2,32) }
 
   [[If-Then-Else|else]] { [[hadd]] %table -lastnick %nick.l }
 
   [[If-Then-Else|else]] { [[hadd]] %table -lastnick %nick.l }
 
  }
 
  }
Line 859: Line 859:
 
  ; $1 = chan
 
  ; $1 = chan
 
  [[alias]] -l auth.n.rem.chan.all {
 
  [[alias]] -l auth.n.rem.chan.all {
   [[Local_Variables|var]] %table = auths.n. $+ $cid
+
   [[Local_Variables|var]] %table = auths.n. [[DollarPlus|$+]] [[$cid]]
   [[If-Then-Else|if]] (!$hget(%table)) { [[return]] }
+
   [[If-Then-Else|if]] (![[$hget]](%table)) { [[return]] }
   [[hdel]] -w %table $chan($1).wid $+ .*
+
   [[hdel]] -w %table [[$chan_(window)|$chan(]][[$1-|$1]]).wid [[DollarPlus|$+]] .*
   [[Local_Variables|var]] %i = $nick($1,0)
+
   [[Local_Variables|var]] %i = [[$nick_(nick)|$nick(]][[$1-|$1]],0)
 
   [[while]] (%i) {
 
   [[while]] (%i) {
     [[If-Then-Else|if]] (!$comchan($nick($1,%i),2)) { auth.n.rem.main $nick($1,%i) }
+
     [[If-Then-Else|if]] (![[$comchan]]([[$nick_(nick)|$nick(]][[$1-|$1]],%i),2)) { auth.n.rem.main [[$nick_(nick)|$nick(]][[$1-|$1]],%i) }
 
     [[dec]] %i
 
     [[dec]] %i
 
   }
 
   }
Line 872: Line 872:
 
  ; $1 = nick  $2 = newnick
 
  ; $1 = nick  $2 = newnick
 
  [[alias]] -l auth.n.nick {
 
  [[alias]] -l auth.n.nick {
   [[If-Then-Else|if]] ($1 == $2) { [[return]] }
+
   [[If-Then-Else|if]] ([[$1-|$1]] == [[$1-|$2]]) { [[return]] }
   [[Local_Variables|var]] %table = auths.n. $+ $cid
+
   [[Local_Variables|var]] %table = auths.n. [[DollarPlus|$+]] [[$cid]]
   [[If-Then-Else|if]] (!$hget(%table)) { [[return]] }
+
   [[If-Then-Else|if]] (![[$hget]](%table)) { [[return]] }
   [[Local_Variables|var]] %i = $comchan($2,0)
+
   [[Local_Variables|var]] %i = [[$comchan]]([[$1-|$2]],0)
 
   [[while]] (%i) {
 
   [[while]] (%i) {
     [[Local_Variables|var]] %id = $chan($comchan($2,%i)).wid $+ . , %val = $hget(%table,%id $+ $1)
+
     [[Local_Variables|var]] %id = [[$chan_(window)|$chan(]][[$comchan]]([[$1-|$2]],%i)).wid [[DollarPlus|$+]] . , %val = [[$hget]](%table,%id [[DollarPlus|$+]] [[$1-|$1]])
 
     [[If-Then-Else|if]] (%val) {
 
     [[If-Then-Else|if]] (%val) {
       [[hdel]] %table %id $+ $1
+
       [[hdel]] %table %id [[DollarPlus|$+]] [[$1-|$1]]
       [[hadd]] %table %id $+ $2 %val
+
       [[hadd]] %table %id [[DollarPlus|$+]] [[$1-|$2]] %val
       [[Local_Variables|var]] %nick.l = $gettok(%val,1,32) , %nick.r = $gettok(%val,2,32)
+
       [[Local_Variables|var]] %nick.l = [[$gettok]](%val,1,32) , %nick.r = [[$gettok]](%val,2,32)
       [[If-Then-Else|if]] (%nick.l !== 0) { [[hadd]] %table %id $+ %nick.l $gettok($hget(%table,%id $+ %nick.l),1,32) $2 }
+
       [[If-Then-Else|if]] (%nick.l !== 0) { [[hadd]] %table %id [[DollarPlus|$+]] %nick.l [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] %nick.l),1,32) [[$1-|$2]] }
       [[If-Then-Else|else]] { [[hadd]] %table %id $+ -firstnick $2 }
+
       [[If-Then-Else|else]] { [[hadd]] %table %id [[DollarPlus|$+]] -firstnick [[$1-|$2]] }
       [[If-Then-Else|if]] (%nick.r !== 0) { [[hadd]] %table %id $+ %nick.r $2 $gettok($hget(%table,%id $+ %nick.r),2,32) }
+
       [[If-Then-Else|if]] (%nick.r !== 0) { [[hadd]] %table %id [[DollarPlus|$+]] %nick.r [[$1-|$2]] [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] %nick.r),2,32) }
       [[If-Then-Else|else]] { [[hadd]] %table %id $+ -lastnick $2 }
+
       [[If-Then-Else|else]] { [[hadd]] %table %id [[DollarPlus|$+]] -lastnick [[$1-|$2]] }
 
     }
 
     }
 
     [[dec]] %i
 
     [[dec]] %i
 
   }
 
   }
   [[Local_Variables|var]] %val = $hget(%table,$1)
+
   [[Local_Variables|var]] %val = [[$hget]](%table,[[$1-|$1]])
 
   [[If-Then-Else|if]] (%val) {
 
   [[If-Then-Else|if]] (%val) {
     [[hdel]] %table $1
+
     [[hdel]] %table [[$1-|$1]]
     [[hadd]] %table $2 %val
+
     [[hadd]] %table [[$1-|$2]] %val
     [[Local_Variables|var]] %nick.l = $gettok(%val,1,32) , %nick.r = $gettok(%val,2,32)
+
     [[Local_Variables|var]] %nick.l = [[$gettok]](%val,1,32) , %nick.r = [[$gettok]](%val,2,32)
     [[If-Then-Else|if]] (%nick.l !== 0) { [[hadd]] %table %nick.l $gettok($hget(%table,%nick.l),1,32) $2 }
+
     [[If-Then-Else|if]] (%nick.l !== 0) { [[hadd]] %table %nick.l [[$gettok]]([[$hget]](%table,%nick.l),1,32) [[$1-|$2]] }
     [[If-Then-Else|else]] { [[hadd]] %table -firstnick $2 }
+
     [[If-Then-Else|else]] { [[hadd]] %table -firstnick [[$1-|$2]] }
     [[If-Then-Else|if]] (%nick.r !== 0) { [[hadd]] %table %nick.r $2 $gettok($hget(%table,%nick.r),2,32) }
+
     [[If-Then-Else|if]] (%nick.r !== 0) { [[hadd]] %table %nick.r [[$1-|$2]] [[$gettok]]([[$hget]](%table,%nick.r),2,32) }
     [[If-Then-Else|else]] { [[hadd]] %table -lastnick $2 }
+
     [[If-Then-Else|else]] { [[hadd]] %table -lastnick [[$1-|$2]] }
 
   }
 
   }
 
  }
 
  }
 
bla
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IAL-UPDATE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
;info:
 
;
 
;  by wiebe @ QuakeNet
 
;  version 1.0  (written and tested on mIRC 6.15)
 
;
 
;  last edit: Sun Jun 06 2004
 
;
 
;
 
;What does this script do?
 
;
 
;  updates the IAL by doing /who chan1,chan2,chan3 etc
 
;  if a channel is too big, /who nick1,nick2,nick3 etc is done untill the IAL for the channel is  updated
 
;  script updates from smallest to the biggest channel
 
;
 
;
 
;How to use this script?
 
;
 
;  config the options below
 
;  /ialupdate can be used to make the script update the IAL without waiting for the timer to  trigger it
 
;
 
;
 
;Why is this script good?
 
;
 
;  sending /who chan for every channel is not needed and goes slow (lag)
 
;  sending /who chan on join may cause Excess Flood or Max sendQ exceeded
 
;  sending /who chan1,chan2,chan3 can be much faster, but only if there are not too many results  (Max sendQ exceeded)
 
;
 
;
 
;  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS MAX.WHO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
[[alias]] -l max.who {
 
  ; maximum number of replies in a WHO, too big may cause 'Max sendQ exceeded' disconnection
 
  ; too low may take the script a long time to update the IAL, 500 or 400 should be fine for most situations
 
  ![[return]] 700
 
}
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS LEN.WHO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
[[alias]] -l len.who {
 
  ; maximum length of the /who <string>, too long may cause the server to ignore the command
 
  ; too low may slow things down, 400 should be fine in most cases
 
  ![[return]] 400
 
}
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS DELAY.WHO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
[[alias]] -l delay.who {
 
  ; N seconds after the first join, the script starts to update the IAL
 
  ![[return]] 120
 
}
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS REPEAT.WHO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
[[alias]] -l repeat.who {
 
  ; wait N seconds after doing /who to do the next check and /who
 
  ![[return]] 30
 
}
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS SHOW ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
[[alias]] -l show.who {
 
  ; set this to 1 if you want the script to echo when the IAL is updated
 
  ; shows number of opers, number of users that are away, number of users that are deaf (+d),
 
  ; number of users that have fake host (+x)
 
  ; may slow things down, needs some checks / loops etc
 
  ; only shows when a whole channel is being who'd
 
  ![[return]] 1
 
}
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; JOIN EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
on *:join:#:{
 
  ; we join, IAL not updated, timer does not run, start a timer
 
  [[If-Then-Else|if]] ($nick == $me) && (!$timer($+($cid,.ial-update.update))) {
 
    .![[timer]] $+ $cid $+ .ial-update.update 1 $$delay.who ial-update.update
 
  }
 
}
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; LOAD EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
on *:load:{ !scon -at1 .!timer $!+ $!cid $!+ .ial-update.update 1 $$delay.who ial-update.update }
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS IALUPDATE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
[[alias]] ialupdate { ![[echo]] -a IAL-update: $ial-update.update }
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS IAL-UPDATE.UPDATE  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
[[alias]] -l ial-update.update {
 
  ![[Local_Variables|var]] %c, %n
 
  ; IAL is set on
 
  [[If-Then-Else|if]] ($ial) {
 
    ; hash table does not exist, set a var with the channels we need to who
 
    [[If-Then-Else|if]] (!$hget($+(ial-update.,$cid))) { ![[Local_Variables|var]] %c = $ial-update.chan($max.who,$len.who)
 
      ; something is in there, send it to the hash alias, send the who request
 
      [[If-Then-Else|if]] (%c) { ial-update.hash %c | .!quote WHO %c }
 
      ; else no channels to who, set a var with the nicks we need to who
 
      [[If-Then-Else|else]] { ![[Local_Variables|var]] %n = $ial-update.nick($max.who,$len.who)
 
        ; something is in there, send it to the hash alias, send the who request
 
        [[If-Then-Else|if]] (%n) { ial-update.hash %n | .!quote WHO %n  }
 
      }
 
    }
 
    ; we did a who or the hash table was not empty, start a timer to run this alias again
 
    [[If-Then-Else|if]] (%c) || (%n) || ($hget($+(ial-update.,$cid))) {
 
      .![[timer]] $+ $cid $+ .ial-update.update 1 $$repeat.who ial-update.update
 
    }
 
    ; return some info
 
    [[If-Then-Else|if]] (%c) || (%n) { ![[return]] updating }
 
    [[If-Then-Else|elseif]] ($hget($+(ial-update.,$cid))) { ![[return]] already in progress }
 
    [[If-Then-Else|else]] { ![[return]] nothing to update }
 
  }
 
  ; ial is off return some info
 
  [[If-Then-Else|else]] { ![[return]] ERROR, IAL is turned off, /IAL on to enable }
 
}
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS IAL-UPDATE.SORT  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
; $ial-update.sort
 
; sorts channels where the IAL is not updated
 
; <number of nicks>.<channel number>
 
; 127.1 <= means 127 users on channel 1
 
[[alias]] -l ial-update.sort {
 
  ![[Local_Variables|var]] %x = 1, %c
 
  ; loop through all common channels that we have with ourself
 
  ; $chan(0) returns the number of open channel windows,
 
  ; which does not mean you are on it ("keep channels open" option)
 
  [[while]] (%x <= $comchan($me,0)) {
 
    ; check if the ial is not updated or busy, add it to a var
 
    [[If-Then-Else|if]] ($chan($comchan($me,%x)).ial == $false) { ![[Local_Variables|var]] %c =  $addtok(%c,$+($nick($comchan($me,%x),0),.,%x),32) }
 
    ![[inc]] %x
 
  }
 
  ; return it sorted
 
  ![[return]] $sorttok(%c,32,n)
 
}
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS IAL-UPDATE.MAX ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
; $ial-update.max(N)
 
; N maximum number of nicks to request at once
 
; this alias returns the channels to ial based on the info provided by $ial-update.sort
 
; #chan1,#chan2,#chan3
 
[[alias]] -l ial-update.max {
 
  ![[Local_Variables|var]] %x = 1, %t = 0, %c = $ial-update.sort, %w
 
  ; loop through the channels and as long as %t smaller then $1, increase %t
 
  [[while]] (%x <= $numtok(%c,32)) && (%t < $1) {
 
    ![[inc]] %t $gettok($gettok(%c,%x,32),1,46)
 
    ; if %t is greater then $1, stop the loop
 
    [[If-Then-Else|if]] (%t > $1) { ![[break]] }
 
    ; add it to a var
 
    ![[Local_Variables|var]] %w = $addtok(%w,$gettok($gettok(%c,%x,32),2,46),32)
 
    ![[inc]] %x
 
  }
 
  ![[return]] %w
 
}
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS IAL-UPDATE.CHAN ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
; $ial-update.chan(N,L)
 
; N maximum number of nicks to request at once
 
; L maximum length of the WHO request
 
; this alias is used to WHO channels
 
[[alias]] -l ial-update.chan {
 
  ![[Local_Variables|var]] %x = 1, %l = 0, %c = $ial-update.max($1), %w
 
  ; loop through the channels, as long as %l smaller then $2, increase %l for the length of the  channel
 
  [[while]] (%x <= $numtok(%c,32)) && (%l < $2) {
 
    ![[inc]] %l $len($comchan($me,$gettok(%c,%x,32)))
 
    ; %l greater then $2, stop the loop
 
    [[If-Then-Else|if]] (%l > $2) { ![[break]] }
 
    ; add it to the var
 
    ![[Local_Variables|var]] %w = $addtok(%w,$comchan($me,$gettok(%c,%x,32)),44)
 
    ![[inc]] %x
 
  }
 
  ![[return]] %w
 
}
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS IAL-UPDATE.NICK ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
; $ial-update.nick(N,L)
 
; N maximum number of nicks to request at once
 
; L maximum length of the WHO request
 
; this alias is used to WHO nicks
 
[[alias]] -l ial-update.nick {
 
  ![[Local_Variables|var]] %x = 1
 
  ; loop through the channels untill we found one where the IAL isnt updated
 
  [[while]] ($chan($comchan($me,%x)).ial != $false) && (%x <= $comchan($me,0)) {
 
    ![[inc]] %x
 
  }
 
  ; ial is not updated, set vars
 
  [[If-Then-Else|if]] ($chan($comchan($me,%x)).ial == $false) { ![[Local_Variables|var]] %y = 1, %t = 0, %l = 0, %w
 
    ; loop
 
    [[while]] (%t <= $1) && (%l < $2) && (%y <= $nick($comchan($me,%x),0)) {
 
      ; ial for that nick isnt updated, increase %l
 
      [[If-Then-Else|if]] (!$ial($nick($comchan($me,%x),%y))) {
 
        ![[inc]] %l $len($nick($comchan($me,%x),%y))
 
        ; if greater then $2, stop the loop
 
        [[If-Then-Else|if]] (%l > $2) { ![[break]] }
 
        ; add it to the var
 
        ![[Local_Variables|var]] %w = $addtok(%w,$nick($comchan($me,%x),%y),44)
 
      }
 
      ![[inc]] %y
 
    }
 
    ![[return]] %w
 
  }
 
}
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS IAL-UPDATE.HASH ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
; /ial-update.hash <things> -remove
 
[[alias]] -l ial-update.hash {
 
  ; $2 is not there, set a var
 
  [[If-Then-Else|if]] ($2 == $null) { ![[Local_Variables|var]] %x = $numtok($1,44)
 
    ; loop through each part seperated with a comma, add it to a hash table
 
    [[while]] (%x) { ![[hadd]] -m $+(ial-update.,$cid) $gettok($1,%x,44) 1 | ![[dec]] %x }
 
    ; add mask
 
    ![[hadd]] -m $+(ial-update.,$cid) -mask $1
 
  }
 
  ; $2 is -remove, set a var
 
  [[If-Then-Else|elseif]] ($2 == -remove) { ![[Local_Variables|var]] %x = $numtok($1,44)
 
    ; loop through each part seperated with a comma, remove it from the hash table
 
    [[while]] (%x) { [[If-Then-Else|if]] ($hget($+(ial-update.,$cid))) { ![[hdel]] $+(ial-update.,$cid) $gettok($1,%x,44) } | ![[dec]] %x }
 
    ; del mask
 
    ![[hdel]] $+(ial-update.,$cid) -mask
 
    ; check hash table, free hash table
 
    [[If-Then-Else|if]] ($hget($+(ial-update.,$cid),0).item == 0) && ($hget($+(ial-update.,$cid))) { ![[hfree]] $+(ial-update.,$cid) }
 
  }
 
}
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RAW 352 WHO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
; 352 <you> <channel> <user> <host> <server> <nick> <flags> :<distance> <realname>
 
raw 352:& & & & & & & & *: {
 
  ; chan or nick are in the hash table
 
  [[If-Then-Else|if]] ($hget($+(ial-update.,$cid),$2)) || ($hget($+(ial-update.,$cid),$6)) {
 
    ; check setting, set a var
 
    [[If-Then-Else|if]] ($show.who == 1) && ($hget($+(ial-update.,$cid),$2)) && ($comchan($6,0)) { ![[Local_Variables|var]] %x = $comchan($6,0)
 
      ; loop, set a var
 
      [[while]] (%x) { ![[Local_Variables|var]] %c = $comchan($6,%x)
 
        ; check has table
 
        [[If-Then-Else|if]] ($hget($+(ial-update.,$cid),%c)) {
 
          ; * meaning oper isin $7, increase
 
          [[If-Then-Else|if]] (* isin $7) { ![[hinc]] $+(ial-update.,$cid) $+(%c,$chr(44),oper) }
 
          ; G meaning Gone isin $7, increase
 
          [[If-Then-Else|if]] (G isincs $7) { ![[hinc]] $+(ial-update.,$cid) $+(%c,$chr(44),away) }
 
          ; d meaning deaf isin $7, increase
 
          [[If-Then-Else|if]] (d isincs $7) { ![[hinc]] $+(ial-update.,$cid) $+(%c,$chr(44),deaf) }
 
          ; x meaning fake host isin $7, increase
 
          [[If-Then-Else|if]] (x isincs $7) { ![[hinc]] $+(ial-update.,$cid) $+(%c,$chr(44),xhost) }
 
        }
 
        ![[dec]] %x
 
      }
 
    }
 
    ; stop mirc from showing this raw
 
    ![[haltdef]]
 
  }
 
}
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RAW 315 WHO END ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
; raw 315 <you> <requested> :End of /who list.
 
raw 315:& & end of /WHO list.: {
 
  ; check -mask in hash table
 
  [[If-Then-Else|if]] ($hget($+(ial-update.,$cid),-mask) == $2) {
 
    ; check setting, set a var
 
    [[If-Then-Else|if]] ($show.who == 1) { ![[Local_Variables|var]] %x = $numtok($2,44)
 
      ; loop, we are on the channel, set var
 
      [[while]] (%x) { [[If-Then-Else|if]] ($me ison $gettok($2,%x,44)) { ![[Local_Variables|var]] %c = $gettok($2,%x,44)
 
          ; oper info
 
          ![[Local_Variables|var]] %oper = $iif($hget($+(ial-update.,$cid),$+(%c,$chr(44),oper)),$ifmatch,0)
 
          ![[Local_Variables|var]] %oper = %oper / $round($calc(%oper / $nick(%c,0) * 100),1) $+ % Oper
 
          ; away info
 
          ![[Local_Variables|var]] %away = $iif($hget($+(ial-update.,$cid),$+(%c,$chr(44),away)),$ifmatch,0)
 
          ![[Local_Variables|var]] %away = %away / $round($calc(%away / $nick(%c,0) * 100),1) $+ % Away
 
          ; deaf info
 
          ![[Local_Variables|var]] %deaf = $iif($hget($+(ial-update.,$cid),$+(%c,$chr(44),deaf)),$ifmatch,0)
 
          ![[Local_Variables|var]] %deaf = %deaf / $round($calc(%deaf / $nick(%c,0) * 100),1) $+ % deaf
 
          ; xhost info
 
          ![[Local_Variables|var]] %xhost = $iif($hget($+(ial-update.,$cid),$+(%c,$chr(44),xhost)),$ifmatch,0)
 
          ![[Local_Variables|var]] %xhost = %xhost / $round($calc(%xhost / $nick(%c,0) * 100),1) $+ % x-host
 
          ; echo
 
          ![[echo]] -t $gettok($2,%x,44) * IAL updated ( $+ %oper ---- %away ---- %deaf ---- %xhost $+ )
 
        }
 
        ; remove from hash table
 
        ![[hdel]] $+(ial-update.,$cid) $+(%c,$chr(44),oper) | ![[hdel]] $+(ial-update.,$cid) $+(%c,$chr(44),away)
 
        ![[hdel]] $+(ial-update.,$cid) $+(%c,$chr(44),deaf) | ![[hdel]] $+(ial-update.,$cid) $+(%c,$chr(44),xhost)
 
        ![[dec]] %x
 
      }
 
    }
 
    ; remove the items from the hash table
 
    ial-update.hash $2 -remove
 
    ![[haltdef]]
 
  }
 
}
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DISCONNECT EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
on *:disconnect:{ [[If-Then-Else|if]] ($hget($+(ial-update.,$cid))) { ![[hfree]] $+(ial-update.,$cid) } }
 

Latest revision as of 01:21, 3 March 2011

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AUTH_UPDATE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;  by Vliedel -- #vliedel @ QuakeNet
;  version 1.1  (written and tested on mIRC 6.2)
;  made for networks supporting WHOX
;
;
;What does this script do?
;
;  - updates the auths of nicks and stores them in a hash table
;  - if a channel is too big, /who nick1,nick2,nick3 etc is done untill the auths for the channel is updated
;  - users who have a site with the auth in it will be saved without a /who
;    ie: "Vliedel" in "Vliedel.users.quakenet.org" will be treated as auth on the QuakeNet network
;  - users who are not authed (auth 0) will be checked every x time to see if they are authed yet
;  - script updates from largest to the smallest channel
;
;
;How to use this script?
;
;  - config the options below
;  - /load -rs auth_update.mrc to load the script
;  - script starts on load or on connect
;  - to get a nicks auth use: $auth(nick) or $auth(nick,cid)
;  - /authupdate.next <nick> [nick] [nick] ... can be used to get auths of those nicks as soon as possible
;    please note that this will use a bit less efficient way to get the auths.
;    You can use the following script to see when such a requested nick is updated
;      on *:SIGNAL:authupdate:{
;        if ($2 == $null) { echo -a Requested: $1 is not on a common channel }
;        elseif ($2 == 0) { echo -a Requested: $1 is not authed }
;        else { echo -a Requested: $1 is authed as $2 }
;      }
;
;    Note that this signal returns $2 == $null when someone isn't on a common channel.
;    This may occur for example when someone parted a channel between the /who and the who reply.
;
;  - /authupdate can be used to make the script update the auths without waiting for the timer to trigger it
;  - You can use the following script to see when a nick is updated
;      on *:SIGNAL:authupdate.new:{
;        if ($2 == 0) { echo -a $1 is not authed }
;        else { echo -a $1 is authed as $2 }
;      }
;
;
;
;Why is this script good?
;
;  - sending /who chan for every channel is not needed and goes slow (lag)
;  - sending /who chan on join may cause Excess Flood or Max sendQ exceeded
;  - sending /who chan1,chan2,chan3 can be much faster, but only if there are not too many results (Max sendQ exceeded)
;  - unauthed users can auth without you knowing, so you need to check if they're authed every so many time.
;
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SETTINGS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
alias -l max.who {
  ; maximum number of replies in a WHO, too high may cause 'Max sendQ exceeded' disconnection
  ; too low may take the script a long time to update the auths, 1000 should be fine for most situations
  return 1000
}

alias -l len.who {
  ; maximum length of the /who <string>, too long may cause the server to ignore the command
  ; too low may slow things down, 400 should be fine in most cases
  return 400
}

alias -l delay.who {
  ; N seconds after your first join, the script starts to update the auths
  return 10
}

alias -l repeat.who {
  ; wait N seconds after doing /who to do the next check and /who
  return 20
}

alias -l minnicks.who {
  ; minimum nr of nicks with unknown auth in a channel to do /who #channel rather then /who nick,nick,
  return 3
}

alias -l minratio.who {
  ; minimum ratio of (nicks with unknown auth) / (total nicks) in a channel to do /who #channel rather then /who nick,nick,
  return 0.04
}

alias -l queue.repeat.who {
  ; number of seconds to do the next /who to check if someone who wasn't authed is now authed
  return 600
}

alias -l next.wait {
  ; wait N seconds to do the next /who check triggered by authupdate.next after the last /who
  return 10
}

alias -l used.network {
  ; The networks the script is supposed to work on (case sensitive).
  ; NOTE that the script ONLY works on networks supporting WHOX (ircu 2.10.* should work)
  ; $1 is the network
  return $istokcs(QuakeNet UnderNet GameSurge HanIRC NetGamers OGameNet,$1,32)
}

alias -l auth.site {
  ; For every network a check to see if a user has a site where his authname is in
  ; $1 is the network, $2 is the site
  if ($1 === QuakeNet) { return $iif(*.users.quakenet.org iswm $2,$true) }
  elseif ($1 === UnderNet) { return $iif(*.users.undernet.org iswm $2,$true) }
  elseif ($1 === GameSurge) { return $iif(*.*.GameSurge iswm $2,$true) }
  elseif ($1 === HanIRC) { return $iif(*.users.HanIRC.org iswm $2,$true) }
  elseif ($1 === NetGamers) { return $iif(*.users.netgamers.org iswm $2,$true) }
  elseif ($1 === OGameNet) { return $iif(*.user.OGameNet iswm $2,$true) }
}

alias -l auth.from.site {
  ; For every network the method to return the auth from the site
  ; $1 is the network, $2 is the site
  if ($1 === QuakeNet) { return $gettok($2,1,46) }
  elseif ($1 === UnderNet) { return $gettok($2,1,46) }
  elseif ($1 === GameSurge) { return $gettok($2,1,46) }
  elseif ($1 === HanIRC) { return $gettok($2,1,46) }
  elseif ($1 === NetGamers) { return $gettok($2,1,46) }
  elseif ($1 === OGameNet) { return $gettok($2,1,46) }
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
alias auth {
  if (!$isid) { $iif($show,.auth,auth) $1- | return }
  if ($1 == $null) || (($2 !== $null) && ((!$scid($2)) || (!$2))) { return }
  return $hget(auths. $+ $iif($2 !== $null,$2,$cid),$1)
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTHUPDATE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
alias authupdate { echo -a Auth update: $auth_update.update }

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTHUPDATE.NEXT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
alias authupdate.next {
  var %i = $0
  while (%i) {
    var %n = $gettok($1-,%i,32)
    if (!$comchan(%n,1)) { .signal authupdate %n }
    else { auth.n.add %n }
    dec %i
  }
  if (!$timer($cid $+ .auth_update.update)) { auth_update.update n }
  else {
    var %d = $timer($cid $+ .auth_update.update).delay , %l = $timer($cid $+ .auth_update.update).secs
    .timer $+ $cid $+ .auth_update.update 1 $iif($calc(%d - %l) < $next.wait,$calc($v2 - $v1),0) auth_update.update n
  }
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; LOAD EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
on *:LOAD:{ scon -at1 auth_load }

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH_LOAD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
alias -l auth_load {
  .timer $+ $cid $+ .auth_update.update 1 $delay.who auth_update.update
  if ($hget(auths. $+ $cid)) { hfree $v1 }
  if ($hget(auths.l. $+ $cid)) { hfree $v1 }
  if ($hget(auths.q. $+ $cid)) { hfree $v1 }
  if ($hget(auths.n. $+ $cid)) { hfree $v1 }
  if ($hget(auths.u. $+ $cid)) { hfree $v1 }
  hmake auths. $+ $cid 200
  hmake auths.l. $+ $cid 200
  hmake auths.q. $+ $cid 200
  hmake auths.n. $+ $cid 100
  var %i = $comchan($me,0)
  while (%i) {
    var %chan = $comchan($me,%i)
    var %j = $nick(%chan,0)
    while (%j) {
      auth.l.add.wid $chan(%chan).wid $nick(%chan,%j)
      dec %j
    }
    dec %i
  }
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH_UPDATE.UPDATE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
alias -l auth_update.update {
  var %who
  if (!$hget(auths.u. $+ $cid)) {
    .timer $+ $cid $+ .auth_update.update off
    hmake auths.u. $+ $cid 200
    var %who = $auth_update.who
    if (%who) {
      hadd auths.u. $+ $cid -mask %who $+ ,,, $+ 273
      .timer $+ $cid $+ .auth_update.timeout 1 $calc($repeat.who * 2) auth_update.timeout
      .quote WHO $hget(auths.u. $+ $cid,-mask) % $+ nat,273
    }
    else {
      hfree auths.u. $+ $cid
      .timer $+ $cid $+ .auth_update.update 1 $$repeat.who auth_update.update
    }
  }
  if (%who) { return updating }
  elseif ($hget(auths.u. $+ $cid)) { return already in progress }
  else { return nothing to update }
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH_UPDATE.TIMEOUT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
alias -l auth_update.timeout {
  hfree auths.u. $+ $cid
  auth_update.update
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH_UPDATE.SORT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; sorts channels by number of nicks in channel
; <number of nicks>.<channel number>
; returns 127.1 23.2 <= means 127 nicks on comchan 1
alias -l auth_update.sort {
  var %i = $comchan($me,0) , %chans
  while (%i) {
    var %chans = %chans $nick($comchan($me,%i),0) $+ . $+ %i
    dec %i
  }
  return $sorttok(%chans,32,n)
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH_UPDATE.WHO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; $auth_update.who(N,L)
; returns #chan,#chan,nick,nick
alias -l auth_update.who {
  var %t = auths.u. $+ $cid , %t.l = auths.l. $+ $cid , %t.q = auths.q. $+ $cid , %t.n = auths.n. $+ $cid
  var %n.max = $max.who , %l.max = $len.who , %n.min = $minnicks.who , %ratio = $minratio.who
  var %len , %n.nr , %chans , %nicks , %chans.go
  if $hget(auths.n.temp) { hfree auths.n.temp }
  hmake auths.n.temp
  var %n = $hget(%t.n,-firstnick)
  while (%n) {
    inc %len $calc($len(%n) + 1)
    inc %n.nr
    if (%n.nr > %n.max) || (%len > %l.max) { dec %n.nr | dec %len $calc($len(%n) + 1) | break }
    hadd auths.n.temp %n 1
    hadd %t %n 1
    var %nicks = $addtok(%nicks,%n,44) , %n = $gettok($hget(%t.n,%n),2,32)
  }
  
  var %sorted = $auth_update.sort , %i = $numtok(%sorted,32) , %time = $calc($ctime - $queue.repeat.who)
  while (%i) {
    var %comchan = $gettok($gettok(%sorted,%i,32),2,46) , %chan = $comchan($me,%comchan) , %id = $chan(%chan).wid $+ .
    var %n.c = $nick(%chan,0) , %left , %go
    if (%n.c > %n.max) { break }
    if $hget(auths.temp) { hfree auths.temp }
    hmake auths.temp
    var %n = $hget(%t.n,%id $+ -firstnick)
    while (%n) {
      if (!$hget(%t,%n)) || ($hget(auths.n.temp,%n)) { hadd auths.temp %n 1 | inc %left }
      if (((%left >= %n.min) && ($calc(%left / %n.c) >= %ratio)) || (%left == %n.c)) { var %go = 1 | break }
      var %n = $gettok($hget(%t.n,%id $+ %n),2,32)
    }
    var %n = $hget(%t.l,%id $+ -firstnick)
    while (%n) {
      if (!$hget(%t,%n)) && (!$hget(auths.temp,%n)) { inc %left }
      if (((%left >= %n.min) && ($calc(%left / %n.c) >= %ratio)) || (%left == %n.c)) { var %go = 1 | break }
      var %n = $gettok($hget(%t.l,%id $+ %n),2,32)
    }
    var %n = $hget(%t.q,%id $+ -firstnick)
    while (%n) {
      tokenize 32 $hget(%t.q,%id $+ %n)
      if ($1 > %time) { break }
      if (!$hget(%t,%n)) && (!$hget(auths.temp,%n)) { inc %left }
      if (((%left >= %n.min) && ($calc(%left / %n.c) >= %ratio)) || (%left == %n.c)) { var %go = 1 | break }
      var %n = $3
    }
    if (!%go) { dec %i | continue }
    var %j = %n.c , %n.tmp = %n.nr , %l.tmp = %len , %chans.go = %chans.go %comchan
    inc %l.tmp $calc($len(%chan) + 1)
    while (%j) {
      var %n = $nick(%chan,%j)
      if (!$hget(%t,%n)) { inc %n.tmp }
      if ($hget(auths.n.temp,%n)) { dec %l.tmp $calc($len(%n) + 1) }
      dec %j
    }
    if (%l.tmp > %l.max) || (%n.tmp > %n.max) { dec %i | continue }
    var %j = $nick(%chan,0)
    while (%j) {
      var %n = $nick(%chan,%j)
      hadd %t %n 1
      hdel auths.n.temp %n
      var %nicks = $remtok(%nicks,%n,1,44)
      dec %j
    }
    var %len = %l.tmp , %n.nr = %n.tmp , %chans = $addtok(%chans,%chan,44)
    dec %i
  }
  
  var %i = $comchan($me,0)
  while (%i) {
    var %chan = $comchan($me,%i)
    if (($nick(%chan,0) > %n.max) || (!$istok(%chans.go,%i,32))) {
      var %id = $chan(%chan).wid $+ . , %n = $hget(%t.l,%id $+ -firstnick)
      while (%n) {
        if (!$hget(%t,%n)) {
          inc %len $calc($len(%n) + 1)
          inc %n.nr
          if (%n.nr > %n.max) || (%len > %l.max) { break }
          hadd %t %n 1
          var %nicks = $addtok(%nicks,%n,44)
        }
        var %n = $gettok($hget(%t.l,%id $+ %n),2,32)
      }
      if (%n.nr > %n.max) || (%len > %l.max) { break }
      var %n = $hget(%t.q,%id $+ -firstnick)
      while (%n) {
        tokenize 32 $hget(%t.q,%id $+ %n)
        if ($1 > %time) { break }
        if (!$hget(%t,%n)) {
          inc %len $calc($len(%n) + 1)
          inc %n.nr
          if (%n.nr > %n.max) || (%len > %l.max) { break }
          hadd %t %n 1
          var %nicks = $addtok(%nicks,%n,44)
        }
        var %n = $3
      }
    }
    if (%n.nr > %n.max) || (%len > %l.max) { break }
    dec %i
  }
  if $hget(auths.temp) { hfree auths.temp }
  if $hget(auths.n.temp) { hfree auths.n.temp }
  return $addtok(%chans,%nicks,44)
}


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RAW 354 SPECIAL WHO REPLY ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; 354 <you>   <nr>  <nick>  <auth>
; 354 Vliedel 273   L       0
RAW 354:& 273 & &:{
  if ($comchan($3,1)) { auth_update.nick $3 $4 }
  elseif ($hget(auths.n. $+ $cid,$3)) { auth.n.rem $3 | .signal authupdate $3 }
  haltdef
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RAW 315 WHO END ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; 315 <you>    <requested>              :End of /who list.
; 315 Vliedel  #vliedel,Rutix,fishbot   :End of /WHO list.
RAW 315:& & end of /WHO list.: {
  if ($hget(auths.u. $+ $cid,-mask) == $2) {
    hfree auths.u. $+ $cid
    .timer $+ $cid $+ .auth_update.timeout off
    .timer $+ $cid $+ .auth_update.update 1 $iif($hget(auths.n. $+ $cid,1).item,$next.wait,$repeat.who) auth_update.update
    haltdef
  }
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH_UPDATE.NICK ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; $1 = nick    $2 = auth
alias -l auth_update.nick {
  if ($hget(auths. $+ $cid,$1) != $2) {
    .signal authupdate.new $1 $2
    auth.add $1 $2
  }
  auth.l.rem $1
  if ($2 == 0) { auth.q.add $1 }
  else { auth.q.rem $1 }
  if ($hget(auths.n. $+ $cid,$1)) { auth.n.rem $1 | .signal authupdate $1 $2 }
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; JOIN EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
on *:JOIN:#:{
  if ($nick == $me) && ($used.network($network)) {
    if (!$hget(auths. $+ $cid)) { hmake auths. $+ $cid 200 }
    if (!$hget(auths.l. $+ $cid)) { hmake auths.l. $+ $cid 200 }
    if (!$hget(auths.q. $+ $cid)) { hmake auths.q. $+ $cid 200 }
    if (!$hget(auths.n. $+ $cid)) { hmake auths.n. $+ $cid 100 }
    if (!$timer($cid $+ .auth_update.update)) { .timer $+ $cid $+ .auth_update.update 1 $delay.who auth_update.update }
    return
  }
  if ($auth.site($network,$site)) { auth_update.nick $nick $auth.from.site($network,$site) | return }
  if ($hget(auths. $+ $cid,$nick) == $null) { auth.l.add.wid $chan($chan).wid $nick }
  elseif ($hget(auths. $+ $cid,$nick) == 0) {
    auth.q.add.wid $chan($chan).wid $nick
    if (!$comchan($nick,2)) { auth.q.add.main $nick }
  }
  if ($hget(auths.n. $+ $cid,$nick)) { auth.n.add.wid $chan($2).wid $nick }
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RAW 366 - END OF NAMES LIST ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; 366 Vliedel #vliedel :End of /NAMES list.
366 Vliedel #Help :End of /NAMES list
RAW 366:& & end of /names list.:{
  var %i = $nick($2,0) , %t = auths. $+ $cid
  while (%i) {
    var %n = $nick($2,%i)
    if ($hget(%t,%n) == $null) { auth.l.add.wid $chan($2).wid %n }
    elseif ($hget(%t,%n) == 0) {
      auth.q.add.wid $chan($2).wid %n
      if (!$comchan(%n,2)) { auth.q.add.main %n }
    }
    if ($hget(auths.n. $+ $cid,%n)) { auth.n.add.wid $chan($2).wid %n }
    dec %i
  }
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PART EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
on *:PART:#:{
  if ($nick == $me) {
    auth.rem.chan $chan
    auth.l.rem.chan.all $chan
    auth.q.rem.chan.all $chan
    auth.n.rem.chan.all $chan
  }
  else {
    auth.l.rem.wid $chan($chan).wid $nick
    auth.q.rem.wid $chan($chan).wid $nick
    auth.n.rem.wid $chan($chan).wid $nick
    if (!$comchan($nick,2)) {
      auth.rem $nick
      auth.q.rem.main $nick
      auth.n.rem.main $nick
    }
    elseif ($auth.site($network,$site)) { auth_update.nick $nick $auth.from.site($network,$site) }
  }
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; KICK EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
on *:KICK:#:{
  if ($knick == $me) {
    auth.rem.chan $chan
    auth.l.rem.chan.all $chan
    auth.q.rem.chan.all $chan
    auth.n.rem.chan.all $chan
  }
  else {
    auth.l.rem.wid $chan($chan).wid $knick
    auth.q.rem.wid $chan($chan).wid $knick
    auth.n.rem.wid $chan($chan).wid $knick
    if (!$comchan($knick,2)) {
      auth.rem $knick
      auth.q.rem.main $knick
      auth.n.rem.main $knick
    }
    if ($auth.site($network,$site)) && ($comchan($nick,1)) { auth_update.nick $nick $auth.from.site($network,$site) }
  }
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; QUIT EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
on *:QUIT:{
  auth.rem $nick
  auth.l.rem $nick
  auth.q.rem $nick
  auth.n.rem $nick
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NICK EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
on *:NICK:{
  auth.nick $nick $newnick
  auth.l.nick $nick $newnick
  auth.q.nick $nick $newnick
  auth.n.nick $nick $newnick
  if ($auth.site($network,$site)) { auth_update.nick $newnick $auth.from.site($network,$site) }
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IAL-UPDATING EVENTS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
on *:TEXT:*:*:{ if ($auth.site($network,$site)) && ($comchan($nick,1)) { auth_update.nick $nick $auth.from.site($network,$site) } }
on *:ACTION:*:*:{ if ($auth.site($network,$site)) && ($comchan($nick,1)) { auth_update.nick $nick $auth.from.site($network,$site) } }
on *:NOTICE:*:*:{ if ($auth.site($network,$site)) && ($comchan($nick,1)) { auth_update.nick $nick $auth.from.site($network,$site) } }
on *:RAWMODE:#:{ if ($auth.site($network,$site)) && ($comchan($nick,1)) { auth_update.nick $nick $auth.from.site($network,$site) } }
on *:TOPIC:#:{ if ($auth.site($network,$site)) && ($comchan($nick,1)) { auth_update.nick $nick $auth.from.site($network,$site) } }
on *:INVITE:#:{ if ($auth.site($network,$site)) && ($comchan($nick,1)) { auth_update.nick $nick $auth.from.site($network,$site) } }
CTCP *:*:*:{ if ($auth.site($network,$site)) && ($comchan($nick,1)) { auth_update.nick $nick $auth.from.site($network,$site) } }
RAW 352:& & & & & & & & *: { if ($auth.site($network,$4)) && ($comchan($6,1)) { auth_update.nick $6 $auth.from.site($network,$4) } }


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DISCONNECT EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
on *:DISCONNECT:{
  if ($hget(auths.u $+ $cid)) { hfree $v1 }
  if ($hget(auths. $+ $cid)) { hfree $v1 }
  if ($hget(auths.q. $+ $cid)) { hfree $v1 }
  if ($hget(auths.l. $+ $cid)) { hfree $v1 }
  if ($hget(auths.n. $+ $cid)) { hfree $v1 }
}


; 200
; auths.cid  nick --> auth

; 200
; auths.l.cid  chanwid.nick --> lnick rnick
; auths.l.cid  chanwid.-firstnick --> first_nick_in_list
; auths.l.cid  chanwid.-lastnick --> last_nick_in_list

; 200
; auths.q.cid  chanwid.nick --> ctime lnick rnick
; auths.q.cid  chanwid.-firstnick --> first_nick_in_queue
; auths.q.cid  chanwid.-lastnick --> last_nick_in_queue
; auths.q.cid  nick --> ctime

; 100
; auths.n.cid  chanwid.nick --> lnick rnick
; auths.n.cid  chanwid.-firstnick --> first_nick_in_list
; auths.n.cid  chanwid.-lastnick --> last_nick_in_list
; auths.n.cid  nick --> lnick rnick
; auths.n.cid  -firstnick --> first_nick_in_list
; auths.n.cid  -lastnick --> last_nick_in_list



; ---------------------------------------------------------------------------------------------
; --------------------------------------- AUTHS - TABLE ---------------------------------------
; ---------------------------------------------------------------------------------------------


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.ADD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; $1 = nick   $2 = auth
alias -l auth.add {
  if (!$hget(auths. $+ $cid)) { return }
  hadd auths. $+ $cid $1 $2
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.REM ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; $1 = nick
alias -l auth.rem {
  if (!$hget(auths. $+ $cid)) { return }
  hdel auths. $+ $cid $1
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.REM.CHAN ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; $1 = chan
alias -l auth.rem.chan {
  if (!$hget(auths. $+ $cid)) { return }
  var %i = $nick($1,0)
  while (%i) {
    if (!$comchan($nick($1,%i),2)) { hdel auths. $+ $cid $nick($1,%i) }
    dec %i
  }
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.NICK ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; $1 = nick   $2 = newnick
alias -l auth.nick {
  if ($hget(auths. $+ $cid,$1) !== $null) { hdel auths. $+ $cid $1 | hadd auths. $+ $cid $2 $v1 }
}



; ----------------------------------------------------------------------------------------------------
; --------------------------------------- AUTHS - LEFT - TABLE ---------------------------------------
; ----------------------------------------------------------------------------------------------------


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.L.ADD.WID ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; $1 = wid   $2 = nick
alias -l auth.l.add.wid {
  var %table = auths.l. $+ $cid
  if (!$hget(%table)) { return }
  var %id = $1 $+ . ,  %lastnick = $hget(%table,%id $+ -lastnick)
  if ($hget(%table,%id $+ $2)) { return }
  if (%lastnick) {
    hadd %table %id $+ $2 %lastnick 0
    hadd %table %id $+ %lastnick $gettok($hget(%table,%id $+ %lastnick),1,32) $2
  }
  else {
    hadd %table %id $+ $2 0 0
    hadd %table %id $+ -firstnick $2
  }
  hadd %table %id $+ -lastnick $2
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.L.REM ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; $1 = nick
alias -l auth.l.rem {
  if (!$hget(auths.l. $+ $cid)) { return }
  var %i = $comchan($1,0)
  while (%i) {
    auth.l.rem.wid $chan($comchan($1,%i)).wid $1
    dec %i
  }
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.L.REM.WID ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; $1 = wid   $2 = nick
alias -l auth.l.rem.wid {
  var %table = auths.l. $+ $cid
  if (!$hget(%table)) { return }
  var %id = $1 $+ . , %val = $hget(%table,%id $+ $2)
  if (!%val) { return }
  var %nick.l = $gettok(%val,1,32) , %nick.r = $gettok(%val,2,32)
  hdel %table %id $+ $2
  if (%nick.l == 0) && (%nick.r == 0) { hdel %table %id $+ -lastnick | hdel %table %id $+ -firstnick | return }
  if (%nick.l !== 0) { hadd %table %id $+ %nick.l $gettok($hget(%table,%id $+ %nick.l),1,32) %nick.r }
  else { hadd %table %id $+ -firstnick %nick.r }
  if (%nick.r !== 0) { hadd %table %id $+ %nick.r %nick.l $gettok($hget(%table,%id $+ %nick.r),2,32) }
  else { hadd %table %id $+ -lastnick %nick.l }
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.L.REM.CHAN.ALL ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; $1 = chan
alias -l auth.l.rem.chan.all {
  if (!$hget(auths.l. $+ $cid)) { return }
  hdel -w auths.l. $+ $cid $chan($1).wid $+ .*
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.L.NICK ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; $1 = nick   $2 = newnick
alias -l auth.l.nick {
  if ($1 == $2) { return }
  var %table = auths.l. $+ $cid
  if (!$hget(%table)) { return }
  var %i = $comchan($2,0)
  while (%i) {
    var %id = $chan($comchan($2,%i)).wid $+ . , %val = $hget(%table,%id $+ $1)
    if (%val) {
      hdel %table %id $+ $1
      hadd %table %id $+ $2 %val
      var %nick.l = $gettok(%val,1,32) , %nick.r = $gettok(%val,2,32)
      if (%nick.l !== 0) { hadd %table %id $+ %nick.l $gettok($hget(%table,%id $+ %nick.l),1,32) $2 }
      else { hadd %table %id $+ -firstnick $2 }
      if (%nick.r !== 0) { hadd %table %id $+ %nick.r $2 $gettok($hget(%table,%id $+ %nick.r),2,32) }
      else { hadd %table %id $+ -lastnick $2 }
    }
    dec %i
  }
}



; -----------------------------------------------------------------------------------------------------
; --------------------------------------- AUTHS - QUEUE - TABLE ---------------------------------------
; -----------------------------------------------------------------------------------------------------


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.Q.ADD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; $1 = nick
alias -l auth.q.add {
  if (!$hget(auths.q. $+ $cid)) { return }
  auth.q.add.main $1
  var %i = $comchan($1,0)
  while (%i) {
    auth.q.add.wid $chan($comchan($1,%i)).wid $1
    dec %i
  }
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.Q.ADD.WID ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; $1 = wid   $2 = nick
alias -l auth.q.add.wid {
  var %table = auths.q. $+ $cid
  if (!$hget(%table)) { return }
  var %id = $1 $+ . , %ctime = $iif($hget(%table,$2) == $null,$ctime,$v1)
  auth.q.rem.wid $1 $2
  var %lastnick = $hget(%table,%id $+ -lastnick)
  if (!%lastnick) {
    hadd %table %id $+ $2 %ctime 0 0
    hadd %table %id $+ -firstnick $2
    hadd %table %id $+ -lastnick $2
    return
  }
  if (%ctime >= $hget(%table,%lastnick)) {
    hadd %table %id $+ $2 %ctime %lastnick 0
    hadd %table %id $+ %lastnick $gettok($hget(%table,%id $+ %lastnick),1-2,32) $2
    hadd %table %id $+ -lastnick $2
    return
  }
  var %n = $hget(%table,%id $+ -firstnick) , %nick = $2
  while (%n) {
    tokenize 32 $hget(%table,%id $+ %n)
    if (%ctime <= $1) {
      hadd %table %id $+ %n $1 %nick $3
      if ($2 == 0) {
        hadd %table %id $+ %nick %ctime 0 %n
        hadd %table %id $+ -firstnick %nick
      }
      else {
        hadd %table %id $+ %nick %ctime $2 %n
        hadd %table %id $+ $2 $gettok($hget(%table,%id $+ $2),1-2,32) %nick
      }
      break
    }
    var %n = $3
  }
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.Q.ADD.MAIN ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; $1 = nick
alias -l auth.q.add.main {
  if (!$hget(auths.q. $+ $cid)) { return }
  hadd auths.q. $+ $cid $1 $ctime
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.Q.REM ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; $1 = nick
alias -l auth.q.rem {
  if (!$hget(auths.q. $+ $cid)) { return }
  var %i = $comchan($1,0)
  while (%i) {
    auth.q.rem.wid $chan($comchan($1,%i)).wid $1
    dec %i
  }
  auth.q.rem.main $1
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.Q.REM.WID ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; $1 = wid   $2 = nick
alias -l auth.q.rem.wid {
  var %table = auths.q. $+ $cid
  if (!$hget(%table)) { return }
  var %id = $1 $+ . , %val = $hget(%table,%id $+ $2)
  if (!%val) { return }
  var %nick.l = $gettok(%val,2,32) , %nick.r = $gettok(%val,3,32)
  hdel %table %id $+ $2
  if (%nick.l == 0) && (%nick.r == 0) { hdel %table %id $+ -lastnick | hdel %table %id $+ -firstnick | return }
  if (%nick.l !== 0) { hadd %table %id $+ %nick.l $gettok($hget(%table,%id $+ %nick.l),1-2,32) %nick.r }
  else { hadd %table %id $+ -firstnick %nick.r }
  if (%nick.r !== 0) { hadd %table %id $+ %nick.r $gettok($hget(%table,%id $+ %nick.r),1,32) %nick.l $gettok($hget(%table,%id $+ %nick.r),3,32) }
  else { hadd %table %id $+ -lastnick %nick.l }
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.Q.REM.MAIN ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; $1 = nick
alias -l auth.q.rem.main {
  if (!$hget(auths.q. $+ $cid)) { return }
  hdel auths.q. $+ $cid $1
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.Q.REM.CHAN.ALL ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; $1 = chan
alias -l auth.q.rem.chan.all {
  var %table = auths.q. $+ $cid
  if (!$hget(%table)) { return }
  hdel -w %table $chan($1).wid $+ .*
  var %i = $nick($1,0)
  while (%i) {
    if (!$comchan($nick($1,%i),2)) { hdel %table $nick($1,%i) }
    dec %i
  }
}


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.Q.NICK ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; $1 = nick   $2 = newnick
alias -l auth.q.nick {
  if ($1 == $2) { return }
  var %table = auths.q. $+ $cid
  if (!$hget(%table)) { return }
  var %i = $comchan($2,0)
  while (%i) {
    var %id = $chan($comchan($2,%i)).wid $+ . , %val = $hget(%table,%id $+ $1)
    if (%val) {
      hdel %table %id $+ $1
      hadd %table %id $+ $2 %val
      var %nick.l = $gettok(%val,2,32) , %nick.r = $gettok(%val,3,32)
      if (%nick.l !== 0) { hadd %table %id $+ %nick.l $gettok($hget(%table,%id $+ %nick.l),1-2,32) $2 }
      else { hadd %table %id $+ -firstnick $2 }
      if (%nick.r !== 0) { hadd %table %id $+ %nick.r $gettok($hget(%table,%id $+ %nick.r),1,32) $2 $gettok($hget(%table,%id $+ %nick.r),3,32) }
      else { hadd %table %id $+ -lastnick $2 }
    }
    dec %i
  }
  if ($hget(%table,$1) !== $null) { hdel %table $1 | hadd %table $2 $v1 }
}



; ----------------------------------------------------------------------------------------------------
; --------------------------------------- AUTHS - NEXT - TABLE ---------------------------------------
; ----------------------------------------------------------------------------------------------------


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.N.ADD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; $1 = nick
alias -l auth.n.add {
  if (!$hget(auths.n. $+ $cid)) { return }
  auth.n.add.main $1
  var %i = $comchan($1,0)
  while (%i) {
    auth.n.add.wid $chan($comchan($1,%i)).wid $1
    dec %i
  }
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.N.ADD.WID ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; $1 = wid   $2 = nick
alias -l auth.n.add.wid {
  var %table = auths.n. $+ $cid
  if (!$hget(%table)) { return }
  var %id = $1 $+ . ,  %lastnick = $hget(%table,%id $+ -lastnick)
  if ($hget(%table,%id $+ $2)) { return }
  if (%lastnick) {
    hadd %table %id $+ $2 %lastnick 0
    hadd %table %id $+ %lastnick $gettok($hget(%table,%id $+ %lastnick),1,32) $2
  }
  else {
    hadd %table %id $+ $2 0 0
    hadd %table %id $+ -firstnick $2
  }
  hadd %table %id $+ -lastnick $2
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.N.ADD.MAIN ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; $1 = nick
alias -l auth.n.add.main {
  var %table = auths.n. $+ $cid
  if (!$hget(%table)) { return }
  var %lastnick = $hget(%table,-lastnick)
  if ($hget(%table,$1)) { return }
  if (%lastnick) {
    hadd %table $1 %lastnick 0
    hadd %table %lastnick $gettok($hget(%table,%lastnick),1,32) $1
  }
  else {
    hadd %table $1 0 0
    hadd %table -firstnick $1
  }
  hadd %table -lastnick $1
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.N.REM ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; $1 = nick
alias -l auth.n.rem {
  if (!$hget(auths.n. $+ $cid)) { return }
  var %i = $comchan($1,0)
  while (%i) {
    auth.n.rem.wid $chan($comchan($1,%i)).wid $1
    dec %i
  }
  auth.n.rem.main $1
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.N.REM.WID ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; $1 = wid   $2 = nick
alias -l auth.n.rem.wid {
  var %table = auths.n. $+ $cid
  if (!$hget(%table)) { return }
  var %id = $1 $+ . , %val = $hget(%table,%id $+ $2)
  if (!%val) { return }
  var %nick.l = $gettok(%val,1,32) , %nick.r = $gettok(%val,2,32)
  hdel %table %id $+ $2
  if (%nick.l == 0) && (%nick.r == 0) { hdel %table %id $+ -lastnick | hdel %table %id $+ -firstnick | return }
  if (%nick.l !== 0) { hadd %table %id $+ %nick.l $gettok($hget(%table,%id $+ %nick.l),1,32) %nick.r }
  else { hadd %table %id $+ -firstnick %nick.r }
  if (%nick.r !== 0) { hadd %table %id $+ %nick.r %nick.l $gettok($hget(%table,%id $+ %nick.r),2,32) }
  else { hadd %table %id $+ -lastnick %nick.l }
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.N.REM.MAIN ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; $1 = nick
alias -l auth.n.rem.main {
  var %table = auths.n. $+ $cid
  if (!$hget(%table)) { return }
  var %val = $hget(%table,$1)
  if (!%val) { return }
  var %nick.l = $gettok(%val,1,32) , %nick.r = $gettok(%val,2,32)
  hdel %table $1
  if (%nick.l == 0) && (%nick.r == 0) { hdel %table -lastnick | hdel %table -firstnick | return }
  if (%nick.l !== 0) { hadd %table %nick.l $gettok($hget(%table,%nick.l),1,32) %nick.r }
  else { hadd %table -firstnick %nick.r }
  if (%nick.r !== 0) { hadd %table %nick.r %nick.l $gettok($hget(%table,%nick.r),2,32) }
  else { hadd %table -lastnick %nick.l }
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.N.REM.CHAN.ALL ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; $1 = chan
alias -l auth.n.rem.chan.all {
  var %table = auths.n. $+ $cid
  if (!$hget(%table)) { return }
  hdel -w %table $chan($1).wid $+ .*
  var %i = $nick($1,0)
  while (%i) {
    if (!$comchan($nick($1,%i),2)) { auth.n.rem.main $nick($1,%i) }
    dec %i
  }
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.N.NICK ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; $1 = nick   $2 = newnick
alias -l auth.n.nick {
  if ($1 == $2) { return }
  var %table = auths.n. $+ $cid
  if (!$hget(%table)) { return }
  var %i = $comchan($2,0)
  while (%i) {
    var %id = $chan($comchan($2,%i)).wid $+ . , %val = $hget(%table,%id $+ $1)
    if (%val) {
      hdel %table %id $+ $1
      hadd %table %id $+ $2 %val
      var %nick.l = $gettok(%val,1,32) , %nick.r = $gettok(%val,2,32)
      if (%nick.l !== 0) { hadd %table %id $+ %nick.l $gettok($hget(%table,%id $+ %nick.l),1,32) $2 }
      else { hadd %table %id $+ -firstnick $2 }
      if (%nick.r !== 0) { hadd %table %id $+ %nick.r $2 $gettok($hget(%table,%id $+ %nick.r),2,32) }
      else { hadd %table %id $+ -lastnick $2 }
    }
    dec %i
  }
  var %val = $hget(%table,$1)
  if (%val) {
    hdel %table $1
    hadd %table $2 %val
    var %nick.l = $gettok(%val,1,32) , %nick.r = $gettok(%val,2,32)
    if (%nick.l !== 0) { hadd %table %nick.l $gettok($hget(%table,%nick.l),1,32) $2 }
    else { hadd %table -firstnick $2 }
    if (%nick.r !== 0) { hadd %table %nick.r $2 $gettok($hget(%table,%nick.r),2,32) }
    else { hadd %table -lastnick $2 }
  }
}