bon vu que ça ne se bouscule pas, j'ai réussi à faire par exemple avec la commande de opage !!!! exemple :
j'ai testé et :
[20:13:22] <Tchatche-Bot> [20:13] select pseudo, pass from access where pseudo = 'Artefact' and pass = 'mayleen91'
[20:13:22] <Tchatche-Bot> [20:13] select pseudo, pass from access where pseudo = 'Artefact' and chan = '#aide'
[20:13:22] <Tchatche-Bot> [20:13] Punishing Tchatche-Land (deopped Artefact on #aide)
[20:13:22] <Tchatche-Bot> [20:13] Now deopping guest@ServAdmin.Tchatche-Land.fr (deopped Artefact on #aide)
Donc nickel!
Par contre, afin de mieux gerer les salons et accès, une personne saurait comment faut t-il procéder pour que la procédure de vérification fonctionne dans access/salon ?
car je souhaite plus tard faire les commandes adduser etc par salon et verif de nick ! (ou alors, dite moi que je me prend sans doute trop la tête à classer ca !)
Bien cordialement
tcl
##############
# CONFIGURATION #
##############
# -> Login
set sql(login) "XXX"
# -> Mot de passe
set sql(pass) "XXX"
# -> Nom de la base de donnée
set sql(db) "access"
# -> L'host a l'aquelle ce connecté
set sql(host) "127.0.0.1"
# -> Localisation de fichier mysql.sock
set sql(sock) "tmp/mysql.sock"
###########
# PAQUETAGE #
###########
catch {package require mysqltcl}
#######
# CODE #
#######
#########
# CONNECT #
#########
proc service:connect {} {
set ::mysqlink [mysqlconnect -host $::sql(host) -user $::sql(login) -password $::sql(pass) -sock $::sql(sock)]
mysqluse $::mysqlink $::sql(db)
}
###########
# DECONNECT #
###########
proc service:deconnect {} {
mysqlclose $::mysqlink; unset -nocomplain ::mysqlink
}
########
# ISAUTH #
########
proc isauth {arg} {
service:connect
set res [mysqlsel $::mysqlink "select statut from access where pseudo = '$arg' and statut = 'On'"]
service:deconnect
return $res
}
##########
# ISSUSPEND #
##########
proc issuspend {arg} {
service:connect
set res [mysqlsel $::mysqlink "select statut from access where pseudo = '$arg' and suspend = 'On'"]
service:deconnect
return $res
}
############
# ISVALIDUSER #
############
proc isvaliduser {arg} {
service:connect
set res [mysqlsel $::mysqlink "select pseudo from access where pseudo = '$arg'"]
service:deconnect
return $res
}
################
# ISVALIDPASSWORD #
################
proc isvalidchan {mot1 mot2} {
service:connect
set res [mysqlsel $::mysqlink "select pseudo, pass from access where pseudo = '$mot1' and chan = '$mot2'"]
putlog "select pseudo, pass from access where pseudo = '$mot1' and chan = '$mot2'"
service:deconnect
return $res
}
################
# ISVALIDPASSWORD #
################
proc isvalidpassword {mot1 mot2} {
service:connect
set res [mysqlsel $::mysqlink "select pseudo, pass from access where pseudo = '$mot1' and pass = '$mot2'"]
putlog "select pseudo, pass from access where pseudo = '$mot1' and pass = '$mot2'"
service:deconnect
return $res
}
########
# AUTH #
########
proc auth {arg} {
service:connect
mysqlsel $::mysqlink "UPDATE `access` SET `statut` = 'On' WHERE pseudo = '$arg'"
service:deconnect
}
#######
# AUTH #
#######
bind msg - xauth msg:xauth
proc msg:xauth {nick host hand arg} {
set mot1 [lindex $arg 0]
set mot2 [lindex $arg 1]
if { $mot1 == "" || $mot2 == "" } { puthelp "NOTICE $nick :Commande auth : /msg $::botnick auth <pseudo> <pass>"; return 0 }
if { ![isvaliduser $mot1] } { puthelp "NOTICE $nick :$mot1 user inconnue !"; return 0 }
if { [isvalidpassword $mot1 $mot2] } {
if { [issuspend $mot1] } { puthelp "NOTICE $nick :Accés suspendu"; return 0 }
if { [isauth $mot1] } { puthelp "NOTICE $nick :Vous êtes déjà identifié !"; return 0 }
puthelp "NOTICE $nick :Félicitation, vous êtes identifier"
auth $mot1
} else {
puthelp "NOTICE $nick :Erreur, mot de passe incorrect."; return 0
}
}
#######
# op #
#######
bind msg - op msg:op
proc msg:op {nick host hand arg} {
set mot1 [lindex $arg 0]
set mot2 [lindex $arg 1]
set mot3 [lindex $arg 2]
set sql(db) "access"
putlog "$mot1 $mot2 $mot3"
if { $mot1 == "" || $mot2 == "" } { putquick "NOTICE $nick :Commande auth : /msg $::botnick auth <pass> <chan>"; return 0 }
set ::mysqlink [mysqlconnect -host $::sql(host) -user $::sql(login) -password $::sql(pass) -sock $::sql(sock)]
mysqluse $::mysqlink $::sql(db)
if { ![isvaliduser $nick] } { return 0 }
if { ![isvalidpassword $nick $mot1] } { putquick "NOTICE $nick :Erreur, mot de passe incorrect $mot1 $mot2"; return 0 }
if { ![isvalidchan $nick $mot2] } { putquick "NOTICE $nick :Vous n'avez pas accès à $mot2"; return 0 }
if { [issuspend $mot1] } { putquick "NOTICE $nick :Votre accés est suspendu !"; return 0 }
putquick "mode $mot2 +o $nick"
}
j'ai testé et :
[20:13:22] <Tchatche-Bot> [20:13] select pseudo, pass from access where pseudo = 'Artefact' and pass = 'mayleen91'
[20:13:22] <Tchatche-Bot> [20:13] select pseudo, pass from access where pseudo = 'Artefact' and chan = '#aide'
[20:13:22] <Tchatche-Bot> [20:13] Punishing Tchatche-Land (deopped Artefact on #aide)
[20:13:22] <Tchatche-Bot> [20:13] Now deopping guest@ServAdmin.Tchatche-Land.fr (deopped Artefact on #aide)
Donc nickel!
Par contre, afin de mieux gerer les salons et accès, une personne saurait comment faut t-il procéder pour que la procédure de vérification fonctionne dans access/salon ?
car je souhaite plus tard faire les commandes adduser etc par salon et verif de nick ! (ou alors, dite moi que je me prend sans doute trop la tête à classer ca !)
Bien cordialement