Access Levels
Access levels are assigned both to a user and to an event and serve to limit a user's access to only certain events.
The default access level is 1 for users that are not listed in the Users list. All users can access level 1 events. The higher a user's access level is, the more events that user can access. You can change the default user level to allow unlisted users to access more commands.
Contents
Users
In the Users section you can specify a list of users and their access levels using the format:
<level1,level2,...,levelN>:<useraddress> 3,5,6:Dana!dana@staff.quakenet.org
The first level is a general access level, which means that the user can access all levels equal to or less than 3. All the other levels are levels that an event must specifically have to allow a user to access it.
If you want to force the first access level to be a specific level instead of a general access level, you can prefix it with an equal sign.
=3,5,6:Dana!dana@staff.quakenet.org
Now this user has access specifically to level 3, 5, and 6 event and to no other events.
Events
In general, the format of an event is:
on <prefix><level>:<event>:<option/parameters>:<target>:<commands/suffix>: on ^3:TEXT:hello:?: { msg $nick Hi, $nick } on 5:TEXT:hello:?:=
With the exception of:
<prefix> <level>:<event>:<target>:<commands> CTCP 1:HELP:*: { msg $nick No help is available for level 1 users }
For information about the on TEXT above, please read about the = suffix.
The above ctcp command can be accessed by all users because it is a level 1 command. So if a user with nickname goat sends you a /ctcp yournick HELP, your script will send them the above reply.
Only the highest level matching event is triggered for a user.
Named Levels
You can also used named levels which work the same way as a specific level but are easier to understand and read than a number.
friend:Dana!dana@staff.quakenet.org on @friend:JOIN:#: { msg $nick Welcome $nick ! }
This treats the word friend as a specific access level and matches the user with the event, and because the user is your friend, you welcome them.
Note:
You can use * as a named level that will match ALL users.
Prefixes
You can limit access to an event by specifying special prefixes which determines how an event is processed or triggered by users.
The + prefix
You can limit an event to users with a specific access level by using the + prefix.
10:Dana!dana@staff.quakenet.org ctcp +5:HELP:*: { msg $nick You have accessed a level +5 event }
The above user can't access this ctcp event even though he has an access level higher than 5, because the event is limited only to level 5 users.
The ! prefix
You can prevent an event from being triggered if it was initiated by you by using the ! prefix.
on !*:JOIN:#: { echo -tc join $chan $nick joined $chan }
You would be unable to access the above event regardless of your access level.
The me: prefix
This prefix is the negate of the ! prefix. Using me: will only trigger the event if you are the user who triggered the event. For example:
on me:*:JOIN:#: { echo -t $chan I joined $chan }
This is the same as the following code:
on *:JOIN:#: { if ($nick == $me) { echo -t $chan I joined $chan } }
Note: The fact this is a three character prefix makes no difference than any other prefix.
The @ prefix
You can limit events to being executed only when you have Ops on a channel by using the @ prefix.
Blacklist:Dana!dana@staff.quakenet.org on @Blacklist:JOIN:#: { mode $chan +b $address($nick,3) | kick $chan $nick You are blacklisted. }
When the above user joins a channel you have Ops on, the associated /mode and /kick command will be executed, in this case banning and kicking the user. If you don't have Ops, the event will not trigger.
The & prefix
You can prevent an event from being triggered if a previous script used /halt or /haltdef to halt the display of default text for an event by using the & prefix.
on &1:TEXT:*:?: { echo this event won't trigger if $halted is true }
The $ prefix
Indicates that the matchtext section of a definition contains a Regular_Expression.
on $*:TEXT:m/regular expression/switches:#: { echo message: $1- }
The 'm' and switches are optional. The // are required. If switches are used they must be standard PCRE switches, otherwise the match will fail. You can use switch 'S' to strip control codes from $1-.
Suffixes
Suffixes are used to prevent certain users from access the commands.
The = suffix
You can prevent users with higher access levels from accessing all lower access level events by using the = suffix.
10:Dana!dana@staff.quakenet.org ctcp 2:HELP:*: { msg $nick You have accessed a level 2 event } ctcp 5:HELP:*:=
The above user can't access any of these events because the level 5 event prevents him from accessing all HELP events with access levels lower than 5. The only users who can access the above event is someone with user access level 2, 3 or 4.
The ! suffix
You can prevent commands for a certain event level from being processed by using the ! suffix.
ctcp 5:PING:*: { echo PING! } ctcp 5:*:*:!
The ! at the end of the line tells the remote to halt any further processing of level 5 commands.
Order of definitions
Many of the prefixes and controls are sensitive to numerical order of the definitions. The safest thing is to order your definitions starting with the lowest access levels first and increasing numerically down the list, this makes it easier to keep track of which events should trigger first.
Also See
- auser ;Used to add a users Access Level.
- guser ;This acts the same as auser except it looks up a users ident/host via the server.
- flush ;This clears the remote user list of nickname definitions that are no longer valid.
- ruser ;Used to remove a user or a users access levels.
- rlevel ;This removes all users from the remote users list with the specified general access level.
- ulist ;This lists users which have the specified access levels.