All pastes #839142 Raw Edit

Untitled

public text v1 · immutable
#839142 ·published 2007-12-30 21:30 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? Query Control has been $+(%status,d) 
  } 
} 
menu Query { 
  $iif($hget(qcaccept,$address($active,3)),$style(1),$style(0)) Query Auto-Accept $+([,$active,]): { 
    var %status = $iif($hget(qcaccept,$address($active,3)) = 1,Del,Add) 
    $+(h,%status) qcaccept $address($active,3) 1 
    echo -a 4? $active has been $iif(%status = del,deleted from,added to) Auto-Accept. 
  } 
} 
dialog qc { 
  title "Query Control" 
  size -1 -1 130 47 
  option dbu 
  text "From:", 1, 4 7 25 10, right 
  text "Time:", 2, 82 7 15 10, left 
  text "", 3, 97 7 28 10, read 
  edit "", 4, 30 6 50 10, read 
  text "Message:", 5, 4 19 25 10, right 
  edit "", 6, 30 18 95 10, read 
  box "", 7, 1 1 127 29 
  button "Auto-Accept", 15, 4 32 37 10, ok 
  button "Accept", 8, 42 32 20 10, ok 
  button "Decline", 9, 63 32 20 10, ok 
  button "Ignore", 10, 84 32 20 10, ok 
  box "", 11, 1 27 106 18 
  link "e-mail", 12, 110 31 15 8 
  text "v2.0.3", 13, 110 37 18 8 
  box "", 14, 107 27 21 18 
} 
on *:DIALOG:qc:sclick:8:{ 
  window -w %qc.nick 
  .msg %qc.nick $ewrap(Query Accepted. I am reading what you've already said.) 
  dialog -x qc 
  window -a %qc.nick 
  unset %qc.* 
} 
on *:DIALOG:qc:sclick:15:{ 
  window -w %qc.nick 
  .msg %qc.nick $ewrap(Query Accepted. You have been added to the Auto-Accept list. $+([,%qc.address,]) ) 
  dialog -x qc 
  hadd -m qcaccept %qc.address 1 
  window -a %qc.nick 
  unset %qc.* 
} 
on *:DIALOG:qc:sclick:9:{ 
  .msg %qc.nick $ewrap(Private Message Declined. Sorry.) 
  window -c %qc.nick 
  unset %qc.* 
  dialog -x qc 
} 
on *:DIALOG:qc:sclick:10:{ 
  .msg %qc.nick $ewrap(Private Message Declined. You have been ignored.) 
  window -c %qc.nick 
  .ignore -pu1200 %qc.nick 2 
  unset %qc.* 
  dialog -x qc 
} 
on *:DIALOG:qc:sclick:12:{ 
  url -na mailto:Bhavik_Patel@msn.com 
} 
#qc on 
on *:START:{ 
  echo $color(info) -st 6? Script: Query Control Script is loaded and running. 
  hmake qcaccept 100 
  if ($exists(qcaccept.hsh)) { 
    .hload -s qcaccept qcaccept.hsh 
    echo $color(info) -st 6? Script: hash table for Query Control loaded 
  } 
} 
on *:EXIT:{ 
  hsave -s qcaccept qcaccept.hsh 
} 
on *:INPUT:?:{ 
  if ($active != -psyBNC && $active != -sBNC && !$away) { 
    .timerclose.query. $+ $active 1 300 close.query $active 
  } 
} 
on *:TEXT:*:?:{ 
  if ($nick != -psyBNC && $active != -sBNC && !$away) { 
    .timerclose.query. $+ $nick 1 300 close.query $nick 
  } 
} 
alias close.query { 
  if ($query($$1)) { 
    close -m $1 
    notice $1 $ewrap(The query window with you has been closed after 5 minutes of inactivity.) 
  } 
} 
on *:CLOSE:?:{ 
  if ($timer($+(close.query.,$nick))) .timer $+ $($+(close.query.,$nick),2) off 
} 
on *:OPEN:?:{ 
  if ($nick == -psyBNC || $nick == -sBNC || bot isin $nick) { 
    goto end 
  } 
  elseif ($hget(qcaccept,$address($nick,3))) { 
    .msg $nick $ewrap(Query Auto-Accepted. I have been idle for $dur($idle) . $& 
      $iif($away,[I am also away: $awaymsg - $+($dur($awaytime),])) ) 
    goto end 
  } 
  elseif ($away) { 
    notice $nick $ewrap(I am currently away: $awaymsg ~ gone $dur($awaytime)) 
    goto end 
  } 
  elseif ($dialog(qc)) { 
    .msg $nick $ewrap(Sorry $nick $+ , but I am busy with another message. Please try again later. (15 second ignore)) 
    echo $color(info) -ast 6? Query Control: $nick tried to Query you with an active Query Control dialog open 
    close -m $nick 
    .ignore -pu15 $nick 
  } 
  else { 
    set %qc.nick $nick 
    set %qc.address $address($nick,3) 
    window -h $nick 
    .msg $nick $ewrap(Please Wait For 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 
  } 
  :end 
} 
CTCP *:VERSION:*:{ 
  if (!$($+(%,ctcp.qc.,$wildsite),2)) { 
    .ctcpreply $nick VERSION Stop Versioning me noob
    echo -a $nick Versioned you at $time on $adate 
    set -eu15 $+(%,ctcp.qc.,$wildsite) on 
  } 
} 
#qc end 
alias dur { 
  return $replace($duration($1), wk,$chr(32) week,day,$chr(32) day,hr,$chr(32) hour,min,$chr(32) minute,sec,$chr(32) second ) 
} 
alias ewrap { 
  var %msg 
  var %tok = 1 
  var %word 
  while ($gettok($1-,%tok,32) != $null) { 
    %word = $gettok($1-,%tok,32) 
    %msg = %msg $+($chr(3)) $+ 15 $+ $upper($left(%word,1)) $+ $+($chr(3)) $+ 15 $+ $right(%word,-1) 
    inc %tok 
  } 
  return $+($chr(2),$chr(3)) $+ 12,1{~ $+ $+($chr(2),$chr(3)) $+ 15 $+ %msg $+ $+($chr(2),$chr(3)) $+ 12~} $+ $chr(15) 
}