Code: Select all
set usernameX "hide"
set passeX "hide"
set LoginOnX 0
bind need - "% op" LoginChan
proc LoginChan { chan type } {
global ChanAccess LoginOnX
if {[info exists ChanAccess([strlwr $chan])] && [onchan X $chan] && $LoginOnX } { LoginOnChanX $chan }
return 0
}
# lecture fichier
if {[file exists "${botnet-nick}.login.txt"]} {
set f [open ${botnet-nick}.login.txt r]
while {[gets $f line] >= 0} {
if {![string match #* [lindex $line 0]]} {
set usernameX [lindex $line 0]
set passeX [lindex $line 1]
} {
set ChanAccess([lindex $line 0]) 0
}
}
close $f
}
# Connexion sur le serveur
bind raw - 001 connectX
proc connectX {server numeric servermsg} {
global usernameX passeX LoginOnX
set LoginOnX 0
putlog "Connexion sur le serveur $server"
if {$usernameX != ""} { utimer 30 LoginOnX }
}
# bind
bind dcc m +login +login
proc +login {hand idx text} {
global ChanAccess usernameX passeX
if {![string match #* [lindex $text 0]]} {
if {[llength $text] != 2} {
putdcc $idx "Usage : .+login <username> <passe>"
return 0
}
if { $usernameX != "" } {
putdcc $idx "Il y a déjà un username existant. Essayez .login"
return 0
}
set usernameX [lindex $text 0]
set passeX [lindex $text 1]
putlog "Le login et le username sur X ont été ajoutés par $hand"
} else {
if {[llength $text] != 1} {
putdcc $idx "Usage : .+login <#chan>"
return 0
}
set chan [strlwr [lindex $text 0]]
if {[info exists ChanAccess($chan)]} {
putdcc $idx "$chan est déjà valide. Essayez .login"
return 0
}
putlog "Le login et l'auto-op sur X sur le chan $chan ont été ajoutés par $hand"
set ChanAccess($chan) 0
}
SaveX
return 1
}
bind dcc m -login -login
proc -login {hand idx text} {
global ChanAccess usernameX passeX
if {![string match #* [lindex $text 0]]} {
if {[llength $text] < 1} {
putdcc $idx "Usage : .-login <username>"
return 0
}
if { $usernameX != [lindex $text 0] } {
putdcc $idx "le username [lindex $text 0] n'est pas valide. Essayez .login"
return 0
}
set usernameX ""
putlog "Le login et le username sur X ont été enlevés par $hand"
} else {
if {[llength $text] != 1} {
putdcc $idx "Usage : .-login <#chan>"
return 0
}
set chan [strlwr [lindex $text 0]]
if {![info exists ChanAccess($chan)]} {
putdcc $idx "$chan n'est pas valide. Essayez .login"
return 0
}
catch {unset ChanAccess($chan)}
putlog "Le login et l'auto-op sur X sur le chan $chan ont été supprimés par $hand"
}
SaveX
return 1
}
bind dcc m login login
proc login {hand idx text} {
global ChanAccess usernameX passeX
putlog "#$hand# login"
putdcc $idx " login sur X "
putdcc $idx "Usage : .+login <#chan> ou .+login <username> <passe> ou .-login <#chan> ou .-login <username>"
putdcc $idx ""
putdcc $idx "Liste des accès :"
foreach a [array name ChanAccess] { putdcc $idx "chan : $a" }
if { $usernameX != ""} { putdcc $idx "username : $usernameX - password : $passeX" }
putdcc $idx ""
}
proc SaveX {} {
global {botnet-nick} ChanAccess usernameX passeX LoginOnX
set f [open ${botnet-nick}.login.txt w]
foreach a [array name ChanAccess] { puts $f $a }
if { $usernameX != ""} {
puts $f "$usernameX $passeX"
if {!$LoginOnX} { LoginOnX }
}
close $f
}
# Procédure de login sur X
proc LoginOnX { } {
global usernameX passeX LoginOnX ChanAccess
foreach t [timers] {
if {[lindex $t 1] == "LoginOnX"} {killtimer [lindex $t 2] }
}
if {[onchan X]} {
if {!$LoginOnX } {
putlog "Xlogin.tcl : Lancement du login sur X"
putserv "PRIVMSG X@channels.undernet.org :LOGIN $usernameX $passeX"
}
} {
if {$LoginOnX} {
set LoginOnX 0
foreach chan [array name ChanAccess] {
set ChanAccess($chan) 0
}
}
}
timer 1 LoginOnX
return 0
}
proc LoginOnChanX { chan } {
global ChanAccess
if {![botisop $chan]} {
putlog "XLogin.tcl : lancement d'une requête op à X sur $chan"
putserv "PRIVMSG X :OP $chan"
}
set ChanAccess($chan) 1
return 0
}
bind notc - "AUTHENTIFICATION RÉUSSIE pour*" LoginSuccessX
bind notc - "AUTHENTICATION SUCCESSFUL as*" LoginSuccessX
bind notc - "Sorry, You are already authenticated as*" LoginSuccessX
bind notc - "Désolé. Vous êtes déjà authentifié sous le nom d'utilisateur*" LoginSuccessX
proc LoginSuccessX {nick host hand texte dest} {
global LoginOnX ChanAccess
if {![validchan $dest]} {
set LoginOnX 1
foreach chan [array name ChanAccess] {
if {[validchan $chan]} { LoginOnChanX $chan }
}
}
return 0
}
bind notc - "Sorry, You must be logged in to use this command." NotLoginX
bind notc - "AUTHENTICATION FAILED*" NotLoginX
proc NotLoginX {nick host hand texte dest} {
global LoginOnX
if {![validchan $dest]} {set LoginOnX 0}
return 0
}
bind splt - *cservice@undernet.org signoffX
bind sign - *cservice@undernet.org signoffX
proc signoffX {cserv uhost handl chan {reason "*split"}} {
global LoginOnX
set LoginOnX 0
return 0
}
putlog "Xlogin.tcl v2.0 by Thor - Tapez .login pour l'aide - Date: 18-08-02"
Make sure alltools.tcl is in your ~scripts folder and that it is loaded. Your "error" will be fixed.##### SCRIPTS #####
# This is a good place to load scripts to use with your bot.
# This line loads script.tcl from the scripts directory inside your Eggdrop's
# directory. All scripts should be put there, although you can place them where
# you like as long as you can supply a fully qualified path to them.
#
# source scripts/script.tcl
source scripts/alltools.tcl
source scripts/action.fix.tcl