mIRC Home    About    Download    Register    News    Help

Print Thread
#203335 12/08/08 01:13 PM
Joined: May 2008
Posts: 2
A
AlienDK Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
A
Joined: May 2008
Posts: 2
Why not support the +a (admin) usermode and add it to the scripting language so you can use on *:ADMIN:#: { echo -a Usermode +a has been set for $opnick/$anick }

AlienDK #203336 12/08/08 01:28 PM
Joined: Jun 2008
Posts: 58
P
Babel fish
Offline
Babel fish
P
Joined: Jun 2008
Posts: 58
It's not part of the RFC...

AlienDK #203394 14/08/08 12:40 AM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
For the time being you could use a custom scripted parser to parse the modes from on rawmode and raise on admin signals yourself.

This is a large script that I wrote for helping to manipule channel modes via scripting and whatnot, but I've modified it slightly so it will do what you asked for.

Code:
alias parsemode {
  if ($status != connected) || (!$isid) return
  var %i = 1, %char, %type, %token, %2 = $2, %3 = $3
  hfree -w parsemode
  tokenize 32 $1
  while ($mid($1,%i,1) != $null) {
    %char = $v1
    if (%char isin +-) {
      %type = %char
      inc %i
      continue
    }
    elseif (%char isincs $gettok($chanmodes,1-2,44) $+ $nickmode) {
      inc %token
      hadd -m parsemode $calc($hget(parsemode,0).item + 1) %type $+ %char $gettok($2-,%token,32)
    }
    elseif (%char isincs $gettok($chanmodes,3,44)) {
      if (%type == +) {
        inc %token
        hadd -m parsemode $calc($hget(parsemode,0).item + 1) %type $+ %char $gettok($2-,%token,32)
      }
      else hadd -m parsemode $calc($hget(parsemode,0).item + 1) %type $+ %char
    }
    elseif (%char isincs $gettok($chanmodes,4,44)) hadd -m parsemode $calc($hget(parsemode,0).item + 1) %type $+ %char
    inc %i
  }
  if ($prop == find) {
    if (($hfind(parsemode,%2,%3,w).data) || ($hfind(parsemode,%2,%3,W).data)) var %found = $v1
    if (%3 != 0) && ($hget(parsemode,%found)) !
    elseif (%found) !
    hfree -w parsemode
    return $iif($v1,$v1,$iif(%3 == 0,0,$false))
  }
  elseif ($prop == findr) {
    if (($hfind(parsemode,%2,%3,r).data) var %found = $v1
    if (%3 != 0) && ($hget(parsemode,%found)) !
    elseif (%found) !
    hfree -w parsemode
    return $iif($v1,$v1,$iif(%3 == 0,0,$false))
  }
  elseif (- isin %2) {
    if (%2 < 0) {
      inc %2
      if ($hget(parsemode,$calc($hget(parsemode,0).item %2))) {
        hfree -w parsemode
        return $v1
      }
    }
    elseif (*-* iswm %2) {
      var %begin = $gettok(%2,1,45), %end = $iif($gettok(%2,2,45),$v1,$hget(parsemode,0).item), %mode, %modes, %ctype, %type
      while (%begin <= %end) && ($hget(parsemode,%begin)) {
        %mode = $v1
        %ctype = %type
        %type = $left($v1,1)
        if (* * iswm %mode) %modes = $gettok(%modes,1,32) $+ $iif(%ctype == %type,$mid($gettok(%mode,1,32),2),$gettok(%mode,1,32)) $gettok(%modes,2-,32) $gettok(%mode,2,32)
        else %modes = $gettok(%modes,1,32) $+ $iif(%ctype == %type,$mid(%mode,2),%mode) $gettok(%modes,2-,32)
        inc %begin
      }
      hfree -w parsemode
      return %modes
    }
  }
  elseif ($hget(parsemode,%2) [ $+ [ $iif(%2 == 0,.item) ] ]) {
    hfree -w parsemode
    return $v1
  }
}

on *:rawmode:#:{
  var %i = 1
  while ($parsemode($1-,%i)) {
    .signal -n mode # $v1
    inc %i
  }
}

on *:signal:mode:{
  if (?a iswm $2) .signal -n $iif(-* iswm $2,de) $+ admin $1 $3
}


You will then catch admin events by using this:

Code:
on *:signal:admin:{
  ; $1 = channel
  ; $2 = user being +ad
}
on *:signal:deadmin:{
  ; $1 = channel
  ; $2 = user being -ad
}


Link Copied to Clipboard