I am trying to accomplish this thing. Err well it works as detects users splitting with a quit message, and then it has to display on all channels the bot is on that a netsplit has occurred.
So this netsplit detection is for DALnet and it is detected by the quit message of the user. The netsplit cannot be faked. This is the message to detect a netsplit.
This is the script which I came up with, but it doesn't seems to work or give any response whatsoever. Any suggestions?* spliff (~spliff@adslfixo-b3-127-230.telepac.pt) Quit (brain.hub.eu.dal.net hotspeed.sg.as.dal.net)
* ismokealo (~ismokealo@c-71-201-208-32.hsd1.il.comcast.net) Quit (brain.hub.eu.dal.net hotspeed.sg.as.dal.net)
* bamford6 (~bamford6@user-544487d3.lns5-c10.dsl.pol.co.uk) Quit (brain.hub.eu.dal.net hotspeed.sg.as.dal.net)
Code: Select all
bind sign - "*" detect:netsplit
proc detect:netsplit {nick uhost hand chan text} {
global detect_netsplit
if {[info exists detect_netsplit]} { return 0 }
if {[string equal "Quit:" [string map {" " ""} [lindex $text 0]]]} { return 0 }
if {[string equal "2" [llength $text]] && [regexp {^(.*) (.*)$} $text] && [string is lower [string map {"." "" " " ""} $text]] && ([regexp -all {[0-9]} $text]] == "0") && ([regexp -all {\.} [lindex $text 0]] >= 3) && ([regexp -all {\.} [lindex $text 1]] >= 3)} {
set server1 [string map {" " "."} [lrange [split [lindex $text 0] "."] [expr [llength [split [lindex $text 0] "."]] - 2] end]]
set server2 [string map {" " "."} [lrange [split [lindex $text 1] "."] [expr [llength [split [lindex $text 1] "."]] - 2] end]]
if {[string equal "dal.net" $server1] && [string equal "dal.net" $server2]} {
foreach chan [channels] {
putquick "PRIVMSG $chan :Netsplit detected: $server1 just split from $server2" -next
set detect_netsplit 1; utimer 20 [list "unset detect_netsplit"]
}
}
}
}