ok heres my situation, taken from the IRC RFC:

Code:
3.3 CHANMODES
 
   o  CHANMODES=A,B,C,D
 
   The CHANMODES token specifies the modes that may be set on a channel.
   These modes are split into four categories, as follows:
 
   o  Type A: Modes that add or remove an address to or from a list.
      These modes always take a parameter when sent by the server to a
      client; when sent by a client, they may be specified without a
      parameter, which requests the server to display the current
      contents of the corresponding list on the channel to the client.
   o  Type B: Modes that change a setting on the channel.  These modes
      always take a parameter.
   o  Type C: Modes that change a setting on the channel. These modes
      take a parameter only when set; the parameter is absent when the
      mode is removed both in the client's and server's MODE command.
   o  Type D: Modes that change a setting on the channel. These modes
      never take a parameter.


so from this data, we can conclude if the mode is in list 1-2 it always requires a parameter, if its in list 3 it only requires a parameter if setting, not unsetting, and list 4 never needs parameters. So by finding which token number the mode contains we can parse the rawmode with something like this:

Code:
parsemodes {
  var %x = 1 , %y = 1 , %sign
  while ($mid($1,%x,1)) {
    var %v1 = $v1 , %pos = $findtok($chanmodes,$matchtokcs($chanmodes,%v1,1,44),44)
    if (!%pos) { %sign = %v1 }
    else {
      if (%pos isnum 1-2) || ((%pos = 3) && (%sign = +)) { 
        inc %y
        echo -a $+(%sign,%v1) $eval($+($,%y),2)
      }
      else  { echo -a $+(%sign,%v1) }
    }
    inc %x
  }
}


so on Webchat, $chanmodes = bouv,k,lOMN,cdejimnpqrstzAJLRU

if we got a rawmode like this: +d-e+j-i+boul-kc *!*@* nick1 nick2 3 key

we can get a finalized result like this:

+d
-e
+j
-i
+b *!*@*
+o nick1
+u nick2
+l 3
-k key
-c