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.

Identify with nickserv before autop op

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
s
silentziler
Voice
Posts: 11
Joined: Wed Sep 09, 2015 10:57 am

Identify with nickserv before autop op

Post by silentziler »

Hello egghelp,

So im currently using AutoopNick.tcl By CoMMy / kirian100@yahoo.com
and im looking to add a line to check to see if a user has identified with nickserv before autoping. I removed the first IF line as it doesnt matter the channel.
I was just wondering if its possible to add an ident check before it reads the autooplist.txt and maybe kick back a not registered with nickserv if a user isnt.

Code: Select all

proc join_check {nick host handle chan} {
  global botnick
  if {![channel get $chan autoopnick]} {return 0}
  set fp [open scripts/autooplist.txt r]
  set lines [split [read $fp] \n]
  set idx [lsearch -glob $lines "$nick"]
  if {$idx != -1} {
    putquick "MODE $chan +o $nick"
    close $fp
  } else {
    close $fp
    return 0
  }
  return 1
}
Thanks for any help.
w
willyw
Revered One
Posts: 1197
Joined: Thu Jan 15, 2009 12:55 am

Re: Identify with nickserv before autop op

Post by willyw »

silentziler wrote: ... im looking to add a line to check to see if a user has identified with nickserv before ...

The problem is: It isn't just one line, to do it. :)

What comes to mind - as a way to do it - is to send a whois to the server, wait for the return, then operate on that that return using raw binds.

If you load this:

Code: Select all


# September 13, 2015

# It seems like it is not unusual for someone to need a way to check if a nick is currently identified with Nickserv, or not.
#
# This will /whois the nick passed to it, and see if the line exists that shows that nick is logged in
#
#
# A global variable -  $id_toggle -  will be set.   "1" if nick is identified,  "0" if not.

# NOTE !!
# Since this script sends a /whois to the server, there can be a lag!  Beware of this, and allow for it, in your scripts that
# may call this one, and use the value of $id_toggle


# Reference : https://www.alien.net.au/irc/irc2numerics.html
# Also, to see the raw numerics returned by your server, before you try to use this script:
# do: .console +r   (must already be enabled in eggdrop.conf)  to turn on the raw flag in console flags.
# then do:   .dump whois <somenick>
# bot will do a /whois on somenick, and since you have raw logging on, you will be able to see the return.
# note the raw numerics.
# test on both a nick that is currently id'd with Nickserv, and one that is not.
# (  do: .console -r to turn off raw logging when done  )
#




proc is_nick_idd {nick} {
global id_toggle

        bind raw - "307" is_idd
        bind raw - "330" is_idd


        set id_toggle "0"

        putserv "whois $nick"

        utimer 7 [list unbind raw  - "307" is_idd]
        utimer 7 [list unbind raw  - "330" is_idd]
}


proc is_idd {from key text} {
global id_toggle

        set id_toggle "1"

}

and just consider it as a command to be used:
is_nick_idd somenick_here
like that, it will set a variable to either "1" or "0".
The variable is named:
$id_toggle

and you can then do an if statement that checks that in whatever other script you need to use it in.

The catch ! :
The can be a lag or delay in the server responding to the whois command sent to it. You must allow for this, by introducing some delay into whatever script will be testing the value of $id_toggle.

Also, there is nothing built into this very basic script if the server returns an error or something like that.

I hope this helps.
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
w
willyw
Revered One
Posts: 1197
Joined: Thu Jan 15, 2009 12:55 am

Re: Identify with nickserv before autop op

Post by willyw »

silentziler wrote:
... if its possible to add an ident check before it reads the autooplist.txt

Coincidentally, I just did something like this for an acquaintance.
However, for simplicity, I didn't bother with having the bot keep a text list, opening and closing and searching it.

We just add the users to the bot's user list with either .adduser or .+user ,
and use that list.

It seems a lot less complicated. :)
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
s
silentziler
Voice
Posts: 11
Joined: Wed Sep 09, 2015 10:57 am

Re: Identify with nickserv before autop op

Post by silentziler »

Hey willyw,

Just wanted to say thanks for the suggestion!
I will play with this code and see if I can't make something of it!

I kinda figured it would be a pain in the rear, I did all kinds of research before
coming here for help. I didnt see to many people with this question, so i figured I would reach out for help.

Thanks again!
w
willyw
Revered One
Posts: 1197
Joined: Thu Jan 15, 2009 12:55 am

Re: Identify with nickserv before autop op

Post by willyw »

You're welcome.

Good luck with it all.
It is fun to work through, once you get rolling.
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
Post Reply