namespace eval ::socks {
variable aurore
#********************#
# Service.Socket 1.0 #
#********************#
#**************************#
# Information link reseau. #
#**************************#
set aurore(serv) "Aurore.****.fr"
set aurore(ip) "ip"
set aurore(port) "port"
set aurore(pwdlink) "pass"
set aurore(info) "Aurore Services"
#****************************#
# Configuration des sockets. #
#****************************#
set aurore(nick) "Hera"
set aurore(identd) "Hera"
set aurore(host) "Services.****.fr"
set aurore(nom) "Services-Log"
#***************************#
# Salon de log des sockets. #
#***************************#
set aurore(log) "#Services"
set aurore(quit01) "Redemarage Aurore-Service."
set aurore(quit02) "Fermeture Aurore-Service."
#****************************************#
# Lancement de la procédure des sockets. #
#****************************************#
utimer 1 [namespace current]::checkconnect
proc checkconnect {} {
if {![info exists aurore(idx)]} { utimer 30 [namespace current]::checkconnect } else { xconnect:serv }
}
proc xconnect:serv {} {
variable aurore
set aurore(idx) "[connect $::socks::aurore(ip) $::socks::aurore(port)]"
putdcc $aurore(idx) "PASS $::socks::aurore(pwdlink)"
putdcc $aurore(idx) "SERVER $::socks::aurore(serv) 1 [unixtime] [unixtime] J09 ACAA\] +s :$::socks::aurore(info)"
putdcc $aurore(idx) ":$::socks::aurore(serv) NICK $::socks::aurore(nick) '' '' $::socks::aurore(identd) $::socks::aurore(host) $::socks::aurore(serv) '' :$::socks::aurore(nom)"
putdcc $aurore(idx) ":$::socks::aurore(nick) MODE $::socks::aurore(nick) +owsgkd"
putdcc $aurore(idx) ":$::socks::aurore(nick) JOIN $::socks::aurore(log)"
putdcc $aurore(idx) ":$::socks::aurore(nick) MODE $::socks::aurore(log) +ntsv $::socks::aurore(nick)"
control $aurore(idx) [namespace current]::controling_server
utimer 10 [namespace current]::verify
}
#***********************************#
# Verify si le serveur est Connecté #
#***********************************#
proc verify {} {
variable aurore
if [valididx [set [namespace current]::aurore(idx)]] {
utimer 30 [namespace current]::verify
} else {
xconnect:serv
}
}
proc valididx {idx} {
variable aurore
set r 0
foreach j [dcclist] {
if {[lindex $j 0] == $idx} {
set r 1
}
}
return $r
}
proc controling_server {idx arg} {
variable aurore
regsub -all {\\} $arg {\\\\} arg
regsub -all {\{} $arg {\{} arg
regsub -all {\}} $arg {\}} arg
regsub -all {\]} $arg {\]} arg
regsub -all {\[} $arg {\[} arg
regsub -all {\"} $arg {\"} arg
regsub -all {\`} $arg {\`} arg
set arg1 "[lindex $arg 0]"
set arg2 "[lindex $arg 1]"
set arg3 "[lindex $arg 2]"
set arg4 "[lindex $arg 3]"
set arg5 "[lindex $arg 4]"
set arg6 "[lindex $arg 5]"
set arg7 "[lindex $arg 6]"
set arg8 "[lindex $arg 7]"
set arg10 "[string trim [lrange $arg 3 end] :]"
if {$arg2=="PING"} {
putdcc $aurore(idx) ":$::socks::aurore(serv) PONG $::socks::aurore(ip) :$::socks::aurore(serv)"
}
}
#**********************#
# Restart des sockets. #
#**********************#
bind evnt - prerestart [namespace current]::eva:restart
proc eva:restart {args} {
variable aurore
putdcc $aurore(idx) ":$::socks::aurore(serv) SQUIT $::socks::aurore(serv) :Restart Sockets."
}
#********************#
# Rehash du Service. #
#********************#
bind dcc n "xrehash" [namespace current]::eggy:xrehash
proc eggy:xrehash {nick idx arg} {
variable aurore
putdcc $idx "\002Rehash de Aurore-Service et des fichiers\002"
utimer 4 rehash
}
#*********************#
# Restart du Service. #
#*********************#
bind dcc n "xrestart" [namespace current]::eggy:xrestart
proc eggy:xrestart {nick idx arg} {
variable aurore
putdcc $idx "\002Redémarrage de Aurore-service\002"
if [valididx [set [namespace current]::aurore(idx)]] {
putdcc $aurore(idx) ":$aurore(nick) QUIT :::socks::$aurore(quit01)"
putdcc $aurore(idx) ":$aurore(serv) SQUIT :$::socks::aurore(serv)"
foreach kill [utimers] {
if {[lindex $kill 1]=="verification"} { killutimer [lindex $kill 2] }
}
}
xconnect:serv
}
#*****************#
# Die du Service. #
#*****************#
bind dcc n "xdie" [namespace current]::eggy:xdie
proc eggy:xdie {nick idx arg} {
putdcc $idx "\002Arrêt de Aurore-Service\002"
if [valididx [set [namespace current]::aurore(idx)]] {
putdcc $aurore(idx) ":$aurore(nick) QUIT : $aurore(quit02)"
putdcc $aurore(idx) ":$aurore(serv) SQUIT :$aurore(quit02)"
foreach kill [utimers] {
if {[lindex $kill 1]=="verification"} { killutimer [lindex $kill 2] }
}
}
}
#****************************#
# Fin du Service Sockets 1.0 #
#****************************#
}
putlog "\0031Service Sockets 1.0 \0034Chargé."