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.

check user status

Old posts that have not been replied to for several years.
Locked
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

check user status

Post by Ofloo »

how do i check user status

i wana see if a user is a normal user or an oper

and make isoper

Code: Select all

proc isoper {nick} {
  putserv "whois $nick
}

bind raw * 313 isoper:raw

proc isoper:raw {} {
  if {[string match -nocase operator]} {
    return 1
  }
}
thing is how do i make isoper proc get the return 1 from isoper:raw or how do i do this .. or is there a beter way then using whois .. then binding raw .. ???
XplaiN but think of me as stupid
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

From the looks of what you are attempting to do, You will need to store the result of the whois in a variable for immediate lookup. You will need to trigger a "whois" by some event, I suggest triggering it when either the bot joins the channel, and when users join the channel. Upon receiving the whois, store if the person is an oper or not in a variable, and simply check against that variable next time you want to see if the user is an oper or not.
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

hmm ok is there a way to check oper status of a user within one proc
XplaiN but think of me as stupid
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

Like I said, you will need to keep a status on all users that join/part channel, update a variable accordingly, and yes, in one procedure, all you do is lookup a value from a variable (most likely an array in this case), and return the desired result.....

Without getting too technical with the code....

Code: Select all

bind join - * opercheck:join
proc opercheck:join {....} {
  # whois the user
}

bind part - * opercheck:leave
bind sign - * opercheck:leave
proc opercheck:leave {...} {
  global opercheck
  if {[isoper $nick]} {
    unset opercheck($nick)
  }
}

bind raw - oper-reply-code-here opercheck:isoper
proc opercheck:isoper {...} {
  global opercheck
  set opercheck($nick) 1
}

proc isoper {nick} {
  global opercheck
  info exists opercheck($nick)
}
That's just the rough pseudo-code... You will of course have to add in other checks and actual code... Take into account nick changes, probably want to unset the opercheck variable when the bot joins irc (due to netsplit, or whatnot), etc.. etc..

With all that in place, you could then use [isoper $nick], just as you would use [isop $nick], etc...
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

indeed nice and simple seems like a good basic
XplaiN but think of me as stupid
Locked