All pastes #516889 Raw Edit

Updated Query Control

public text v1 · immutable
#516889 ·published 2007-05-28 21:51 UTC
rendered paste body
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
; Query Control Script                              ;
; Created & Coded by SyntaxError                    ;
; Version 1.5.7 last updated May 26th, 2007         ;
; /server -m irc.SwiftIRC.net -j #acethebunny       ;
; © 2007 Gary Hoalcraft III (acethebunny@gmail.com) ;
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;

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)
  }
}

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.7", 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. I am 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. Sorry.)
  window -c %qc.nick
  unset %qc.nick
  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
  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 ($nick != acethebunny|bot || $active == -psyBNC) {
    .timerclose.query. $+ $active $+ .1 1 300 close -m $active
    .timerclose.query. $+ $active $+ .2 1 300 notice $active $ewrap(The query window with you has been closed after 5 minutes of inactivity.)
  }
}
on *:TEXT:*:?:{ 
  if ($nick != acethebunny|bot || $nick == -psyBNC) { 
    .timerclose.query. $+ $nick $+ .1 1 300 close -m $nick
    .timerclose.query. $+ $nick $+ .2 1 300 notice $nick $ewrap(The query window with you has been closed after 5 minutes of inactivity.)
  }
}
on *:CLOSE:?:{
  if ($timer($+(close.query.,$nick,.1))) .timer $+ $eval($+(close.query.,$nick,.*)2) off
}
on *:OPEN:?:{ 
  if ($away) {
    halt
  }
  elseif ($nick == acethebunny|bot || $nick == -psyBNC) {
    halt
  }
  elseif ($dialog(qc)) {
    .msg $nick $ewrap(Sorry $nick $+ , but I am busy with another message. Please try again later. (15 second ignore))
    close -m $nick
    .ignore -pu15 $nick
  }
  else {
    set %qc.nick $nick
    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-
  }
}
#qc end

alias ewrap {
  var %msg
  var %tok = 1
  var %word
  while ($gettok($1-,%tok,32) != $null) {
    %word = $gettok($1-,%tok,32)
    %msg = %msg 15 $+ $upper($left(%word,1)) $+ 15 $+ $right(%word,-1) 
    inc %tok
  }
  return 12,1{~15 $+ %msg $+ 12~}
}

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
;                                                   ;
;                    End Of File                    ;
;                                                   ;
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;