Peace & Protection 4.00 — File Browser
PeaceProtection4.00v4.0 / PeaceProtection4.00v4.0 / SCRIPT / SCRIPT.MRC
SCRIPT.MRC — 25.13 KB — Download this file
; #= P&P -rs
; **********************
; Unsorted routines
; **********************
;;;###*** Not yet divided ***###;;;
; (theme routines)
; Checks and performs beeping/flashing options for a window
; _beep.flash #chan/nick (nick goes for chats too)
alias _beep.flash {
if ($_optn(5,15)) {
if (($1 ischan) && ($_optn(0,3))) beep
elseif (($1 !ischan) && ($_optn(4,2))) beep
elseif ($readini $mircini beeping $1 == on) beep
}
if (($readini $mircini flashing $1 == on) && (%!away == $null)) flash [message waiting]
}
; Does an event beep (sound, or beep, or nothing)
; _event.beep notice|???
alias _event.beep {
if ($_optn(5,15) == 0) return
if ($1 == notice) _event.beep² $1 $_optn(1,16)
}
alias -l _event.beep² if ($2 == 1) beep | elseif ($2) { var %wave = $readini -n $mircini waves $1 | .splay " $+ %wave $+ " }
; Opens notices window if not open; fills editbox regardless
; _notice.win target
alias _notice.win {
if ($window(@Notices) == $null) { _window 1 $iif($_optn(1,18),-en,-e) + @Notices -1 -1 -1 -1 /n @Notices | titlebar @Notices (F1 to cycle) }
if ($numtok($editbox(@Notices),32) > 2) return
if (@+* iswm $1) editbox -p @Notices /ovnotice $right($1,-2)
elseif (@* iswm $1) editbox -p @Notices $iif($event == TEXT,/omsg,/onotice) $right($1,-1)
elseif ($istok(%!servnick,$1,32)) editbox -p @Notices /msg $1
else editbox -p @Notices /notice $1
}
alias _do.op.notice {
if (%`op.notice == 0) echo $colour(notice) -ti2 $1 $2-
elseif (%`op.notice == 1) {
if ($1 isin $target) _notice.win $target | else _notice.win @ $+ $1
echo $colour(notice) -ti2 @Notices $2-
_win.log @Notices $2-
}
else {
echo $colour(notice) -ti2 $_event.win($1) $2-
_win.log %.ewin $2-
}
_ssplay opnotice
}
; Used when sending a notice, to log to proper log if needed
; _show.send.notice #chan what to display
alias _show.send.notice {
if ($active == @Notices) { echo $colour(own) -qti2 @Notices $2- | _win.log @Notices $2- }
elseif (@Events-* iswm $active) { echo $colour(own) -qati2 $2- | _win.log $active $2- }
else echo $colour(own) -qti2 $1 $2-
}
; Opens events window for a channel if not open; returns window name
; Window name will also be in %.ewin
; _event.win #chan
alias _event.win set -u %.ewin @Events- $+ $1 | if ($window(%.ewin) == $null) _window 1 $iif($_optn(1,18),-en,-e) + %.ewin -1 -1 -1 -1 @Events- | return %.ewin
; umode (to view/edit)
; umode +/- (normal changes)
; umode * mode (to set to exactly those modes)
alias umode {
if ($1 == *) {
var %mode = -,%umode = $remove($usermode,+),%newmode = $remove($2,+),%num = $len(%umode)
if (%num) {
:loop1
if ($mid(%umode,%num,1) !isincs %newmode) %mode = %mode $+ $ifmatch
if (%num > 1) { dec %num | goto loop1 }
}
if (%mode == -) var %mode
var %mode2 = +
%num = $len(%newmode)
if (%num) {
:loop2
if ($mid(%newmode,%num,1) !isincs %umode) %mode2 = %mode2 $+ $ifmatch
if (%num > 1) { dec %num | goto loop2 }
}
if (%mode2 == +) var %mode2
if ((%mode) || (%mode2)) .raw mode $me %mode $+ %mode2 $3-
}
elseif ($1) .raw mode $me $1-
else _dialog -am usermode usermode
}
dialog usermode {
title "Usermodes"
size -1 -1 364 160
box "&Current", 1, 10 10 60 104
check "+&i", 11, 20 30 35 16
check "+&s", 12, 20 48 35 16
check "+&w", 13, 20 66 35 16
edit "", 14, 19 84 40 22, autohs
box "&Default", 2, 80 10 60 104
check "+i", 21, 90 30 35 16
check "+s", 22, 90 48 35 16
check "+w", 23, 90 66 35 16
edit "", 24, 89 84 40 22, autohs
box "&Away", 3, 150 10 60 104
check "+i", 31, 160 30 35 16
check "+s", 32, 160 48 35 16
check "+w", 33, 160 66 35 16
edit "", 34, 159 84 40 22, autohs
text "(invisible)", 4, 220 31 100 20
text "(server notices)", 5, 220 49 100 20
text "(wallops)", 6, 220 67 100 20
text "(other)", 7, 220 88 100 20
button "&Filters...", 104, 300 43 55 20
button "Fil&ters...", 105, 300 67 55 20
button "OK", 101, 50 126 80 25, OK default
button "Cancel", 102, 140 126 80 25, cancel
button "Help", 103, 230 126 80 25, disable
}
on *:DIALOG:usermode:init:*:{
if ($server == $null) did -b $dname 11,12,13,14
else _umsplit 1 $usermode
_umsplit 2 $_cfgi(umode)
_umsplit 3 $_cfgi(uaway)
}
alias -l _umsplit {
if (i isincs $2) did -c $dname $1 $+ 1
if (s isincs $2) did -c $dname $1 $+ 2
if (w isincs $2) did -c $dname $1 $+ 3
did -o $dname $1 $+ 4 1 $removecs($2,i,s,w,+)
}
on *:DIALOG:usermode:sclick:101:{
if ($server) umode * $_ummerge(10)
_cfgw umode $_ummerge(20)
_cfgw uaway $_ummerge(30)
}
on *:DIALOG:usermode:sclick:104:_juryrig config sn
on *:DIALOG:usermode:sclick:105:_juryrig config wa
alias -l _ummerge return $iif($did($calc($1 + 1)).state,i) $+ $iif($did($calc($1 + 2)).state,s) $+ $iif($did($calc($1 + 3)).state,w) $+ $did($calc($1 + 4))
; Temp - May expand/replace later
on me:^*:JOIN:#:repjoin -r $chan | if ($ial) if ($chan($chan).ial != $inwho) _linedance _Q.who h $+ $chan $chan | if ($_cfgi(fill.chan)) _recent chan $_cfgi(num.chan) $chan | _recseen chan $chan
;
; Userhost queue wrapper
;
; Methods this supports-
; Standard- up to five replies per line, no-such-users are missing, blank line if all are no-such-user
; Undernet- up to five replies per line, no-such-users produce no-such-user and split reply, blank line if all or last are no-such-user
; ConfRoom- one reply per line, no-such-users disappear, blank line if all are no-such-user
; Strategy-
; * Hide no-such-user if next in line for queue, remove from queue
; * If a nick turns up that isn't next in queue, all in queue before it get no-such-user status
; * If a blank line turns up, all in queue up to special marker get no-such-user status
; * Special markers mark end of each line of requests, and are discarded otherwise (* is a special marker)
;;; Also can't (ever) handle ConfRoom doing /userhost a b c and getting :a and :b back
;;; Oh, and juryrig sucks :/
;;; Might want to split all userhost code into version for undernet, for CR, and for normal
raw 401:*no such*:{
if ($2 == %_nickrc) _retakecheck
var %next = %-uhq. [ $+ [ $calc(%-uhq.use + 1) ] ]
if ($gettok(%next,1,32) == $2) {
inc %-uhq.use
_juryrig2 $_p2s($replace($gettok(%next,3,32),&n,$2))
halt
}
}
raw 302:*:{
var %num = 2,%search,%cmd,%found
:outer
if ($ [ $+ [ %num ] ] != $null) { %found = $ifmatch | %search = $remove($gettok($ifmatch,1,61),*) }
else %search = *
:inner
inc %-uhq.use
%cmd = %-uhq. [ $+ [ %-uhq.use ] ]
unset %-uhq. [ $+ [ %-uhq.use ] ]
if (%cmd == $null) { unset %-uhq.* | return }
if ($gettok(%cmd,1,32) == %search) {
if (%search == *) halt
_juryrig2 $_p2s($replace($gettok(%cmd,2,32),&i,$iif(* isin $gettok(%found,1,61),1,0),&n,$remove($gettok(%found,1,61),*),&a,$right($gettok(%found,2,61),-1),&h,$left($gettok(%found,2,61),1)))
inc %num
if ($ [ $+ [ %num ] ] != $null) goto outer
if ((< !isin %!feat) && (> !isin %!feat)) { %search = * | goto inner }
if (%-uhq. [ $+ [ $calc(%-uhq.use + 1) ] ] == *) {
inc %-uhq.use
unset %-uhq. [ $+ [ %-uhq.use ] ]
}
halt
}
elseif ($gettok(%cmd,1,32) != *) _juryrig2 $_p2s($replace($gettok(%cmd,3,32),&n,$gettok(%cmd,1,32)))
goto inner
}
;
; Channel nick completion
;
;;; clean up?
on &*:INPUT:#:if ((%`nc.char) && (%.input.type == say)) _do.nc %.input.text
alias -l _do.nc {
if (($right($2,1) isin %`nc.char) && ($3)) { var %chr = $right($2,1),%part = $left($2,-1),%msg = $3- }
elseif (($len($3) == 1) && ($3 isin %`nc.char) && ($4)) { var %chr = $3,%part = $2,%msg = $4- }
elseif (($len($2) isnum 3-20) && ($2 !ison $chan) && ($left($2,-1) !ison $chan)) {
var %num = $len($2)
:loop
if ($mid($2,%num,1) isin %`nc.char) { var %chr = $mid($2,%num,1),%part = $left($2,$calc(%num - 1)),%msg = $mid($2,$calc(%num + 1),20) $3- }
elseif (%num > 3) { dec %num | goto loop }
}
else return
if ((%chr) && (%msg != $null)) {
if ((%chr != ,) || ($istok(k aw yes no uh uhh hey um umm er err heh hehe hah haha well ok okay so wow ack look see duh doh now o oh ah ahh hi yo i and nah mm mmm hm hmm,%part,32) == $false)) {
var %found = $_nci(%part,$chan)
if (($numtok(%found,32) > 1) && ($_cfgi(nc.askchan))) { _juryrig2 _nci2 %part $_s2c(%found) $chan %chr %msg | halt }
if (%found ison $chan) %.input.text = $1 $_nci3(%found,$chan,%chr,%msg)
}
}
}
alias _nci {
if ($1 ison $2) return $nick($2,$nick($2,$1))
if ((* isin $1) || (? isin $1)) return $1
if ($chan($2).ial == $true) {
var %scan = * $+ $left($1,1) $+ * $+ $mid($1,2,1) $+ * $+ $mid($1,3,1) $+ *!*
if ($ialchan(%scan,$2,0) > 0) {
var %found,%nick,%num = $ifmatch
:loop
%nick = $ialchan(%scan,$2,%num).nick
if (($1* iswm %nick) || ($1* iswm $remove(%nick,$chr(124),\,`,^,-,_,$chr(91),$chr(93),$chr(123),$chr(125)))) %found = %found %nick
if (%num > 1) { dec %num | goto loop }
return $remtok(%found,$me,1,32)
}
return $1
}
return $_qnc($1,$2)
}
alias _nci2 set %.part $1 | set %.found $2 | msg $3 $_nci3($$dialog(nickcomp,nickcomp,-4),$3,$4,$5-)
alias _nci3 var %form = $_msg(nc) | return $_finalmsg($replace(%form,&op&,$_stsym($1,$2),&nick&,$1,&chan&,$2,&char&,$3,&msg&,$4-)) $iif(&msg& !isin %form,$4-)
dialog nickcomp {
title "Selection"
size -1 -1 140 155
text "", 1, 3 3 130 28
list 2, 0 32 140 102, sort
button "Select", 3, 21 131 97 21, default ok
edit "", 4, 1 1 1 1, hide result autohs
button "", 5, 1 1 1 1, hide cancel
check "", 6, 1 1 1 1, hide
}
on *:DIALOG:nickcomp:init:*:{
if (%.fullmsg) { did -a $dname 1 %.fullmsg | did -c $dname 6 }
else did -a $dname 1 ' $+ %.part $+ ' matches multiple nicks, please select one:
var %num = $numtok(%.found,44)
:loop
if (%num) { did -a $dname 2 $gettok(%.found,%num,44) | dec %num | goto loop }
did -c $dname 2 1
unset %.fullmsg %.part %.found
}
on *:DIALOG:nickcomp:dclick:2:dialog -k $dname
on *:DIALOG:nickcomp:sclick:3:if ($did(6).state) set -u1 %.from-input-nc 1 | did -o $dname 4 1 $did(2,$did(2).sel)
;
; Nick completion identifiers
;
; $_nc(partial)
; Returns partial if no match
alias _nc {
if ($1 == $null) return
if ((%`nc.cmd == 0) || (%.from-input-nc != 1)) return $1
if ($1 == %_lastsrec) return %_lastsrec
if ($query($1)) return $query($1)
if ($chat($1)) return $chat($1)
if ((" isin $1) || (= isin $1)) return $remove($1,")
if ((= isin $1) || (, isin $1) || (! isin $1) || (* isin $1) || (@ isin $1) || (? isin $1) || (. isin $1) || ($left($1,1) isin +&#)) return $1
if ($1 == $me) return $me
if ($comchan($1,1)) return $nick($ifmatch,$nick($ifmatch,$1))
if ($notify($1).ison) return %-notify.nick. [ $+ [ $1 ] ]
if ($istok(%!servnick,$1,32)) return $1
var %nick,%scan,%found,%num = 1
if (($_cfgi(nc.askcmd)) && ($ial)) {
if (($query($active)) && ($1* iswm $active)) %found = $active
:loopN2
if ($notify(%num)) {
if ($notify(%num).ison) if ($1* iswm $notify(%num)) %found = $addtok(%found,%-notify.nick. [ $+ [ $notify(%num) ] ] ,44)
inc %num
goto loopN2
}
%scan = * $+ $left($1,1) $+ * $+ $mid($1,2,1) $+ * $+ $mid($1,3,1) $+ *!*
if ($ial(%scan,0) > 0) {
%num = $ial(%scan,0)
:loopS2
%nick = $ial(%scan,%num).nick
if (($1* iswm %nick) || ($1* iswm $remove(%nick,$chr(124),\,`,^,-,_,$chr(91),$chr(93),$chr(123),$chr(125)))) %found = $addtok(%found,%nick,44)
if (%num > 1) { dec %num | goto loopS2 }
}
if ($numtok(%found,44) == 1) return %found
if (%found == $null) return $1
set %.part $1
set %.found %found
return $$dialog(nickcomp,nickcomp,-4)
}
if (($query($active)) && ($1* iswm $active)) return $active
if (#) {
if ($chan(#).ial == $true) {
if ($ialchan($1*!*,#,0) > 1) return $1
if ($ialchan($1*!*,#,1).nick) return $ifmatch
}
elseif ($_qnc($1,#)) return $ifmatch
}
if ($ial) {
if ($ial($1*!*,0) > 1) return $1
if ($ial($1*!*,1).nick) return $ifmatch
}
elseif ($chan(0)) {
%num = $chan(0)
:loopC
if ($_qnc($1,$chan(%num))) return $ifmatch
if (%num > 1) { dec %num | goto loopC }
}
%num = 1
:loopN
if ($notify(%num)) {
if ($notify(%num).ison) if ($1* iswm $notify(%num)) return %-notify.nick. [ $+ [ $notify(%num) ] ]
inc %num
goto loopN
}
if ($ial) {
%scan = * $+ $left($1,1) $+ * $+ $mid($1,2,1) $+ * $+ $mid($1,3,1) $+ *!*
if ($ial(%scan,0) > 0) {
%num = $ifmatch
:loopS
if ($1* iswm $remove($ial(%scan,%num).nick,$chr(124),\,`,^,-,_,$chr(91),$chr(93),$chr(123),$chr(125))) return $ial(%scan,%num).nick
if (%num > 1) { dec %num | goto loopS }
}
}
return $1
}
; $_ncs(token,series)
; Same as above for a series
alias _ncs {
if ($2 == $null) return
if ((%`nc.cmd == 0) || (%.from-input-nc != 1)) return $2-
if ($2- == %_lastsrec) return %_lastsrec
if ($chr($1) !isin $2-) return $_nc($2)
var %ret,%num = 1
:loop
%ret = $addtok(%ret,$_nc($gettok($2-,%num,$1)),$1)
if (%num < $numtok($2-,$1)) { inc %num | goto loop }
return %ret
}
; $_qnc(partial,#chan)
; Quick nick complete- uses $nick, only scans a channel, returns $null if no match
alias _qnc {
if (($nick($2,0) < 1) || ($2 !ischan)) return
var %num = $nick($2,0)
:loop
if ($1* iswm $nick($2,%num)) return $nick($2,%num)
if (%num > 1) { dec %num | goto loop }
return
}
; $_ncc(partial,#chan)
; Returns parial if no match
alias _ncc {
if ($2 == $null) return
if ((%`nc.cmd == 0) || (%.from-input-nc != 1)) return $1
if ($1 == %_lastsrec) return %_lastsrec
if (" isin $1) return $remove($1,")
if ((= isin $1) || (, isin $1) || (! isin $1) || (* isin $1) || (@ isin $1) || (? isin $1) || (. isin $1) || ($left($1,1) isin +&#)) return $1
if ($1 ison $2) return $nick($2,$nick($2,$1))
if ($1 == $me) return $me
if ($istok(%!servnick,$1,32)) return $1
if ($chan($2).ial == $true) {
if ($_cfgi(nc.askcmd)) {
var %scan = * $+ $left($1,1) $+ * $+ $mid($1,2,1) $+ * $+ $mid($1,3,1) $+ *!*
if ($ialchan(%scan,$2,0) > 0) {
var %found,%nick,%num = $ifmatch
:loopS2
%nick = $ialchan(%scan,$2,%num).nick
if (($1* iswm %nick) || ($1* iswm $remove(%nick,$chr(124),\,`,^,-,_,$chr(91),$chr(93),$chr(123),$chr(125)))) %found = $addtok(%found,%nick,44)
if (%num > 1) { dec %num | goto loopS2 }
}
if ($numtok(%found,44) == 1) return %found
if (%found == $null) return $1
set %.part $1
set %.found %found
return $$dialog(nickcomp,nickcomp,-4)
}
if ($ialchan($1*!*,$2,0) > 1) return $1
if ($ialchan($1*!*,$2,1).nick) return $ifmatch
var %scan = * $+ $left($1,1) $+ * $+ $mid($1,2,1) $+ * $+ $mid($1,3,1) $+ *!*
if ($ialchan(%scan,$2,0) > 0) {
var %num = $ifmatch
:loopS
if ($1* iswm $remove($ialchan(%scan,$2,%num).nick,$chr(124),\,`,^,-,_,$chr(91),$chr(93),$chr(123),$chr(125))) return $ialchan(%scan,$2,%num).nick
if (%num > 1) { dec %num | goto loopS }
}
}
elseif ($_qnc($1,$2)) return $ifmatch
return $1
}
; $_nccs(token,#chan,series)
; Same as above for a series
alias _nccs {
if ($3 == $null) return
if ((%`nc.cmd == 0) || (%.from-input-nc != 1)) return $3-
if ($3- == %_lastsrec) return %_lastsrec
if ($chr($1) !isin $3-) return $_ncc($3,$2)
var %ret,%num = 1
:loop
%ret = $addtok(%ret,$_ncc($gettok($3-,%num,$1),$2),$1)
if (%num < $numtok($3-,$1)) { inc %num | goto loop }
return %ret
}
;
; Adds nick to recent nicknames; detects query-open flood
;
on ^*:OPEN:?:*:{
if (($notify($nick) == $null) && ($level($fulladdress) == $dlevel)) {
if (%-xqhalt) { set -u60 %-xqhalt 1 | halt }
if ($_genflood(-extremequery,$_cfgi(xquery.cfg))) {
set -u60 %-xqhalt 1
_alert FLOOD Query flood detected- Further queries from unknown users won't be opened
halt
}
}
_recseen user $nick
}
;
; Ignore
;
dialog ignore {
title "Ignore User"
size -1 -1 300 257
box "&Ignoring:", 101, 10 10 280 54
combo 1, 20 30 260 100, edit drop
box "&Duration:", 102, 10 68 280 66
radio "&Permanent", 5, 20 88 70 16
radio "Ignore &for", 6, 20 108 65 16
text "&minute(s)", 103, 134 109 50 20
edit "1", 7, 90 105 40 22
text "Ig&nore:", 104, 20 146 40 20
combo 8, 60 142 170 120, drop
check "&Tell user that they are being ignored:", 9, 60 168 200 16
edit "", 10, 76 188 200 22, autohs disable
button "Ignore", 201, 10 222 80 25, OK default
button "Cancel", 202, 110 222 80 25, cancel
button "Help", 203, 210 222 80 25, disable
}
on *:DIALOG:ignore:init:*:{
var %opt = $_dlgi(ign)
if (%opt == $null) %opt = 5 10 1 0
loadbuf -otignore $dname 8 script\dlgtext.dat
if (* !isin $gettok(%.mask,1,33)) did -o $dname 101 1 &Ignoring: ( $+ $gettok(%.mask,1,33) $+ )
else did -b $dname 9
_ddaddm $dname 1 %.mask 022 030 100 002 111
did -c $dname 1 1
unset %.mask
did -c $dname $gettok(%opt,1,32)
if ($gettok(%opt,1,32) == 5) did -b $dname 7
did -o $dname 7 1 $gettok(%opt,2,32)
did -c $dname 8 $gettok(%opt,3,32)
if ($gettok(%opt,3,32) isnum 3-4) did -b $dname 9
if ($gettok(%opt,4,32)) { did -c $dname 9 | if ($did(9).enabled) did -e $dname 10 }
}
on *:DIALOG:ignore:sclick:5:did -b $dname 7
on *:DIALOG:ignore:sclick:6:did -e $dname 7
on *:DIALOG:ignore:sclick:8:if ($did(8).sel isnum 3-4) did -b $dname 9 | elseif ($chr(40) isin $did(101)) did -e $dname 9
on *:DIALOG:ignore:sclick:9:did $iif($did(9).state,-e,-b) $dname 10
on *:DIALOG:ignore:sclick:201:{
var %time = 10
if (($did(7) isnum) && ($did(7) > 0)) %time = $did(7)
ign $gettok(-ptinck -ptink -it -k -ptincks,$did(8).sel,32) $+ $iif($did(6).state,u [ $+ [ $int($calc(%time * 60)) ] ] ) $$did(1)
_dlgw ign $iif($did(5).state,5,6) %time $did(8).sel $did(9).state
var %nick = $left($right($gettok($did(101),2,32),-1),-1)
upd.nick.nickbit $did(1)
if (%nick) {
close -m $ifmatch
if (($did(9).state) && ($did(8).sel !isnum 3-4)) {
var %msg = $_msg($iif($did(8).sel == 2,ignoreallbut,ignoreall))
if ((&reason& !isin %msg) && ($did(10) != $null)) %msg = %msg ( $+ $did(10) $+ )
notice %nick $_finalmsg($replace(%msg,&nick&,%nick,&reason&,$did(10)))
}
}
}
; /ign [-r] nick|address (or mirc-style options)
alias ign {
if (-* iswm $1) { var %mask,%flag = $1,%who = $_nc($2) }
else { var %mask,%flag = -,%who = $_nc($1) }
if (%who == $null) _qhelp /ign $1
if ((@ isin %who) || (* isin %who)) %mask = $_fixmask(%who)
elseif (($query(%who) == %who) && ($query(%who).address != %who)) %mask = %who $+ ! $+ $ifmatch
elseif ($address(%who,5)) %mask = $ifmatch
else {
disp Looking up address of $:t(%who) $+ ...
_Q.userhost ign $+ %flag $+ &n!&a $+ $3 dispNouser $+ $:t(%who) $+ foundto $+ $iif(r isin %flag,unignore,ignore) %who
halt
}
if (r isin %flag) {
if (((s isin %!feat) || (s isin %flag)) && ($server)) .raw silence - $+ %mask
var %count = 0,%num = $ignore(0)
:loop
if (%num) {
if ((%mask iswm $ignore(%num)) || ($ignore(%num) iswm %mask)) {
inc %count
%who = $ignore(%num)
dispa Removed $:s(%who) from ignore list
.ignore -r %who
upd.nick.nickbit %who
}
dec %num | goto loop
}
if (%count) dispa Removed $:t(%count) $iif(%count == 1,ignore,ignores) total
else dispa No ignores matching $:s(%mask) found to remove
}
elseif (%flag != -) {
if ($3 isnum) %who = $_ppmask(%mask,$3)
else %who = $_ppmask(%mask,3)
if ((s isin %flag) && ($server)) {
.raw silence + $+ %mask
if (u isin %flag) .timer 1 $calc($mid(%flag,$calc($pos(%flag,u) + 1),$len(%flag))) .raw silence - $+ %mask
}
ignore %flag %who
if (u isin %flag) .timer -o 1 $calc($mid(%flag,$calc($pos(%flag,u) + 1),$len(%flag))) upd.nick.nickbit %who
upd.nick.nickbit %who
if (* !isin $gettok(%mask,1,33)) close -m $gettok(%mask,1,33)
}
else { set %.mask %mask | return $dialog(ignore,ignore,-4) }
}
;
; Nickname retake
;
alias _retakecheck {
if (%!net == offline) halt
.timer.nickretake 1 14 _retakecheck
if (%-sp.count > 20) halt
_linedance _Q.userhost halt _donretake %_nickrc
}
on *:UNOTIFY:if ($nick == %_nickrc) _retakecheck
on *:NICK:if ($nick == %_nickrc) { if ($nick == $me) { unset %_nickrc | _donretake } | elseif ($nick != $newnick) _retakecheck } | else if (($nick == $me) && ($newnick == %_nickretake)) unset %_nickretake
on *:QUIT:if ($nick == %_nickrc) _retakecheck
on *:PART:#:if ($nick == %_nickrc) .timer.nickretake 1 5 _retakecheck
on *:NOTICE:*Your ghost has been killed*:?:if ($nick == %_nickrc) .timer.nickretake 1 5 _retakecheck
on *:NOTICE:*Nick*has been released from custody*:?:if ($nick == %_nickrc) .timer.nickretake 1 5 _retakecheck
alias _donretake {
if (%_nickrc) { dispa $:n(%_nickrc) Nickname no longer in use. Changing to nick... | nick %_nickrc }
.timer.nickretake off | unset %_nickretake %_nickrc
}
;
; Channel rejoin
;
alias repjoin {
if ($_ischan($1)) {
if ($istok(%-repjoin,$1,44)) { %-repjoin = $remtok(%-repjoin,$1,1,44) | disp Removed $:s($1) from rejoin attempts | if (%-repjoin == $null) .timer.repjoin off }
else { %-repjoin = $addtok(%-repjoin,$1,44) | disp Added $:s($1) to rejoin attempts; You will attempt to rejoin every 20 seconds; Use /repjoin -c to cancel | .timer.repjoin 0 20 _linedance .raw join % $+ -repjoin }
}
elseif ($1 == -c) {
if (%-repjoin) disp All rejoin attempts cancelled
else disp No channel rejoins being attempted
unset %-repjoin | .timer.repjoin off
}
elseif ($1 == -r) { %-repjoin = $remtok(%-repjoin,$2,1,44) | if (%-repjoin == $null) .timer.repjoin off }
else {
if (%-repjoin) { disp You are currently attempting to rejoin: $:l(%-repjoin) | disp Use /repjoin #chan to add or remove channels | disp Use /repjoin -c to clear all rejoins }
else { disp You are currently not attempting to rejoin any channels | disp Use /repjoin #chan to add a channel }
}
}
;
; Connect routines- Obtain my address, network, services, and determine server features from version
;
; address from 1 raw or USERHOST we send
; network from 1 raw, 4 raw, or certain connection data
; services from network name
; features from raws or network name
raw 1:& Welcome to & IRC *:_do.raw1 $4 $1-
raw 1:& Welcome to IRC at & *:_do.raw1 $6 $1-
raw 1:& Welcome to the & *network *:_do.raw1 $5 $1-
raw 1:*:_do.raw1 $4 $1-
alias -l _do.raw1 {
unset %-* %<*
%<protect.ctcp = #none
.enable #+*
.disable #-*
%!myself = $gettok($2-,$numtok($2-,32),32)
if ($_not($_isaddr(%!myself))) _Q.userhost _addself&n!&a _trackcode %!myself
%!net = $1
if ($len(%!net) < 5) %!net = internet
if ((%!net == dalnet) && (*.dal.net !iswm $server)) %!net = internet
%-signon = progress
_upd.title
remini config\ $+ %!user $+ \config.ini c
_cfgw lastserv $server $port
_recent srv 9 $server $+ , $port
if ($_cfgi($iif(%!away,uaway,umode)) != $null) umode $ifmatch
}
raw 4:*:{
if ((nn-* iswm $3) && (%!net == internet)) %!net = NewNet
; Find matching server version for "additional features", max modes, num targets, identd prefixes
window -hl @.servfeat
loadbuf @.servfeat script\servfeat.dat
var %num = $line(@.servfeat,0)
:loop
if ($gettok($line(@.servfeat,%num),1,32) iswm $3) {
%!modes = $gettok($line(@.servfeat,%num),2,32)
%!target = $gettok($line(@.servfeat,%num),3,32)
%!feat = $gettok($line(@.servfeat,%num),4-,32)
}
elseif (%num > 1) { dec %num | goto loop }
window -c @.servfeat
; Network
if (%!net == internet) {
%!net = $_cap1st($network)
if ((%!net == dalnet) && (*.dal.net !iswm $server)) %!net = internet
elseif (%!net == $null) %!net = $iif(efnet isin $2,EFnet,internet)
}
if ((CR* iswm $3) && (%!net == internet)) %!net = $_cap1st($gettok($server,$count($server,.),46))
}
raw 250:*Highest connection count*:if ((%!net == internet) && ($network == $null)) %!net = EFNet
raw 265:*Current local*:if ((%!net == internet) && ($network == $null)) %!net = EFNet
raw 251:*There are & users plus & invisible and & services on & servers:if ((%!net == internet) && ($network == $null)) %!net = IRCnet
raw 255:*I have & clients, & services and & servers:if ((%!net == internet) && ($network == $null)) %!net = IRCnet
; MOTD missing
raw 422:*:_fin.signon
; Start of MOTD
raw 375:*:_fin.signon
; End of MOTD
raw 376:*:_fin.signon
alias -l _fin.signon {
if (%-signon != progress) return
unset %-signon
if (%!net == internet) %!net = $iif(*.oz.org iswm $server,OzORG,$_cap1st($gettok($server,$count($server,.),46)))
; Determine services on network and approx. number of servers
tokenize 32 $read -tns [ $+ [ %!net ] ] script\netwfeat.dat
%!serv = $1
%!servopt = $2
%!servnick = $3-
var %num = $numtok(%!addon.i.signon,44)
:loop
if (%num) {
_blackbox $gettok(%!addon.i.signon,%num,44)
dec %num | goto loop
}
if ($_cfgi(fav.auto)) .timer 1 0 fav j x
_upd.title
}
alias _trackcode if (*!*@* !iswm %!myself) %!myself = $me | _Q.userhost _addself&n!&a _trackcode $me
alias _addself %!myself = $1