All pastes #566436 Raw Edit

Stuff

public text v1 · immutable
·published 2007-06-14 13:16 UTC
rendered paste body
menu menubar {
  Secure Private Messenger
  .Allowed List:/dialog -m allow allow
  .Blocked List:/dialog -m block block
}
dialog pm {
  title "Secure Private Message"
  size -1 -1 343 142
  option dbu
  box "Information", 1, 3 2 335 84
  box "Allow?", 2, 3 89 81 29
  text "Nickname", 3, 6 11 25 8
  text "Messages", 4, 6 21 25 8
  list 5, 34 10 98 10, size
  list 6, 34 21 300 60, size
  button "Yes", 7, 6 100 37 12
  button "No", 8, 43 100 37 12
  box "Blocker", 9, 90 89 51 50
  box "Allow", 10, 147 89 50 50
  button "Add Address", 11, 98 97 37 12
  button "Add Nickname", 12, 98 109 37 12
  button "View List", 13, 98 121 37 12
  button "Add Address", 14, 153 97 37 12
  button "Add Nickname", 15, 153 109 37 12
  button "View List", 16, 153 121 37 12
}
on *:DIALOG:pm:sclick:11:{
  writeini Block.ini Pm $address(%nick,2) $address(%nick,2)
  msg %nick You have been blocked
  unset %nick
  unset %message
  dialog -x pm pm
}
on *:DIALOG:pm:sclick:12:{
  wirteini Block.ini Pm %nick %nick
  msg %nick You have been blocked
  unset %nick
  unset %message
  dialog -x pm pm
}
on *:DIALOG:pm:sclick:13:{ dialog -ma block block }
on *:DIALOG:pm:sclick:14:{
  writeini Block.ini Allow $address(%nick,2) $address(%nick,2)
  msg %nick You have been allowed
  query %nick
  unset %nick
  unset %message
  dialog -x pm pm
}
on *:DIALOG:pm:sclick:15:{
  writeini Block.ini Allow %nick %nick
  msg %nick You have been allowed
  query %nick
  unset %nick
  unset %message
  dialog -x pm pm
}
on *:DIALOG:pm:sclick:16:{ dialog -ma allow allow }
on *:DIALOG:pm:init:*:{
  if (%message && %nick) {
    did -a pm 5 %nick
    did -a pm 6 %message
  }
}
on *:DIALOG:pm:sclick:7:{
  msg %nick Query has been accepted, I have already read your message(s).
  var %x = 1
  while ($did(pm,6,%x)) {
    echo $did(pm,6,%x)
    inc %x
  }
  dialog -x pm pm
  query %nick
  unset %nick
  unset %message
}
on *:DIALOG:pm:sclick:8:{
  msg %nick Query has been declined
  dialog -x pm pm
  unset %message
  unset %nick
}
dialog block {
  title "Blocked List"
  size -1 -1 169 83
  option dbu
  text "Name", 1, 71 4 15 8
  list 2, 3 13 161 49, size
  button "Edit", 3, 24 66 37 12
  button "Add", 4, 61 66 37 12
  button "Remove", 5, 97 66 37 12
}
on *:DIALOG:block:init:*:{
  var %x = 1
  while ($ini(Block.ini,Pm,%x)) {
    did -a block 2 $ini(Block.ini,Pm,%x)
    inc %x
  }
}
on *:DIALOG:block:sclick:3:{
  var %x = $did(block,2).seltext
  if (!%x) halt
  dialog -ma blocke blocke
  did -a blocke 1 %x
  set $+(%,edit) %x
}
on *:DIALOG:block:sclick:4:{
  var %x = $$?="Address Or Nickname"
  writeini Block.ini Pm %x %x
  did -a block 2 %x
}
on *:DIALOG:block:sclick:5:{
  var %x = $did(block,2).seltext
  remini Block.ini Pm %x
  dialog -x block block
  dialog -ma block block
}
dialog blocke {
  title "Edit"
  size -1 -1 105 36
  option dbu
  edit "", 1, 2 2 100 10
  button "Ok", 2, 12 15 37 12
  button "Cancel", 3, 49 15 37 12, cancel
}
on *:DIALOG:blocke:sclick:3:{ unset $+(%,edit) }
on *:DIALOG:blocke:sclick:2:{
  remini Block.ini Pm $($+(%,edit),2) $($+(%,edit),2)
  writeini Block.ini Pm $did(blocke,1) $did(blocke,1)
  unset $+(%,edit)
  dialog -x blocke blocke
  dialog -x block block
  dialog -ma block block
}
dialog allow {
  title "Allowed List"
  size -1 -1 169 83
  option dbu
  text "Name", 1, 71 4 15 8
  list 2, 3 13 161 49, size
  button "Edit", 3, 24 66 37 12
  button "Add", 4, 61 66 37 12
  button "Remove", 5, 97 66 37 12
}
on *:DIALOG:allow:init:*:{
  var %x = 1
  while ($ini(Block.ini,Allow,%x)) {
    did -a allow 2 $ini(Block.ini,Allow,%x)
    inc %x
  }
}
on *:DIALOG:allow:sclick:3:{
  var %x = $did(allow,2).seltext
  if (!%x) halt
  dialog -ma allowe allowe
  did -a allowe 1 %x
  set $+(%,edit) %x
}
on *:DIALOG:allow:sclick:4:{
  var %x = $$?="Address Or Nickname"
  writeini Block.ini Allow %x %x
  did -a allow 2 %x
}
on *:DIALOG:allow:sclick:5:{
  var %x = $did(allow,2).seltext
  if (!%x) halt
  remini Block.ini Allow %x
  dialog -x allow allow
  dialog -ma allow allow
}
dialog allowe {
  title "Edit"
  size -1 -1 105 36
  option dbu
  edit "", 1, 2 2 100 10
  button "Ok", 2, 12 15 37 12
  button "Cancel", 3, 49 15 37 12, cancel
}
on *:DIALOG:blocke:sclick:3:{ unset $+(%,edit) }
on *:DIALOG:allowe:sclick:2:{
  remini Block.ini Allow $($+(%,edit),2) $($+(%,edit),2)
  writeini Block.ini Allow $did(allowe,1) $did(allowe,1)
  unset $+(%,edit)
  dialog -x allowe allowe
  dialog -x allow allow
  dialog -ma allow allow
}
on *:OPEN:?:{
  if ($readini(Block.ini,-n,Allow,$nick) || $readini(Block.ini,-n,Allow,$address($nick,2))) { halt }
  elseif ($readini(Block.ini,-n,Pm,$nick) || $readini(Block.ini,-n,Pm,$address($nick,2))) {
    msg $nick You have been blocked
    close -m $nick
  }
  elseif (%message && $nick == %nick) { did -a pm 6 $1- }
  else {
    set %message $1-
    set %nick $nick
    msg $nick I am currently operating on a secure private message, please wait to be accepted
    close -m $nick
    dialog -ma pm pm
  }
}
alias /list {
  if ($1 == block) {
    var %x = 1
    while ($ini(Block.ini,Pm,%x)) {
      echo $active %x $+ . $ini(Block.ini,Pm,%x)
      inc %x
    }
  }
  elseif ($1 == allow) {
    var %x = 1
    while ($ini(Block.ini,Allow,%x)) {
      echo $active %x $+ . $ini(Block.ini,Allow,%x)
      inc %x
    }
  }
}
alias /block {
  writeini Block.ini Pm $1 $1
  echo $active $1 has been added
}
alias /unblock {
  if ($readini(Block.ini,-n,Pm,$1)) {
    remini Block.ini Pm $1
    echo $active $1 has been removed
  }
  else { echo $active $1 is not on the block list }
}
alias /allow {
  writeini Block.ini Allow $1 $1
  echo $active $1 is now allowed
}
alias /unallow {
  if ($readini(Block.ini,-n,Allow,$1)) {
    remini Block.ini Allow $1
    echo $active $1 has been unallowed
  }
  else { echo $active $1 is not on the allow list }