; Extended Mode Events by myggan ; ; This snippet allows you to create events that triggers for some lesser used modes (excepts, invite-excepts, etc..) ; I've currently only included a few sets of modes, if you need any other, I'll add them later on. ; The events can't have any channel field, so you need to perform your own if-then-else statement to achieve channel filtering. ; In order to provide as much functionality as possible, the following identifiers are available in these events: ; ; $_chan == $chan ; $_nick == $nick ; $_addr == $address ; $_scid == $cid ; $_parm == $banmask/$opnick (matching nick/mask for that particular mode) ; ; Edit these SIGNAL events to do whatever you want them to do, they trigger once for EACH mode set. on *:SIGNAL:admin:{ echo I will trigger when mode 'a' is set. } on *:SIGNAL:deadmin:{ echo I will trigger when mode 'a' is unset. } on *:SIGNAL:except:{ echo I will trigger when mode 'e' is set. } on *:SIGNAL:unexcept:{ echo I will trigger when mode 'e' is unset. } on *:SIGNAL:flood:{ echo I will trigger when mode 'f' is set. } on *:SIGNAL:unflood:{ echo I will trigger when mode 'f' is unset. } on *:SIGNAL:invite:{ echo I will trigger when mode 'I' is set. } on *:SIGNAL:uninvite:{ echo I will trigger when mode 'I' is unset. } on *:SIGNAL:join:{ echo I will trigger when mode 'j' is set. } on *:SIGNAL:unjoin:{ echo I will trigger when mode 'j' is unset. } on *:SIGNAL:key:{ echo I will trigger when mode 'k' is set. } on *:SIGNAL:unkey:{ echo I will trigger when mode 'k' is unset. } on *:SIGNAL:limit:{ echo I will trigger when mode 'l' is set. } on *:SIGNAL:unlimit:{ echo I will trigger when mode 'l' is unset. } on *:SIGNAL:creator:{ echo I will trigger when mode 'O' is set. } on *:SIGNAL:decreator:{ echo I will trigger when mode 'O' is unset. } on *:SIGNAL:owner:{ echo I will trigger when mode 'q' is set. } on *:SIGNAL:deowner:{ echo I will trigger when mode 'q' is unset. } on *:SIGNAL:word:{ echo I will trigger when mode 'w' is set. } on *:SIGNAL:unword:{ echo I will trigger when mode 'w' is unset. } ; -- DON'T EDIT BELOW THIS POINT -- on *:RAWMODE:#:parse_mode $chan $nick $address $cid $1- alias -l parse_mode { ; count the modes that has parameters .echo -q $regex(count_modes,$5,/([abBefhILjkloOqvw])/g) var %i = 1, %c ; loop through all parameter modes while (%i <= $regml(count_modes,0)) { var %a = $null, %x = $null, %y = $false ; check whetever mode is getting set or unset .echo -q $regex(mode_form,$left($5,$regml(count_modes,%i).pos),/[-+a-z]*([-+])/i) ; adjust parameter count for modes who haven't got a parameter if ($regml(mode_form,1) == -) && ($regml(count_modes,%i) isincs BfjlL) { inc %c var %y = $true } ; get the matching parameter for the mode var %b = $($+($,$calc(%i + 5 - %c)),2) ; decide which event to trigger if ($regml(count_modes,%i) === a) { var %a = ext_admin var %x = $+($iif($regml(mode_form,1) == -,de),admin) } if ($regml(count_modes,%i) === e) { var %a = ext_except var %x = $+($iif($regml(mode_form,1) == -,un),except) } if ($regml(count_modes,%i) === f) { var %a = ext_flood var %x = $+($iif($regml(mode_form,1) == -,un),flood) } if ($regml(count_modes,%i) === I) { var %a = ext_invite var %x = $+($iif($regml(mode_form,1) == -,un),invite) } if ($regml(count_modes,%i) === j) { var %a = ext_join var %x = $+($iif($regml(mode_form,1) == -,un),join) } if ($regml(count_modes,%i) === k) { var %a = ext_key var %x = $+($iif($regml(mode_form,1) == -,un),key) } if ($regml(count_modes,%i) === l) { var %a = ext_limit var %x = $+($iif($regml(mode_form,1) == -,un),limit) } if ($regml(count_modes,%i) === O) { var %a = ext_creator var %x = $+($iif($regml(mode_form,1) == -,de),creator) } if ($regml(count_modes,%i) === q) { var %a = ext_owner var %x = $+($iif($regml(mode_form,1) == -,de),owner) } if ($regml(count_modes,%i) === w) { var %a = ext_badword var %x = $+($iif($regml(mode_form,1) == -,un),word) } ; store data from the RAWMODE event for later retrieval if (%a != $null) { hadd -m ext_events current %a hadd -m %a chan $1 hadd -m %a nick $2 hadd -m %a addr $3 hadd -m %a scid $4 hadd -m %a parm $iif(!%y,%b) } ; trigger the event if (%x != $null) .signal -n %x ; increment iteration variable inc %i } ; free some memory by removing useless hash tables .timer $+ eme 1 10 hfree -w ext_* } alias -l _chan return $hget($hget(ext_events,current),chan) alias -l _nick return $hget($hget(ext_events,current),nick) alias -l _addr return $hget($hget(ext_events,current),addr) alias -l _scid return $hget($hget(ext_events,current),scid) alias -l _parm return $hget($hget(ext_events,current),parm) ; -EOF-