All pastes #992358 Raw Edit

Stuff

public text v1 · immutable
#992358 ·published 2008-04-21 19:47 UTC
rendered paste body
on 1:TEXT:!status:#what.cd-invites: {
  if ($isfile(st.temp.txt)) { return }
  var %i = 1, %chunk | write -c st.temp.txt
  while ($read(queue.txt,%i)) {
    var %n = $+(%i,.,$v1), %new = $addtok(%chunk,%n,32)
    if ($len(%new) > 400) { write st.temp.txt %chunk | var %chunk = %n }
    else { var %chunk = %new }
    inc %i
  }
  if (%chunk) { write st.temp.txt $v1 }
  .play $chan st.temp.txt
}

on *:PLAYEND: { if ($nopath($filename) == st.temp.txt) { .remove $qt($filename) } }
on 1:TEXT:!queue:#what.cd-invites:{ if ($read(queue.txt,w,$nick)) { notice $nick Already queued on position $readn } | else { write queue.txt $nick } }
on 1:TEXT:!next:#what.cd-invites: { if ($nick !ishop $chan) && ($nick !isop $chan) { return } | :retry | if ($read(queue.txt,1)) { var %nick = $v1 | write -dl1 queue.txt | if (%nick !ison $chan) { goto retry } | mode $chan +v %nick }

alias dequeue {
  if (!$1) { return ERROR: missing parameter (nickname) }
    else {
        if ($1 isvoice #what.cd-invites) || ($1 isreg #what.cd-invites) {
          var %i = 1
          while ($lines(queue.txt) <= %i) {
            if ($read(queue.txt, %i) == $1) {
              write -dl $+ %i queue.txt
              return Nickname " $+ $1 $+ " has been removed from the queue list.
            }
            inc %i
          }
}

on *:PART:#what.cd-invites:{
  if ($1 isvoice #what.cd-invites) || ($1 isreg #what.cd-invites) {
    msg $chan $dequeue($nick)
}

on *:TEXT:!dequeue *:#what.cd-invites:{
  if ($nick ishop $chan) || ($1 isop $chan) && ($1 isvoice $chan) || ($1 isreg $chan) {
    msg $chan $dequeue($2)
  }
}