All pastes #835617 Raw Edit

Unnamed

public text v1 · immutable
#835617 ·published 2007-12-28 23:19 UTC
rendered paste body
###############
## Away/Back ##
###############
menu channel,status {
  Away (Status):status 
} 
alias status { 
  dialog -m status status 
} 
dialog status { 
  title "Away Dialog" 
  size -1 -1 235 115 
  option dbu 
  tab "Away", 1, -2 -2 237 116 
  tab "List", 2 
  tab "Logs", 3 
  box "Away Table" 4, 5 16 110 45, tab 1 
  text "Away Msg:" 5, 11 26 30 10, tab 1 
  edit "", 6, 40 26 70 9, tab 1 
  text "Set Nick:" 7, 11 39 30 10, tab 1 
  edit "", 8, 36 37 74 9, tab 1 
  button "Set Away" 9, 45 48 33 11, tab 1 
  box "Back Table" 10, 120 16 110 45, tab 1 
  text "Away Time:" 11, 128 26 30 8, tab 1 
  text "", 12, 157 26 67 8, tab 1 
  text "Nick:" 13, 128 38 30 8, tab 1 
  edit "", 14, 141 37 83 8, tab 1 
  button "Set Back" 15, 160 48 33 11, tab 1 
  box "Status" 16, 55 84 130 20, tab 1 
  text "Status:" 17, 60 92 30 10, tab 1 
  text "", 18, 80 92 115 9, tab 1 
  box "Logger", 19, 35 63 170 20, tab 1 
  text "Enable Logging:", 20, 40 72 40 9, tab 1 
  check "", 21, 81 71 10 10, tab 1 
  text "Enable Reply PM:", 22, 146 72 43 9, tab 1 
  check "", 23, 190 71 10 9, tab 1 
  box "Trigger List", 24, 30 13 80 97, tab 2 
  list 25, 35 21 70 74, size tab 2 
  button "Delete", 26, 38 96 31 11, tab 2 
  button "Clear", 27, 69 96 31 11, tab 2 
  box "Add Trigger", 28, 115 15 105 39, tab 2 
  text "Name:", 29, 121 27 25 9, tab 2 
  edit "", 30, 138 25 73 9, tab 2 
  button "Add Trigger", 31, 145 37 35 13, tab 2 
  box "Logger", 32, 115 56 105 30, tab 2 
  text "Enable Logger:", 33, 133 69 40 9, tab 2 
  check "", 34, 172 68 10 10, tab 2 
  box "Logs", 35, 30 13 170 98, tab 3 
  list 36, 36 21 157 72, size tab 3 
  button "Clear Logs", 37, 158 96 40 13, tab 3 
  text "Enable Notice:" 38, 94 72 40 9, tab 1 
  check "", 39, 131 71 10 10, tab 1 
} 
on *:DIALOG:status:init:0: { 
  did -a $dname 14 %cnick 
  did -a $dname 12 $iif(%atime != $acstime,$duration($calc($ctime - $ctime(%atime))),You aren't away.) 
  var %trig 1 
  while (%trig <= $lines(trigger.txt)) { 
    did -a $dname 25 $read(trigger.txt,%trig) 
    inc %trig 
  } 
  var %vlog 1 
  while (%vlog <= $lines(logger.txt)) { 
    did -a $dname 36 $read(logger.txt,%vlog) 
    inc %vlog 
  } 
  if (%away != on) { 
    did -a $dname 18 Active 
  } 
  if (%away == on) { 
    did -a $dname 18 Away 
  } 
  if (%logging == on) { 
    did -c $dname 21 
    did -c $dname 34 
  } 
  if (%pmreply == on) { 
    did -c $dname 23 
  } 
  if (%nreply == on) { 
    did -c $dname 39 
  } 
} 
on *:DIALOG:status:sclick:9: {
  if (%away != on) {
    set %away on 
    set %cnick $me 
    set %awaymsg $did(6) 
    set %atime $asctime 
    set %nick $did(8)

    var %x = 1, %connections = $scon(0) 
    while (%x <= %connections) {
      scon %x
      if ($status == connected) {  
        amsg 12.:[11Away12]:. %awaymsg 12.:[11Time12]:. $time 12.:[11Logger12]:. $iif(%logging == on,ON,OFF) 
        away %awaymsg 
        if (%nick) { nick %nick } 
      } 
      inc %x
    }
    dialog -x status
  }
  else { 
    did -a $dname 18 You are already away. 
  }
} 
on *:DIALOG:status:sclick:15: { 
  if (%away == on) { 
    var %x = 1, %connections = $scon(0) 
    while (%x <= %connections) {
      scon %x
      if ($status == connected) {
        amsg 12.:[11BaCk12]:. %awaymsg 12.:[11GoNe12]:. $duration($calc($ctime - $ctime(%atime))) 
        nick $did(14) 
        away 
      }
      inc %x
    }
    unset %cnick 
    unset %atime 
    unset %awaymsg 
    unset %nick 
    unset %away 
    unset %pr* 
    unset %nt* 
    unset %trig 
    dialog -x status 
  } 
  else { 
    did -a $dname 18 You aren't away. 
  } 
} 
on *:DIALOG:status:sclick:21: { 
  if (%logging != on) { 
    did -c $dname 34 
    set %logging on 
    did -a $dname 18 Logging is now ENABLED 
  } 
  elseif (%logging == on) { 
    did -u $dname 34 
    unset %logging 
    did -a $dname 18 Logging is now DISABLED 
  } 
} 
on *:DIALOG:status:sclick:26: { 
  did -d $dname 25 $did($dname,25).sel 
  write -d trigger.txt $readn(trigger.txt,$did($dname,25)) 
} 
on *:DIALOG:status:sclick:27: { 
  did -r $dname 25 
  write -c trigger.txt 
} 
on *:DIALOG:status:sclick:34: { 
  if (%logging != on) { 
    did -c $dname 21 
    set %logging on 
    did -a $dname 18 Logging is now ENABLED 
  } 
  elseif (%logging == on) { 
    did -u $dname 21 
    unset %logging 
    did -a $dname 18 Logging is now DISABLED 
  } 
} 
on *:DIALOG:status:sclick:23: { 
  if (%pmreply != on) { 
    set %pmreply on 
    did -a $dname 18 PM Amsg is now ENABLED 
  } 
  elseif (%pmreply == on) { 
    unset %pmreply 
    did -a $dname 18 PM Amsg is now DISABLED 
  } 
} 
on *:DIALOG:status:sclick:31: { 
  if ($did(30) != $null) { 
    did -a $dname 25 $did(30) 
    write trigger.txt $did(30) 
    did -r $dname 30 
  } 
} 
on *:DIALOG:status:sclick:37: { 
  did -r $dname 36 
  write -c logger.txt 
} 
on *:DIALOG:status:sclick:39: { 
  if (%nreply != on) { 
    set %nreply on 
    did -a $dname 18 Notice Reply is now ENABLED 
  } 
  elseif (%nreply == on) { 
    unset %nreply 
    did -a $dname 18 Notice Reply is now DISABLED 
  } 
} 
on *:OPEN:?:*: { 
  if (%away == on && %pr [ $+ [ $nick ] ] != on && %pmreply == on) { 
    set %pr [ $+ [ $nick ] ] on 
    msg $nick 2[5PrivMsg2] I am currently 12.:[11AwAy12]:. %awaymsg 12.:[11Gone12]:. $duration($calc($ctime - $ctime(%atime))) 12.::. One Time Response to PM 
  } 
} 
on *:TEXT:*:#: { 
  if (%away == on) { 
    set %trig 1 
    while (%trig <= $lines(trigger.txt)) { 
      if ($read(trigger.txt,*,%trig) isin $1-) { 
        if (%logging == on) { 
          write logger.txt $chr(123) $+ $asctime(ddd HH:nn) $+ $chr(125) $+ $chr(91) $+ $network $+ $chr(47) $+ $chan $+ $chr(47) $+ $nick $+ ] $1-
        } 
        if (%nt [ $+ [ $nick ] ] != on) && (%nreply == on) { 
          set %nt [ $+ [ $nick ] ] on 
          notice $nick 2[5PrivMsg2]14 I am currently 12.:[11AwAy12]:.14 %awaymsg 12.:[11Gone12]:. $duration($calc($ctime - $ctime(%atime))) 12.::.14 One Time Response to PM 
        } 
        break 
      } 
      else { 
        inc %trig 
      } 
    } 
    else { 
      break 
    } 
  } 
} 
alias gone { 
  if (%away != on) { 
    set %away on 
    set %cnick $me 
    set %awaymsg $2- 
    set %atime $asctime 
    set %nick $1 
    amsg 12.:[11AwAy12]:. %awaymsg 12.:[11TiMe12]:. $time 12.::. $iif(%logging == on,ON,OFF) 
    away %awaymsg 
    nick %nick 
  } 
  else { 
    echo -at You are already 12AWAY 
  } 
} 
alias back { 
  if (%away == on) { 
    amsg 12.:[11Back12]:. %awaymsg 12.:[11Gone12]:. $duration($calc($ctime - $ctime(%atime))) 
    nick %cnick 
    away 
    unset %cnick 
    unset %atime 
    unset %awaymsg 
    unset %nick 
    unset %away 
    unset %pr* 
    unset %nt* 
    unset %trig 
  } 
  else { 
    echo -at You are 4NOT 12AWAY 
  }