All pastes #521422 Raw Edit

Someone

public text v1 · immutable
#521422 ·published 2007-05-30 05:40 UTC
rendered paste body
dialog pmb { 
  title "Private Message Blocker - By Crossfire39" 
  size -1 -1 195 163 
  option dbu 
  tab "Settings", 100, 0 -2 193 150 
  box "Main Settings", 101, 3 13 188 40, tab 100 
  edit "", 104, 6 41 183 10, tab 100 autohs 
  box "Popup Notification", 105, 3 54 89 41, tab 100 
  check "Enable Popup Notification", 106, 6 61 80 10, tab 100 
  edit "", 107, 5 82 17 10, tab 100 
  text "Notification Duration (sec)", 108, 25 84 63 8, tab 100 
  check "Enable Beep on Notification", 110, 6 71 82 10, group tab 100 
  check "Enable Message Blocker", 102, 6 21 70 10, tab 100 
  text "Text To Display To Users", 103, 6 32 86 8, tab 100 
  box "Private Message Logging", 114, 3 97 89 31, tab 100 
  check "Enable Message Logging", 115, 6 104 72 10, tab 100 
  edit "", 116, 4 115 18 10, tab 100 
  text "Maximum Log Entries", 117, 26 116 55 8, tab 100 
  box "Window Handling", 111, 94 54 96 21, tab 100 
  check "Close Message Windows", 112, 97 62 87 10, tab 100 
  tab "Message Log", 200 
  box "Recieved Messages", 201, 2 13 190 117, tab 200 
  list 202, 4 21 185 94, tab 200 size hsbar vsbar 
  button "Clear Log", 204, 154 117 35 10, tab 200 
  text "Double click an entry to send a pm", 205, 52 118 87 8, tab 200 
  tab "Help", 300 
  box "Main Settings", 301, 4 12 186 31, tab 300 
  text "Main settings apply to the whole program. Here you can enable or disable the blocker. You can also change the message that is displayed to users when they try to message you witht he program enabled. ", 302, 7 20 181 21, tab 300 
  box "Notifications", 303, 4 43 186 44, tab 300 
  text "Notifications are triggered when a user messages you and the blocker is enabled. If popup notifications are enabled, a popup will be triggered and will request input from you. After a set delay, the popup will close and the user will recieve the blocker message, If sounds are enabled, a beep will be triggered with the popup. ", 304, 6 50 180 35, tab 300 
  box "Message Logging", 305, 4 88 186 32, tab 300 
  text "If logging is enabled, whenever a message is blocked, the contents of the message will be logged for you to check later. You can remove messages from the logger and send a message to the nick.", 306, 7 96 179 21, tab 300 
  box "Disable Triggers", 307, 4 121 186 23, tab 300 
  text "When disable triggers is enabled none of your scripts will be triggered by a command sent by personal message.", 308, 6 129 181 14, tab 300 
  link "Get Latest Version and Support", 4, 1 153 80 8 
  button "Ok", 1, 160 152 32 10, ok 
  button "Cancel", 3, 89 152 32 10, cancel 
  button "Apply", 2, 124 152 32 10 
} 

dialog pmb_confirm { 
  title "Confirmation Request" 
  size -1 -1 124 75 
  option dbu 
  button "Accept", 1, 16 56 37 12, cancel 
  button "Ignore", 2, 72 56 37 12, ok 
  box "Confirmation", 3, 2 0 120 73 
  text "", 4, 6 12 111 39 
} 

; Commands that happen before and after loading. Unset variables etc 
on *:load:{ 
  ;Creates a file with default variable values. 
  if ( $exists(pmb.ini) == $false ) { 
    /writeini -n pmb.ini Variables Enabled 0 
    /writeini -n pmb.ini Variables Message Sorry, I am blocking all pm's right now. 
    /writeini -n pmb.ini Variables Notification 0 
    /writeini -n pmb.ini Variables Delay 60 
    /writeini -n pmb.ini Variables Sounds 0 
    /writeini -n pmb.ini Variables Logging 1 
    /writeini -n pmb.ini Variables Entries 25 
    /writeini -n pmb.ini Variables Window 1 
    /writeini -n pmb.ini Variables Enabled 0 
  } 
  /echo -s ** Loaded Message Blocker Successfully ** 
} 

on 1:dialog:pmb:sclick:4:/run http://forum.swiftirc.net/viewtopic.php?t=7860 

on *:unload:{ 
  /var %unload = $input(If you wish for your settings to be saved press 'No'. Otherwise press 'Yes' for all traces of this script to be removed., yvgqa, You are about to unload PM Blocker) 
  if ( %unload == $yes ) { .remove pmb.ini } 
  /echo -s Thank you for using Crossfire39's Pm Blocker 
} 

;Allows there to be a link to access the dialog 
menu status,channel,query { 
  Tools 
  .Message Blocker:/dialog -mr pmb pmb 
} 

on 1:dialog:pmb:init:0:{ 
  ;Loads tab1 
  if ( $readini(pmb.ini, n, Variables, Enabled) == 1 ) /did -c pmb 102 
  /did -ra pmb 104 $readini(pmb.ini, n, Variables, Message) 
  if ( $readini(pmb.ini, n, Variables, Notification) == 1 ) /did -c pmb 106 
  /did -ra pmb 107 $readini(pmb.ini, n, Variables, Delay) 
  if ( $readini(pmb.ini, n, Variables, Sounds) == 1 ) /did -c pmb 110 
  if ( $readini(pmb.ini, n, Variables, Window) == 1 ) /did -c pmb 112 
  if ( $readini(pmb.ini, n, Variables, Logging) == 1 ) /did -c pmb 115 
  /did -ra pmb 116 $readini(pmb.ini, n, Variables, Entries) 

  ;Loads tab2 
  var %x = $ini(pmb.ini,Messages,0) 
  /did -r pmb 202 
  /did -a pmb 201 Recieved Messages - $iif(%x != $null,%x,None) 
  while (%x > 0) { 
    /did -az pmb 202 $readini(pmb.ini, n, Messages, %x) 
    /dec %x 
  } 
} 

on 1:dialog:pmb:sclick:118:if ( $did(pmb,118).state == 1) $noop($input(This feature disables all other scripts from being triggered by a 'on text' trigger through a personal message. Only use this if you are sure you want this disabled., -aogw, Use With Caution)) 

on 1:dialog:pmb:sclick:1,2:{ 
  if ($did(pmb,104).text == $null) { $noop($input(Please enter a message to send to users, -ogwa, Error)) | /halt } 
  if (($did(pmb,107).text == $null) || ($did(pmb,107).text !isnum)) { $noop($input(Please enter a number for duration, -ogwa, Error)) | /halt } 
  if (($did(pmb,116).text == $null) || ($did(pmb,116).text !isnum)) { $noop($input(Please enter a number for entries, -ogwa, Error)) | /halt } 
  /writeini -n pmb.ini Variables Delay $int($did(pmb,107).text) 
  /writeini -n pmb.ini Variables Entries $int($did(pmb,116).text) 
  /writeini -n pmb.ini Variables Message $did(pmb,104).text 
  /writeini -n pmb.ini Variables Sounds $iif($did(pmb,110).state == 1,1,0) 
  /writeini -n pmb.ini Variables Window $iif($did(pmb,112).state == 1,1,0) 
  /writeini -n pmb.ini Variables Logging $iif($did(pmb,115).state == 1,1,0) 
  /writeini -n pmb.ini Variables Notification $iif($did(pmb,106).state == 1,1,0) 
  /writeini -n pmb.ini Variables Enabled $iif($did(pmb,102).state == 1,1,0) 
  if ( $did(pmb,102).state == 1) .enable #PMB 
  else .disable #PMB 
} 

;Tab2 Controls 
on 1:dialog:pmb:sclick:204:{ /did -r pmb 202 | /did -a pmb 201 Recieved Messages - None | .remini pmb.ini Messages } 

on 1:dialog:pmb:dclick:202:{ 
  /var %nick = $gettok($did(pmb,202).seltext,2,45) 
  /var %message = $input( Enter a message to send to: %nick , -eogqa, Enter a message) 
  if ( %message != $null ) .msg %nick %message  
} 

#PMB on 
on 1:open:?:*:{ 
  if ($readini(pmb.ini, n, Variables, Notification) == 0) /Ignore $nick $1- 
  else { 
    if ( $readini(pmb.ini, n, Variables, Sounds) == 1) /beep 3 
    /dialog -mv $+(pmb.,$nick) pmb_confirm 
    /did -a $+(pmb.,$nick) 4 $nick has sent you a personal message. If you wish to accept this message press 'Accept'. Otherwise press 'Ignore' and they will recieve the preset personal block message. 
    $($+(.timer,pmb.,$nick),2) 1 $readini(pmb.ini, n, Variables, Delay) /Timeout $nick $1- 
  } 
} 
#PMB END 

alias -l Timeout { /dialog -x $+(pmb.,$1) | /Ignore $1 $2- } 

on 1:dialog:pmb.*:sclick:*:{ 
  /tokenize 32 $timer($dname).com 
  if ( $did == 2 ) /Ignore $2 $3- 
  $($+(.timer,$dname),2) off 
} 

;Alias that closes window, logs, and messages user 
alias -l Ignore { 
  .msg $1 [ $readini(pmb.ini, n, Variables, Message) ]
  if ($readini(pmb.ini, n, Variables, Logging) == 1) { 
    /var %x = $ini(pmb.ini,Messages,0) 
    if ( $calc(%x) < $readini(pmb.ini, n, Variables, Entries)) /writeini -n pmb.ini Messages $calc( %x +1) $asctime(mmm d h:nntt) - $1 $2- 
  } 
  if ($readini(pmb.ini, n, Variables, Window) == 1) /close -m $1 
} 

alias -l TagColor { return $+($chr(3),04,$chr(2),[) $+ $1- $+ $+($chr(3),01,],$chr(2)) }