Away Manager

By Disturbed on Dec 15, 2006

Just Put it into a New Page in your remotes ;D.

dialog away {
  title "DisturbScript away script"
  size -1 -1 111 148
  option dbu
  combo 1, 2 27 76 50, size edit drop
  button "Add", 2, 79 26 14 12
  button "Del", 3, 94 26 14 12
  combo 4, 2 56 76 50, size edit drop
  button "Add", 5, 79 55 14 12
  button "Del", 6, 94 55 14 12
  text "DisturbScript away script", 7, 2 3 55 8
  text "Away Nick", 8, 2 18 25 8
  text "Away Reason", 9, 2 42 36 8
  button "Go Away", 10, 2 120 53 12
  button "Come back", 11, 56 120 53 12
  check "Logs enabled", 12, 2 72 50 10
  check "When your nick is said", 13, 2 91 63 10
  check "When you get noticed", 14, 2 100 65 10
  check "When you get queried", 15, 2 110 63 10
  text "Notify users when:", 16, 2 84 46 8
  button "Log viewer", 17, 2 134 107 12
}
on *:dialog:away:init:0:{
  loadbuf -oe away 1 awaynicks.txt
  loadbuf -oe away 4 awayreasons.txt
}
on *:dialog:away:sclick:2:{
  if ($read(awaynicks.txt, w, $did(1)) == $null) { 
    write awaynicks.txt $did(1)
    did -r away 1
    loadbuf -oe away 1 awaynicks.txt
  }
}
on *:dialog:away:sclick:3:{
  write -dl $+ $did(1).sel awaynicks.txt
  did -r away 1
  loadbuf -oe away 1 awaynicks.txt
}
on *:dialog:away:sclick:5:{
  if ($read(awayreasons.txt, w, $did(1)) == $null) { 
    write awayreasons.txt $did(4)
    did -r away 4
    loadbuf -oe away 4 awayreasons.txt
  }
}
on *:dialog:away:sclick:6:{
  write -dl $+ $did(4).sel awayreasons.txt
  did -r away 4
  loadbuf -oe away 4 awayreasons.txt
}
on *:dialog:away:sclick:10:{
  if (!$away) {
    if ($did(4) != $null) && ($did(1) != $null) {
      away $did(4)
      set %anick [ $+ [ $network ] ] $me
      amsg %DisturbScript $+  4,1[7Away4]_[7Reason: $did(4) $+ 4,1] 
      .timeraway 0 3600 amsg %DisturbIRC $+  4,1[7Away4]_[7Reason: $did(4) $+ 4,1]_[7Time Away: $!duration($awaytime)4,1]
      nick $did(1) 
      dialog -x away away
    }
  }
}
on *:dialog:away:sclick:11:{
  if ($away) {
    .timeraway off
    amsg %DisturbIRC $+  4,1[7Back4]_[7Reason: $awaymsg $+ 4,1]_[7,1Time Away: $duration($awaytime)4,1]
    away
    nick %anick [ $+ [ $network ] ]
    unset %anick [ $+ [ $network ] ]
    unset %awaytime
    dialog -x away away
    unset %logsenabled
    unset %nicksenabled 
    unset %noticeenabled 
    unset %queryenabled 
  }
}
on *:dialog:away:sclick:12:{
  if ($did(12).state == 1) { set %logsenabled Yes }
  else { unset %logsenabled }
}
on *:dialog:away:sclick:13:{
  if ($did(13).state == 1) { set %nicksenabled Yes }
  else { unset %nicksenabled }
}
on *:dialog:away:sclick:14:{
  if ($did(14).state == 1) { set %noticeenabled Yes }
  else { unset %noticeenabled }
}
on *:dialog:away:sclick:15:{
  if ($did(15).state == 1) { set %queryenabled Yes }
  else { unset %queryenabled }
}
on *:dialog:away:sclick:17:{
  dialog -m logview logview 
}
on *:text:*:#:{ 
  if ($away) {
    if (%nicksenabled == Yes) {
      if ($me isin $1-) { 
        if (%logsenabled == yes) {
          .notice 4,1[7 $nick I am currently away. You can reach me by typing /ctcp $me log <your message>4]
        }
        else { 
          .notice 4,1[7 $nick I am currently away. If you were trying to reach me, you'll have to wait.4]
        }
      }
    }
  }
}
on *:action:*:#:{ 
  if ($away) {
    if (%nicksenabled == Yes) {
      if ($me isin $1-) { 
        if (%logsenabled == yes) {
          .notice 4,1[7 $nick I am currently away. You can reach me by typing /ctcp $me log <your message>4]
        }
        else { 
          .notice 4,1[7 $nick I am currently away. If you were trying to reach me, you'll have to wait.4]
        }
      }
    }
  }
}
on *:notice:*:?:{ 
  if ($away) {
    if (%noticesenabled == Yes) {
      if (%logsenabled == yes) {
        .notice 4,1[7 $nick I am currently away. You can reach me by typing /ctcp $me log <your message>4]
      }
      else { 
        .notice 4,1[7 $nick I am currently away. If you were trying to reach me, you'll have to wait.4]
      }
    }
  }
}
on *:open:?:{ 
  if ($away) {
    if (%queryenabled == Yes) {
      if (%logsenabled == yes) {
        msg 4,1[7 $nick I am currently away. You can reach me by typing /ctcp $me log <your message>4]
      }
      else { 
        msg 4,1[7 $nick I am currently away. If you were trying to reach me, you'll have to wait.4]
      }
    }
  }
}
ctcp *:log:?:{ 
  if ($away) {
    if (%logsenabled == yes) {
      window -a @logs 
      echo @logs $asctime(hh:nn:ss:tt) < $+ $nick $+ > $2- 
      if ($read(logs.txt,1) == You have no logs.) {
        write -c logs.txt $asctime(hh:nn:ss:tt) < $+ $nick $+ > $2-
      }
      if ($read(logs.txt,1) != You have no logs.) {
        write logs.txt $asctime(hh:nn:ss:tt) < $+ $nick $+ > $2-
      }
    }
  }
}
dialog logalert {
  title "Alert!"
  size -1 -1 181 37
  option dbu
  edit "", 1, 3 4 173 19, read multi
  button "OK", 2, 71 24 37 12, ok
}

dialog logview {
  title "Log Viewer"
  size -1 -1 118 178
  option dbu
  list 1, 0 13 116 151, size
  text "eclipseScript log viewer", 2, 3 3 51 8
  button "View log", 3, 1 165 37 12
  button "Delete Log", 4, 40 165 37 12
  button "Clear Logs", 5, 79 165 37 12
}
dialog logdisp {
  title "Log"
  size -1 -1 196 65
  option dbu
  edit "", 1, 4 6 187 43, read multi vsbar
  button "Close", 2, 78 51 37 12, ok
}
on *:dialog:logview:init:0:{ 
  if ($read(logs.txt,1) == $null) {
    did -r logview 1
    dialog -mo logalert logalert
    did -ra logalert 1 You have no logs.
    dialog -x logview
  }
  else {
    did -r logview 1
    var %lognum 1
    while (%lognum <= $lines(logs.txt)) {    
      tokenize 32 $read(logs.txt, %lognum)
      var %lognick $remove($2,<,>) 
      did -a logview 1 %lognick
      inc %lognum
    }
  }
}
on *:dialog:logview:dclick:1:{
  dialog -m logdisp logdisp
  tokenize 32 $read(logs.txt,$did(logview,1).sel )
  did -ra logdisp 1 Log from $remove($2,<,>) $+ $chr(13) $+ $chr(10)
  did -a logdisp 1 Received at $1 $+ $chr(13) $+ $chr(10)
  did -a logdisp 1 $3- $+ $chr(13) $+ $chr(10)
}
on *:dialog:logview:sclick:3:{ 
  dialog -m logdisp logdisp
  tokenize 32 $read(logs.txt,$did(logview,1).sel )
  did -ra logdisp 1 Log from $remove($2,<,>) $+ $chr(13) $+ $chr(10)
  did -a logdisp 1 Received at $1 $+ $chr(13) $+ $chr(10)
  did -a logdisp 1 $3- $+ $chr(13) $+ $chr(10)
}
on *:dialog:logview:sclick:4:{
  write -dl $+ $did(1).sel logs.txt
  if ($read(logs.txt,1) == $null) {
    did -r logview 1
    dialog -mo logalert logalert
    did -ra logalert 1 Log deleted
  }
  else {
    did -r logview 1
    var %lognum 1
    while (%lognum <= $lines(logs.txt)) {    
      tokenize 32 $read(logs.txt, %lognum)
      var %lognick $remove($2,<,>) 
      did -a logview 1 %lognick
      inc %lognum
    }
  }
}
on *:dialog:logview:sclick:5:{
  write -c logs.txt 
  did -r logview 1
  dialog -mo logalert logalert
  did -ra logalert 1 Logs cleared
}
alias aways dialog -m away away
menu channel,status,menubar {
  Away
  .Away:aways
  .Logs:dialog -m logview logview 
}

Comments

Sign in to comment.
SyntaxIRC   -  Dec 23, 2006

By looking at your other scripts, I don\'t think this is yours.

 Respond  
Disturbed   -  Dec 17, 2006

K thanks Zabuza

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.