All pastes #1885423 Raw Edit

Someone

public text v1 · immutable
#1885423 ·published 2010-06-17 22:17 UTC
rendered paste body
alias strippunct {
  var %final
  var %posn = 1
  var %flag = off
  while (%posn <= $len($1-)) {
    if (($asc($mid($1-,%posn,1)) >= 65) && ($asc($mid($1-,%posn,1)) <= 90)) || (($asc($mid($1-,%posn,1)) >= 97) && ($asc($mid($1-,%posn,1)) <= 122)) { 
      if (%flag == on) {
        %final = %final $+ $chr(32) $+ $mid($1-,%posn,1))
        %flag = off
      }
      else {
        %final = %final $+ $mid($1-,%posn,1))
      }
    }
    else if ($asc($mid($1-,%posn,1)) == 32) {
      %flag = on
    }
    else {
      %flag = on
    }
    inc %posn
  }
  return $lower(%final)
}


on *:text:*:#spp,#spp-wifi: {
  if ( %rp_duration == $null ) { set %rp_duration 120 }
  if ( %rp_bantime == $null ) { set %rp_bantime 300 }
  if ( %rp_offences == $null ) { set %rp_offences 2 }
  if ( $nick !ishop # ) && ( $nick !isop # ) && ($numtok($1-,32) >= 2) {
    var %rp.repeats = rp. $+ $nick $+ . $+ $chan
    var %rp.text = rp. $+ $nick $+ . $+ $chan $+ .text
    if ( % [ $+ [ %rp.repeats ] ] == $null ) {
      set -u [ $+ [ %rp_duration ] ] % [ $+ [ %rp.repeats ] ] 1
      set -u [ $+ [ %rp_duration ] ] % [ $+ [ %rp.text ] ] $strippunct($1-)
    }
    elseif ( % [ $+ [ %rp.text ] ] == $strippunct($1-) ) || ( % [ $+ [ %rp.text ] ] isin $strippunct($1-) ) {
      inc % [ $+ [ %rp.repeats ] ]
    }
    elseif ( % [ $+ [ %rp.text ] ] != $strippunct($1-) ) && ( % [ $+ [ %rp.text ] ] !isin $strippunct($1-) ) {
      set -u [ $+ [ %rp_duration ] ] % [ $+ [ %rp.text ] ] $strippunct($1-)
      set -u [ $+ [ %rp_duration ] ] % [ $+ [ %rp.repeats ] ] 1
    }
    if ( % [ $+ [ %rp.repeats ] ] > %rp_offences ) {
      ban -u [ $+ [ %rp_bantime ] ] # $nick 2
      kick # $nick Stop repeating yourself! (5 mins)
      unset % [ $+ [ %rp.repeats ] ]
      unset % [ $+ [ %rp.text ] ]
    }
  }
}