All pastes #835345 Raw Edit

Untitled

public text v1 · immutable
#835345 ·published 2007-12-28 20:44 UTC
rendered paste body
dialog away {
  title "Away System"
  size -1 -1 117 132
  option dbu
  text "Away Nick" 1, 2 5 25 8
  combo 2, 2 13 76 50, size edit drop
  button "Add", 3, 79 12 14 12
  button "Del", 4, 94 12 14 12
  text "Away Reason", 5, 2 29 36 8
  combo 6, 2 37 76 50, size edit drop
  button "Add", 7, 79 36 14 12
  button "Del", 8, 94 36 14 12
  check "Logs Enabled", 9, 5 54 50 10
  check "Block PMs", 10, 5 64 50 10
  button "Go Away", 11, 62 54 44 10
  button "Come Back", 12, 62 64 44 10
  box "Idle Settings", 13, 3 76 111 54
  text "Auto-Away After:", 14, 5 84 45 10
  radio "10 Minutes", 15, 5 92 45 10
  radio "15 Minutes", 16, 5 101 45 10
  radio "20 Minutes", 17, 5 109 45 10
  radio "30 Minutes", 18, 5 118 45 10
  check "Enable Auto-Away", 19, 52 91 52 10
  button "Apply", 20, 60 105 30 10
  button "Default", 21, 60 116 30 10
}
on *:start:{
  echo -st 4A14way 4S14cript 4b14y: 4D14ark4W14arrior 14.4.14:4¤14: 14Å4k冚ükí 14§4çrïÞ†® 14:4¤14:4.14.
}
on *:dialog:away:init:0:{
  loadbuf -oe away 2 awaynicks.txt
  loadbuf -oe away 6 awayreasons.txt
  if (%idletime == 600) { did -c away 15 }
  elseif (%idletime == 900) { did -c away 16 }
  elseif (%idletime == 1200) { did -c away 17 }
  elseif (%idletime == 1800) { did -c away 18 }
  if (%autoaway == on) { did -c away 19 }
  else { did -u away 19 }
}
on *:dialog:away:sclick:3:{
  if ($read(awaynicks.txt, w, $did(2)) == $null) { 
    write awaynicks.txt $did(2)
    did -r away 2
    loadbuf -oe away 2 awaynicks.txt
  }
}
on *:dialog:away:sclick:4:{
  write -dl $+ $did(2).sel awaynicks.txt
  did -r away 2
  loadbuf -oe away 2 awaynicks.txt
}
on *:dialog:away:sclick:7:{
  if ($read(awayreasons.txt, w, $did(6)) == $null) { 
    write awayreasons.txt $did(6)
    did -r away 6
    loadbuf -oe away 6 awayreasons.txt
  }
}
on *:dialog:away:sclick:8:{
  write -dl $+ $did(6).sel awayreasons.txt
  did -r away 6
  loadbuf -oe away 6 awayreasons.txt
}
on *:dialog:away:sclick:9:{
  if ($did(9).state == 1) { set %logsenabled on }
  elseif ($did(9).state == 0) { unset %logsenabled }
}
on *:dialog:away:sclick:10:{
  if ($did(10).state == 1) { set %awayblocker on }
  elseif ($did(10).state == 0) { unset %awayblocker }
}
on *:dialog:away:sclick:11:{
  if (!$away) {
    if ($did(2) != $null) && ($did(6) != $null) {
      away $did(6)
      set %anick [ $+ [ $network ] ] $me
      set %awaytime $time(hh:nntt)
      amsg 15»4 $me 4i14s 4n14ow 4A14way 15« 4¤ 15» 4R14eason:4 $did(6) 15« %akatsuki
      .timeraway 0 3600 amsg 15»4 $me 4i14s 4S14till 4A14way. 15« 4¤ 15» 4A14way 4F14or:4 $!duration($awaytime) 15« 4¤ 15» 4R14eason:4 $!awaymsg 15« %akatsuki
      nick $did(2)
      dialog -x away away
    }
  }
}
on *:dialog:away:sclick:12:{
  if ($away) {
    .timeraway off
    amsg 15»4 $me 4i14s 4B14ack 15« 4¤ 15» 4A14way 4F14or:4 $duration($awaytime) 15« 4¤ 15» 4R14eason:4 $awaymsg 15« 4¤ 15» 4S14ince: %awaytime 15« %akatsuki
    away
    nick %anick [ $+ [ $network ] ]
    unset %anick [ $+ [ $network ] ]
    unset %awaytime
    unset %awayblocker
    dialog -x away away
  }
}
on *:dialog:away:sclick:20:{
  if ($did(15).state == 1) { set %idletime 600 | set %idleaway $duration(%idletime) }
  elseif ($did(16).state == 1) { set %idletime 900 | set %idleaway $duration(%idletime) }
  elseif ($did(17).state == 1) { set %idletime 1200 | set %idleaway $duration(%idletime) }
  elseif ($did(18).state == 1) { set %idletime 1800 | set %idleaway $duration(%idletime) }
  if ($did(19).state == 1) { set %autoaway on }
  else { unset %autoaway }
}
on *:dialog:away:sclick:21:{
  set %idletime 900
  set %idleaway $duration(%idletime)
  set %autoaway on
  did -c away 16
  did -c away 19
  did -u away 15
  did -u away 17
  did -u away 18
}
on *:input:*:{
  if (%autoaway == on) {
    if (!$away) { .timeridle 1 %idletime autoaway }
  }
}
alias autoaway {
  if ($away) { halt }
  else {
    set %anick [ $+ [ $network ] ] $me
    away Auto-Away After %idleaway of inactivity.
    nick $me $+ `Idle
    amsg 4 $+ $me 4i14s 4n14ow 4A14way 4a14fter4 %idleaway 4o14f 4i14nactivity. %akatsuki
    echo 4 -st Type /comeback to return from Auto-Away.
  }
}
alias comeback {
  if ($awaymsg) { halt }
  else {
    nick %anick [ $+ [ $network ] ]
    unset %anick [ $+ [ $network ] ]
    amsg 4 $+ $me 4h14as 4r14eturned 4f14rom 4A14uto15-4A14way. %akatsuki
    away
  }
}
on *:load:{
  set %idletime 900
  set %idleaway $duration(%idletime)
  set %autoaway on
  set %akatsuki 14.4.14:4¤14: 14Å4k冚ükí 14§4çrïÞ†® 14:4¤14:4.14.
}
menu channel,menebar {
  Away System:/dialog -m away away
}
on *:open:?:*:{
  if ($away) {
    if (%awayblocker == on) {
      if (%logsenabled == on) {
        window @AwayLogs
        window -h $nick
        msg $nick 4I 4a14m 4c14urrently 4a14way 4a14nd I14'm 4n14ot 4a14ccepting 4P14M's. 4Y14our 4m14essage 4h14as 4b14een 4l14ogged 4a14nd 4w14ill 4b14e 4v14iewed 4u14pon 4r14eturn. %akatsuki
        aline -l @AwayLogs 14[4 $+ $time(hh:nn:sstt) $+ 14] 14<4 $+ $nick $+ 14> $1-
        window -c $nick
      }
      else {
        window -h $nick
        msg $nick 4I 4a14m 4c14urrently 4a14way 4a14nd I14'm 4n14ot 4a14ccepting 4P14M's. %akatsuki
        window -c $nick
      }
    }
    elseif (%awayblocker == $null) && (%logsenabled == on) {
      window @awaylogs
      aline -l 14[4 $+ $time(hh:nn:sstt) $+ 14] 14<4 $+ $nick $+ 14> $1-
      msg $nick 4I 4a14m 4c14urrently 4a14way, 4Y14our 4m14essage 4h14as 4b14een 4l14ogged 4a14nd 4w14ill 4b14e 4v14iewed 4u14pon 4r14eturn. %akatsuki
      window -n $nick
    }
  }
}