Peace & Protection 4.00 — File Browser
PeaceProtection4.00v4.0 / PeaceProtection4.00v4.0 / SCRIPT / last.mrc
last.mrc — 29 KB — Download this file
; #= P&P -rs -1
; ########################################
; Peace & Protection
; Themes and everything that belongs LAST
; ########################################
#pp-texts on
; These text schemes reformat all/most standard display,
; including text, raws, etc. as well as many 'events'
; such as notify, whois, etc.
; Addons before this can use halt to prevent display
; of most any part. This system uses halt to prevent
; the 'standard' areas later (raw/input/etc.) from
; displaying. (not ctcps)
; Any -single- display alias is never called more than once
;
; Simple display formatting
;
; Basic display
on &^*:TEXT:*:#:{
; Global message
if (($me !ison $target) && (#* iswm $target)) { if (* isin $target) return | halt }
_beep.flash $chan
if (@* iswm $target) _do.op.notice $chan $<chan.op.txt>($nick,$address,$fulladdress,$chan,$target,$iif(($1- == $null) && ($left($1,1) == $null),$chr(32),$1-))
else echo -lti2 $chan $<chan.txt>($nick,$address,$fulladdress,$chan,-,$iif(($1- == $null) && ($left($1,1) == $null),$chr(32),$1-))
halt
}
on &^*:ACTION:*:#:{
_beep.flash $chan
if (@* iswm $target) echo $colour(act) -lti2 $chan $<chan.op.act>($nick,$address,$fulladdress,$chan,$target,$iif(($1- == $null) && ($left($1,1) == $null),$chr(32),$1-))
else echo $colour(act) -lti2 $chan $<chan.act>($nick,$address,$fulladdress,$chan,-,$iif(($1- == $null) && ($left($1,1) == $null),$chr(32),$1-))
halt
}
on &^*:NOTICE:*:#:{
_event.beep notice
if (@* iswm $target) { _do.op.notice $chan $<chan.op.not>($nick,$address,$fulladdress,$chan,$target,$iif(($1- == $null) && ($left($1,1) == $null),$chr(32),$1-)) | halt }
elseif ($me !ison $target) echo $colour(notice) -sti2 $<chan.not>($nick,$address,$fulladdress,$chan,-,$iif(($1- == $null) && ($left($1,1) == $null),$chr(32),$1-))
else echo $colour(notice) -ti2 $chan $<chan.not>($nick,$address,$fulladdress,$chan,-,$iif(($1- == $null) && ($left($1,1) == $null),$chr(32),$1-))
_ssplay notice
halt
}
on &^*:TEXT:*:?:{
; Global message
if ($left($target,1) == $) return
_beep.flash $nick
if ($query($nick)) {
echo -lti2 $nick $<query.txt>($nick,$address,$fulladdress,-,-,$iif(($1- == $null) && ($left($1,1) == $null),$chr(32),$1-))
if ((%`copy.query != 1) || ($active == $nick)) halt
if (($active !ischan) && ($query($active) != $active)) halt
}
elseif ($_optn(0,22)) {
if ($line(Message Window,0) == $null) dqwindow show
echo -ldti2 $<dqwin.txt>($nick,$address,$fulladdress,-,-,$iif(($1- == $null) && ($left($1,1) == $null),$chr(32),$1-))
if (%`copy.query != 1) halt
if (($active !ischan) && ($query($active) != $active)) halt
}
; only show a copy to channels or other queries
; otherwise if we are here, we're showing to active by process of elimination (mirc would open a query otherwise)
echo -lati2 $<priv.txt>($nick,$address,$fulladdress,-,-,$iif(($1- == $null) && ($left($1,1) == $null),$chr(32),$1-))
halt
}
on &^*:ACTION:*:?:{
_beep.flash $nick
if ($query($nick)) {
echo $colour(act) -lti2 $nick $<query.act>($nick,$address,$fulladdress,-,-,$iif(($1- == $null) && ($left($1,1) == $null),$chr(32),$1-))
if ((%`copy.query != 1) || ($active == $nick)) halt
if (($active !ischan) && ($query($active) != $active)) halt
}
elseif ($_optn(0,22)) {
echo $colour(act) -ldti2 $<dqwin.act>($nick,$address,$fulladdress,-,-,$iif(($1- == $null) && ($left($1,1) == $null),$chr(32),$1-))
if (%`copy.query != 1) halt
if (($active !ischan) && ($query($active) != $active)) halt
}
; only show a copy to channels or other queries
; otherwise if we are here, we're showing to active by process of elimination (mirc would open a query otherwise)
echo $colour(act) -lati2 $<priv.act>($nick,$address,$fulladdress,-,-,$iif(($1- == $null) && ($left($1,1) == $null),$chr(32),$1-))
halt
}
on &^*:NOTICE:*:?:{
_event.beep notice
if (%.opnotice) { _do.op.notice %.opnotice $<priv.not>($nick,$address,$fulladdress,-,-,$iif(($1- == $null) && ($left($1,1) == $null),$chr(32),$1-)) | halt }
if ($istok(%!servnick,$nick,32)) var %window = %`serv.notice
else var %window = %`reg.notice
_ssplay notice
<priv.not> $nick $address $fulladdress - - $iif(($1- == $null) && ($left($1,1) == $null),$chr(32),$1-)
if ((($comchan($nick,0) == 0) && (%window != 1)) || ($1 === DCC) || (%window == 2)) echo $colour(notice) -esti2 $result
elseif (%window == 1) {
_notice.win $nick
echo $colour(notice) -ti2 @Notices $result
_win.log @Notices $result
halt
}
else {
var %num = $comchan($nick,0)
:loop2
echo $colour(notice) -ti2 $comchan($nick,%num) $result
if (%num > 1) { dec %num | goto loop2 }
}
if (($_optn(5,13)) && ($1 !== DCC)) if ((($active ischan) && ($nick !ison $active)) || (=* iswm $active) || ($query($active))) echo $colour(notice) -ati2 $result
halt
}
on &^*:CHAT:*:{
if ($1 == SOUND) return
_beep.flash $nick
if ($1 == ACTION) {
if (* iswm $1-) echo $colour(act) -lti2 = $+ $nick $<dcc.act>($nick,-,-,-,-,$left($2-,-1))
else echo $colour(act) -lti2 = $+ $nick $<dcc.act>($nick,-,-,-,-,$iif($2- == $null,$chr(32),$2-))
}
else echo -lti2 = $+ $nick $<dcc.txt>($nick,-,-,-,-,$iif(($1- == $null) && ($left($1,1) == $null),$chr(32),$1-))
halt
}
; Your input
alias say {
if (($1- == $null) && ($left($1,1) == $null)) _qhelp /say
if ($show) {
if ($active ischan) echo $colour(own) -ati2 $<chan.you.txt>($me,-,-,$active,-,$1-)
elseif ($query($active)) echo $colour(own) -ati2 $<query.you.txt>($me,-,-,-,$active,$1-)
elseif ((=* iswm $active) && ($chat($right($active,-1)))) echo $colour(own) -ati2 $<dcc.you.txt>($me,-,-,-,$right($active,-1),$1-)
else { echo $colour(info) -a * /say: can't use /say in this window | halt }
}
.msg $active $1-
}
alias me {
if (($1- == $null) && ($left($1,1) == $null)) _qhelp /me
if ($show) {
if ($active ischan) echo $colour($iif($colour(ow) == $colour(nor),a,o)) -ati2 $<chan.you.act>($me,-,-,$active,-,$1-)
elseif ($query($active)) echo $colour($iif($colour(ow) == $colour(nor),a,o)) -ati2 $<query.you.act>($me,-,-,-,$active,$1-)
elseif ((=* iswm $active) && ($chat($right($active,-1)))) echo $colour($iif($colour(ow) == $colour(nor),a,o)) -ati2 $<dcc.you.act>($me,-,-,-,$right($active,-1),$1-)
else { echo $colour(info) -a * /me: can't use /me in this window | halt }
}
.me $1-
}
alias msg {
if ($show == $false) msg $1-
elseif (($2- != $null) || ($left($2,1) != $null)) {
var %who = $_ncs(44,$1)
if (%who ischan) echo $colour(own) -ti2 %who $<chan.you.txt>($me,-,-,%who,-,$2-)
elseif ($query(%who)) {
echo $colour(own) -ti2 %who $<query.you.txt>($me,-,-,-,%who,$2-)
if ((%`copy.query) && ($active != %who) && (($active ischan) || ($query($active) == $active))) echo $colour(own) -ati2 $<priv.you.txt>($me,-,-,-,%who,$2-)
}
elseif ((=* iswm %who) && ($chat($right(%who,-1)))) echo $colour(own) -ti2 %who $<dcc.you.txt>($me,-,-,-,$right(%who,-1),$2-)
else echo $colour(own) -ati2 $<priv.you.txt>($me,-,-,-,%who,$2-)
.msg %who $2-
}
else _qhelp /msg $1
}
alias describe {
if ($show == $false) describe $1-
elseif (($2- != $null) || ($left($2,1) != $null)) {
var %who = $_ncs(44,$1)
if (%who ischan) echo $colour($iif($colour(ow) == $colour(nor),a,o)) -ti2 %who $<chan.you.act>($me,-,-,%who,-,$2-)
elseif ($query(%who)) {
echo $colour($iif($colour(ow) == $colour(nor),a,o)) -ti2 %who $<query.you.act>($me,-,-,-,%who,$2-)
if ((%`copy.query) && ($active != %who) && (($active ischan) || ($query($active) == $active))) echo $colour($iif($colour(ow) == $colour(nor),a,o)) -ati2 $<priv.you.act>($me,-,-,-,%who,$2-)
}
elseif ((=* iswm %who) && ($chat($right(%who,-1)))) echo $colour($iif($colour(ow) == $colour(nor),a,o)) -ti2 %who $<dcc.you.act>($me,-,-,-,$right(%who,-1),$2-)
else echo $colour($iif($colour(ow) == $colour(nor),a,o)) -ati2 $<priv.you.act>($me,-,-,-,%who,$2-)
.describe %who $2-
}
else _qhelp /describe $1
}
alias notice {
if ($show == $false) notice $1-
elseif (($2- != $null) || ($left($2,1) != $null)) {
var %who = $_ncs(44,$1)
_qnotice %who $2-
<priv.you.not> $me - - - %who $2-
echo $colour(own) -ati2 $result
_win.log @Notices $result
}
else _qhelp /notice $1
}
; Event targeting
; _event.t #chan type (or as identifier)
; for 0, looks up mirc setting instead, returning hide, $true, chan, 0/null (status)
alias _event.t {
var %val = 0
if (%`event. [ $+ [ $2. ] $+ [ $1 ] ] != $null) %val = $ifmatch
elseif (%`event. [ $+ [ $2 ] ] != $null) %val = $ifmatch
if (%val) return %val
if ($2 == kick) return chan
%val = $gettok($iif($2 == quit,chan.hide.chan.hide,chan.0.hide),$calc($_edef($findtok(join.part.quit.mode.topic.ctcp.nick,$2,46)) + 1),46)
if (($2 == nick) && (%val == 0)) return hide
return %val
}
; Modes
on &^*:RAWMODE:#:{
_event.t $chan mode
if ($result != hide) {
if ($result == chan) echo $colour(mode) -ti2 $chan $<chan.mode>($nick,$iif(. isin $nick,$nick,$address),$iif(. isin $nick,$nick,$fulladdress),$chan,-,$1-)
elseif ($result) {
<chan.mode> $nick $iif(. isin $nick,$nick,$address) $iif(. isin $nick,$nick,$fulladdress) $chan - $1-
echo $colour(mode) -ti2 $_event.win($chan) $result
_win.log %.ewin $result
}
else echo $colour(mode) -esti2 $<status.mode>($nick,$iif(. isin $nick,$nick,$address),$iif(. isin $nick,$nick,$fulladdress),$chan,-,$1-)
}
halt
}
; Channel events
on &^*:JOIN:#:{
if ($nick == $me) {
if ($nick($chan,0) > 1) echo $colour(join) -ti2 $chan $<chan.you.rejoin>($nick,$address,$fulladdress,$chan,-,-)
else echo $colour(join) -ti2 $chan $<chan.you.join>($nick,$address,$fulladdress,$chan,-,-)
}
else {
_event.t $chan join
if ($result == hide) halt
if ($_level($chan,$level($fulladdress)) >= 25) var %count = 0
elseif (%`clone.join) {
var %num = 1,%who,%mask = $mask($fulladdress,1),%count = $ialchan(%mask,$chan,0)
if ($_getcflag($chan,2) == 0) { if ($ialchan($wildsite,$chan,0) > %count) { %count = $ifmatch | %mask = $wildsite } }
if (%count < 2) %count = 0
else {
if (%count < 6) {
:loop
if ($ialchan(%mask,$chan,%num).nick != $nick) %who = %who $ifmatch
if (%num < %count) { inc %num | goto loop }
_recseen user $nick
_recseen clones $nick $+ , $+ $_s2c(%who)
_recseen offend $+ $chan $fulladdress clones $+ $chr(9) $+ %count $+ $chr(9) $+ %mask 7
_ssplay clones
}
else %who = $ialchan(%mask,$chan,1).nick
}
}
if ($result == chan) echo $colour(join) -ti2 $chan $<chan.join>($nick,$address,$fulladdress,$chan,-,-,%count,%mask,%who)
elseif ($result) {
<chan.join> $nick $address $fulladdress $chan - - %count %mask %who
echo $colour(join) -ti2 $_event.win($chan) $result
_win.log %.ewin $result
}
else echo $colour(join) -esti2 $<status.join>($nick,$address,$fulladdress,$chan,-,-,%count,%mask,%who)
}
halt
}
on &^!*:PART:#:{
_event.t $chan part
if ($result == hide) halt
if ($result == chan) echo $colour(part) -ti2 $chan $<chan.part>($nick,$address,$fulladdress,$chan,-,$1-)
elseif ($result) {
<chan.part> $nick $address $fulladdress $chan - $1-
echo $colour(part) -ti2 $_event.win($chan) $result
_win.log %.ewin $result
}
else echo $colour(part) -esti2 $<status.part>($nick,$address,$fulladdress,$chan,-,$1-)
halt
}
on &^!*:QUIT:{
var %chan,%num = $comchan($nick,0)
:loop
if (%num) {
%chan = $comchan($nick,%num)
_event.t %chan quit
if ($result != hide) {
if (($result) && ($result != chan)) {
<chan.quit> $nick $address $fulladdress %chan - $1-
echo $colour(quit) -ti2 $_event.win(%chan) $result
_win.log %.ewin $result
}
else echo $colour(quit) -ti2 %chan $<chan.quit>($nick,$address,$fulladdress,%chan,-,$1-)
}
dec %num | goto loop
}
if (%`hide.status.quit != 1) echo $colour(quit) -esti2 $<status.quit>($nick,$address,$fulladdress,-,-,$1-)
halt
}
on &^*:KICK:#:{
if ($knick == $me) {
echo $colour(kick) -esti2 $<status.you.kick>($nick,$address,$fulladdress,$chan,$knick,$1-)
if ($chan ischan) {
echo $colour(kick) -ti2 $chan $<chan.you.kick>($nick,$address,$fulladdress,$chan,$knick,$1-)
echo $colour(info) -ti2 $chan $<chan.you.attempt>($nick,$address,$fulladdress,$chan,$knick,$1-)
}
}
else {
_event.t $chan kick
if ($result == hide) halt
if (($result) && ($result != chan)) {
<chan.kick> $nick $address $fulladdress $chan $knick $1-
echo $colour(kick) -ti2 $_event.win($chan) $result
_win.log %.ewin $result
}
else echo $colour(kick) -ti2 $chan $<chan.kick>($nick,$address,$fulladdress,$chan,$knick,$1-)
}
halt
}
on &^*:NICK:{
var %chan,%num = $comchan($newnick,0)
:loop
if (%num) {
%chan = $comchan($newnick,%num)
_event.t %chan nick
if ($result != hide) {
if (($result) && ($result != chan)) {
<chan.nick> $nick $address $fulladdress %chan $newnick $1-
echo $colour(nick) -ti2 $_event.win(%chan) $result
_win.log %.ewin $result
}
else echo $colour(nick) -ti2 %chan $<chan.nick>($nick,$address,$fulladdress,%chan,$newnick,$1-)
}
dec %num | goto loop
}
if ($nick == $me) echo $colour(nick) -esti2 $<status.you.nick>($nick,$address,$fulladdress,-,$newnick,$1-)
halt
}
on &^*:TOPIC:#:{
_event.t $chan topic
if ($result == hide) halt
if ($result == chan) echo $colour(topic) -ti2 $chan $<chan.topic>($nick,$address,$fulladdress,$chan,-,$iif($1,$1-,$chr(32)))
elseif ($result) {
<chan.topic> $nick $address $fulladdress $chan - $1-
echo $colour(topic) -ti2 $_event.win($chan) $result
_win.log %.ewin $result
}
else echo $colour(topic) -esti2 $<chan.topic>($nick,$address,$fulladdress,$chan,-,$iif($1,$1-,$chr(32)))
halt
}
; Nick coloring/opsymbol wrapper (DOESN'T account for ircop/ping/lag)
; $_nwrap(nick,fulladdress,chan)
alias _nwrap {
if (%`themecol) return $+ $col.nick($1,$2,$3,$iif(%`themeop,=)) $+ $1 $+
if (%`themeop) return $_stsym($1,$3) $+ $1
return $1
}
#pp-texts end
on &^*:TEXT:*:?:{
; show a copy to channels or other queries?
if (%`copy.query) {
if (($active !ischan) && ($query($active) != $active)) return
if (($left($target,1) == $) || ($active == $nick) || ($query($nick) == $null)) return
echo -lati2 $<priv.txt>($nick,$address,$fulladdress,-,-,$iif(($1- == $null) && ($left($1,1) == $null),$chr(32),$1-))
}
}
on &^*:NOTICE:*:*:{
if ((@* iswm $target) || (%.opnotice)) _ssplay opnotice
else _ssplay notice
}
alias msg if ($show == $false) msg $1- | elseif ($2) msg $_ncs(44,$1) $2- | else _qhelp /msg $1
alias describe if ($show == $false) describe $1- | elseif ($2) describe $_ncs(44,$1) $2- | else _qhelp /describe $1
alias notice if ($show == $false) notice $1- | elseif ($2) notice $_ncs(44,$1) $2- | else _qhelp /notice $1
; colors should always end up using exactly two digits
; colors are in %`nickcol
; space tokens for normal, notify/userlist, failed-notify, blacklist/ignore, ircop, self, lagged, ping
; (reverse order of importance)
; within token is dash tokens for normal, voice, helper, op
; 32 colors in all
; this identifier returns the color code to use for a user (status is *pL for ircop/ping/lagged)
; status equal = to also add @+
; $col.nick(nick,fulladdress,chan,status)
alias col.nick {
col.nick² %`nickcol $1-
if ($1 isop $3) return $gettok($result,3,45) $+ $iif($4 == =,@)
if ($1 isvo $3) return $gettok($result,2,45) $+ $iif($4 == =,+)
return $gettok($result,1,45)
}
alias -l col.nick² {
if (p isin $12) return $8
if (L isin $12) return $7
if ($9 == $me) return $6
if (* isin $12) return $5
if ($wildtok($level($10),=color*,1,44)) return $str($replace($ifmatch,=color,-),4)
if (($10 isignore) || ($istok($level($10),=black,44))) return $4
if (($9 isnotify) && ($gettok(%-notify.on. [ $+ [ $9 ] ] ,3,32) == fail)) return $3
if (($9 isnotify) || ($level($10) != 1)) return $2
return $1
}
#pp-nicklist on
; nicklist coloring
on !*:JOIN:#:cline $col.nick($nick,$fulladdress,$chan) $chan $nick | unset %-nickflags. $+ $nick | _onjoin
on *:OP:#:on.op.col
on *:DEOP:#:on.op.col
on *:VOICE:#:on.op.col
on *:DEVOICE:#:on.op.col
on *:SERVEROP:#:on.op.col
alias -l on.op.col cline $col.nick($opnick,$address($opnick,5),$chan,%-nickflags. [ $+ [ $opnick ] ] ) $chan $opnick
raw 352:*:if ($2 ischan) { %-nickflags. [ $+ [ $6 ] ] = $7 | cline $col.nick($6, [ [ $6! ] $+ [ $3@ ] $+ [ $4 ] ] ,$2,$7) $2 $6 }
on *:NICK:if ($nick == $newnick) return | %-nickflags. [ $+ [ $newnick ] ] = %-nickflags. [ $+ [ $nick ] ] | unset %-nickflags. $+ $nick
;;; test below nick-clearing section
on *:PART:#:{
if ($nick == $me) { _clrnick $chan | unset %-=*. $+ $chan }
elseif ($comchan($nick,0) <= 1) unset %-nickflags. $+ $nick
}
on *:KICK:#:{
if ($knick == $me) { _clrnick $chan | unset %-=*. $+ $chan }
elseif ($comchan($knick,0) <= 1) unset %-nickflags. $+ $knick
}
on *:QUIT:unset %-nickflags. $+ $nick
alias -l _clrnick {
var %num = $nick($1,0)
:loop
if ($comchan($nick($1,%num),0) <= 1) unset %-nickflags. [ $+ [ $nick($1,%num) ] ]
if (%num > 1) { dec %num | goto loop }
}
; update nicklist colors; $1 = channel
alias col.nicklist {
var %nick,%num = $nick($1,0)
:loop
if (%num > 0) {
%nick = $nick($1,%num)
cline $col.nick(%nick,$address(%nick,5),$1,%-nickflags. [ $+ [ %nick ] ] ) $1 %num
dec %num | goto loop
}
}
; update one color; $1 chan $2 nick
alias upd.nick.col cline $col.nick($2,$address($2,5),$1,%-nickflags. [ $+ [ $2 ] ] ) $1 $2
; update one user; $1 = nick
alias upd.nick.comchan {
var %num = $comchan($1,0)
:loop
if (%num > 0) {
cline $col.nick($1,$address($1,5),$comchan($1,%num),%-nickflags. [ $+ [ $1 ] ] ) $comchan($1,%num) $1
dec %num | goto loop
}
}
#pp-nicklist end
on me:*:PART:#:unset %-=*. $+ $chan
alias upd.nick.nickbit {
if (* !isin $gettok($1,1,33)) upd.nick.comchan $gettok($1,1,33)
elseif ($ial($1,0)) {
var %nick = $ifmatch
:loop
upd.nick.comchan $ial($1,%nick).nick
if (%nick > 1) { dec %nick | goto loop }
}
}
alias col.nick return
alias col.nicklist return
alias upd.nick.col return
alias upd.nick.comchan return
; clear nicklist colors
alias clr.nicklist unset %-nickflags.* | var %num = $nick($1,0) | :loop | cline $1 %num | if (%num > 1) { dec %num | goto loop }
;
; On join interface (skips whois during mass joins)
;
on !*:JOIN:#:_onjoin
alias -l _onjoin {
inc -z %-massjoin
if (%-massjoin > 3) { if (%-massjoin > 10) %-massjoin = 10 }
elseif ((%.joinwhois.do == _ircopchk) && (%.joinwhois.show == 0)) {
%-ircopchk. [ $+ [ $chan ] ] = $addtok(%-ircopchk,$nick,32)
if ($numtok(%-ircopchk. [ $+ [ $chan ] ] ,32) == 5) _do.i.userhost $chan
else .timer.ircop.uh. [ $+ [ $chan ] ] -m 1 500 _do.i.userhost $chan
}
elseif ((%.joinwhois.do) || (%.joinwhois.show)) _linedance _Q.whois $nick _joinwhois $chan %.joinwhois.show %.joinwhois.do
unset %.joinwhois.show %.joinwhois.do
}
alias -l _do.i.userhost _linedance _Q.userhost _ircopchk $+ $1 $+ &n&a&i halt %-ircopchk. [ $+ [ $1 ] ] | .timer.ircop.uh. [ $+ [ $1 ] ] off | unset %-ircopchk. $+ $1
alias _joinwhois {
if (%-mwho.err) { unset %-mwho.* | return }
var %num = 3
:loop
if ($ [ $+ [ %num ] ] ) { _blackbox $ifmatch $1 %-mwho.nick | inc %num | goto loop }
if ($2 == 1) _w.show 0
elseif ($2 == 2) _w.show $1
else unset %-mwho.*
}
;
; Invites
;
on &^*:INVITE:#:{
inc -u30 %-recd.inv
if ($_not($_known($nick,$fulladdress))) inc -u30 %-recd.inv. $+ $site
if ($len($chan) > 30) inc -u30 %-recd.inv. $+ $site
if ((%-recd.inv. [ $+ [ $site ] ] > 3) || (%-recd.inv > 5)) {
.ignore -iu120 **!**@**
_alert FLOOD Invite flood from $:b($nick) ( $+ $address $+ ) Further invites won't be shown
}
if ((%-recd.inv. [ $+ [ $site ] ] > 2) || (%-recd.inv > 3)) halt
_recseen user $nick
if ($_optn(3,11)) {
if ($_cfgi(verify.inv)) {
.ajinvite off | .timer -om 1 0 .ajinvite on
%-invited = %-invited $chan
_linedance .raw mode $chan
%-invn. [ $+ [ $chan ] ] = $:b($nick)
}
else {
_recurse <invite.plain> $chan $nick 1
_ssplay invite
_recseen nick $nick
}
}
elseif ($_cfgi(verify.inv)) {
%-invited = %-invited $chan
_linedance .raw mode $chan
%-invn. [ $+ [ $chan ] ] = $:b($nick)
}
else {
_recurse <invite.plain> $chan $nick 0
_ssplay invite
_recseen chan $chan
_recseen nick $nick
}
halt
}
;
; Menu endings
;
menu query {
-
$iif((($mid(%`popups.2,9,1) != 0) || ($mouse.key & 2)) && ($active != Notify List),Window)
.Hide:hide $active
.Close:if (= isin $active) close -cf $1 | elseif ($active == Message Window) dqwindow hide | else closemsg $1
.-
.Logging
..On:log on
..Off:log off
..-
..View:viewlog
..Delete:dellog
.Clear:clear
$iif(($mid(%`popups.2,10,1) != 0) || ($mouse.key & 2) || ($active == Notify List),Close):if ($active == Notify List) notify -h | else closemsg $1
$iif(($mid(%`popups.2,11,1) != 0) || ($mouse.key & 2),Help!):{ }
}
menu channel {
-
$iif(($mid(%`popups.3,9,1) != 0) || ($mouse.key & 2),Part):part # | dispa Parting # $+ ...
-
$iif(($mid(%`popups.3,10,1) != 0) || ($mouse.key & 2),Window)
.Hide:hide $active
.Close:if ($active ischan) { part # | dispa Parting # $+ ... } | elseif (= isin $active) close -cf $1 | elseif ($active == Message Window) dqwindow hide | else closemsg $1
.-
.Logging
..On:log on
..Off:log off
..-
..View:viewlog
..Delete:dellog
.Clear:clear
$iif(($mid(%`popups.3,11,1) != 0) || ($mouse.key & 2),Help!):{ }
}
menu status {
-
$iif(($mid(%`popups.5,10,1) != 0) || ($mouse.key & 2),Window)
.Hide:hide $active
.-
.Logging
..On:log on
..Off:log off
..-
..View:viewlog
..Delete:dellog
.Clear:clear
$iif(($mid(%`popups.5,11,1) != 0) || ($mouse.key & 2),Help!):{ }
}
menu nicklist {
-
$iif(($mid(%`popups.4,12,1) != 0) || ($mouse.key & 2),Help!):{ }
}
menu menubar {
-
$iif(($mouse.key & 2) || ($mid(%`popups.1,10,1) != 0),Help!):{ }
}
;
; Generic WINDOW (sub)menus (not for picture windows/etc.)
;
; Window that only needs to close
menu @Close {
Close window:_wclose
}
; Window that closes on click
menu @Close2 {
sclick:_wclose
$_wclose:{ }
}
alias -l _wclose window -c $active
; All other windows
menu @* {
-
$iif((%@S [ $+ [ $active ] ] >= 1) && (($mid(%`popups.6,1,1) != 0) || ($mouse.key & 2)),Select all):_selectall $active %@S [ $+ [ $active ] ]
$iif(($istok(%!@copy,$active,32)) && ((($mid(%`popups.6,2,1) != 0) && ($sline($active,0))) || ($mouse.key & 2)),Copy):{
if ($sline($active,0)) {
var %num = 2,%clip = $strip($sline($active,1))
if ($sline($active,0) > 1) {
:loop
%clip = %clip $+ $chr(157) $+ $strip($sline($active,%num))
if (%num < $sline($active,0)) { inc %num | goto loop }
%clip = %clip $+ $chr(157)
}
clipboard $replace(%clip,$chr(157),$crlf)
}
}
-
$iif(($istok(%!@nolog,$active,32)) && (($mid(%`popups.6,3,1) != 0) || ($mouse.key & 2)),Window)
.$_dynpopf Hide:window -h $active
.$_dynpopf Close:_dowclose $active | window -c $active
.-
.$iif($istok(%!@log,$active,32), [ $_dynpop(%@L [ $+ [ $active ] ] ) ] Logging)
..$_dynpop(%@L [ $+ [ $active ] ] ) On...:_logon $active
..$_dynpopn(%@L [ $+ [ $active ] ] ) Off:_logoff $active
..-
..$_dynpopf View:var %file = $readini -n $_cfg(window.ini) $active log | if (%file) %file = $logdir $+ %file | else %file = $logdir $+ $active $+ .log | if ($exists(%file)) edit %file | else disps File ' $+ %file $+ ' does not exist
..$_dynpopf Delete:var %file = $readini -n $_cfg(window.ini) $active log | if (%file) %file = $logdir $+ %file | else %file = $logdir $+ $active $+ .log | _remove %file
.$iif($istok(%!@log,$active,32), [ $_dynpopf ] Clear):clear $active | if ($active == @Whois) .remove $_temp(who)
.$iif($line($active,0),$_dynpopf) $iif($line($active,0),Save...):var %save = $$dir="mIRC Save Buffer" $logdir\ [ $+ [ $active ] $+ [ .txt ] ] | if ($exists(%save)) _fileopt 2 %save | _bufsav $active %save
.-
.$iif($line($active,0),$_dynpopf) $iif($line($active,0),Font)
..Select...:font
..Default:window -h @.fontgrab | var %font = $window(@.fontgrab).fontsize $window(@.fontgrab).font $iif($window(@.fontgrab).fontbold,bold) | window -c @.fontgrab | font %font
.-
.$_dynpopf Position
..$_dynpop(%@R [ $+ [ $active ] ] ) Remember:if (%@R [ $+ [ $active ] ] ) { %@R [ $+ [ $active ] ] = 0 | writeini $_cfg(window.ini) $active rem 0 } | else { %@R [ $+ [ $active ] ] = 1 | remini $_cfg(window.ini) $active rem }
..-
..$_dynpopf Record now:{
if (f isin % [ $+ [ $active ] ] ) %@P [ $+ [ $active ] ] = $window($active).x $window($active).y $window($active).dw $window($active).dh
else %@P [ $+ [ $active ] ] = $window($active).x $window($active).y $window($active).w $window($active).h
writeini $_cfg(window.ini) $active pos %@P [ $+ [ $active ] ]
}
..$_dynpopf Restore:window $active %@P [ $+ [ $active ] ]
..$_dynpopf Default:window $active %@D [ $+ [ $active ] ] | %@P [ $+ [ $active ] ] = %@D [ $+ [ $active ] ] | remini $_cfg(window.ini) $active pos
.$iif($line($active,0),$_dynpopn($window($active).mdi)) $iif($line($active,0),Desktop):if ($window($active).mdi) _deskon $active | else _deskoff $active
$iif(($istok(%!@nolog,$active,32)) && (($mid(%`popups.6,4,1) != 0) || ($mouse.key & 2)),Close):_dowclose $active | window -c $active
$iif(($istok(%!@nolog,$active,32)) && (($mid(%`popups.6,5,1) != 0) || ($mouse.key & 2)),Hide):window -h $active
$iif(($istok(%!@help,$active,32)) && (($mid(%`popups.6,6,1) != 0) || ($mouse.key & 2)),Help!):{ }
}
; Common routines
alias -l _bufsav savebuf -a $1 " $+ $2- $+ " | disps Contents of $1 saved to ' $+ $2- $+ '
alias -l _logon {
var %file = $dir="Log $1 to..." $logdir [ $+ [ $1.log ] ]
if (%file) {
%@L [ $+ [ $1 ] ] = $nopath(%file)
disps Logging $1 to ' $+ $nopath(%file) $+ '
writeini $_cfg(window.ini) $1 log $nopath(%file)
}
}
alias -l _logoff {
if (%@L [ $+ [ $1 ] ] ) {
%@L [ $+ [ $1 ] ] = 0
disps Logging for $1 halted
remini $_cfg(window.ini) $1 log
}
}
alias -l _deskon if ($window($1).mdi) _desktog $1 1
alias -l _deskoff if ($window($1).mdi) halt | _desktog $1 0
alias -l _desktog {
var %title = $window($1).title,%edit = $editbox($1),%set = % [ $+ [ $1 ] ],%file = $_temp(dsk)
if ($2) var %pos = $calc($window($1).x + $window(-3).x) $calc($window($1).y + $window(-3).y)
else var %pos = $calc($window($1).x - $window(-3).x) $calc($window($1).y - $window(-3).y)
if (f isin % [ $+ [ $1 ] ] ) %pos = %pos $window($1).dw $window($1).dh
else %pos = %pos $window($1).w $window($1).h
savebuf $1 %file
window -c $1
window $gettok(%set,1,32) $+ $iif($2,d) $_p2s($gettok(%set,2,32)) $1 %pos $gettok(%set,3-,32)
titlebar $1 %title
if (%edit) editbox $1 %edit
loadbuf -c [ $+ [ $:d ] ] $1 %file
.remove %file
if ($2) writeini $_cfg(window.ini) $1 desk 1
else remini $_cfg(window.ini) $1 desk
}
;
; Input wrappers
;
on &*:INPUT:*:{
if (($target !ischan) && ($query($target) == $null) && (=* !iswm $target)) return
if (%.input.type == say) { if (($group(#pp-texts) == on) || ($1- != /say %.input.text)) { %.input.text | halt } }
elseif (%.input.type == me) { if (($group(#pp-texts) == on) || ($1- != %.input.text)) { %.input.text | halt } }
elseif (%.input.type == cmd) {
if (?notice iswm $gettok(%.input.text,1,32)) { ntc $gettok(%.input.text,2-,32) | halt }
elseif (($target ischan) && ($mid($gettok(%.input.text,1,32),2,1) isin +-)) {
var %bits = $right($gettok(%.input.text,1,32),-1),%targ = $gettok(%.input.text,2-,32)
goto %bits
:+o | op %targ | halt
:-o | dop %targ | halt
:+b | ban %targ | halt
:-b | unban %targ | halt
:+v | voc %targ | halt
:-v | dvoc %targ | halt
:%bits | mode %bits %targ | halt
}
elseif (%.input.text != $1-) { _juryrig2 %.input.text | halt }
}
}
; Once chat is opened, don't need to save why chat was opened
on *:OPEN:=:unset %_chat.open. $+ $nick
; Disconnect clearance
on *:DISCONNECT:%!net = Offline | .enable #+* | .disable #-* | unset %-* %<* %_nickretake %_nickrc %!serv %!servnick %!servopt | .timer.nickretake off | _upd.title
; flash/sounds that must be last
ctcp &*:DCC CHAT:?:_ssplay chatreq
ctcp &*:DCC SEND:?:_ssplay filereq
on &^*:OPEN:?:*:_ssplay newquery | if ($mid(%`flash.opt,$iif(%!away,2,1),1)) flash [query- $nick: $1- $+ ]
on &*:CHAT:*:if ($mid(%`flash.opt,$iif(%!away,6,5),1)) flash [dcc- $nick: $iif($1 == ACTION,$remove($2-,),$1-) $+ ]]
on &*:TEXT:*:?:if ($mid(%`flash.opt,$iif(%!away,4,3),1)) flash [msg- $nick: $1- $+ ]
on &*:ACTION:*:?:if ($mid(%`flash.opt,$iif(%!away,4,3),1)) flash [msg- $nick: $1- $+ ]