Peace & Protection 4.00 — File Browser
PeaceProtection4.00v4.0 / PeaceProtection4.00v4.0 / SCRIPT / NOTIFY.MRC
NOTIFY.MRC — 6.83 KB — Download this file
; #= P&P -rs
; ########################################
; Peace & Protection
; Notify routines and scripts
; ########################################
;
; Notify
;
on ^*:NOTIFY:{
%-notify.nick. [ $+ [ $nick ] ] = $nick
if (%`notify.win == off) return
%-notifychk = $addtok(%-notifychk,$nick,32)
if ($numtok(%-notifychk,32) == 5) _do.n.userhost
else .timer.notify.userhost -m 1 500 _do.n.userhost
halt
}
alias _do.n.userhost _linedance _Q.userhost _run.notify&n&a&h&n!&a halt %-notifychk | .timer.notify.userhost off | unset %-notifychk
alias _run.notify {
%-notify.nick. [ $+ [ $1 ] ] = $1
if ($1 == $me) { %-notify.hid. [ $+ [ $1 ] ] = 1 | return }
var %mask = $gettok($notify($1).note,1,32)
if ((* isin %mask) || (@ isin %mask) || ($left(%mask,1) == $)) var %note = $gettok($notify($1).note,2-,32)
else var %note = $notify($1).note
if ($ isin %mask) {
if ($left(%mask,1) == $) { var %net = $right(%mask,-1) | %mask = 0 }
else { var %net = $gettok(%mask,2-,36) | %mask = $gettok(%mask,1,36) }
if (* isin %net) {
%net = * $+ %net $+ *
if (%net !iswm $server) { %-notify.hid. [ $+ [ $1 ] ] = 1 | return }
}
elseif (%net != %!net) { %-notify.hid. [ $+ [ $1 ] ] = 1 | return }
}
if (%mask) { %mask = * $+ %mask $+ * | var %match = $iif(%mask iswm $4,match,fail) }
else var %match = nocheck
if (%-notify.on. [ $+ [ $1 ] ] == $null) %-notify.on. [ $+ [ $1 ] ] = $ctime $2 %match
else %-notify.on. [ $+ [ $1 ] ] = $gettok(%-notify.on. [ $+ [ $1 ] ] ,1,32) $2 %match
if (%match == fail) upd.nick.comchan $1
if (%`notify.win == none) return
var %show = $_cfgi(notify. [ $+ [ %match ] ] )
if (%show == hide) return
if (%show == ext) <notify.ext> $1 $2 $3 $4 %`notify.win %match %note
else <notify.short> $1 $2 $3 $4 %`notify.win %match %note
if ($_cfgi(notify.beep [ $+ [ %match ] ] )) { beep 1 1 | flash Notify- $1 $gettok((verified) (wrong address),$findtok(match fail,%match,1,32),32) }
_recseen user $1
if (%note != $null) %note = ( $+ %note $+ )
if (%match == nocheck) var %how = .
elseif (%match == match) var %how = , address verified.
else var %how = , address check $:b(failed) $+ .
_away.logit @ 8 (notify) »»» $1 on IRC $+ %how %note $iif($3 == -,(away),(not away))
;;; thunk in halting of duplicates
if ($notify($1).sound) .splay " $+ $ifmatch $+ "
else _ssplay $iif(%match == fail,fakenotify,realnotify)
if ($notify($1).whois) whois $1
}
on ^*:UNOTIFY:{
if ($gettok(%-notify.on. [ $+ [ $nick ] ] ,1,32) isnum) var %time = $calc($ctime - $ifmatch)
else var %time = 0
var %addr = $gettok(%-notify.on. [ $+ [ $nick ] ] ,2,32),%nick = %-notify.nick. [ $+ [ $nick ] ],%match = $gettok(%-notify.on. [ $+ [ $nick ] ] ,3,32)
if (%addr == $null) %addr = ??
if (%match == $null) %match = nocheck
unset %-notify.on. $+ $nick %-notify.nick. $+ $nick
if (%`notify.win == off) return
if ((%-notify.hid. [ $+ [ $nick ] ] ) || (%nick == $null)) { unset %-notify.hid. $+ $nick | halt }
if (%`notify.win == none) return
var %show = $_cfgi(unotify. [ $+ [ %match ] ] )
if (%show == hide) halt
if ($_cfgi(unotify.part)) var %color = $colour(quit)
else var %color = $colour(notify)
if (%show == ext) <unotify.ext> %nick %addr %time %color %`notify.win %match
else <unotify.short> %nick %addr %time %color %`notify.win %match
_recseen user %nick +
_away.logit @ 8 (notify) ««« %nick left IRC (on $_dur(%time) $+ ) $iif($6 == match,(verified address),$iif($6 == fail,(failed address check),$chr(32)))
_ssplay $iif(%match == fail,fakeunotify,realunotify)
halt
}
;
; Notify
;
; /notif nick [more nicks]
; Adds/Edits notify list entry(s)
alias notif {
set %.param $_ncs(32,$1-)
:loop
set %.param $$dialog(addnotif,addnotif,-4)
goto loop
}
dialog addnotif {
title "Notify"
size -1 -1 230 260
text "A&dding", 201, 5 9 35 20
edit "", 1, 42 5 100 22, autohs
text "to notify list:", 202, 146 9 60 20
radio "on &all networks", 2, 22 30 90 16
radio "&only for", 3, 22 50 55 16
edit "", 4, 79 47 100 22, autohs
text "network", 203, 182 51 40 20
text "&Mask to match address against:", 204, 5 90 200 20
combo 5, 22 110 200 100, drop edit
check "&Whois user on notify", 6, 22 134 200 16
text "&User note:", 205, 5 170 200 20
edit "", 7, 21 188 202 22, autohs
button "OK", 101, 5 230 70 25, OK default
button "Cancel", 102, 80 230 70 25, cancel
button "&Remove", 103, 154 230 70 25
edit "", 241, 1 1 1 1, hide autohs
edit "", 242, 1 1 1 1, hide autohs result
}
on *:DIALOG:addnotif:init:*:{
var %net,%mask,%note,%addr,%nick = $gettok(%.param,1,32)
if (! isin %nick) { %addr = %nick | %nick = $gettok(%nick,1,33) }
elseif ($address(%nick,5)) %addr = $ifmatch
elseif (($query(%nick).address != $null) && ($query(%nick).address != %nick)) %addr = %nick $+ ! $+ $ifmatch
elseif (%nick) %addr = *! $+ %nick $+ @*
did -a $dname 1 %nick
; Saves original nick and any extra params
did -a $dname 241 %nick
did -a $dname 242 $gettok(%.param,2-,32)
unset %.param
if (%!net) did -a $dname 4 %!net
if ($notify(%nick)) {
did -a $dname 201 &Editing
did -a $dname 202 in notify list:
if ($notify(%nick).whois) did -c $dname 6
%note = $notify(%nick).note
%mask = $gettok(%note,1,32)
if ((* isin %mask) || (@ isin %mask) || ($left(%mask,1) == $)) {
%note = $gettok(%note,2-,32)
if ($ isin %mask) {
%mask = @ $+ %mask
%net = $gettok(%mask,2-,36)
%mask = $right($gettok(%mask,1,36),-1)
}
}
did -a $dname 7 %note
if (%net) {
did -o $dname 4 1 %net
did -c $dname 3
}
else {
did -c $dname 2
did -b $dname 4
}
}
else {
did -b $dname 103,4
did -c $dname 2
}
did -f $dname $iif(%nick,5,1)
if (%mask) did -ca $dname 5 %mask
else did -ca $dname 5 None
if (* isin %addr) { if (%addr != %mask) did -a $dname 5 %addr }
elseif (%addr) _ddaddm $dname 5 %addr 002 022 030 011
}
on *:DIALOG:addnotif:sclick:2:did -b $dname 4
on *:DIALOG:addnotif:sclick:3:did -e $dname 4
on *:DIALOG:addnotif:sclick:101:{
if ($did(1)) {
var %mask = $did(5)
if (%mask == None) var %mask
elseif ((@ !isin %mask) && (* !isin %mask)) %mask = * $+ %mask $+ *
if (($did(3).state) && ($did(4))) %mask = %mask $+ $ $+ $did(4)
%mask = %mask $did(7)
if ($notify($did(241))) {
if (($did(1) == $did(241)) && ($notify($did(241)).note == %mask) && ($_tf($notify($did(241)).whois) == $did(6).state)) return
.notify -r $did(241)
upd.nick.nickbit $did(241)
.notify -r $did(1)
}
notify $iif($did(6).state,+) $+ $did(1) %mask
upd.nick.nickbit $did(1)
}
}
on *:DIALOG:addnotif:sclick:103:notify -r $did(241) | did -r $dname 1 | upd.nick.nickbit $did(241) | dialog -k $dname