I haven't fully tested this, but it should be right.
Code:
on *:rawmode:#:{
  noop $regex(ckm,$1,/([+-][^+-]*)/g)
  var %i = 1,%masks = $2-
  while $regml(ckm,%i) {
    var %v1 = $v1
    set -u %cmodes $remove($gettok($chanmodes,$iif(+* iswm %v1,1-3,1-2),44) $+ $nickmode,$chr(44))
    var %t = $count(%v1, [ $mid($regsubex(%cmodes,/(.)/g,$chr(44)\t),2) ] ) [color:gray]| ; don't destroy this spacing.[/color]
    _add %v1 $gettok(%masks,$+(1-,%t),32)
    inc %t | %masks = $gettok(%masks,$+(%t,-),32) | inc %i
  }
}
alias -l _add {
  var %i = 2,%p = 2,%c
  while $mid($1,%i,1) != $null {
    %c = $v1
    if %c !isin %cmodes { inc %i | continue }
    if $gettok($1-,%p,32) == $me && $findtok(q a o h v,%c,1,32) {
      var %v = $gettok(founders protects ops hops voices,$v1,32)
      if -* iswm $1 { var %v = de $+ %v }
      inc % $+ %v
      echo # % $+ %v $(% $+ %v,2)
    }
    inc %i | inc %p
  }
}