Anope IRC Services

Please login or register.

Login with username, password and session length
Advanced search  


Pages: [1]   Go Down

Author Topic: Checking user access  (Read 4243 times)

0 Members and 1 Guest are viewing this topic.


  • Anope User
  • Offline Offline
  • Posts: 242
    • French Eggdrop community
Checking user access
« on: December 12, 2011, 02:50:19 PM »

Hello there,

I can't find a global documentation in the wiki, so I fed up and ask here :)

I'm looking to the way to check users access, to allow commands to people.
I want to add the possibility to restrict a command only to registered (NS_IDENTIFIED ?) or VOP access on chan (CA_VOICE, CA_AUTOVOICE ?), or HOP access (CA_HALFOP, CA_AUTOHALFOP ?) or VOP (CA OPDEOP, CA_AUTOOP ?). Can someone explain me the differences between each constant ?

Thanks by advance.


Jan Milants

  • Team
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 1372
Re: Checking user access
« Reply #1 on: December 12, 2011, 06:59:09 PM »

you failed to mention which version of anope you are looking at so I will assume 1.8...  ::)

NS_IDENTIFIED is a bit status flag of the NickAlias (na->status).. though for checking whether a user is identified there are far easier and better ways: simply use anopes API rather then reinventing the wheel. There is this nice little function "nick_identified(User*)" which simply returns true or false.  :)

As for the CA_* constants, they nicely map to the levels as also listed in "/cs help levels desc".. VOICE lets you use /cs VOICE, VOICEME just allows you to use it on yourself and AUTOVOICE means you get it on join, but can't actually use the command.. it s similar for OP/etc..
As for checking whether a user has a level with the anope API, simply call the function check_access() which returns true or false.
Eg: check_access(User*, ChannelInfo*, CA_AUTOVOICE);
If you like me donate coins to 1FBmZVT4J8WAUMHKqpWhgNVj3XXnRN1cCk :)


  • Anope User
  • Offline Offline
  • Posts: 242
    • French Eggdrop community
Re: Checking user access
« Reply #2 on: December 13, 2011, 08:30:18 AM »

Thanks a lot, I understand better the way I can use it. I'll try to use this and come back if I fail ;)
Pages: [1]   Go Up