Hi people

I have a socket bot. I want to follow user modes correctly and am having difficulty with it. I am getting user modes on joining a channel from the names list but when mode changes happen in a channel i have trouble following them.

I want to add these mode changes to a hash table so if solo has +v and then gets +o the hash table should show +vo. Additionally i want to cater if someone sets /mode #test +oo-v solo solo123 otheruser so it should show that solo1 and solo123 having +o and otheruser -v etc.
I have pasted the raw message my server sends and the deficient code idea i am using now.

;server raw example
:Solo!solo@hhx-C0087967.dsl.in-add.orange.co.uk MODE #test +o Solo

;my code example

Code:
if ($2 == mode) && (+ isin $4) {
hadd -m temp $+($3,_,$5) users mode
}


as you can see it wont keep track of complex mode changes etc. What is the best way of doing this?

Many Thanks