Basic — File Browser
Basicv23042002 / Basicv23042002 / basic / sys / mtheme.mrc
mtheme.mrc — 28.32 KB — Download this file
; ###################################
;
; Basic v23042002
; blue-elf, belf@mircscripter.com
;
; MTS support (my lame engine)
;
; ###################################
; standard mts aliases
alias mtsversion { return 1.1 }
alias theme.setting { return $hget(_systheme,$1) }
; /_syswritefonts <fchannel|fstatus|fquery> [b] <fontsize> <fontname>
alias _syswritefonts {
var %fontname, %fontsize, %w = @.sysfont $+ $1 $+ $ticks
window -h %w
if ($2 == b) {
font %w $3-
font -b %w
%fontsize = $calc($window(%w).fontsize + 700)
}
else {
font %w $2-
%fontsize = $calc($window(%w).fontsize + 400)
}
%fontname = $window(%w).font
writeini -n $+(",$mircini,") fonts $1 %fontname $+ , $+ %fontsize $+ , $+ $oddfont(%fontname)
close -@ %w
}
alias -l oddfont {
if ($1 == Terminal) return 255
return 0
}
; MTS
alias themeunload {
; var %f = themes\default.ini
; if (!$_isfile(%f)) return
; _display.restore
; write -c %f
; _set theme loaded
if ($script($gts(script))) .timer -m 1 0 .unload -rs $+(",$ifmatch,")
if ($gts(unload)) {
if (!script* iswm $ifmatch) $($gettok($gts(unload),2-,32),2)
else _sysdisp $color(info) UNLOAD -s
}
if ($_isfile(themes\theme.txt)) .remove -b $ifmatch
_hfree _systheme
.disable #mts.text
.timestamp off
unset %:*
}
alias -l tempxbg {
var %i = 1
while ($chan(%i)) {
background -ex $ifmatch
inc %i
}
var %i = 1
while ($chat(%i)) {
background -ex $+(=,$ifmatch)
inc %i
}
var %i = 1
while ($query(%i)) {
background -ex $ifmatch
inc %i
}
}
alias _sysmtsvar {
var %a, %rep = $cr % $+ ::\1 $lf
!.echo -q $regsub($replace($1-,$,$+($,!)),/<([a-zA-Z0-9]+)>/g,%rep,%a)
return $replace($remove($eval(%a,2),$+($cr,$chr(32)),$+($chr(32),$lf),$+($cr,$chr(32),$lf)),^g,>,^l,<)
}
; /_sysdisp <color> <EVENT|raw numeric> <-s|-a|#|query|=nick|@window>
alias _sysdisp {
if ($halted) return
var %w = $3, %s, %e = $iif($2 isnum,$+(raw.,$2),$2), %c = $color($1)
if ((!$hget(_systheme,%e)) && (raw.* iswm %e)) %e = raw.other
if ($hget(_systheme,%e)) {
tokenize 32 $ifmatch
if ((%w ischan) || ($query(%w)) || ($chat($remove(%w,=)))) set -u %:echo echo %c -bflti %w
elseif ((@* iswm %w) && ($window(%w))) set -u %:echo echo -i %w
elseif (@* iswm $active) set -u %:echo echo %c -slti
elseif ($remove(%w,-) isincs sa) set -u %:echo echo %c $+(%w,ti)
else set -u %:echo echo %c $s $+ lti
setbasicvars
if ($1 == !script) $($2-,2)
else {
set -nu %::text $replace(%::text,>,^g,<,^l)
set -u %::parentext $replace(%::parentext,>,^g,<,^l)
if ($mts2var($1-)) %:echo $_sysrb($ifmatch)
}
haltdef
}
}
alias -l _sysrb { return $replace($1-,^g,>,^l,<) }
alias -l setparen {
if ($gts(parentext)) set -nu %::parentext $replace($ifmatch,<c1>,%::c1,<c2>,%::c2,<c3>,%::c3,<c4>,%::c4,<text>,$1-)
}
alias -l setbasicvars {
tokenize 44 $hget(_systheme,basecolors)
set -u2 %::c1 $1
set -u2 %::c2 $2
set -u2 %::c3 $3
set -u2 %::c4 $4
set -u2 %::pre $mts2var($hget(_systheme,prefix))
set -u2 %::me $me
set -u2 %::server $server
set -u2 %::port $port
set -u2 %::timestamp $timestamp
}
#display.mts off
; /themeload [scheme] <name> -- [scheme] should be N
alias themeload {
; var %dir = $_(default,themedir)
var %dir = themes\, %err, %w = $+(@thmtmp.,$ticks), %mtsdir, %mts, %ver, %f = $iif($2,$2,$1), %sch = $iif($2,$1), %doload
if (*.mts !iswm %f) %f = %f $+ .mts
_progress Loading theme, verifying file
; verify if file exists
if ($_isfile(%f)) %mtsdir = $nofile(%f)
elseif ($findfile(%dir,$nopath(%f),1)) {
; FROM: C:\Documents and Settings\root\My Documents\basic2002\themes\basic\basic.mts
; TO : themes\basic\basic.mts
%f = $gettok($ifmatch,$+($findtok($ifmatch,$remove(%dir,\),1,92),-),92)
%mtsdir = $nofile(%f)
}
else %err = Theme file does not exist or it may not be in the themes\ directory. $+ $crlf
_progress² 1 12 Verifying script file
; find accompanying .mrc file, if any
if ($read(%f,ns,script)) {
var %script = %mtsdir $+ $ifmatch
if (!$isfile(%script)) %err = %err Accompanying script file ( $+ %script $+ ) not found. $+ $crlf
else %doload = .load -rs %script
}
; if ((!$read(%f,nw,scheme*)) && (!$read(%f,ns,basecolors))) %err = No scheme or colors available. $+ $crlf
_progress² 2 12 Verifying MTS version
; check version, 1.1 only please...
var %ver = $read(%f,ns,mtsversion), %mts = $ini(%f,mts)
if ((!%ver) || (%ver < $mtsversion)) %err = Unsupported MTS version. $+ $crlf
if (!%mts) %err = Not a valid MTS theme file.
; halt for errors
if ($dialog(display)) %sys.last.dialog = display
if (%err) {
window -c @Progress
unset %Sys.ProgressBarText
_err Unable to load theme $iif($2,$2,$1) $+ : $+ $str($crlf,2) $+ %err
}
_progress² 2 12 Unloading previous script file
; unload old script file
if ($script($gts(script))) { if ($gts(script) != $read(%f,ns,script)) .timer 1 0 .unload -rsn $+(",$ifmatch,") }
_progress² 3 12 Removing all previous images
; remove all images
var %p = 1
while ($mid(amsgdluh,%p,1)) {
background $+(-ex,$ifmatch)
inc %p
}
scid -a tempxbg
_progress² 2 12 Restoring nicklist colors
; remove all lame cnick colors
_cnickrem
_progress² 3 12 Loading MTS theme
; start loading
_hfree _systheme
window -hl %w
loadbuf -tmts %w %f
var %i = $line(%w,0), %l
while (%i) {
; if ($line(%w,%i) != $null) hadd -m _systheme $ifmatch <- this doesn't work. why?
if ($_scrlf($gettok($line(%w,%i),2,32)) != $null) hadd -m _systheme $line(%w,%i)
dec %i
}
clear %w
_progress² 4 12 Searching for scheme
; look for [scheme*]
if (%sch) {
var %i = 1, %load
while ($gts($+(scheme,%i))) {
if (%i == %sch) {
loadbuf $+(-tscheme,%i) %w %f
%load = 1
break
}
inc %i
}
if (%load) {
var %i = $line(%w,0), %l
while (%i) {
if ($_scrlf($gettok($line(%w,%i),2,32)) != $null) hadd -m _systheme $line(%w,%i)
dec %i
}
clear %w
}
}
else {
; force scheme1 if there's no basecolors.
if (!$gts(basecolors)) {
if ($read(%f,nw,scheme*)) {
loadbuf $+(-t,$gettok($read(%f,nl,$readn),1,32)) %w %f
var %i = $line(%w,0), %l
while (%i) {
if ($_scrlf($gettok($line(%w,%i),2,32)) != $null) hadd -m _systheme $line(%w,%i)
dec %i
}
}
;else _err Unable to load theme: no basecolors found!
}
}
window -c %w
_progress² 5 12 Saving previous settings
; backup current settings but only if there's no theme loaded
; if (!$_(theme,loaded)) displaybackup
_progress² 6 12 Applying colors
; change the colors
var %i = 1, %colors = $gts(colors), %rgb = $gts(rgbcolors), %array = $_syscoloritems
while ($gettok(%colors,%i,44) != $null) {
color $gettok(%array,%i,44) $ifmatch
if ((%rgb) && (%i < 16)) color $calc(%i -1) $rgb( [ $gettok(%rgb,%i,32) ] )
inc %i
}
_progress² 6 12 Applying basecolors
; change the basecolors
if ($gts(basecolors)) {
var %i = 1, %basecol = $ifmatch, %num
while ($gettok(%basecol,%i,44) != $null) {
var %tmp = $ifmatch
hadd _systheme $+(c,%i) $iif($len(%tmp) < 2,$+(0,%tmp),%tmp)
set %::c $+ %i %tmp
inc %i
}
}
_progress² 7 12 Applying nicklist colors
; change the nicklist colors
if (!$_(display,mts.nicklist)) goto fonts
var %i = 1
while ($gettok(op hop voice regular owner me friend enemy,%i,32)) {
var %tmp1 = $ifmatch, %tmp2 = $gts($+(cline,%tmp1))
if (%tmp2 != $null) {
%tmp2 = $calc(%tmp2 % 16)
if ($istok(op hop voice owner,%tmp1,32)) .cnick * %tmp2 $replace(%tmp1,hop,$chr(37),voice,+,owner,.,op,@)
elseif ($_istok(friend enemy,%tmp1,32)) .cnick $iif($ifmatch == friend,-v,-i) * %tmp2
elseif (%tmp1 == me) .cnick $me %tmp2
else .cnick * %tmp2
}
inc %i
}
:fonts
_progress² 8 12 Applying fonts
; change the fonts
var %b
if ($gts(fontdefault)) {
var %fd = $ifmatch, %fstatus = $gettok(%fd,2,44) $gettok(%fd,1,44), %b = $iif($gettok($ifmatch,3,44),b)
if ($gettok(%fd,3,44)) scid -a font -dsb %fstatus
else scid -a font -sd %fstatus
_syswritefonts fstatus %b %fstatus
}
if ($gts(fontchan)) {
var %font = $ifmatch, %b = $iif($gettok($ifmatch,3,44),b)
applyfontchan %font
_syswritefonts fchannel %b %fchan
}
if ($gts(fontquery)) {
var %fq = $ifmatch, %s = 1, %fchat = $gettok(%fq,2,44) $gettok(%fq,1,44)
while ($scon(%s)) {
scid $ifmatch
var %i = 1
while ($query(%i)) {
var %qw = $ifmatch
font -d %qw %fchat
if ($gettok(%fq,3,44)) {
font -b %qw
%b = b
}
inc %i
}
var %i = 1
while ($chat(%i)) {
var %cw = $+(=,$ifmatch)
font -d %cw %fchat
if (%b) font -b %qw
inc %i
}
inc %s
}
scid -r
_syswritefonts fquery %b %fchat
}
_progress² 9 12 Applying images
; look for image* in $hget(_systheme) and load them
if (!$_(display,mts.images)) goto timestamp
var %tmp, %i = 1
while ($hmatch(_systheme,image*,%i)) {
var %itm = $ifmatch, %p = $gts(%itm), %file = $+(%mtsdir,$iif(*buttons iswm %itm,%p,$gettok(%p,2,32)))
if ($isfile(%file)) {
%tmp = $remove(%itm,image)
if (%tmp == buttons) background -u %file
elseif ($_istok(center fill normal stretch tile photo,$gettok(%p,1,32),32)) {
var %sw = $replace($left($ifmatch,1),s,r)
if ($findtok(status toolbar mirc switchbar,%tmp,32)) %sw = $+(-,%sw,$mid(slmh,$ifmatch,1))
if ((%tmp == chan) || (%tmp == query)) {
var %s = 1, %type = $ $+ ! $+ %tmp $+ ( $+ % $+ x)
; *ph33r* my $eval() routine
while ($scon(%s)) {
scid $ifmatch
while ($(%type,3)) {
background $+(-e,%sw) $ifmatch %file
inc %x
}
inc %s
}
scid -r
}
else background %sw %file
}
}
inc %i
}
:timestamp
_progress² 10 12 Applying timestamp
; timestamp
if ($gts(timestampformat)) {
.timestamp -f $mts2var($ifmatch)
%::timestamp = $timestampfmt
}
if ($gts(timestamp) == on) .timestamp on
%::pre = $mts2var($gts(prefix))
; add sounds later
; disable #mts.text if the text option is disabled.
_progress² 11 12 Checking text settings
$iif(($_(display,mts.text)),.enable,.disable) #mts.text
_progress² 12 12 Storing theme info
; store theme info
_set theme loaded %f
; trigger on load
if (%doload) %doload
if ($gts(load)) _sysdisp info load -a
}
; /applyfontchan Font,size,b
alias -l applyfontchan { scid -a applyfontchan2 $1- }
alias -l applyfontchan2 {
var %fontfinal = $gettok($1,2,44) $gettok($1,1,44), %bold = $gettok($1,3,44), %i = 1
while ($chan(%i)) {
if (%bold) font -db $chan(%i) %fontfinal
else font -d $chan(%i) %fontfinal
inc %i
}
}
; events
; /_mchfont <windowtype> <windowname>
alias -l _mchfont {
if ($gts($1)) var %font = $ifmatch
else var %font = $gts(fontdefault)
if (!%font) return
var %fontsize = $gettok(%font,2,44), %font = $gettok(%font,1,44)
font -d $2 %fontsize %font
; mIRC has serious problems with fontnames and sizes *sigh*
; if (($window($2).font != %font) || ($window($2).fontsize != %fontsize)) font -d $2 %fontsize %font
}
alias -l dammit {
var %b = $_isfile(themes\theme.txt)
if (%b) {
if (!$hget(_systheme)) hmake _systheme 666
hload _systheme %b
.remove %b
}
}
on *:start:{
dammit
ForceStatusWindowFontsBecauseThereIsNoOnOpenEventForItAndmIRCfontsAreBroken
}
on *:connect:{
dammit
if ($gts(connecting)) hdel _systheme connecting
}
on *:exit:if ($_(theme,loaded)) if ($hget(_systheme)) hsave -o $ifmatch themes\theme.txt
; font fighter
on *:open:?:_mchfont fontquery $nick
on *:open:=:_mchfont fontquery =$nick
on &^*:join:#:{
if ($nick == $me) _mchfont fontchan #
set -u %::chan #
set -u %::nick $nick
set -u %::address $address
_sysdisp join $+(join,$iif($nick == $me,self)) #
chancline # $nick $fulladdress
}
on &^*:part:#:{
set -u %::chan #
set -u %::nick $nick
set -u %::address $address
setparen $1-
_sysdisp part part #
}
on &^*:kick:#:{
addlast k $timestamp *** $knick was kicked from # by $nick ( $+ $1- $+ )
set -u %::chan #
set -u %::knick $knick
set -u %::kaddress $gettok($address($knick,5),2,33)
set -u %::nick $nick
set -u %::cnick $nick(#,$nick).color
set -u %::text $1-
setparen $1-
if ($knick == $me) _sysdisp kick kickself -s
else _sysdisp kick kick #
}
on &^*:quit:{
if ($1 != $null) addlast q $timestamp *** $nick has quit IRC ( $+ $1- $+ )
set -u %::nick $nick
set -u %::address $address
setparen $1-
var %i = 1
while ($comchan($nick,%i)) {
set -u %::chan $ifmatch
set -u %::cnick $nick($ifmatch,$nick).color
_sysdisp quit quit %::chan
inc %i
}
if ($query($nick)) _sysdisp quit quit $ifmatch
}
on &^*:rawmode:#:{
set -u %::chan #
set -u %::nick $nick
set -u %::modes $1-
set -u %::cmode $left($nick(#,$nick).pnick,1)
if (%::cmode !isin $prefix) unset %::cmode
set -u %::cnick $nick(#,$nick).color
_sysdisp mode mode #
}
on &^*:usermode:{
set -u %::nick $_iif($nick,$me)
set -u %::modes $1-
_sysdisp mode modeuser $s
}
on &^*:topic:#:{
set -u %::nick $nick
set -u %::address $address
set -u %::chan #
set -u %::cmode $left($nick(#,$nick).pnick,1)
if (%::cmode !isin $prefix) unset %::cmode
set -u %::cnick $nick(#,$nick).color
set -nu %::text $1-
_sysdisp topic topic #
}
on &^*:nick:{
if (!$comchan($newnick,0)) {
set -u %::newnick $newnick
set -u %::nick $me
_sysdisp nick nickself $s
return
}
set -u %::newnick $newnick
set -u %::nick $nick
var %i = 1, %d = $iif($newnick == $me,nickself,nick)
while ($comchan($newnick,%i)) {
set -u %::chan $ifmatch
set -u %::cnick $nick($ifmatch,$newnick).color
set -u %::cmode $left($nick($ifmatch,$newnick).pnick,1)
if (%::cmode !isin $prefix) unset %::cmode
_sysdisp nick %d %::chan
inc %i
}
if (($query($nick)) || ($query($newnick))) _sysdisp nick nick $ifmatch
}
on &^*:invite:#:{
set -u %::chan #
set -u %::nick $nick
_sysdisp invite invite $iif($_mopt(3,26),$s,-s)
}
; show notifies in active window = $_mopt(3,24)
; show notifies in notify window only = $_mopt(2,16)
alias notifyshow {
;if (($_mopt(2,16)) || ($halted)) return
set -u %::nick $nick
set -u %::address $notify($nick).addr
set -nu %::text $notify($nick).note
_sysdisp notify notify $iif($_mopt(3,24),$s,-s)
}
alias unotifyshow {
;if (($_mopt(2,16)) || ($halted)) return
set -u %::nick $nick
set -u %:address $notify($nick).addr
set -nu %::text $notify($nick).note
_sysdisp notify unotify $iif($_mopt(3,24),$s,-s)
}
on &^*:error:{
set -nu %::text $1-
_sysdisp normal servererror -s
}
on &^*:wallops:*:{
set -u %::nick $nick
set -nu %::text $1-
; displaying to status so that users won't get confused.
_sysdisp other wallop -s
}
on &^*:snotice:*:{
set -u %::nick $nick
set -nu %::text $1-
;if ((*IP#?Mismatch:* iswm $1-) || (*host*running*version* iswm $1-) || (*If?you?are?having?problems?connecting?due* iswm $1-)) halt
if (*User*trying?to?become?a?server* iswm $1-) set -nu %::text User $5 trying to become server $11-
if (*rehashing?Server?config* iswm $1-) set -nu %::text Rehash requested by $4
if (*is?now?operator* iswm $1-) set -nu %::text New $iif($mid($9,2,1) === O,global,local) IRC Op $4-5
if (*KILL?message* iswm $1-) set -nu %::text $10 has killed $8 $13-
if (*K-Lined* iswm $1-) set -nu %::text $8 is K:lined on $server
_sysdisp notice noticeserver $iif($_mopt(5,13),$s,-s)
}
alias _themedns {
if ($1 == -h) set -u %::address $2
elseif (. isin $1) set -u %::address $1
else set -u %::nick $1
if ((%::address) || (%::nick)) set -u %::text Looking up $ifmatch
if ($gts(dns)) {
_sysdisp other dns $s
!.dns $1-
}
elseif ($gts(echo)) {
_sysdisp other echo $s
!.dns $1-
}
else !dns $1-
}
alias ctcpshow {
set -u %::nick $nick
set -u %::address $address
set -u %::target $target
set -u %::ctcp $1
set -nu %::text $2-
if ($target ischan) _sysdisp ctcp ctcpchan #
elseif ($target == $me) _sysdisp ctcp ctcp $iif($_mopt(4,19),$s,-s)
}
; I could use this, but it will slow things down: /su me = /set -u %::me $me
; alias su { set -u %:: $+ $1 $($+($,$1),2) }
on *:ctcpreply:*:{
set -u %::ctcp $1
if ($1 == PING) {
if ($_isticks($2)) set -nu %::text $duration($calc(($ticks - $2) / 1000))
else set -nu %::text $iif($2 isnum,$duration($calc($ctime - $2)),$2-)
}
else set -nu %::text $2-
set -nu %::value %::text
addlast cr $timestamp $+([,$nick) $upper($1) reply]: %::text
set -u %::nick $nick
set -u %::address $address
_sysdisp ctcp ctcpreply $s
}
alias ctcp {
if ((!$server) || (!$1)) return
addlast sc -> $+([,$1,]) $upper($2) $3-
if ($show) {
set -u %::chan $1
set -u %::nick $1
set -u %::target $1
set -u %::ctcp $2
set -nu %::text $3-
var %h = $iif($left($1,1) isin $chantypes,ctcpchanself,ctcpself)
if ((%h == ctcpchanself) && (!$gts(%h))) %h = ctcpself
_sysdisp ctcp %h $s
}
if ($2 == ping) .raw PRIVMSG $1 :PING $+($ticks,)
else !.ctcp $1-
}
alias ctcpreply {
if ((!$server) || ($2 == $null)) return
if ($show) {
if ($left($1,1) isin $chantypes) {
set -u %::chan $1
unset %::nick
}
else {
set -u %::nick $1
unset %::chan
}
set -u %::ctcp $2
set -nu %::text $3-
_sysdisp ctcp ctcpreply $s
}
!.ctcpreply $1-
}
alias _themeondns {
if ((!$gts(dnsresolve)) || (!$gts(dnserror))) return
var %i = 1
while ($gettok(nick address naddress iaddress raddress,%i,32)) {
set -u2 %:: $+ $ifmatch $($+($,$ifmatch),2)
inc %i
}
return _sysdisp other $iif($raddress,dnsresolve,dnserror) $s
}
;nick in use
raw 433:*:{
var %info = Nick $2 is in use.
if ($_comchan($2)) {
set -u1 %::text %info (In $ifmatch $+ )
_sysdisp normal 433 $s
}
else {
set -u1 %::text %info Retrieving /WHOIS info for $2 ...
_sysdisp normal 433 $s
.timer 1 2 whois $2
}
}
;names
raw 353:*:{
sr
set -u1 %::chan $3
set -u1 %::text $4-
_sysdisp normal 353 $3
}
raw 366:*:{
sr
set -u %::chan $2
set -nu %::text $3-
_sysdisp normal 366 $2
}
; topic
raw 332:*:{
sr
set -u2 %::chan $2
set -u2 %::text $3-
_sysdisp normal 332 $2
}
; :irc.rt.ru 333 blue-elf #shelter firecat^ 1017508661
raw 333:*:{
sr
set -u2 %::chan $2
set -u2 %::nick $3
set -u2 %::text $asctime($4)
set -u2 %::value $asctime($4)
_sysdisp normal 333 $2
}
; who
raw 352:*:{
sr
set -u %::nick $6
set -u %::address $+($3,@,$4)
set -u %::cmode $removecs($7,H,G,*,+)
set -u %::away $remove($7,@,*,+)
set -u %::chan $2
set -u %::wserver $5
set -u %::realname $9-
set -u %::value $8
set -nu %::text $2-
set -u %::isoper is $iif(* !isin $7,not)
chancline $2 $6 $+($6,!,$3,@,$4)
_sysdisp normal 352 $iif($me ison $2,$2,$s)
}
raw 315:*:{
sr
set -u %::chan $2
set -nu %::text $3-
_sysdisp normal 315 $iif($me ison $2,$2,$s)
}
;whowas
raw 314:*:{
if ($halted) return
var %tmp = $+(%,::theme.whowas.previous.,$cid)
if ($gts(whowas)) {
if ($(%tmp,2)) _sysdisp whois whowas $ws
unset $(%tmp)
haltdef
return
}
set $(%tmp) 1
sr
set %_sys.tmp. $+ $cid $+ .whois whowas
set -u2 %::nick $2
set -u2 %::address $+($3,@,$4)
set -u2 %::realname $6-
_sysdisp whois $iif($gts(whowas),whowas,314) $ws
}
raw 369:*:{
sr
set -u2 %::nick $2
set -u2 %::text $3-
_sysdisp whois $iif($gts(whowas),whowas,369) %::ww
unset $($+(%,::theme.whowas.previous.,$cid))
}
;whois
raw 311:*:{
sr
var %tmp = $+(%,::theme.whois.previous.,$cid)
set %_sys.tmp. $+ $cid $+ .whois whois
set -u2 %::ww $iif($_mopt(2,26),$s,-s)
set -u2 %::nick $2
set -u2 %::address $+($3,@,$4)
set -u2 %::realname $6-
if ($gts(whois)) {
if ($(%tmp,2)) _sysdisp whois whois $ws
unset $(%tmp)
haltdef
}
else {
set $(%tmp) 1
_sysdisp whois 311 $ws
}
}
raw 319:*:{
sr
set -u2 %::nick $2
set -u2 %::chan $3-
if ($gts(whois)) haltdef
else _sysdisp whois 319 %::ww
}
raw 312:*:{
sr
set -u2 %::nick $2
set -u2 %::wserver $3
set -u2 %::serverinfo $4-
if ($gts(whois)) haltdef
else _sysdisp whois 312 %::ww
}
raw 313:*:{
sr
set -u2 %::nick $2
set -u2 %::operline $3-
set -u2 %::isoper is
if ($gts(whois)) haltdef
else _sysdisp whois 313 %::ww
}
raw 301:*:{
sr
if ($($+(%,::theme.whois.previous.,$cid),2)) {
_sysdisp normal echo $s
return
}
set -u2 %::nick $2
set -u2 %::away $3-
set -u2 %::text $3-
if ($gts(whois)) haltdef
else _sysdisp whois 301 %::ww
}
raw 317:*:{
sr
set -u2 %::idletime $3
set -u2 %::signontime $asctime($4)
if ($gts(whois)) haltdef
else _sysdisp whois 317 %::ww
}
raw 307:*:{
set -u2 %::nick $2
set -u2 %::text $3-
set -u2 %::isregd $3-
if ($gts(whois)) haltdef
else _sysdisp whois 307 %::ww
}
raw 318:*:{
sr
set -u2 %::nick $2
set -u2 %::text $3-
var %r = $+(%,_sys.tmp.,$cid,.whois)
if ($(%r,2) === HALT_IT_BABY_YEAH!@) {
unset $(%r)
halt
}
if (!$(%r,2)) return
if ($gts(whois)) _sysdisp whois $(%r,2) %::ww
else _sysdisp whois 318 %::ww
unset $(%r)
unset $($+(%,::theme.whois.previous.,$cid))
}
; banlist
raw 367:*:{
sr
set -u %::chan $2
set -nu %::text $2-
set -u %::value $2-
_sysdisp normal 367 $2
}
raw 368:*:{
sr
set -u %::chan $2
set -nu %::text $2-
_sysdisp normal 368 $2
}
raw 1:*:{
hadd -m _systheme connecting $true
stv $1-
_sysdisp normal 001 -s
}
; lusers
raw 251:*:{
sr
set -u2 %::text $2-
set -u2 %::value $2-
set -u2 %::users $4
_sysdisp normal 251 $s
}
raw 252:*:{
sr
set %::text $2-
set %::value $2
_sysdisp normal 252 $s
}
raw 253:*:{
sr
set -u2 %::text $2-
set -u2 %::value $2
_sysdisp normal 253 $s
}
raw 254:*:{
sr
%::value = $2
re $s
}
raw 255:*:{
sr
%::servers = $7
%::value = $4
re $s
}
raw 401:*:{
sr
set $+(%,_sys.tmp.,$cid,.whois) HALT_IT_BABY_YEAH!@
set -u %::nick $2
set -u %::text $3-
re $s
}
raw 402:*:{
sr
set -u %::server $2
set -u %::text $3-
re $s
}
raw 324:*:{
sr
set -u %::chan $2
set -nu %::value $3-
set -nu %::modes $3-
re $iif($me ison $2,$2,$s)
}
raw 329:*:{
if ($istok($($+(%,ial.,$cid),2),$2,44)) {
haltdef
return
}
sr
set -u %::chan $2
set -u %::value $asctime($3)
set -u %::text $3
;set -u %::text $2 created on $asctime($3-)
re $iif($me ison $2,$2,$s)
}
raw 421:*:{
sr
set -u %::value $2
set -u %::text $3-
re $s
}
raw *:*:{
if ($istok(403 471 473 482 474 475,$numeric,32)) {
sr
set -u %::chan $2
set -u %::text $3-
re $s
}
if ($istok(404 433 432,$numeric,32)) {
sr
set -u %::nick $2
set -u %::text $3-
re $s
}
if (($istok(265 266 422 306 2 3 4 5,$numeric,32)) || (($gts($+(raw.,$numeric))) || ($gts(raw.other)))) {
stv $1-
re $s
}
}
alias -l re { _sysdisp normal $numeric $1- }
alias -l stv {
sr
set -nu2 %::text $2-
set -nu2 %::value $2-
}
alias -l sr {
set -u2 %::numeric $numeric
set -u2 %::fromserver $nick
}
alias -l s {
if ($activecid != $cid) return -s
return $iif($gts(connecting),-s,-a)
if (!$istok(251 253 255 265 266 422,$numeric,32)) return -a
}
alias -l ws {
set -u2 %::ww $iif($_mopt(2,26),-a,-s)
return %::ww
}
alias chancline {
if ($me ison $1) {
var %c = $gts(clineenemy), %f = $gts(clinefriend)
if ((%c isnum) && ($_isbanned($network,$1,$3))) cline %c $1-2
elseif ((%f isnum) && ($_isuser($network,$1,$3))) cline %f $1-2
}
}
#display.mts end
; this is the group to be disabled if the user chooses NOT to use text displays.
#mts.text off
on &^*:notice:*:*:{
addlast n $timestamp $+(-,$nick,-) $1-
set -u2 %::me $me
set -u2 %::nick $nick
set -u2 %::address $address
set -nu2 %::text $1-
set -u2 %::target $target
if (($target ischan) || (($left($target,1) isin $prefix) && ($mid($target,2,1) isin $chantypes))) {
set -u %::chan #
set -u %::cmode $left($nick(#,$nick).pnick,1)
if (%::cmode !isin $prefix) unset %::cmode
_sysdisp notice noticechan %::chan
}
else {
if ($_mopt(5,13)) {
var %i = 1, %found
while ($comchan($nick,%i)) {
set -u2 %::chan $ifmatch
_sysdisp notice notice $ifmatch
%found = 1
inc %i
}
if (!%found) _sysdisp notice notice $s
}
else _sysdisp notice notice -s
}
}
on &^*:text:*:#:{
set -u %::nick $nick
set -u %::address $address
set -u %::chan #
set -nu %::text $1-
set -u %::target $target
set -u %::cnick $nick(#,$nick).color
set -u %::cmode $left($nick(#,$nick).pnick,1)
if (%::cmode !isin $prefix) unset %::cmode
_sysdisp normal textchan #
}
on &^*:action:*:#:{
set -u %::nick $nick
set -u %::address $address
set -u %::chan #
set -nu %::text $1-
set -u %::target $target
set -u %::cmode $left($nick(#,$nick).pnick,1)
if (%::cmode !isin $prefix) unset %::cmode
_sysdisp action actionchan #
}
on &^*:chat:*:{
set -u %::nick $nick
set -u %::target $target
if (ACTION * iswm $1-) {
set -nu %::text $2-
set -u %::event actionquery
}
else {
set -nu %::text $1-
set -u %::event textquery
}
_sysdisp normal %::event =$nick
}
on &^*:text:*:?:{
addlast m $timestamp $+(<,$nick,>) $1-
set -u %::nick $nick
set -u %::address $address
set -nu %::text $1-
set -u %::target $target
if (($_mopt(4,5)) && (!$query($nick))) _sysdisp normal textmsg $s
else _sysdisp normal textquery $nick
}
on &^*:action:*:?:{
set -u %::nick $nick
set -u %::address $address
set -u %::target $target
set -nu %::text $1-
if (($_mopt(4,5)) && (!$query($nick))) _sysdisp action actionmsg $s
else _sysdisp action actionquery $nick
}
on &*:input:*:{
if (((/* !iswm $1-) || ($ctrlenter)) && ($_isvalidwin($active))) {
say $1-
halt
}
}
alias say {
if (($1 == $null) || (!$_isvalidwin($active))) return
set -u %::target $active
set -u %:: $+ $iif($left($active,1) isin $chantypes,chan,nick) $active
set -u %::cmode $left($nick($active,$me).pnick,1)
set -u %::nick $me
set -u %::me $me
if (%::cmode !isin $prefix) unset %::cmode
set -nu %::text $1-
!.msg $active $1-
if ($show) _sysdisp own $iif($active ischan,textchanself,textqueryself) $s
}
alias describe {
if ($2 == $null) return
var %n = $_isvalidwin($1), %m
if (!%n) return
set -u %::nick $me
set -u %::target $1
set -nu %::text $2-
set -u %:: $+ $iif($left($1,1) isin $chantypes,chan,nick) $1
%m = $iif($me ison $1,actionchanself,$iif(($query($1)) || ($chat($right($1,-1))),actionqueryself,textmsgself))
if ($show) _sysdisp action %m $1
!.describe $1-
}
alias me {
if (($1 == $null) || (!$_isvalidwin($active))) return
$+($iif(!$show,.),describe) $active $1-
}
alias ame {
var %i = 1
while ($chan(%i)) {
$iif($show,describe,.describe) $chan(%i) $$1-
inc %i
}
}
alias query {
!query $1
if ($2) $iif($show,msg,.msg) $1-
}
alias msg {
premsg $1-
if ($show) {
var %a
if ($1 ischan) %a = textchanself
elseif (($query($1)) || ($chat($right($1,-1)))) {
%a = textqueryself
addlast sm $timestamp -> $+(*,$1,*) $2-
}
else %a = textmsgself
_sysdisp own %a $s
}
!.msg $1-
}
alias amsg {
var %i = 1
while ($chan(%i)) {
$iif($show,msg,.msg) $chan(%i) $$1-
inc %i
}
}
alias notice {
premsg $1-
addlast sn $timestamp $+(<,$1,>) $2-
if ($show) _sysdisp notice noticeself $s
!.notice $1-
}
alias -l premsg {
set -u %::nick $me
set -u %::target $1
set -u %:: $+ $iif($left($1,1) isin $chantypes,chan,nick) $1
set -u %::cmode $left($nick($1,$me).pnick,1)
if (%::cmode !isin $prefix) unset %::cmode
set -nu %::text $2-
}
#mts.text end
; eof