Class Irc::Bot::Auth::BotUser
In: lib/rbot/botuser.rb
Parent: Object

This is the basic class for bot users: they have a username, a password, a list of netmasks to match against, and a list of permissions. A BotUser can be marked as ‘transient’, usually meaning it‘s not intended for permanent storage. Transient BotUsers have lower priority than nontransient ones for autologin purposes.

To initialize a BotUser, you pass a username and an optional hash of options. Currently, only two options are recognized:

transient:true or false, determines if the BotUser is transient or permanent (default is false, permanent BotUser).

Transient BotUsers are initialized by prepending an asterisk (*) to the username, and appending a sanitized version of the object_id. The username can be empty. A random password is generated.

Permanent Botusers need the username as is, and no password is generated.

masks:an array of Netmasks to initialize the NetmaskList. This list is used as-is for permanent BotUsers.

Transient BotUsers will alter the list elements which are Irc::User by globbing the nick and any initial nonletter part of the ident.

The masks option is optional for permanent BotUsers, but obligatory (non-empty) for transients.

Methods

Attributes

login_by_mask  [W] 
netmasks  [R] 
password  [R] 
perm  [R] 
perm_temp  [R] 
transient  [W] 
username  [R] 

Public Class methods

Create a new BotUser with given username

This method sanitizes a username by chomping, downcasing and replacing any nonalphanumeric character with _

Public Instance methods

Do we allow automatic logging in?

Check if the current BotUser is the default one

Restore from hash

Inspection

This method checks if BotUser has a Netmask that matches user

This method gets called when User user wants to log in. It returns true or false depending on whether the password is right. If it is, the Netmask of the user is added to the list of acceptable Netmask unless it‘s already matched.

Do we allow logging in without providing the password?

Make the BotUser permanent

Check if the current BotUser is the owner

This method sets the password if the proposed new password is valid

Sets if the BotUser is permanent or not

Checks if the BotUser is permanent (not transient)

Checks if BotUser is allowed to do something on channel chan, or on all channels if chan is nil

Reset the autologin option

Reset the login-by-mask option

Reset Netmasks, clearing @netmasks

Resets the password by creating a new onw

Resets the permission for command cmd on channel chan

Resets the temporary permission for command cmd on channel chan

Sets the permission for command cmd to val on channel chan

Sets the temporary permission for command cmd to val on channel chan

Convert into a hash

In strings

Checks if the BotUser is transient

[Validate]