Communauté Eggdrop
Fonction isidentified - Version imprimable

+- Communauté Eggdrop (https://forum.eggdrop.fr)
+-- Forum : Eggdrop et TCL (https://forum.eggdrop.fr/forumdisplay.php?fid=8)
+--- Forum : Scripts TCL (https://forum.eggdrop.fr/forumdisplay.php?fid=4)
+--- Sujet : Fonction isidentified (/showthread.php?tid=1776)



Fonction isidentified - Amand - 07/02/2024

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.


RE: Fonction isidentified - CrazyCat - 08/02/2024

Utilise, si le réseau te permet d'avoir le CAP account-notify, la fonction getaccount.


RE: Fonction isidentified - Amand - 08/02/2024

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


RE: Fonction isidentified - CrazyCat - 08/02/2024

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é


RE: Fonction isidentified - CrazyCat - 08/02/2024

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 *



RE: Fonction isidentified - CrazyCat - 11/02/2024

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


RE: Fonction isidentified - CrazyCat - 11/02/2024

J'ai testé le correctif (https://github.com/eggheads/eggdrop/commit/f29429541c121fe86a24ffed54be89168b9c07a8) et ça marche. isidentified ne retourne 1 que si l'utilisateur est sur un canal commun et identifié.


RE: Fonction isidentified - Amand - 11/02/2024

Parfait ! merci