Written by weaver aka solo irccompanionATgmail.com
A project by recelate. www.recelate.net
URL http://www.mircscripts.org/comments.php?cid=3923
*** /servernotify enables users to have a notify list for other servers without opening a whole new connection
it will work exactly like /notify and will execute on start, and will let you know when watched users come and go on IRC.
if you use this for a server you are already connected on it could cause one notify to go off depending on server.
This is only useful if you want to keep tabs on a user on another network, otherwise use mIRC's /notify.
if the user is not on IRC it will notify you when the user comes on irc.
;*Usage***
/servernotify server nick ;this will add a user
/servernotify -r server nick ;this will delete a user
/servernotify on
/servernotify off
/notify_check -f forces a notify list for all server's in your list
without the -f switch it will just check servers you are not connected to.
;#################
;#################
;Written by weaver aka solo irccompanionATgmail.com
;A project by recelate. www.recelate.net
;URL http://www.mircscripts.org/comments.php?cid=3923
;*** /servernotify enables users to have a notify list for other servers without opening a whole new connection
;it will work exactly like /notify and will execute on start, and will let you know when watched users come and go on IRC.
;if you use this for a server you are already connected on it could cause one notify to go off depending on server.
;This is only useful if you want to keep tabs on a user on another network, otherwise use mIRC's /notify.
;if the user is not on IRC it will notify you when the user comes on irc.
;***********Usage*************
;/servernotify server nick ;this will add a user
;/servernotify -r server nick ;this will delete a user
;/servernotify on
;/servernotify off
;/notify_check -f forces a notify list for all server's in your list
;without the -f switch it will just check servers you are not connected to.
on *:start: if ($group(#server.notify) == on) notify_check -f
alias servernotify {
if $regex($1,/(on|off|-r)/g) {
$iif(($1 == off),.disable #server.notify,.enable #server.notify))
$iif($1 != -r,echo 3 -a * servernotify is $iif(($1 == on),on,off)))
if ($sock($+(servernotify,$1))) { sockwrite -n $v1 $upper(watch c) }
if ($1 == -r) {
if ($sock($+(servernotify,$1))) { sockwrite -n $v1 $upper(watch) $+(-,$3) }
var %line = $+($hget(servernotify,$2)),%nwline = $remtok(%line,$3,32)
echo 3 -a $iif(!$istok(%line,$3,32), * /servernotify: $3 not in list,* Removed $3 from server notify list)
$iif($istok(%line,$3,32),.hadd servernotify $2 %nwline)
}
return
}
if ($numtok($1-,32) < 2) { echo $color(info) -a * /servernotify: insufficient parameters. | return }
if ($left($1,3) != irc) && ($left($1,2) !isnum) { echo $color(info) -a * /servernotify insufficient parameters | return }
if !$hget(servernotify) { .hmake servernotify 10 }
var %inf = $hget(servernotify,$1),%sock = $+(servernotify,_,$1)
if ($istok(%inf,$2,32)) { echo 3 -a * /servernotify: $2 is already in list | return }
.hadd servernotify $1 $2 %inf
echo 3 -a * Added $2 to server_notify list for $1
.hsave $str(servernotify $+ $chr(32),2)
if ($sock(%sock)) { sockwrite -n %sock $upper(watch) $+(+,$2) }
else {
sockopen %sock $1 6667
sockmark $+(servernotify_,$1) $1
}
}
alias notify_check {
if ($group(#server.notify) == off) { echo 3 -a * /servernotify: error notify is off | return }
if ($isfile(servernotify)) && (!$hget(servernotify)) { .hmake servernotify 10 | .hload $str(servernotify $+ $chr(32),2) }
if ($$1 == -f) { sockclose servernotify* }
var %i = 1
while $hget(servernotify,%i).item {
var %srv = $v1
if (!$sock($+(servernotify,%srv))) { sockopen $+(servernotify_,%srv) %srv 6667 }
sockmark $+(servernotify_,%srv) %srv
inc %i
}
}
#server.notify on
on *:sockopen:servernotify*:{
if ($sockerr) { echo $color(info) -a * /servernotify: error connecting to $gettok($sockname,2,95) | return }
sockwrite -n $sockname $upper(nick) notify $+ $right($ticks,4)
sockwrite -n $sockname $upper(user) servernotify . . servernotifybot
}
on *:sockread:servernotify*: {
var %tmpdata
sockread %tmpdata
tokenize 32 %tmpdata
;echo 5 -a %tmpdata
if ($1 == ping) { sn_sockwrite $upper(pong) $2 }
if ($2 == 376) {
var %sock = $gettok($sock($sockname).mark,1,32))
sn_sockwrite $upper(watch c) $sn($gettok($sock($sockname).mark,1,32))) S
}
if ($2 == $sn_on) { echo $color(notify) -ta * $4 $+([,$5,@,$6,]) is on $gettok($sock($sockname).mark,1,32)) }
if ($2 == $sn_logon) { echo $color(notify) -ta * $4 $+([,$5,@,$6,]) is on $gettok($sock($sockname).mark,1,32)) }
if ($2 == $sn_logoff) { echo $color(notify) -ta * $4 $+([,$5,@,$6,]) has left $gettok($sock($sockname).mark,1,32)) }
}
#server.notify end
alias -l sn_sockwrite {
if ($sock($sockname).status == active) {
sockwrite -n $sockname $1-
}
}
alias -l sn_on { return 604 }
alias -l sn_logon { return 600 }
alias -l sn_logoff { return 601 }
alias -l sn {
var %inf = $+($hget(servernotify,$1)),%cr = $+($chr(32),+)
return + $+ $replace(%inf,$chr(32),%cr)
}