VrS (Variant realities Script) — File Browser
VrSVariantrealitiesScriptv2.0 / VrSVariantrealitiesScriptv2.0 / VrS / System / Modules / vMI / VMI2.MRC
VMI2.MRC — 29.01 KB — Download this file
;--------vMI Commands--------
; Syntax: /vMI.CMD.Server [-sbve] [bouncer:port:pass[:vhost]] <server address> [port] [pass]
;The -s means specific server name - really only used if you are /server'ing to a local server on your
;network that might be named an irc network name (like undernet - highly unlikely)
;The -b means you've specified the bouncer parameter.
;The -v means you've put the vhost on the end of the bouncer parameter
;The -e means the bouncer is an EZbounce bouncer, so vMI will send INTERFACE instead of VIP.
alias vMI.CMD.Server {
if ($1 == $null) { SEcho /server [-nlsbve] [bouncer:port:pass[:vhost]] <address> [port] [pass] | return }
var %vMI.CommandLine = $1-
if ($left($1,1) == -) { var %Options $1 | tokenize 32 $2- }
if (n isin %Options) { .timer 1 0 vMI.Server $remove(%Options,n) $1- | return }
vMI.SrvSet NoReconnect 1
if ($sock( vMI. [ $+ [ %vMI.CN ] ] ).status) { vMI.CloseConnect %vMI.CN }
vMI.SrvUnset NoReconnect 1
if ($window($vMI.WinName( [ [ %vMI.CN ] $+ @* ] ,*),0)) {
set -u %vS.Wait 1
while ($window($vMI.WinName( [ [ %vMI.CN ] $+ @* ] ,#*),0) > 0) { window -c $window($vMI.WinName( [ [ %vMI.CN ] $+ @* ] ,#*),1) }
while ($window($vMI.WinName( [ [ %vMI.CN ] $+ @* ] ,&*),0) > 0) { window -c $window($vMI.WinName( [ [ %vMI.CN ] $+ @* ] ,&*),1) }
while ($window($vMI.WinName( [ [ %vMI.CN ] $+ @* ] ,+*),0) > 0) { window -c $window($vMI.WinName( [ [ %vMI.CN ] $+ @* ] ,+*),1) }
}
vIAL -rc
if (l isin %Options) {
var %vMI.CommandLine = $vUser(vMI,LastServer) | tokenize 32 %vMI.CommandLine
if ($left($1,1) == -) { var %Options $1 | tokenize 32 $2- }
}
if (b isin %Options) { tokenize 32 $2- }
if (. !isin $1) { var %vMI.Comp = $vMI.Servers( [ $1 ] ) | var %vMI.ServComp = $iif(s isin %Options,$1,%vMI.Comp) }
else { var %vMI.ServComp $1 $iif($2 isnum,$2,6667) }
if (b isin %Options) {
var %vMI.Address = $gettok($gettok(%vMI.CommandLine,2,32),1,58)
var %vMI.Port = $gettok($gettok(%vMI.CommandLine,2,32),2,58)
var %vMI.Pass = $gettok($gettok(%vMI.CommandLine,2,32),3,58)
var %vMI.VHost = $gettok($gettok(%vMI.CommandLine,2,32),4,58)
}
else {
var %vMI.Address = $iif(%vMI.ServComp,$gettok(%vMI.ServComp,1,32),$1)
if (%vMI.ServComp) { var %vMI.Port = $iif($2,$2,$gettok(%vMI.ServComp,2,32)) }
else { var %vMI.Port = $iif($2 isnum,$2,6667) }
var %vMI.Pass = $3
}
var %vMI.Port = $iif(%vMI.Port isnum,%vMI.Port,6667)
.identd on $vUser(vMI,User)
vMI.OpenConnect %vMI.CN %vMI.Address %vMI.Port
if (%vMI.Pass) { vMI.SrvSet Pass %vMI.Pass }
if (b isin %Options) {
vMI.SrvSet ConnectTo $iif(%vMI.ServComp, [ [ %vMI.ServComp ] [ $3 ] ] ,$1-)
if (v isin %Options) {
if (e isin %Options) { vMI.SrvSet VHost INTERFACE %vMI.VHost }
else { vMI.SrvSet VHost VIP %vMI.VHost }
}
}
vMI.Titlebar $vMI.WinName(Status) Connecting to %vMI.Address $+ : $+ %vMI.Port
vMI.SrvSet CommandLine %vMI.CommandLine
vUser vMI LastServer %vMI.CommandLine
vMI.SrvSet Server %vMI.Address
set -u %:echo vMI.Echo Status
set -u %::server %vMI.Address
set -u %::port %vMI.Port
theme.text Connect
}
alias vMI.CMD.Clearall {
var %Counter = 1
while ($window( [ $vMI.WinName(*,*) ] ,%Counter)) {
clear $window( [ $vMI.WinName(*,*) ] ,%Counter)
vS.HilightWindow $window( [ $vMI.WinName(*,*) ] ,%Counter) off
inc %Counter
}
}
alias vMI.CMD.Disconnect {
; Syntax: /vMI.CMD.Disconnect
vIAL -rc
if ($vMI.SrvSetting(Server)) {
vMI.SrvSet NoReconnect 1
vMI.CloseConnect %vMI.CN
}
}
alias vMI.CMD.SaveLocation {
set -u %:echo vMI.NEcho -qa
if ($1 != All) {
set -u %vMI.Active $iif($1,$1,$active)
vLib.WinPosition %vMI.Active $window(%vMI.Active).x $window(%vMI.Active).y $window(%vMI.Active).w $window(%vMI.Active).h
set -u %::text Saved window location of %vMI.Active
theme.text echo
}
else {
var %counter 1
while (%counter <= $window(@vMI.[*,0)) {
vLib.WinPosition $window(@vMI.[*,%counter) $window($window(@vMI.[*,%counter)).x $window($window(@vMI.[*,%counter)).y $window($window(@vMI.[*,%counter)).w $window($window(@vMI.[*,%counter)).h
inc %counter
}
set -u %::text Saved window location of all vMI chat windows.
theme.text echo
}
}
alias vMI.CMD.RemLocation {
return
set -u %:echo vMI.NEcho -qa
if ($1 != All) {
set -u %vMI.Active $iif($1,$1,$active)
vReg G vMIWinPositions %vMI.Active
set -u %::text Removed window location of %vMI.Active
theme.text echo
}
else {
vReg G vMIWinPositions.*
set -u %::text Removed all window locations.
theme.text echo
}
}
alias vMI.CMD.Raw {
; Syntax: /vMI.CMD.Raw <Text to send to server>
if ($1 == $null) { SEcho /raw <text> | return }
if ($show == $true) { vMI.Echo Status -> Server: $1- }
vMI.Send $1-
}
alias vMI.CMD.Ban {
; Syntax: /vMI.CMD.Ban [-r] [#channel] <nickname|fulladdress - user@host> [type]
if ($1 == $null) { SEcho /ban [-r] [#channel] <nickname|fulladdress - user@host> [type] | return }
if ($left($1,1) == -) { var %Options = $1 | tokenize 32 $2- }
if ($left($1,1) isin &#+) { var %Chan = $1 | tokenize 32 $2- }
else {
var %Chan = $gettok($active,2-,58)
if ($left(%Chan,1) !isin &#+) { SEcho /ban Can't use /ban from this window. Specify a #channel. | return }
}
var %Address = $strip($1) ,%BanType = $2
if (@ !isin %Address) && (. !isin %Address) {
;Get address from IAL for nickname.
if ($vIAL(%Chan,$1).Address) { %Address = $1 $+ ! $+ $vIAL(%Chan,$1).Address }
else {
vMI.SrvSet Ban.Resolve %Address %Chan $iif(%BanType,%BanType,5)
vMI.Send USERHOST %Address
}
}
if (%BanType == $null) { %BanType = 5 }
if ($vMI.SrvSetting(Ban.Resolve) == $null) { vMI.Send mode %Chan $iif(r isin %Options,-b,+b) $mask(%Address,%BanType) }
}
alias vMI.CMD.Quote {
; Syntax: /vMI.CMD.Quote <Text to send to server>
if ($1 == $null) { SEcho /quote <text> | return }
vMI.CMD.Raw $1-
}
alias vMI.CMD.Query {
; Syntax: /vMI.CMD.Query [-n] <Nickname> [Text]
if ($1 == -n) { var %Minimized = 1 | tokenize 32 $2- }
if ($1 == $null) { SEcho /query [-n] <Nickname> [Text] | return }
if ($vMI.ServName) {
if ($window($vMI.WinName( [ [ $1 ] $+ [ $chr(160) ] ] )).state == $null) {
window [ - $+ [ $iif(%Minimized != $null,h,a) ] $+ ek0 ] $vMI.WinName( [ [ $1 ] $+ [ $chr(160) ] ] ) $vLib.WinPosition($vMI.WinName( [ [ $1 ] $+ [ $chr(160) ] ] ))
!window $vMI.WinName( [ [ $1 ] $+ [ $chr(160) ] ] ) $shortfn($mircexe) 5
if (%Minimized) { !window -h $vMI.WinName( [ [ $1 ] $+ [ $chr(160) ] ] ) }
vMI.CMD.Log open $vMI.WinName( [ [ $1 ] $+ [ $chr(160) ] ] )
vMI.Titlebar $vMI.WinName( [ [ $1 ] $+ [ $chr(160) ] ] )
font $iif($gettok($theme.setting(FontQuery),3,44) == B,-b) $vMI.WinName( [ [ $1 ] $+ [ $chr(160) ] ] ) $gettok($theme.setting(FontQuery),2,44) $gettok($theme.setting(FontQuery),1,44)
if ($theme.setting(ImageQuery)) { background $theme.bgoption($gettok($theme.setting(ImageQuery),1,32)) $vMI.WinName( [ [ $1 ] $+ [ $chr(160) ] ] ) $+(",$themedir($gettok($theme.setting(ImageQuery),2-,32)),") }
else { background -x $vMI.WinName( [ [ $1 ] $+ [ $chr(160) ] ] ) }
}
else { window -a $vMI.WinName( [ [ $1 ] $+ [ $chr(160) ] ] ) }
if ($2- != $null) { vMI.CMD.Msg $1 $2- }
}
}
alias vMI.CMD.Cycle {
; Syntax: /vMI.CMD.Cycle [Chan]
if ($1) { var %vMI.Chan = $1 }
else {
var %vMI.Chan = $gettok($active,2-,58)
if ($left(%vMI.Chan,1) !isin &#+) { SEcho /cycle Can't use /cycle in this window. | return }
}
vMI.Send part %vMI.Chan
vMI.Send join %vMI.Chan $vIAL(%vMI.Chan).Key
vMI.SrvSet Part. [ $+ [ %vMI.Chan ] ] 1
set -u %:echo vMI.Echo %vMI.Chan
set -u %::chan %vMI.Chan
theme.text Rejoin
}
alias vMI.CMode {
if (+o isin $1) { return @ }
elseif (+h isin $1) { return $chr(37) }
elseif (+v isin $1) { return + }
else { return - }
}
alias vMI.CMD.Msg {
; Syntax: /vMI.CMD.Msg <Nickname|#Channel> <Text>
;if ($2 == $null) { SEcho /msg <Nickname|#Channel> <Text to send> | return }
if ($2 == $null) { return }
set -u %::chan $1
set -u %::nick $1
set -nu %::text $2-
if ($vUser(IRCOptions,Prefix) == Checked) { set -u %::me $vMI.Me }
if ($show != $false) {
if ($window($vMI.WinName( [ [ $1 ] $+ [ $chr(160) ] ] )) == $null) && ($window($vMI.WinName($1)) == $null) {
set -u %:echo vMI.NEcho $colour(own) -ai2
theme.text TextMsgSelf
}
elseif ($left($1,1) isin &#+) {
set -u %:echo vMI.Echo %::chan
set -u %::cmode $vMI.CMode($vIAL($1,$vMI.Me).Modes)
if ($vMI.SrvSetting(Server)) { theme.text TextChanSelf }
}
else {
set -u %:echo vMI.Echo [ [ %::nick ] $+ [ $chr(160) ] ]
if ($vMI.SrvSetting(Server)) { theme.text TextQuerySelf }
}
}
vMI.Send PRIVMSG $1 : $+ $2-
}
alias vMI.CMD.ONotice {
; Syntax: /vMI.CMD.Onotice [Chan] <Text>
if ($1 == $null) { SEcho /onotice [chan] <text> | return }
if ($left($1,1) isin &#+) { var %Chan = $1 | tokenize 32 $2- }
else {
set -u %vMI.To $gettok($active,2-,58)
if ($gettok($active,2-,58) == Status) { SEcho /onotice Can't use /onotice in this window. | return }
elseif ($left(%vMI.To,1) isin &#+) { var %Chan = %vMI.To }
}
vMI.CMD.Notice @ $+ %Chan $1-
}
alias vMI.CMD.AMe {
; Syntax: /vMI.CMD.AMe <Text>
if ($1 == $null) { SEcho /ame <text> | return }
set -u %vMIEvent.TotalChans $vIAL(0)
if (%vMIEvent.TotalChans < 1) { SEcho /ame You're not on any channels in this vMI session. | return }
var %vMICounter = 1,%Chanlist
while (%vMICounter <= %vMIEvent.TotalChans) {
%Chanlist = %Chanlist $vIAL(%vMICounter)
if ($vMI.ServName) {
set -u %:echo vMI.NEcho $colour(action text) -qi2t $vMI.WinName($vIAL(%vMICounter))
set -u %::chan $gettok(%Chanlist,%vMICounter,32)
set -u %::me $vMI.Me
set -u %::text $1-
set -u %::cmode $vMI.CMode($vIAL(%::chan,%::Me).Modes)
theme.text ActionChanSelf
}
inc %vMICounter
}
%Chanlist = $replace(%Chanlist,$chr(32),$chr(44))
.vMI.CMD.Describe %Chanlist $1-
}
alias vMI.CMD.AMsg {
; Syntax: /vMI.CMD.AMsg <Text>
if ($1 == $null) { SEcho /amsg <text> | return }
var %vMIEvent.TotalChans $vIAL(0)
if (%vMIEvent.TotalChans < 1) { SEcho /amsg You're not on any channels in this vMI session. | return }
var %vMICounter = 1
while (%vMICounter <= %vMIEvent.TotalChans) {
var %vMIEvent.Chanlist = %vMIEvent.Chanlist $vIAL(%vMICounter)
if ($vMI.ServName) {
set -u %:echo vMI.NEcho -qti2 $vMI.WinName($gettok(%vMIEvent.Chanlist,%vMICounter,32))
set -u %::chan $gettok(%Chanlist,%vMICounter,32)
set -u %::me $vMI.Me
set -u %::text $1-
set -u %::cmode $vMI.CMode($vIAL(%::chan,%::Me).Modes)
theme.text TextChanSelf
}
inc %vMICounter
}
%vMIEvent.Chanlist = $replace(%vMIEvent.Chanlist,$chr(32),$chr(44))
.vMI.CMD.Msg %vMIEvent.Chanlist $1-
}
alias vMI.CMD.Describe {
; Syntax: /vMI.CMD.Describe <Nickname|#Channel> <Text>
if ($2 == $null) { SEcho /describe <Nickname|#Channel> <Action to send> | return }
if ($show != $false) {
set -u %::Me $vMI.Me
set -u %::Chan $1
set -u %::Nick $1
set -u %::Text $2-
if ($window($vMI.WinName( [ [ $1 ] $+ [ $chr(160) ] ] )) == $null) && ($window($vMI.WinName($1)) == $null) {
set -u %:echo vMI.NEcho $colour(action text) -ai2
theme.text TextMsgSelf
}
elseif ($left($1,1) isin &#+) {
set -u %:echo vMI.NEcho $colour(action text) -ti2 $vMI.WinName($1)
set -u %::cmode $vMI.CMode($vIAL($1,%::Me).Modes)
theme.text ActionChanSelf
}
else {
set -u %:echo vMI.NEcho $colour(action text) -ti2 $vMI.WinName( [ [ $1 ] $+ [ $chr(160) ] ] )
theme.text ActionQuerySelf
}
}
vMI.Send PRIVMSG $1 :ACTION $2- $+
}
alias vMI.CMD.Ctcp {
; Syntax: /vMI.CMD.Ctcp <Nickname|#Channel> <Name> <Text>
if ($2 == $null) { SEcho /ctcp <Nickname|#Channel> <Name> <Text to send> | return }
if ($2 == PING) { set -u %vMIEvent.Text $upper($2) $ticks }
else { set -u %vMIEvent.Text $upper($2) $3- }
set -u %vMIEvent.Text $+ %vMIEvent.Text $+
set -u %:echo vMI.NEcho -ai2
set -u %::Nick $1
set -u %::Ctcp $upper($2)
set -u %::Text $3-
if ($show != $false) { theme.text CtcpSelf }
vMI.Send PRIVMSG $1 : $+ %vMIEvent.Text
}
alias vMI.CMD.Ping {
if ($1 == $null) { SEcho /ping <Nickname|#Channel> | return }
vMI.CMD.Ctcp $1 PING
}
alias vMI.CMD.Notice {
if ($2 == $null) { SEcho /notice <Nickname|#Channel> <Text> | return }
set -u %:echo vMI.NEcho -ai2
set -u %::Text $2-
set -u %::Nick $1
if ($show == $true) { theme.text NoticeSelf }
vMI.Send NOTICE $1 : $+ $2-
}
alias vMI.CMD.Quit { vMI.SrvSet NoReconnect 1 | vMI.Send QUIT : $+ $1- }
alias vMI.CMD.Kick {
if ($1 == $null) { SEcho /kick [#channel] <Nickname> [text] | return }
if ($left($1,1) isin &#+) { var %Chan = $1 | tokenize 32 $2- }
else {
var %Chan = $gettok($active,2-,58)
if ($left(%Chan,1) !isin &#+) { SEcho /kick Can't use /kick from this window. Specify a #channel. | return }
}
vMI.Send KICK %Chan $1 : $+ $2-
}
alias vMI.CMD.Topic {
if ($1 == $null) { SEcho /topic <Nickname|#Channel> [text] | return }
if ($2- != $null) { vMI.Send TOPIC $1 : $+ $2- }
else { vMI.Send TOPIC $1 }
}
alias vMI.CMD.Me {
; Syntax: /vMI.CMD.Me <Text>
if ($1 == $null) { SEcho /me <Action to send> | return }
set -u %vMI.To $gettok($active,2-,58)
if ($gettok($active,2-,58) == Status) { SEcho /me Can't use /me in this window. | return }
elseif ($mid(%vMI.To,1,1) isin &#+) { vMI.CMD.Describe %vMI.To $1- }
else { vMI.CMD.Describe $left(%vMI.To,$calc($len(%vMI.To) - 1)) $1- }
}
alias vMI.CMD.Part {
; Syntax: /vMI.CMD.Part [channel] [message]
set -u %vMI.To $gettok($active,2-,58)
if ($1) { vMI.Send PART $1 : $+ $2- }
elseif ($mid(%vMI.To,1,1) isin &#+) && ($1 == $null) { vMI.Send PART %vMI.To : $+ $1- }
elseif ($1 == $null) { SEcho /part Can't /part from this window. }
}
alias vMI.CMD.Say {
; Syntax: /vMI.CMD.Say <Text>
if ($1 == $null) { SEcho /say <text to say> | return }
set -u %vMI.ToText $gettok($active,2-,58)
if ($gettok($active,2-,58) == Status) { SEcho /say Can't use /say in this window. | return }
elseif ($mid(%vMI.ToText,1,1) isin &#+) { vMI.CMD.Msg %vMI.ToText $1- }
else { vMI.CMD.Msg $left(%vMI.ToText,$calc($len(%vMI.ToText) - 1)) $1- }
}
alias vMI.CMD.Dns {
; Syntax: /vMI.CMD.Dns [-ch] [nick|address]
if ($1 == $null) { SEcho /dns [-h] <nick|address> | return }
if ($left($1,1) == -) { var %Options = $1 | tokenize 32 $2- }
var %Address = $1
if (h isin %Options) || (. isin $1) { !.dns %Options $1 }
else {
var %Address = $gettok($vIAL($vMI.ActiveChan,$1).Address,2,64)
if (%Address) { !.dns %Options %Address }
else { EEcho /dns Unable to find address for $1 $+ . | return }
}
if ($show) {
set -u %::Address %Address
set -u %:echo vMI.NEcho -ai2t | theme.text Dns
}
}
alias vMI.CMD.Ctcpreply {
; Syntax: /vMI.CMD.Ctcpreply <Nickname|#Channel> <Name> <Text>
if ($2 == $null) { SEcho /ctcp <Nickname|#Channel> <Name> <Text to send> | return }
set -u %vMIEvent.Text $upper($2) $3-
set -u %vMIEvent.Text $+ %vMIEvent.Text $+
vMI.Send NOTICE $1 : $+ %vMIEvent.Text
set -u %:echo vMI.NEcho -ai2
set -u %::Nick $1
set -u %::Ctcp $upper($2)
set -u %::Text $3
if ($show != $false) { theme.text CtcpReplySelf }
}
alias vMI.CMD.DCC {
if ($1 == chat) {
if ($2 == $null) { SEcho /dcc chat <nickname> | return }
vMIDCC.ChatS $2
}
elseif ($1 == send) {
if ($2 == $null) { SEcho /dcc send <nickname> [file] | return }
if ($3 == $null) { .timerDCCSend 1 0 vMI.DCCSend [ %vMI.CN ] $2 }
else { vFT3.Send DCC $2 $3- }
}
else { SEcho /dcc <send/chat> <nickname> [file] }
}
alias vMI.DCCSend {
var %vMI.CNTemp = %vMI.CN
var %vMIDCC.Filename $dir="Select a file to send" $vrsdir
set -u %vMI.CN $1
vFT3.Send DCC $2 %vMIDCC.Filename
set -u %vMI.CN %vMI.CNTemp
}
;--------- IAL code ----------
;----------------------
;Command mode
;----------------------
; Syntax: /vIAL <-rnctam> <#Chan> [Nickname] [Address] [Topic] [Modes]
;Switches:
; -r = Remove - If no Nickname is specified, the channel is removed,
; otherwise, the Nickname is removed from the specified
; channel IAL.
; -n = Nickname mode
; -a = Add Nickname Address
; -m = Add Nickname Modes
; -c = Channel mode
; -m = Add Modes
; -t = Add Topic
; -k = Add key
; -l = Limit
; If just -c is specified, the IAL for the specified
; #Channel will be created.
;----------------------
;Identifier mode
;----------------------
; Syntax: $vIAL(<#Chan/N>,[Nickname/N])
;Properties: Topic, Modes, Address, Key,Limit
;If no property is specified, then the channel name will
;be returned, otherwise if a nickname or number is
;specified, the nickname will be returned if it exists
;on the channel.
alias vIAL {
if ($isid) {
; Syntax: $vIAL(<#Chan/N>,[Nickname/N])
;Identifier mode, use $prop
hunset vIAL.* | .timerRemvIALVars 1 0 hunset vIAL.*
if ($1 !isnum) { hvar vIAL.Chan $1 }
elseif ($1 == 0) { return $numtok($hvar( vIALList. [ $+ [ %vMI.CN ] $+ .Channels ] ),32) }
else { hvar vIAL.Chan $gettok($hvar( vIALList. [ $+ [ %vMI.CN ] $+ .Channels ] ),$1,32) }
if ($prop == Topic) { return $hget(vIAL. [ $+ [ %vMI.CN ] $+ . $+ [ $hvar(vIAL.Chan) ] ] ,!Topic) }
elseif ($prop == Modes) && ($2 == $null) { return $hget( vIAL. [ $+ [ %vMI.CN ] $+ . $+ [ $hvar(vIAL.Chan) ] ] ,!Modes) }
elseif ($prop == Key) && ($2 == $null) { return $hget( vIAL. [ $+ [ %vMI.CN ] $+ . $+ [ $hvar(vIAL.Chan) ] ] ,!Key) }
elseif ($prop == Limit) && ($2 == $null) { return $hget( vIAL. [ $+ [ %vMI.CN ] $+ . $+ [ $hvar(vIAL.Chan) ] ] ,!Limit) }
if ($2 == $null) { return $iif($hget( vIAL. [ $+ [ %vMI.CN ] $+ . $+ [ $hvar(vIAL.Chan) ] ] ),$hvar(vIAL.Chan)) }
if ($2 !isnum) { hvar vIAL.Nick $2 }
elseif ($2 == 0) { return $line($vMI.WinName($hvar(vIAL.Chan)),0,1) }
else { hvar vIAL.Nick $vMI.StripNick($line($vMI.WinName($hvar(vIAL.Chan)),$2,1)) }
if ($prop == $null) { return $gettok($hget( vIAL. [ $+ [ %vMI.CN ] $+ . $+ [ $hvar(vIAL.Chan) ] ] ,$hvar(vIAL.Nick)),1,32) }
elseif ($prop == Address) {
hvar vIAL.Address $gettok($hget( vIAL. [ $+ [ %vMI.CN ] $+ . $+ [ $hvar(vIAL.Chan) ] ] ,$hvar(vIAL.Nick)),2,32)
if (@ isin $hvar(vIAL.Address)) { return $hvar(vIAL.Address) }
return
}
elseif ($prop == Modes) {
hvar vIAL.Modes $gettok($hget( vIAL. [ $+ [ %vMI.CN ] $+ . $+ [ $hvar(vIAL.Chan) ] ] ,$hvar(vIAL.Nick)),2-,32)
if (@ isin $gettok($hvar(vIAL.Modes),1,32)) { hvar vIAL.Modes $gettok($hvar(vIAL.Modes),2-,32) }
return $hvar(vIAL.Modes)
}
}
else {
; Syntax: /vIAL <-rncktam> [#Chan] [Nickname] [Address] [Topic] [Modes]
;Command mode
var %Options = $1 | tokenize 32 $2-
if (c isin %Options) {
if ($hget( vIAL. [ $+ [ %vMI.CN ] $+ . $+ [ $1 ] ] ) == $null) {
hmake vIAL. [ $+ [ %vMI.CN ] $+ . $+ [ $1 ] ] 20
hvar vIALList. [ $+ [ %vMI.CN ] $+ .Channels ] $addtok($hvar( vIALList. [ $+ [ %vMI.CN ] $+ .Channels ] ),$1,32)
}
if (r isin %Options) {
if ($1) { hfree vIAL. [ $+ [ %vMI.CN ] $+ . $+ [ $1 ] ] | hvar vIALList. [ $+ [ %vMI.CN ] $+ .Channels ] $remtok($hvar( vIALList. [ $+ [ %vMI.CN ] $+ .Channels ] ),$1,1,32) }
else { hfree -w vIAL. [ $+ [ %vMI.CN ] $+ .* ] | hunset hvar vIALList. [ $+ [ %vMI.CN ] $+ .Channels ] }
return
}
elseif (t isin %Options) { hadd vIAL. [ $+ [ %vMI.CN ] $+ . $+ [ $1 ] ] !Topic $2- | return }
elseif (m isin %Options) { hadd vIAL. [ $+ [ %vMI.CN ] $+ . $+ [ $1 ] ] !Modes $2- | return }
elseif (k isin %Options) { hadd vIAL. [ $+ [ %vMI.CN ] $+ . $+ [ $1 ] ] !Key $2- | return }
elseif (l isin %Options) { hadd vIAL. [ $+ [ %vMI.CN ] $+ . $+ [ $1 ] ] !Limit $2- | return }
elseif (b isin %Options) { hadd vIAL. [ $+ [ %vMI.CN ] $+ . $+ [ $1 ] ] !Ban. [ $+ [ $2 ] ] $2 $3- | return }
elseif (u isin %Options) { hdel vIAL. [ $+ [ %vMI.CN ] $+ . $+ [ $1 ] ] !Ban. [ $+ [ $2 ] ] | return }
}
elseif (n isin %Options) {
if ($hget( vIAL. [ $+ [ %vMI.CN ] $+ . $+ [ $1 ] ] )) {
if ($hget( vIAL. [ $+ [ %vMI.CN ] $+ . $+ [ $1 ] ] ,$2) == $null) { hadd vIAL. [ $+ [ %vMI.CN ] $+ . $+ [ $1 ] ] $2 $2 }
if (r isin %Options) { hdel vIAL. [ $+ [ %vMI.CN ] $+ . $+ [ $1 ] ] $2 | return }
var %vIAL.Line = $hget( vIAL. [ $+ [ %vMI.CN ] $+ . $+ [ $1 ] ] ,$2)
if (a isin %Options) {
if (@ isin $gettok(%vIAL.Line,2,32)) { %vIAL.Line = $puttok(%vIAL.Line,$3,2,32) }
else { %vIAL.Line = $instok(%vIAL.Line,$3,2,32) }
}
if (m isin %Options) {
if (@ isin $gettok(%vIAL.Line,2,32)) { %vIAL.Line = $gettok(%vIAL.Line,1-2,32) $iif(@ isin $3,$4-,$3-) }
else { %vIAL.Line = $gettok(%vIAL.Line,1,32) $iif(@ isin $3,$4-,$3-) }
}
hadd vIAL. [ $+ [ %vMI.CN ] $+ . $+ [ $1 ] ] $2 %vIAL.Line
}
}
}
}
; Syntax: $vIBL(<#Channel>,<N>)
; Properties: By, Date, Ctime
alias vIBL {
hunset vIAL.* | .timerRemvIALVars 1 0 hunset vIAL.*
hvar vIAL.Chan $1
if ($2 == 0) { return $hmatch(vIAL. [ $+ [ %vMI.CN ] $+ . $+ [ $hvar(vIAL.Chan) ] ] ,!Ban.*,0) }
elseif ($2 isnum) { var %Line = $hmatch(vIAL. [ $+ [ %vMI.CN ] $+ . $+ [ $hvar(vIAL.Chan) ] ] ,!Ban.*,$2) }
if ($prop == $null) { return $gettok($hget(vIAL. [ $+ [ %vMI.CN ] $+ . $+ [ $hvar(vIAL.Chan) ] ] ,%Line),1,32) }
elseif ($prop == By) { return $gettok($hget(vIAL. [ $+ [ %vMI.CN ] $+ . $+ [ $hvar(vIAL.Chan) ] ] ,%Line),2,32) }
elseif ($prop == Date) { return $asctime($gettok($hget(vIAL. [ $+ [ %vMI.CN ] $+ . $+ [ $hvar(vIAL.Chan) ] ] ,%Line),3,32)) }
elseif ($prop == CTime) { return $gettok($hget(vIAL. [ $+ [ %vMI.CN ] $+ . $+ [ $hvar(vIAL.Chan) ] ] ,%Line),3,32) }
}
; Syntax: $isovh(<#channel>,<nickname>,<ovh>,[connection number])
;returns $true or $false depending on whether the nickname is:
; o -opped
; v -voiced
; h -a half op
alias isovh {
if ($4 isnum) { var %Cur.CN = %vMI.CN | set -u %vMI.CN $4 }
var %Return = $iif($3 isin $vIAL($1,$2).modes,$true,$false)
if ($4 isnum) { set -u %vMI.CN %Cur.CN }
return %Return
}
;--------- End IAL code ----
;vSwitch alias
alias vMI.vSProcess {
if ($1 == Sort) {
var %List = $2-
%List = $wildtok(%List,@vMI.*:Status,1,32) $sorttok($remove(%List,$wildtok(%List,@vMI.*:Status,1,32)),32)
return %List
}
elseif ($1 == Close) {
var %vMI.Mid = $gettok($gettok($2,1,93),2,91)
if (DCC !isin %vMI.Mid) {
var %CN = $gettok(%vMI.Mid,1,64)
vMI.CloseWindow $2
}
else {
vMIDCC.Close $2
}
}
elseif ($1 == CloseCheck) {
var %vMI.Mid = $gettok($gettok($2,1,93),2,91)
var %CN = $gettok(%vMI.Mid,1,64)
;if (%CN == 1) && ($gettok($2,2-,58) == Status) { return halt }
}
elseif ($left($1,1) == @) {
var %vMI.Mid = $gettok($gettok($1,1,93),2,91)
var %CN = $gettok(%vMI.Mid,1,64)
var %Win = $iif($window($1),$window($1),$1)
;vecho ? $vs.win(%Win) - $active
if ($active != %Win) && ($vS.HilightNum(%Win)) && ($vReg(U,vMI,Num) == 1) {
var %HilightNum = $chr(91) $+ $vS.HilightNum(%Win) $+ $chr(93)
}
if ($gettok($1,2-,58) == Status) {
var %Group = vMI $+ %CN
var %Icon = 1
var %Server = Status
;$iif( %vMI. [ $+ [ %CN ] $+ ] .Server ,$ifmatch,Status)
var %Caption = %HilightNum %Server $chr(91) $+ %CN $+ $chr(93)
var %Tooltip = Status: $vMI.Titlebar($1)
}
elseif ($left($gettok($1,2-,58),1) isin &#+) {
var %Group = vMI $+ %CN
var %Icon = 2
var %Caption = %HilightNum $gettok(%Win,2-,58)
var %Tooltip = $gettok(%Win,2-,58) $vMI.Titlebar($1)
}
elseif ($right($gettok($1,2-,58),1) == $chr(160)) {
var %Group = vMI $+ %CN
var %Icon = 3
var %Caption = %HilightNum $left($gettok(%Win,2-,58),-1)
var %Tooltip = $left($gettok(%Win,2-,58),-1) $vMI.Titlebar($1)
}
else {
var %Group = vMIDCC
var %Icon = 4
var %Caption = %HilightNum $gettok(%Win,2-,58)
var %Tooltip = DCC Chat with $gettok(%Win,2-,58)
}
return %Group %Caption $+ , $+ %Icon $+ , $+ %Tooltip
}
}
alias vMIDCC.vSProcess {
if ($1 == Sort) {
return $sorttok($2-,32)
}
elseif ($1 == Close) {
vMIDCC.Close $2
}
elseif ($left($1,1) == @) {
var %vMI.Mid = $gettok($gettok($1,1,93),2,91)
var %CN = $gettok(%vMI.Mid,1,64)
var %Win = $iif($window($1),$window($1),$1)
;vecho ? $vs.win(%Win) - $active
if ($active != %Win) && ($vS.HilightNum(%Win)) && ($vReg(U,vMI,Num) == 1) {
var %HilightNum = $chr(91) $+ $vS.HilightNum(%Win) $+ $chr(93)
}
var %Group = vMIDCC
var %Icon = 4
var %Caption = %HilightNum $gettok(%Win,2-,58)
var %Tooltip = DCC Chat with $gettok(%Win,2-,58)
return %Group %Caption $+ , $+ %Icon $+ , $+ %Tooltip
}
}
alias vMI.Servers {
; Syntax: /vMI.Servers [-rs] [num] [network] [country] [location]
;OR
; Syntax: $vMI.Servers(<network>,[country],[location])
;-r rebuild hash table
;-s show
if ($left($1,1) == -) {
var %vMI.Options = $1
tokenize 32 $2-
}
if ($prop == server) { var %Num = $1 | tokenize 32 $2- }
if ($hget(vMI.Servers) == $null) || (r isin %vMI.Options) {
var %Counter = 1
if ($hget(vMI.Servers)) { hfree vMI.Servers }
hmake vMI.Servers 50
if ($hget(vMI.Servers.Groups)) { hfree vMI.Servers.Groups }
hmake vMI.Servers.Groups 20
var %Group , %GroupTotal = 0
while ($readini(servers.ini,n,servers, n [ $+ [ %counter ] ] )) {
var %serverline = $ifmatch
%serverline = $gettok(%serverline,$numtok(%serverline,58),58) $gettok($mid(%serverline,$pos(%serverline,SERVER:,1),$calc($pos(%serverline,GROUP:,1) - $pos(%serverline,SERVER:,1))),2-,58)
if ($gettok(%serverline,1,32) !isnum) && ($gettok(%serverline,1,32) != %Group) && ($hget(vMI.Servers.Groups,Group. [ $+ [ $gettok(%serverline,1,32) ] ] ) == $null) {
%Group = $gettok(%serverline,1,32)
inc %GroupTotal
hadd vMI.Servers.Groups Group. [ $+ [ %GroupTotal ] ] %Group
hadd vMI.Servers.Groups Group. [ $+ [ %Group ] ] %GroupTotal
}
hadd vMI.Servers %Counter %serverline
inc %counter
}
hadd vMI.Servers.Groups GroupTotal %GroupTotal
}
if ($1 == $null) { return }
var %SearchString = $1 $+ * $+ $iif($3, [ $3 $+ * ] ) $+ $iif($2, [ $2 $+ * ] )
var %Counter = 1
if ($prop == num) { return $hmatch(vMI.Servers,%SearchString,0).data }
elseif ($prop == server) { return $gettok($gettok($hget(vMI.Servers,$hmatch(vMI.Servers,%SearchString,%Num).data),1,58),2-,32) }
var %firstline = $hget(vMI.Servers,$hmatch(vMI.Servers,%SearchString,%Counter).data)
if (%firstline == $null) { return }
if (s isin %vMI.Options) { vMI.NEcho -a 1. $gettok(%firstline,2-,32) }
if ($hget(vMI.Servers.List)) { hfree vMI.Servers.List }
hmake vMI.Servers.List 10
hadd vMI.Servers.List Serv [ $+ [ %counter ] ] $gettok(%firstline,2-,32)
inc %counter
while ($hget(vMI.Servers,$hmatch(vMI.Servers,%SearchString,%Counter).data)) {
var %vMI.Match = $ifmatch
hadd vMI.Servers.List Serv [ $+ [ %counter ] ] $gettok(%vMI.Match,2-,32)
if (s isin %vMI.Options) { vMI.NEcho -a %counter $+ . $hget(vMI.Servers.List,Serv [ $+ [ %counter ] ] ) }
inc %counter
}
dec %counter
var %rand = $rand(1,%counter)
var %servname = $gettok($hget(vMI.Servers.List, Serv [ $+ [ %rand ] ] ),1,58)
var %port = $gettok($gettok($hget(vMI.Servers.List, Serv [ $+ [ %rand ] ] ),2-,58),$rand(1,$numtok($gettok($hget(vMI.Servers.List, Serv [ $+ [ %rand ] ] ),2-,58),44)),44)
if (- isin %port) { %port = $rand($gettok(%port,1,45),$gettok(%port,2,45)) }
hfree vMI.Servers.List
return %servname %port
}
alias vMI.Chat.Desktop {
savebuf $active $vrsdir(tempdat.dat)
var %Titlebar = $vMI.Titlebar($active)
var %X = $window($active).dx ,%Y = $window($active).dy ,%W = $window($active).w ,%H = $window($active).h
var %WinName $active
!window -c $active
!window -daek0 %WinName %X %Y %W %H
font $iif($gettok($theme.setting(FontQuery),3,44) == B,-b) %WinName $gettok($theme.setting(FontQuery),2,44) $gettok($theme.setting(FontQuery),1,44)
vMI.Titlebar %WinName %Titlebar
loadbuf %WinName $vrsdir(tempdat.dat)
.remove $vrsdir(tempdat.dat)
}
alias vMI.Chat.Mdi {
savebuf $active $vrsdir(tempdat.dat)
var %Titlebar = $vMI.Titlebar($active)
var %X = $window($active).x ,%Y = $window($active).y ,%W = $window($active).w ,%H = $window($active).h
var %WinName $active
!window -c $active
!window -aek0 %WinName %X %Y %W %H
font $iif($gettok($theme.setting(FontQuery),3,44) == B,-b) %WinName $gettok($theme.setting(FontQuery),2,44) $gettok($theme.setting(FontQuery),1,44)
vMI.Titlebar %WinName %Titlebar
loadbuf %WinName $vrsdir(tempdat.dat)
.remove $vrsdir(tempdat.dat)
}