This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Problem where isop always returns true

Help for those learning Tcl or writing their own scripts.
Post Reply
d
diskman1
Voice
Posts: 2
Joined: Mon Jul 12, 2010 5:19 pm

Problem where isop always returns true

Post by diskman1 »

Hi,
I have a small problem with the fallowing invite Script:

Code: Select all

bind raw - INVITE join:invite

proc join:invite {nickname key arg} {
       set channame [lindex [split $arg :] 1]
       if {[validchan $channame] || $channame == "#somechan" || $channame == "#other-chan"} {
          putlog "\[\002Join Request\002\] fehlgeschlagen! Channel \002$channame\002 bereits vorhanden. Anforderung von \002$nickname\002."
          } else {
                 channel add $channame
                 set klnick [split $nickname "!"] ;# hostmask beim ! splitten
                 set nick [lindex $klnick 0]      ;# davon das erste element -> nur der nick
                 utimer 20 [list checkchannel $nick $channame]  ;# 20 sekunden warten bis der bot den channel komplett 'eingelesen' hat
                                                                ;# wird nicht lange genug gewartet gibt in  checkchannel die isop funktion false zurück weil noch keine daten vorhanden
          }
}


proc checkchannel {nickname channame} {
           if {![isop $nickname $channame]} {
           putserv "PRIVMSG $channame :Anforderung fehlgeschlagen. \002$nickname\002 ist kein Operator."
           putserv "NOTICE $nickname :Anforderung fehlgeschlagen. Du bist kein Operator in \002$channame\002."
           channel remove $channame
           putlog "\[\002Join Request\002\] fehlgeschlagen! \002$nickname\002 ist kein Operator in \002$channame\002."
            } else {
                   putserv "PRIVMSG $channame :Anforderung erfolgreich."
                   putlog "\[\002Join Request\002\] erfolgreich von \002$nickname\002 für \002$channame\002."
           }
}
so heres the scenario:
someone invites the bot into his channel (in my network also non-ops can invite somebody)
the bot adds the channel, and joins
after 20 seconds the function checkchannel is called.
checkchannel checks wether the user who invited the bot is channel operator or not.

Heres the Problem.
The bot always stays inside the channel and prints out "Anforderung erfolgreich"

There is also a !part function, which also checks the op status via isop.
This Function can also be called from everyone on the channel. The bot dont cares about the op status.
After the join everyone is recorgnized as operator unless he parts and rejoins the channel.

I tried to let the bot part and check afterwards but nothings changed.
I also tried the resetchan function to re-read the channel ops, but this also changed nothing.

I cant explain why everyone is recorgnized as channel operator... if i manually let the bot part the channel by .dump part #channel the problem seems to go away.
but thats not a solution :)

Hope anyone can help me... i tried to search the forum for related topics... there is a similar script but it doesnt check for chanops.

Greetings,

diskman
w
willyw
Revered One
Posts: 1209
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

I see that no one has replied yet. Perhaps that is due to all the German... I really don't know. ( I don't speak German either)

I'm not really sure what is wrong, or why the result is always the same.

Just for fun, (and to be sure) I copied a piece of your code, and made only two small changes. You can spot them easily:

Code: Select all

bind pub - "!checkme" checkchannel

proc checkchannel {nickname uhost handle channame text} {
           if {![isop $nickname $channame]} {
           putserv "PRIVMSG $channame :Anforderung fehlgeschlagen. \002$nickname\002 ist kein Operator."
           putserv "NOTICE $nickname :Anforderung fehlgeschlagen. Du bist kein Operator in \002$channame\002."
        #   channel remove $channame
           putlog "\[\002Join Request\002\] fehlgeschlagen! \002$nickname\002 ist kein Operator in \002$channame\002."
            } else {
                   putserv "PRIVMSG $channame :Anforderung erfolgreich."
                   putlog "\[\002Join Request\002\] erfolgreich von \002$nickname\002 für \002$channame\002."
           }
}
I ran the above simple code, and it seemed to work fine. That is, I got
different results, if I was op'd or not op'd, when I sent the public command.
In other words - it works. Try it on yours, just to see if it works on yours.

I wonder if it is possible that it might behave differently on different servers?
Post Reply