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.

Detecting a users umodes (not flags) in a tcl

Help for those learning Tcl or writing their own scripts.
Post Reply
n
neo42
Voice
Posts: 5
Joined: Wed Jul 19, 2006 11:59 pm
Location: Alabama
Contact:

Detecting a users umodes (not flags) in a tcl

Post by neo42 »

I'd like for my "doorkeeper" script to kick/ban a user whose nick is not registered or has expired. I know that umodes like +o and +v are handled by isop(), isvoice(), etc... Is there a way to get/parse a user's umodes to determine if other modes (+r in this instance) are set? I've checked FAQ's, searched, done my homework... can't find reference to this anywhere. Ideas anybody?
--------------------------------------------
Neo42
NetAdmin, StrandedIRC
irc://irc.strandedirc.com:7000
Come join us on the #island, mon! :)
ethercrash@yahoo.com
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

You will have to relay on the raw reply from whois to contain "blabla is a registered nick" or use a "MODE blabla" and bind RAW MODE to see if it replys something about +r (or +R, depending on ircd).
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
n
neo42
Voice
Posts: 5
Joined: Wed Jul 19, 2006 11:59 pm
Location: Alabama
Contact:

Post by neo42 »

That's kinda what I thought... I had tried a couple things along that line, but nothing has worked yet. I'll dig up what I tried and post the code in a bit. Thanks for the reply.
--------------------------------------------
Neo42
NetAdmin, StrandedIRC
irc://irc.strandedirc.com:7000
Come join us on the #island, mon! :)
ethercrash@yahoo.com
n
neo42
Voice
Posts: 5
Joined: Wed Jul 19, 2006 11:59 pm
Location: Alabama
Contact:

Post by neo42 »

OK here goes... This is the script as it currently exists. It properly executes the whois, but seems to do nothing with the 379 numeric, which on Unreal Ircd is REPL_WHOISMODES. I can get the mode string with mIRC, so I know the reply is being made.

Code: Select all

setudef flag sentry   # channel must have +sentry
bind raw - 379 test:whois
bind join * *!*@* exec:whois

proc test:whois { from keyword text } {
  putquick "PRIVMSG #mychan :$text"   # just dump reply into chan
}

proc exec:whois {nick uhost handle chan} {
set chan [string tolower $chan]
 if {[channel get $chan sentry]} {
   putserv "whois $nick"
 }
}

putlog "gatekeeper.tcl has been loaded successfully. (c)Neo42"
--------------------------------------------
Neo42
NetAdmin, StrandedIRC
irc://irc.strandedirc.com:7000
Come join us on the #island, mon! :)
ethercrash@yahoo.com
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

as "De_Kus2" made "WHOIS De_Kus":
:irc.shockerz.net 307 De_Kus2 De_Kus :has identified for this nick
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
n
neo42
Voice
Posts: 5
Joined: Wed Jul 19, 2006 11:59 pm
Location: Alabama
Contact:

Post by neo42 »

Yep. I know about 307. Trick is, I want something to happen when a user is not registered. Not as easy as trapping the 307. It should be simple to take the reply from 379, split it, and check for "r" in the umode string, but for some reason the bot isn't getting the 379 response.
--------------------------------------------
Neo42
NetAdmin, StrandedIRC
irc://irc.strandedirc.com:7000
Come join us on the #island, mon! :)
ethercrash@yahoo.com
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

neo42 wrote:Yep. I know about 307. Trick is, I want something to happen when a user is not registered.
then catch the "End of /WHOIS List" numeric reply

if you still haven't received 307 upon receiving EOW, the nick is not registered (needless to say, you need to maintain track of nicks you inquired about by sending WHOIS; this is commonly done using Tcl's associative arrays)
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
Post Reply