All pastes #246035 Raw Edit

Unnamed

public text v1 · immutable
#246035 ·published 2006-11-11 19:52 UTC
rendered paste body
;; Use a 1 To be alerted of new notices, and a 0 for no alerts
alias -l alert return 0

;; Enter You're Preffered Timestamp Format Below
alias -l ts return hh:nn

;; Enter any Nicknames you do NOT want to show if they notice you
alias -l except return chanserv nickserv mirc

;; Enter any Nicknames you want to Always be in the conversation list
alias -l always return


alias nthing dialog -md nthing nthing
dialog nthing {
  title "Notice Thing v0.1"
  size -1 -1 251 78
  option dbu
  list 1, 77 10 170 50, size vsbar
  text "", 2, 80 1 400 8
  button "New Conversation", 3, 29 62 48 12
  list 4, 1 11 76 50, size vsbar
  button "Clear Nick", 5, 1 62 27 12
  edit "", 6, 77 61 136 10, autohs
  button "Send", 7, 217 61 26 12, default
  link "AltScripts", 8, 2 2 24 8
  text "|", 9, 26 2 2 8
  link "Close", 10, 31 2 22 8
  text "", 11, 78 71 135 8
}

on *:DIALOG:nthing:*:*:{
  ;; Init and Close Events
  if ($devent == init) || ($devent == close) {
    .timernthing off
    hfree -w notices*
    if ($devent == init) {    
      .timernthing 0 5 checktype
      hadd -m notices current $Null
      var %i = 0
      while (%i < $numtok($always,32)) {
        inc %i
        did -a $dname 4 $gettok($always,%i,32)
        hmake notices. [ $+ [ $gettok($always,%i,32) ] ] 100
        hadd -m notices $hget(notices,0).item $gettok($always,%i,32)
      }
    }
  }
  ;; Single Click Events
  if ($devent == sclick) {
    ;; New Conversation Button
    if ($did == 3) {
      hadd -m notices $hget(notices,0).item $$?="Nickname?"
      hadd -m notices current $!
      hmake notices. [ $+ [ $hget(notices,current) ] ] 100
      did -ra $dname 2 Conversation with $hget(notices,current)
      did -a $dname 4 $!
      dialog -v $dname
    }    
    ;; Clear Nick Button
    elseif ($did == 5) {
      hfree notices. [ $+ [ $did($dname,4).seltext ] ]
      did -d $dname 4 $did($dname,4).sel
      did -r $dname 1,2
    }    
    ;; Send Button
    elseif ($did == 7) {
      if ($left($did($dname,6).text,1) == /) { $($did($dname,6).text,2) | did -r $dname 6 | halt }
      .notice $hget(notices,current) $did($dname,6).text
      hadd -m notices. [ $+ [ $hget(notices,current) ] ] $calc($hget(notices. [ $+ [ $hget(notices,current) ] ],0).item + 1) $+([,$asctime($ts),]) $me : $did($dname,6).text
      did -a $dname 1 $+([,$asctime($ts),]) $me : $did($dname,6).text
      did -c nthing 1 $did(nthing,1).lines
      did -u nthing 1
      did -r $dname 6
      did -j $dname 2
    }    
    ;; AltScripts Link
    elseif ($did == 8) {
      url -n http://www.altscripts.net
    }
    ;; Close Link
    elseif ($did == 10) {
      dialog -x $dname
    }    
  }
  ;; Double Click Events
  elseif ($devent == dclick) {
    ;; Expanded Text
    if ($did == 1) {
      .echo -q $input($did($dname,$did).seltext,io,Expanded View)
      dialog -v nthing
    }
    ;; Nick Selection
    elseif ($did == 4) {
      if (* (N) iswm $did($dname,$did).seltext) {
        var %x = $did($dname,$did).sel 
        did -o $dname $did %x $gettok($did($dname,$did).seltext,1,32)
        did -c $dname $did %x 
      }
      hadd -m notices current $did($dname,$did).seltext
      did -ra $dname 2 Conversation with $hget(notices,current)
      did -r $dname 1
      var %i = 0
      while (%i < $hget(notices. [ $+ [ $did($dname,$did).seltext ] ],0).item) {
        inc %i      
        did -a $dname 1 $hget(notices. [ $+ [ $did($dname,$did).seltext ] ],%i)
      }
      did -c $dname 1 $did($dname,1).lines
      did -u $dname 1
    }
  }
  ;; Lets the other user know that you are typing to them
  if ($devent == edit) && ($did == 6) {
    if (%alerted. [ $+ [ $hget(notices,current) ] ] != 1) {
      set -u1 %alerted. [ $+ [ $hget(notices,current) ] ] 1
      .ctcp $hget(notices,current) editing
    }
  }
}
ctcp *:editing:?:{
  if (!%editing [ $+ [ $nick ] ]) {
    set -u5 %editing [ $+ [ $nick ] ] 1
    if ($hget(notices,current) == $nick) {
      did -r nthing 11 
      did -a nthing 11 $nick is typing a message...
    }
  }
  haltdef
}
on !*:NOTICE:*:?:{
  if ($dialog(nthing)) {
    if ($istok($except,$nick,32)) return
    if ($nick == $hget(notices,current)) {
      did -a nthing 1 $+([,$asctime($ts),]) $nick : $strip($1-)
      did -c nthing 1 $did(nthing,1).lines
      did -u nthing 1
    }
    if (!$hfind(notices,$nick).data) {
      hadd -m notices $hget(notices,0).data $nick
      did -a nthing 4 $nick
    }
    hadd -m notices. [ $+ [ $nick ] ] $calc($hget(notices. [ $+ [ $nick ] ],0).item + 1) $+([,$asctime($ts),]) $nick : $strip($1-)
    $iif($alert,echo -a 04 New Notice From $nick)
    var %i = 0
    while (%i < $did(nthing,4).lines) {
      if ($hget(notices,current) == $nick) break
      inc %i
      if ($did(nthing,4,%i) == $nick) {
        did -o nthing 4 %i $nick (N)
        break
      }
    }
    haltdef
  }
}

alias checktype {
  if ($dialog(nthing)) {
    if (%editing. [ $+ [ $hget(notices,current) ] ]) did -ra nthing 11 $hget(notices,current) is typing a message... 
    else did -r nthing 11  
  }
}