VrS (Variant realities Script) — File Browser

VrSVariantrealitiesScriptv2.0 / VrSVariantrealitiesScriptv2.0 / VrS / System / Modules / ChanList / chanlist.mrc

chanlist.mrc — 2.2 KB — Download this file

;#[vHD@3.0 F!ChanList@2.0.0;2001.07.18;Variant<variant@variantrealities.com>]
;#[SD ]
;#[Incl ]
;#[VrS' channel autojoin, auto perform, and config pages for the two features]
;#[ ]
;#[ ]

on *:signal:vMI.Connect: {
  if ($mouse.key != 4) {
    vMI.CMD.Perform $vMI.Network
    vMI.CMD.Perform All
    vMI.CMD.Chanlist -j $vMI.Network
    vMI.CMD.Chanlist -j All
  }
  else { 
    IEcho Skipping auto-join and auto-perform... [Shift key was held down]
  }
}

alias vMI.CMD.Autojoin { vMI.CMD.Chanlist -j $vMI.Network }


; Syntax: /vMI.CMD.ChanList [-arjup] [Network] [#Channel] [Password] [Description]
;-a will add the chan to the channel list
;-r will remove the chan
;-u turns on auto-join on connect
;-o turns off auto-join
;-j joins all channels that have auto-join on, in the specified network.
;-p indicates you've specified a password
alias vMI.CMD.ChanList {
  if ($left($1,1) == -) { var %Options = $1 | tokenize 32 $2- }
  if (a isin %Options) {
    if (p isin %Options) { var %Password = $3 | tokenize 32 $1 $2 $4- }
    else { var %Password = !No:Password! }
    var %Description = $3-
    if (u isin %Options) { var %AutoJoin = On }
    else { var %AutoJoin = Off }
    vUser ChanList $1 $+ . $+ $2 %AutoJoin %Password %Description
    vUser ChanList $1 $+ .List $sorttok($addtok($vUser(ChanList, [ [ $1 ] $+ .List ] ),$2,32),32)
    vUser ChanList !Network.List $sorttok($addtok($vUser(ChanList,!Network.List),$1,32),32)
  }
  elseif (r isin %Options) {
    vUser ChanList $1 $+ . $+ $2
    vUser ChanList $1 $+ .List $remtok($vUser(ChanList, [ [ $1 ] $+ .List ] ),$2,1,32)
    if ($vUser(ChanList, [ [ $1 ] $+ .List ] ) == $null) {
      vUser ChanList !Network.List $remtok($vUser(ChanList,!Network.List),$1,1,32)
    }
  }
  elseif (j isin %Options) {
    var %Counter = 1
    while (%Counter <= $numtok($vUser(ChanList, [ [ $1 ] $+ .List ] ),32)) {
      var %Chan = $gettok($vUser(ChanList, [ [ $1 ] $+ .List ] ),%Counter,32) $vUser(ChanList, [ [ $1 ] $+ . $+ [ $gettok($vUser(ChanList, [ [ $1 ] $+ .List ] ),%Counter,32) ] ] )
      if ($gettok(%Chan,2,32) == On) { join $gettok(%Chan,1,32) $iif($gettok(%Chan,3,32) != !No:Password!,$ifmatch) }
      inc %Counter
    }
  }
}