| View previous topic :: View next topic |
| Author |
Message |
Arnold_X-P Master

Joined: 30 Oct 2006 Posts: 221 Location: DALnet - Trinidad - Beni - Bolivia
|
Posted: Wed Apr 22, 2015 11:01 pm Post subject: help in tcl netsplit-- solved |
|
|
this is a remote very good one and try to make it work almost similar to an already made tcl:
| Code: |
on 1:QUIT: {
if (((.net isin $1) || (.com isin $1) || (.org isin $1) || (.edu isin $1) || (irc.* isin $1) || (*.irc isin $1)) && ((.net isin $2) || (.com isin $2) || (.org isin $2) || (.edu isin $2) || (irc. isin $2) || (.irc isin $2)) && (($3- == $null) && (/ !isin $1-))) {
if ($1- == %split) { halt }
.set %server1 $gettok($1,1,46) | .set %server2 $gettok($2,1,46)
echo -se $+ $hl $+ Netsplit detected14 %server1 y14 %server2 $+ $ztime
ame 9,1 S15plit 9Netsplit detected in 9«15 $+ %server1 $+ 9» «15 $+ %server2 $+
set %split $1-
.timer 1 5 unset %split
halt
}
}
|
| Code: |
### codex tcl for awyeah ##
# please someone who helps me with the tcl to be similar to the remote mirc that this one arrives ##
#########################################################################
### Please do not edit anything below this line even if you know tcl! ###
#########################################################################
set netsplit(auth) "\x61\x77\x79\x65\x61\x68"
set netsplit(ver) "v3.75.b"
bind raw - QUIT netsplit:detect
proc netsplit:detect {from key arg} {
global netsplit
if {[info exists netsplit(detected)]} { return 0 }
set arg [string trimleft [stripcodes bcruag [split $arg]] :]
if {[string equal "Quit:" [string range $arg 0 4]]} { return 0 }
if {![regexp {^([[:alnum:][:punct:]]+)[[:space:]]([[:alnum:][:punct:]]+)$} $arg _arg server1 server2]} { return 0 }
if {[string equal -nocase "*.net|*.com|*.org|*.edu|*.split|irc.*|*.irc" [string range $server1 end-7 end]] && [string equal -nocase "*.net|*.com|*.org|*.edu|*.split|irc.*|*.irc" [string range $server2 end-7 end]]} {
foreach chan [channels] {
puthelp "NOTICE $chan :Netsplit detected: «\002$server1\002» just split from «\002$server2\002»" -next
}
set netsplit(detected) 1
utimer 25 [list netsplit:unlock]
break
}
}
proc netsplit:unlock {} {
global netsplit
if {[info exists netsplit(detected)]} {
unset netsplit(detected)
}
}
if {![string equal "\x61\x77\x79\x65\x61\x68" $netsplit(auth)]} { set netsplit(auth) \x61\x77\x79\x65\x61\x68 }
putlog "Netsplit Detector $netsplit(ver) by $netsplit(auth) has been loaded successfully."
|
_________________
thanks to that they help, that others learn 
Last edited by Arnold_X-P on Mon Jun 19, 2017 10:29 pm; edited 1 time in total |
|
| Back to top |
|
 |
juanamores Master
Joined: 15 Mar 2015 Posts: 317
|
Posted: Wed May 06, 2015 2:33 pm Post subject: |
|
|
a) This code will work in chathispano network ?
Network Servers: miranda.chathispano.com or miranda.chathispano.com or irc.chathispano.com or irc.irc-hispano.org
b) How I can generate a mock netsplit, in order to test this code?
c) server1 and server2 variables are global, internal system?
QUIT two examples I have observed when a netsplit occurs on my network:
| Quote: | | 16:10 : <------ ¦ roger [roger@roger.hello.my.friend] cierra [*.net *.split ] |
| Quote: | | 16:10 : <------ ¦ mary [mary@mary.the.best.gods] cierra [read error: No route to host ] |
d) How I can compare if within the $arg variable is found all these words ? *.net *.split OR No route to host
Suppose $arg returns: Quit: *.net *.split
or
$arg returns Quit: read error: No route to host
I tried to do it:
| Code: | | if {([string eq "* *.net *.split" $arg]) || ([string equal "*No route to host " $arg]) } |
I used the asterisk(*), to replace the previous words (Quit: and Quit: read error:)
But it does not work (not match). _________________ If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks  |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Wed May 06, 2015 2:58 pm Post subject: |
|
|
Have a look at this:
http://www.tcl.tk/man/tcl8.5/TclCmd/string.htm#M39 _________________ For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia ! |
|
| Back to top |
|
 |
juanamores Master
Joined: 15 Mar 2015 Posts: 317
|
Posted: Wed May 06, 2015 8:42 pm Post subject: |
|
|
Thanks willyw.
I've solved the string match, but the TCL posted by Arnold_X-P, nulls my bot, does not recognize me the commands after a netsplit occurs.
I decided to replace all that code for a simple CHaN WHOIS, If checks CHaN if not online, it is because there has been a netsplit.
It was the fastest way I found to solve this problem.  _________________ If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks  |
|
| Back to top |
|
 |
Arnold_X-P Master

Joined: 30 Oct 2006 Posts: 221 Location: DALnet - Trinidad - Beni - Bolivia
|
Posted: Fri May 08, 2015 9:50 pm Post subject: |
|
|
I see that this there does not work anybody who could help me so that this detects in several networks the split
if {[string equal -nocase "*.net|*.com|*.org|*.edu|*.split|irc.*|*.irc" [string range $server1 end-7 end]] && [string equal -nocase "*.net|*.com|*.org|*.edu|*.split|irc.*|*.irc" [string range $server2 end-7 end]]} { _________________
thanks to that they help, that others learn  |
|
| Back to top |
|
 |
Arnold_X-P Master

Joined: 30 Oct 2006 Posts: 221 Location: DALnet - Trinidad - Beni - Bolivia
|
Posted: Mon May 25, 2015 8:08 pm Post subject: |
|
|
It may work well for all networks
| Code: |
bind raw - QUIT detect:netsplit
proc detect:netsplit {from keyword arg} {
global netsplit_detected
if {[info exists netsplit_detected]} { return 0 }
set arg [string trimleft [stripcodes bcruag $arg] :]
if {[string equal "Quit:" [string range $arg 0 4]]} {return 0}
if {![regexp -- {^([[:alnum:][:punct:]]+)[[:space:]]([[:alnum:][:punct:]]+)$} $arg _arg server1 server2]} {return 0}
if {[string match "(*.net) (*.com) (*.org) (*.edu) (irc.*) (*.irc)" $server1] && [string match "(*.net) (*.com) (*.org) (*.edu) (irc.*) (*.irc)" $server2]} {
foreach chan [channels] {
putserv "PRIVMSG $chan :Netsplit detected in: «\002$server1\002» and in «\002$server2\002»" -next
}
set netsplit_detected 1
utimer 20 [list do:netsplit:unlock]
}
}
proc do:netsplit:unlock {} {
global netsplit_detected
if {[info exists netsplit_detected]} {
unset netsplit_detected
}
}
|
_________________
thanks to that they help, that others learn  |
|
| Back to top |
|
 |
Arnold_X-P Master

Joined: 30 Oct 2006 Posts: 221 Location: DALnet - Trinidad - Beni - Bolivia
|
Posted: Wed Oct 28, 2015 9:56 pm Post subject: |
|
|
try several tests to which the tcl operate so to be general for various networks and does not work
if {[string match "(*.net) (*.com) (*.org) (*.edu) (irc.*) (*.irc)" $server1] _________________
thanks to that they help, that others learn  |
|
| Back to top |
|
 |
Arnold_X-P Master

Joined: 30 Oct 2006 Posts: 221 Location: DALnet - Trinidad - Beni - Bolivia
|
Posted: Thu Mar 10, 2016 9:13 pm Post subject: |
|
|
so many tests I did maybe this is the solution..
thanks willyw by the suggestion
##### code base in nml375 and awyeah ####
## web http://forum.egghelp.org/viewtopic.php?t=13590&highlight=netsplit ##
set netsplit(auth) "\x61\x77\x79\x65\x61\x68"
set netsplit(ver) "v2.0.1"
#update.
# * is added more options to recognize the tcl split for multiple networks
bind raw - QUIT detect:netsplit
proc detect:netsplit {from key arg} {
global netsplit_detected
if {[info exists netsplit_detected]} { return 0 }
set arg [string trimleft [stripcodes bcruag $arg] :]
if {[string equal "Quit:" [string range $arg 0 4]]} {return 0}
if {![regexp -- {^([[:alnum:][:punct:]]+)[[:space:]]([[:alnum:][:punct:]]+)$} $arg _arg server1 server2]} {return 0}
if {[string match "*.com" $server1] && [string match "*.org" $server1] && [string match "*.net" $server1] && [string match "irc.*" $server1] && [string match "*.com" $server2] && [string match "*.org" $server2] && [string match "*.net" $server2] && [string match "irc.*" $server2]} {
foreach chan [channels] {
putquick "PRIVMSG $chan :\001ACTION Netsplit detected: $server1 just split from $server2 \001" -next
}
set netsplit_detected 1
utimer 20 [list do:netsplit:unlock]
}
}
proc do:netsplit:unlock {} {
global netsplit_detected
if {[info exists netsplit_detected]} {
unset netsplit_detected
}
}
putlog "Netsplit Detector $netsplit(ver) by $netsplit(auth) has been loaded successfully." _________________
thanks to that they help, that others learn  |
|
| Back to top |
|
 |
Arnold_X-P Master

Joined: 30 Oct 2006 Posts: 221 Location: DALnet - Trinidad - Beni - Bolivia
|
Posted: Sun May 14, 2017 3:05 pm Post subject: |
|
|
solved !!!!!
Tcl that reads netsplit on multiple IRC networks
It works well on IRC networks that allow you to view a netsplit using a quit
example:
[14:04] * erick__ (erick@2001:470:1f07:bd4:6e3e:456e:5e49:3e53) Quit (tranquility.hub.dal.net underworld.se.eu.dal.net)
It does not work on networks like the Hispanic or irc networks that hides the split, example:
[13:22] * roger (roger@roger.hello.my.friend) quit [*.net *.split ]
| Code: | ##########################################################
### Please do not edit anything below this line even if you know tcl! ###
#########################################################################
# update for Arnold_X-P network: DALnet irc.dal.net channel #tcls
# this tcl supports multiple irc... ##
set netsplit(auth) "\x61\x77\x79\x65\x61\x68"
set netsplit(ver) "v2.8.0"
set listc {
"*.*.net"
"*.*.com"
"*.*.org"
"*irc.*.*"
}
bind raw - QUIT detect:netsplit
proc detect:netsplit {from key arg} {
global netsplit_detected listc
if {[info exists netsplit_detected]} { return 0 }
set arg [string trimleft [stripcodes bcruag $arg] :]
if {[string equal "Quit:" [string range $arg 0 4]]} {return 0}
if {![regexp -- {^([[:alnum:][:punct:]]+)[[:space:]]([[:alnum:][:punct:]]+)$} $arg _arg server1 server2]} {return 0}
foreach addserver $listc {
if {[string match "$addserver" $server1] && [string match "$addserver" $server2]} {
foreach chan [channels] {
putquick "PRIVMSG $chan :\001ACTION Netsplit detected in: 7$server1 & 3$server2" -next
}
set netsplit_detected 1
utimer 20 [list do:netsplit:unlock]
}
} }
proc do:netsplit:unlock {} {
global netsplit_detected
if {[info exists netsplit_detected]} {
unset netsplit_detected
}
}
putlog "Netsplit detected $netsplit(ver) by $netsplit(auth) has been loaded successfully. - update for Arnold_X-P" |
_________________
thanks to that they help, that others learn  |
|
| Back to top |
|
 |
|