All pastes #886572 Raw Edit

Someone

public text v1 · immutable
#886572 ·published 2008-01-31 19:35 UTC
rendered paste body
on *:TEXT:*:#:{
  if ($chan == $active) && ($appactive == $true) { halt }
  if ($highlighttrig($1-) == yes) || ($+(*,$me,*) iswm $1-) {
    if ($isbot($nick) == $false) { 
      if ($($+(%,highlightspam.,$address($nick,2)),2) >= %highlight.times) { 
        .ignore -u60 $nick 2 
        if ($appactive == $false) {
          if ($window(@Highlights)) { closewin | showpopup $nick triggerd your highlight spam protection! Ignoring user for 60 seconds. }
          else { showpopup $nick triggerd your highlight spam protection! Ignoring user for 60 seconds. }
        }
        else { echo -at *** $nick triggerd your highlight spam protection! Ignoring user for 60 seconds. }
        unset $+(%,highlightspam.,$address($nick,2)) 
        halt
      }
      if ($appactive == $false) {
        if (%highlightprot.status == on) { inc -u $+ %highlight.secs $+(%,highlightspam.,$address($nick,2)) }
        if ($window(@Highlights)) { closewin | showpopup $nick highlighted you in $chan on $network saying $strip($qt($1-)) }
        else { showpopup $nick highlighted you in $chan on $network saying $strip($qt($1-)) }
        if (%logging.high == on) { write highlights.txt $time([hh:nn:ssTT) @ $date(dd/mm/yy]) $+($nick,/,$chan,/,$network,:) $strip($1-) }
      }
      else { 
        echo -at *** Highlight: $nick highlighted you in $chan on $network saying $strip($qt($1-))
        if (%highlightprot.status == on) { inc -u $+ %highlight.secs $+(%,highlightspam.,$address($nick,2)) }
        if (%logging.high == on) { write highlights.txt $time([hh:nn:ssTT) @ $date(dd/mm/yy]) $+($nick,/,$chan,/,$network,:) $strip($1-) }
      }
    }
  }
}
menu channel,status {
  -
  Highlight Logs:highlightlogs
}
dialog highlight {
  title Highlight logs $+($chr(40),$lines(highlights.txt),$chr(41))
  size -1 -1 242 161
  option dbu
  list 1, 6 12 231 81, size hsbar vsbar
  box "Logs", 2, 4 2 235 96
  button "Delete", 3, 62 107 37 12
  button "Clear logs", 4, 62 126 37 12
  text "Written by Mr_White (AKA Arbiter) @ sir_sonic1234@yahoo.com", 9, 5 146 163 8
  link "alice.heliohost.org", 11, 182 145 54 8
  button "Close", 12, 107 126 37 12, ok cancel
  radio "Enable Logging", 8, 7 112 50 10
  radio "Disable Logging", 10, 7 128 50 10
  button "Update Bots", 13, 107 107 37 12
  text "Credit for the popup alias goes to Xnemesis (www.crispycrisp.org)", 14, 180 118 54 25
  button "Highlight Triggers", 5, 149 109 27 27, multi
  button "Highlight Spam", 6, 187 103 41 12
}
on *:dialog:highlight:*:*:{ 
  if ($devent == init) && ($did == 0) { updateit }
  if ($devent == sclick) {
    if ($did == 3) { 
      var %l = $read(highlights.txt,nw,$+(*,$gettok($did(highlight,1).seltext,5-,32),*))
      write -dw $+ $qt(%l) highlights.txt %l
      closeit
    }
    if ($did == 4) { write -c highlights.txt | echo -at *** Highlight log files cleard. | closeit }
    if ($did == 8) { 
      if (%logging.high == on) { echo -at *** Error: Highlight logging is already on. }
      else {
        set %logging.high on
        echo -at *** Highlight logging enabled.
      }
    }
    if ($did == 10) { 
      if (%logging.high == off) { echo -at *** Error: Highlight logging is already on. }
      else {
        set %logging.high off
        echo -at *** Highlight logging disabled.
      }
    }
    if ($did == 12) { dialog -x highlight }
    if ($did == 13) { botlist }
    if ($did == 5) { dialog -x highlight | dialog -dm trigs trigs }
    if ($did == 6) { dialog -x highlight | dialog -dm protecthi protecthi }
  }
}
dialog trigs {
  title Highlight Triggers $+($chr(40),$lines(highlighttrigs.txt),$chr(41))
  size -1 -1 242 161
  option dbu
  combo 1, 10 15 222 99, size edit hsbar vsbar
  box "Triggers", 2, 6 6 230 112
  button "Add", 3, 10 124 37 12
  button "Delete", 4, 10 143 37 12
  button "Clear", 5, 60 124 37 12
  button "Save && Close", 6, 60 143 37 12, ok cancel
  edit "Notes: Regex is not supported in the highlight triggers. To add a highlight, input it in the edit box above and hit Add. To delete a trigger, highlight the trigger in the list box and hit Delete. Clear removes all triggers.", 7, 106 121 131 37, read multi
}
on *:dialog:trigs:*:*:{ 
  if ($devent == init) && ($did == 0) { updateit2 }
  if ($devent == sclick) {
    if ($did == 4) { 
      var %l = $read(highlighttrigs.txt,nw,$+(*,$did(trigs,1).seltext,*))
      write -dw $+ $qt(%l) highlighttrigs.txt %l
      closeit2
    }
    if ($did == 5) { write -c highlighttrigs.txt | echo -at *** Highlight triggers cleard. | closeit2 }
    if ($did == 3) { write highlighttrigs.txt $did(trigs,1).text | closeit2 }
  }
}
dialog protecthi {
  title "Highlight spam options"
  size -1 -1 178 112
  option dbu
  radio "On", 1, 7 17 23 10
  radio "Off", 2, 7 39 26 10
  box "Protection status", 3, 4 6 51 50
  button "Close", 4, 5 59 37 12, ok cancel
  button "Highlight Log", 5, 5 76 37 12
  button "Highlight Triggers", 6, 5 92 37 17, multi
  box "Options", 7, 95 4 74 42
  text "Secs:", 10, 99 15 18 8
  text "Times:", 11, 99 30 20 8
  edit "", 12, 121 15 20 10
  edit "", 13, 121 30 20 10
  text "Notes: Use the ON/OFF switchs to enable/disable the highlgiht spam protection. In the options part, Times = the amount of times you're highlighted by the same person in X seconds (Secs section).", 14, 58 70 114 37
  button "Save", 15, 127 52 37 12
}
on *:dialog:protecthi:*:*:{ 
  if ($devent == init) && ($did == 0) { updateit3 }
  if ($devent == sclick) { 
    if ($did == 1) { set %highlightprot.status on | echo -at *** Highlight spam protection is now on. }
    if ($did == 2) { set %highlightprot.status off | echo -at *** Highlight spam protection is now off. }
    if ($did == 5) { dialog -x protecthi | dialog -dm highlight highlight }
    if ($did == 6) { dialog -x protecthi | dialog -dm trigs trigs }
    if ($did == 15) { 
      if ($did(protecthi,12).edited == $true) && ($did(protecthi,13).edited == $true) {
        set %highlight.secs $did(protecthi,12).text 
        set %highlight.times $did(protecthi,13).text
        echo -at *** Highlight protection will now ignore user (when activated) after $did(protecthi,13).text times in $did(protecthi,12).text seconds. 
      }
      else { echo -at *** Error: You must supply the valus for Secs/Times! }
    }
  }
}
alias highlighttrig {
  var %i = 1
  while (%i <= $lines(highlighttrigs.txt)) {
    if ($+(*,$read(highlighttrigs.txt,%i),*) iswm $1-) { return yes | break }
    else { inc %i } 
  }
} 
alias -l updateit3 {
  did -c protecthi $iif(%highlightprot.status == on,1,2)  
  did -a protecthi 12 %highlight.secs 
  did -a protecthi 13 %highlight.times
}
alias -l updateit2 {
  var %i = 1 
  while (%i <= $lines(highlighttrigs.txt)) {
    did -a trigs 1 $read(highlighttrigs.txt,n,%i)
    inc %i
  }
}
alias -l updateit {
  did -c highlight $iif(%logging.high == on,8,10)  
  var %i = 1 
  while (%i <= $lines(highlights.txt)) {
    did -a highlight 1 $read(highlights.txt,n,%i)
    inc %i
  }
}
alias -l closeit { dialog -x highlight | dialog -dm highlight highlight }
alias -l closeit2 { dialog -x trigs | dialog -dm trigs trigs }
alias highlightlogs {
  if ($dialog(highlight)) { dialog -x highlight | dialog -dm highlight highlight }
  else { dialog -dm highlight highlight }
}
on ^*:NOTICE:*:?: {
  if ($nick = BotServ && %botlist) {
    haltdef
    if ($regex($1-,/^(\S+) \(\w+@\w+\.\w+(?:\.\w+)*\)$/Si)) write bots.txt $regml(1)
    elseif ($regex($1-,/^(\d+) bots available\.$/Si)) {
      unset %botlist
      echo -a Finished writing bots to BotList. There are currently $regml(1) bots available. This alias was written by Kol of SwiftIRC.
    }
  }
}
alias isbot return $iif($read(bots.txt,r,/^\Q $+ $$1 $+ \E$/),$true,$false)
alias botlist {
  echo -a Updating BotList
  bs botlist
  set %botlist on
  write -c bots.txt
}
alias closewin { close -@Highlights }
alias showPopup {
  window -pBdk0w0o +blL @Highlights $calc(%highlights.screenx - 250) $calc(%highlights.screenx - 92) 250 63 
  drawfill @Highlights $popc1 $popc1 0 0
  var %highlights.nxtln = $true, %highlights.popup = $1-, %highlights.y = 9
  while (%highlights.nxtln) {
    if ($len(%highlights.popup) > 50) {
      if (%highlights.y == 39) {
        drawtext -p @Highlights $popc2 10 %highlights.y $mid(%highlights.popup,0,46) ...
        unset %highlights.nxtln
        unset %highlights.popup
      }
      else {
        drawtext -p @Highlights $popc2 10 %highlights.y $mid(%highlights.popup,0,50)
        %highlights.popup = $mid(%highlights.popup,51,$mid(%highlights.popup,51,0))
      }
    }
    else {
      drawtext -p @Highlights $popc2 10 %highlights.y %highlights.popup
      unset %highlights.nxtln
      unset %highlights.popup
    }
    inc %highlights.y 10
  }
  .timerwin 1 5 close -@Highlights
}
alias -l popc1 {
  return 15
}
alias -l popc2 {
  return 01
}
on *:start:{
  %highlights.screenx = $window(-1).w 
  %highlights.screeny = $window(-1).h
}
on *:load:{
  %highlights.screenx = $window(-1).w 
  %highlights.screeny = $window(-1).h
}