function parseModeSet($ModeString) { $tModeSet[] = explode(" ",$ModeString); $LastModeParamIndex = 1 $Adding = true; //Lets assume we are adding :\ foreach (ModeSet[0] as $tChar) { if ($tChar == "-") $Adding = false; else if ($tChar == "+") $Adding = true; else { //Going by what is most common to save time //First status modes if ($clientBase->server_StatusModes->ContainsMode(tChar) == true) { //I don't like this but meh if (count($tModeSet) >= $LastModeParamIndex) { if ($Adding == true) $this->channelMembers($tModeSet[$LastModeParamIndex])->addMode($tChar); else $this->channelMembers($tModeSet[$LastModeParamIndex])->removeMode($tChar); $clientBase->RaiseStatusChange($this->channelMembers($tModeSet[$LastModeParamIndex]), $this->channelName;) $LastModeParamIndex += 1; } } // It would be easy to add checks for list modes, or other special mode // sets here,but they are not important for this demonstration else { if ($Adding == true) { if (strpos($this->modes, $tChar) === false) $this->modes .= $tChar; } else { $this->modes = str_replace($tChar, "",$this->modes); } } } } }