All pastes #390171 Raw Edit

Something

public text v1 · immutable
·published 2007-03-11 06:11 UTC
rendered paste body
alias -l amdlg { dialog -m antimsg antimsg }
alias -l amadd { .guser PMfriend $1 3 }
alias -l amrem { .ruser PMfriend $1 3 }
alias -l amload {
  set %ama 0 
  set %amb $ulist(*,pmfriend,0)
  while (%ama < %amb) {
    inc %ama
    did -a antimsg 2 $ulist(*,pmfriend,%ama)
  }
  unset %ama %amb
}

menu nicklist {
  - 
  AntiMsg
  .Add to list:{ amadd $$1 | if (%amamsg != $null) { .notice $$1 %amamsg } }
  .Remove from list:{ amrem $$1 }
  .-
  .Setup:{ amdlg }
}

dialog antimsg {
  title "SantaIRC ~ Query Blocker"
  size -1 -1 181 154
  icon santa.ico
  option dbu
  button "OK", 9, 45 140 36 11, ok
  button "Cancel", 10, 104 140 36 11, cancel
  check "Enable", 11, 5 4 31 10
  text "Allowed nicks:", 1, 5 18 36 8
  list 2, 5 28 120 81, sort size vsbar
  button "Add", 3, 136 28 32 11
  button "Delete", 4, 136 44 32 11
  text "Blocked message:", 5, 5 116 44 8
  edit "", 6, 56 115 121 10, autohs
  text "Accepted message:", 7, 5 128 49 8
  edit "", 8, 56 127 121 10, autohs
}

on *:dialog:antimsg:init:*:{
  amload
  if (%amstat == on) did -c $dname 11
  did -a $dname 6 %ambmsg
  if (%amamsg != $null) { did -a $dname 8 %amamsg }
}

on *:dialog:antimsg:edit:*:{ 
  if ($did == 6) { set %ambmsg $did(6) }
  if ($did == 8) { set %amamsg $did(8) }
}

on *:dialog:antimsg:close:*:{
  if ($did(6) == $null) { set %ambmsg Sorry I am not accepting private messages at this time. }
}

on *:dialog:antimsg:sclick:*:{
  if ($did == 3) { 
    set %ama $$?="Enter the users nick! (user must be online) "
    .guser PMfriend %ama 3 $chr(32) $+ %amb
    if (%amamsg != $null) { .notice $nick %amamsg }
    did -r $dname 2 | amload
    unset %ama %amb
  }    
  if ($did == 4) { 
    if ($server != $null) {
      set %ama $did(2).seltext  
      .ruser PMfriend %ama 
      did -r $dname 2
      amload
      unset %ama
    }
  }
  if ($did == 11) { if ($did(11).state == 0) set %amstat off | if ($did(11).state == 1) set %amstat on }
}

on *:text:*:?:{
  if (%amstat == on) {
    if ($level($address($nick,3)) != PMfriend) {
      close -m $nick
      .notice $nick %ambmsg
      echo -a 4-2 $nick 4- 2just tried to Private Message you! The attempt was blocked.
    }
  }
}

on *:load:{
  if ($version > 6.02) { echo -a 10Anti-MSG by SwitchDragon was successfully loaded. | set %amstat on | amdlg }
  else { echo -a 10Sorry. This addon requires mIRC 6.03. Please download the latest version from www.mirc.com | .unload -rs " $+ $script $+ " } 
}

on *:unload:{ unset %amamsg %ambmsg %ama %amb %amstat }