One correction for my above code:

Code:

      if ((%sign == +) && (%char !isin %cmodes)) { hadd -m usermodes $+($1,_,%arg) $sortmodes($+(%cmodes,%char)) }
      elseif ((%sign == -) && (%char isin %cmodes)) { hadd -m usermodes $+($1,_,%arg) $sortmodes($removecs(%cmodes,%char)) }



should be:

Code:

      if ((%sign == +) && (%char !isincs %cmodes)) { hadd -m usermodes $+($1,_,%arg) $sortmodes($+(%cmodes,%char)) }
      elseif ((%sign == -) && (%char isincs %cmodes)) { hadd -m usermodes $+($1,_,%arg) $sortmodes($removecs(%cmodes,%char)) }



When you connect to the IRC server, you are sent a RAW that contains the PREFIX settings for that server. Example:
PREFIX=(ohv)@%+ . The characters inside the brackets correspond to the characters outside the brackets in the same order. o -> @, h -> %, v -> +. You need to store that information when your bot connects, and then use it later.

And here is a code to read the PREFIX from RAW 005 and user modes from RAW 353:

Code:

alias 005 {

  var %pre = $gettok($matchtok($2-,PREFIX=,1,32),2,61)
  var %prec = $remove($gettok(%pre,1,41),$chr(40))
  var %pres = $gettok(%pre,2,41)

  hadd -m server pre_symb %pres
  hadd -m server pre_char %prec

}

alias 353 {
  var %pres = $hget(server,pre_symb)
  var %prec = $hget(server,pre_char)
  var %temp, %nick, %symb, %char

  var %i = 0, %ii = $numtok($5-,32)
  while (%i < %ii) {
    inc %i

    %temp = $gettok($5-,%i,32)
    %symb = $left(%temp,1)
    %char = $null
    %nick = %temp
    if (%symb isin %pres) {
      %char = $mid(%prec,$pos(%pres,%symb,1),1)
      %nick = $mid(%temp,2)
    }

    ;You can store the nicknames to a list here. $3=chan, %nick=nick
    hadd -m userlist $+($3,_,%nick) $ctime

    var %cmodes = $hget(usermodes,$+($3,_,%nick))
    if (%char !isincs %cmodes) { hadd -m usermodes $+($3,_,%nick) $sortmodes($+(%cmodes,%char)) }
    ;echo -a > %symb : %char : %nick : %temp
  }
}



These aliases respond to the standard format for their respective RAWs.

Samples from my server:

RAW 005:
YourNick MAP KNOCK SAFELIST HCN WATCH=128 SILENCE=5 MODES=13 MAXCHANNELS=25 MAXBANS=120 NICKLEN=30 TOPICLEN=307 KICKLEN=307 CHANTYPES=# PREFIX=(ohv)@%+ are supported by this server

RAW 353:
YourNick @ #channel UserNick1 @UserNick2 %UserNick3 +UserNick4

The code adds the modes to the same hash as my previous code.

-genius_at_work