1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
|
# Third Eye - netsplit/rejoin detection stuff
@ max[split] = max[split]!=[]?max[split]:total_splits
^on ^hook "server_found %" {
^local tsc
@ tsc = rmatch($1 $mkgenlist(split 2))
if (tsc) {
@tsc--
if (split[$tsc][1]==lastsplit) { ^assign -lastsplit }
teecho NetRejoin: $nborders\[$ccl$cbold$split[$tsc][1]$nborders\/$ccl$cbold$split[$tsc][2]$nborders\]$ccl
remfromlist split $tsc
compresslist split
}
}
alias netscan {
if (isconnected()) {
for (@ nscount = 0, nscount < max[split], @ nscount++) {
if (isalpha($split[$nscount][2])) {
if (nscount == (rmatch($split[$nscount][2] $mkgenlist(split 2)) - 1)) {
^quote ping $S $split[$nscount][2]
}
}{
teecho Removing split server $cbold$c7$split[$nscount][2]$cnorm from split list \(undetectable rejoin\)
remfromlist split $nscount
compresslist split
}
}
}{
//^timer -refnum lagmeter 60 lagmeter
}
if (max[split]) {
timer $nsint netscan
}{
^assign -lastsplit
}
}
alias ss { lssplit }
alias lssplit {
^local acount
if (max[split]) {
echote1 Current NetSplits$cbold\:$cnorm
for (@ acount = 0, acount < max[split], @ acount++) {
echote2 $cbold${acount + 1}$(cnorm): $nborders\[$cbold$c7$split[$acount][1]$nborders\/$cbold$c7$split[$acount][2]$nborders\] \($cbold$c7$split[$acount][3]$nborders\)$ccl
}
echote2 Network is currently being scanned for rejoins every $cbold$nsint$cnorm seconds.
}{
teecho No NetSplits currently in memory.
}
}
alias rmsplit {
^local sn ${[$0] - 1}
if (split[$sn][1]) {
remfromlist split $sn
compresslist split
teecho Split #$cbold$sn$cnorm removed from list.
}{
usage rmsplit Misc
}}
^on ^channel_signoff "% % %.% %.*" {
if (!rmatch($3 $mkgenlist(split 2))) {
if ([$2]!=[$3]&&c_convert($2)) {
teecho \($cbold$Z$cnorm\) NetSplit detected of $cbold$2$cnorm and $cbold$3$cnorm
teecho $cbold\^R${1 + max[split]}$cnorm to change servers to $c3$3$cnorm
@ split[$max[split]][1] = [$2]
@ split[$max[split]][2] = [$3]
@ split[$max[split]][3] = Z
@ lastsplit = [$2]
@ max[split]++
if (max[split] == 1) {
if (nsdetect) {
timer 5 netscan
}
}
}
}
if (nsdisp) {
if ([$2]!=[$3]&&c_convert($2)) {
teecho NetSplit Signoff: $cbold$1$cnorm
}{
echote Signoff: $nick$1$nborders\[$ccl$2-$nborders\]$ccl
}
}
}
alias nstime {
@ nsint = [$0]>[0]?[$0]:nsint
teecho Currently scanning the network every $cbold$nsint$cnorm seconds.
}
alias c_convert {
^local cval
if (cachens) {
if (genget($0 nscache 0)>=0) {
@ function_return = 1
}{
@ cval = convert($0)
if (cval) {
loadnscache
@ nscache[$max[nscache]][0] = [$0]
@ nscache[$max[nscache]][1] = cval
@ max[nscache]++
makenscache
@ function_return = 1
}{
@ function_return = 0
}
}{
@ function_return = convert($*)
}
}
}
|