All pastes #896491 Raw Edit

addy

public text v1 · immutable
·published 2008-02-08 18:28 UTC
rendered paste body
menu Status,Channel,MenuBar,Query {
  $iif($group(#qc) == on,$style(1)Disable,$style(0)Enable) Query Control: {
    var %status = $iif($group(#qc) == on,Disable,Enable)
    $+(.,%status) #qc
    echo -a 4»7 Query Control has been $+(%status,d)
  }
}

dialog qc {
  title "Query Control"
  size -1 -1 130 47
  option dbu

  text "From:", 1, 4 7 25 10 center
  text "Time:", 2, 82 7 15 10 center
  edit "", 3, 97 6 28 10, read
  edit "", 4, 30 6 50 10, read
  text "Message:", 5, 4 19 25 10 left
  edit "", 6, 30 18 95 10, read
  box "", 7, 1 1 127 29

  button "Accept", 8, 4 32 20 10 ok
  button "Decline", 9, 25 32 20 10 ok
  button "Ignore", 10, 46 32 20 10 ok
  box "", 11, 1 27 68 17

  link "e-mail", 12, 75 34 15 8
  text "v1.5.9", 13, 95 35 18 8 left
  box "", 14, 70 27 58 17 
}

on *:dialog:qc:sclick:8:{
  window -w %qc.nick
  .msg %qc.nick $ewrap(Query Accepted. DarKyWarKy® is reading what you've already said.)
  dialog -x qc
  window -a %qc.nick
  unset %qc.nick
}
on *:dialog:qc:sclick:9:{
  .msg %qc.nick $ewrap(Private Message Declined by  DarKyWarKy®. Sorry, Please try again shortly.)
  window -c %qc.nick
  unset %qc.nick
  dialog -x qc
}
on *:dialog:qc:sclick:10:{
  .msg %qc.nick $ewrap(Private Message Declined by  DarKyWarKy®. You have been ignored.)
  window -c %qc.nick
  .ignore -pu1200 %qc.nick
  unset %qc.nick
  dialog -x qc
}
on *:dialog:qc:sclick:12:{
  url -na mailto:acethebunny@gmail.com
}
#qc on
on *:START:{ echo -st 6» Script: Query Control script by SyntaxError is loaded and running. }
on *:INPUT:?:{ 
  if ($active != -psyBNC && $active != -sBNC && !$away) {
    .timerclose.query. $+ $active 1 1200 close.query $active
  }
}
on *:TEXT:*:?:{ 
  if ($nick != -psyBNC && $active != -sBNC && !$away) { 
    .timerclose.query. $+ $nick 1 1200 close.query $nick
  }
}
alias close.query {
  if ($query($$1)) {
    close -m $1
    notice $1 $ewrap(The query window with you has been closed after 20 minutes of inactivity.)
  }
}
on *:CLOSE:?:{
  if ($timer($+(close.query.,$nick))) .timer $+ $eval($+(close.query.,$nick)2) off
}
on *:OPEN:?:{ 
  if ($nick == -psyBNC || $nick == -sBNC) {
    halt
  }
  elseif ($away) {
    notice $nick $ewrap(I am currently away: $awaymsg ~ gone $duration($awaytime))
    halt
  }
  elseif ($dialog(qc)) {
    .msg $nick $ewrap(Sorry $nick $+ , but I am busy with another message. Please try again later. (15 second ignore))
    echo -a 2 $+ $nick tried to Query you with an active Query Control dialog open
    close -m $nick
    .ignore -pu15 $nick
  }
  else {
    set %qc.nick $nick
    window -h $nick
    .msg $nick $ewrap(Please Wait For DarKyWarKy® PM Acceptance/Decline)
    dialog -mdo qc qc
    did -a qc 3 $asctime(hh:nn:ss) 
    did -a qc 4 $nick
    did -a qc 6 $1-
    did -f qc 1
  }
}

#qc end

alias ewrap {
  var %msg
  var %tok = 1
  var %word
  while ($gettok($1-,%tok,32) != $null) {
    %word = $gettok($1-,%tok,32)
    %msg = %msg $+($chr(3)) $+ 14 $+ $upper($left(%word,1)) $+ $+($chr(3)) $+ 14 $+ $right(%word,-1) 
    inc %tok
  }
  return $+($chr(2),$chr(3)) $+ 2[ $+ $+($chr(2),$chr(3)) $+ 14 $+ %msg $+ $+($chr(2),$chr(3)) $+ 2 ] $+ $chr(15)