All pastes #70714 Raw Edit

Someone

public text v1 · immutable
#70714 ·published 2006-06-24 18:48 UTC
rendered paste body
alias autov {
  if (($1 == !avcheck!) && ($me !isreg $3) && ($me !isvoice $3) && ($2 isreg $3) && ($3 isin %autovoice.channels)) {
    inc %autov.total
    .mode $3 +v $2
    halt
  }

  if (($1 == help) || ($1 == $null)) {
    .echo # *****************************************
    .echo # *** 4Auto-Voice Usage: /autov <+/-#chan>
    .echo # *** Example: /autov +#chan1 +#chan2 -#chan3 +#chan4 -#chan5
    .echo # *** This would modify the Auto-Voicing Channel list by Adding #chan1 #chan2 and #chan4 and Removing #chan3 and #chan5
    .echo # *****************************************
    Halt
  }

  Set -u0 %autov $1-
  Set -u0 %autov.added 0
  Set -u0 %autov.removed 0

  if (- isin %autov) {
    Set -u0 %autov.cnt 1
    Set -u0 %autov.remtotal $matchtok(%autov,-,0,32)
    unset %autov.noexists
    while (%autov.cnt <= %autov.remtotal) {
      Set -u0 %autov.work $remove($matchtok(%autov,-,%autov.cnt,32),-)
      if (%autov.work !isin %autovoice.channels) { %autov.noexists = %autov.noexists %autov.work }
      else { %autovoice.channels = $DelTok(%autovoice.channels,$FindTok(%autovoice.channels,%autov.work,1,32),32) | inc %autov.removed }
      inc %autov.cnt
    }
  }

  if (+ isin %autov) {
    Set -u0 %autov.cnt 1
    Set -u0 %autov.addtotal $matchtok(%autov,+,0,32)
    unset %autov.exists
    while (%autov.cnt <= %autov.addtotal) {
      Set -u0 %autov.work $remove($matchtok(%autov,+,%autov.cnt,32),+)
      if (%autov.work isin %autovoice.channels) { %autov.exists = %autov.exists %autov.work }
      else { %autovoice.channels = %autovoice.channels %autov.work | inc %autov.added }
      inc %autov.cnt
    }
  }

  %autovoice.channels = $SortTok(%autovoice.channels,32)

  .echo # *****************************************
  if (%autov.exists) .echo # *** 4Auto-Voice: These channels were already on the AV list:4 %autov.exists 
  if (%autov.noexists) .echo # *** 4Auto-Voice: These channels were already NOT on the AV list:4 %autov.noexists 
  .echo # *** 4Auto-Voice: Added4 %autov.added Channels and Removed4 %autov.removed Channels.
  .echo # *** 4Auto-Voice: I will now Auto-Voice people that join these channels:4 %autovoice.channels 
  .echo # *****************************************

  unset %autov.*
}

on *:join:#:{ timer 1 3 autov !avcheck! $nick $chan }