Communauté Eggdrop

Version complète : Fonction isidentified
Vous consultez actuellement la version basse qualité d’un document. Voir la version complète avec le bon formatage.
J'ai une condition dans une procédure qui doit s'effectuer quand l'utilisateur est identifié auprès de NickServ:

tcl
bind join - * [namespace current]::joincertif
proc joincertif { nick host hand chan } {
 
lassign [split $host "@"] ident uhost
 
putlog "isidentified => $nick = [isidentified $nick]"
 
if {![isidentified $nick] || [isvoice $nick $chan]} { return }
 
::certUser::service:connect
set res [mysqlsel $::mysqlink "SELECT count(*) FROM `voiceauto` WHERE pseudo='$nick' and salon='$chan'" -list]
set nb [lindex $res 0]
if {$nb >= 1} {
putserv "PRIVMSG ChanServ voice $chan $nick"
}
::certUser::service:deconnect
 
}



La problématique est que la fonction isidentified renvoie 1 même quand l'user est présent sur le canal et qu'il n'est pas identifié ou register.
Utilise, si le réseau te permet d'avoir le CAP account-notify, la fonction getaccount.
tcl
bind account - * [namespace current]::accountuser
proc accountuser {nick user hand chan {account ""}} {
 
if {![channel get $chan certif]} {
return
}
 
putlog "$nick : $user / $hand *$chan* -> $account"
if {$account==""} { return }
[namespace current]::joincertif $nick $user $hand $chan
 
}
 
bind join - * [namespace current]::joincertif
proc joincertif { nick host hand chan } {
 
if {![channel get $chan certif]} {
return
}
 
lassign [split $host "@"] ident uhost
putlog "getaccount => $nick = [getaccount $nick $chan]"
if {[getaccount $nick $chan] eq "*" || [isvoice $nick $chan]} { return }
 
::certUser::service:connect
set res [mysqlsel $::mysqlink "SELECT count(*) FROM `voiceauto` WHERE pseudo='$nick' and salon='$chan'" -list]
set nb [lindex $res 0]
if {$nb >= 1} {
putnow "PRIVMSG ChanServ voice $chan $nick"
}
::certUser::service:deconnect
 
}



sur le bind join, quand je suis identifié c'est nickel:

[02:26:35] getaccount => amandtest = amandtest

par contre depuis bind account quand je m'identifie pas à la connection et que je le fais après le join, quand il envoie à la proc joincertif, la fonction getaccount retourne * alors qu'il est bien identifié :

[02:28:25] amandtest : testamand@6D3C7BDB.83D19FC4.BEC71239.IP / * *#test* -> amandtest
[02:28:25] getaccount => amandtest = *

du coup, il entre dans la condition:

tcl
if {[getaccount $nick $chan] eq "*" || [isvoice $nick $chan]} { return }




je regarderais plus demain
Je viens de faire un test. test0r et JArvis (l'eggdrop) sont sur #test
Code :
.tcl cap enabled
Tcl: invite-notify extended-join sasl chghost account-notify message-tags
.tcl getaccount test0r
Tcl: *
# là, test0r s'identifie en tant que toto
[08:55] test0r!test0r@zeolia-74F4447D.not.my.ip logged in to their account toto
.tcl getaccount test0r
Tcl: toto

Ensuite, test0r fait un /ns logout:
Code :
[08:57] test0r!toto@toto.vhost.fr has logged out of their account
.tcl getaccount test0r
Tcl: *

Ensuite test0r sort de #test et s'identifie à nouveau (Jarvis ne voit rien bien sûr):
Code :
.tcl getaccount test0r
Tcl:
Fonctionnement normal, Jarvis ne voit pas test0r. Donc test0r revient sur le canal (en étant identifié)
Code :
.tcl getaccount test0r
Tcl: toto

Donc getaccount marche très bien vu de mon côté
Test du bind account:

tcl
.tcl proc ac {nick user hand chan acc} { putlog "$nick is $acc"}
.tcl bind account - "#% *" ac



test0r est sur #test et s'identifie
Code :
[09:09] test0r!test0r@zeolia-74F4447D.not.my.ip logged in to their account toto
[09:09] test0r is toto

# toujours sur #test, test0r fait un logout
Code :
[09:12] test0r!toto@toto.vhost.fr has logged out of their account
[09:12] test0r is *
Le bug (qui est en fait une régression) est validé et sera corrigé prochainement.

Pour suivre sur github: https://github.com/eggheads/eggdrop/issues/1533
J'ai testé le correctif (https://github.com/eggheads/eggdrop/comm...168b9c07a8) et ça marche. isidentified ne retourne 1 que si l'utilisateur est sur un canal commun et identifié.
Parfait ! merci