Class: Irc::Bot::Auth::DefaultBotUserClass
- Includes:
- Singleton
- Defined in:
- lib/rbot/botuser.rb
Overview
This is the default BotUser: it’s used for all users which haven’t identified with the bot
Instance Attribute Summary
Attributes inherited from BotUser
#login_by_mask, #netmasks, #password, #perm, #perm_temp, #transient, #username
Instance Method Summary collapse
-
#autologin=(val) ⇒ Object
This method returns without changing anything.
-
#initialize ⇒ DefaultBotUserClass
constructor
The default BotUser is named ‘everyone’.
-
#knows?(user) ⇒ Boolean
default knows everybody.
-
#login(user, password) ⇒ Object
We always allow logging in as the default user.
-
#login_by_mask=(val) ⇒ Object
This method returns without changing anything.
-
#permit?(cmd, chan = nil) ⇒ Boolean
DefaultBotUser will check the default_perm after checking the global ones or on all channels if chan is nil.
-
#reset_autologin ⇒ Object
The default botuser doesn’t allow autologin (meaningless).
-
#reset_login_by_mask ⇒ Object
The default botuser allows logins by mask.
-
#set_default_permission(cmd, val) ⇒ Object
Sets the default permission for the default user (i.e. the ones set by the BotModule writers) on all channels.
Methods inherited from BotUser
#add_netmask, #autologin?, #default?, #delete_netmask, #from_hash, #inspect, #login_by_mask?, #make_permanent, #owner?, #permanent=, #permanent?, #remote_login, #reset_netmasks, #reset_password, #reset_permission, #reset_temp_permission, sanitize_username, #set_permission, #set_temp_permission, #to_hash, #to_s, #transient?
Constructor Details
#initialize ⇒ DefaultBotUserClass
The default BotUser is named ‘everyone’
537 538 539 540 541 542 |
# File 'lib/rbot/botuser.rb', line 537 def initialize reset_login_by_mask reset_autologin super("everyone") @default_perm = PermissionSet.new end |
Instance Method Details
#autologin=(val) ⇒ Object
This method returns without changing anything
559 560 561 562 |
# File 'lib/rbot/botuser.rb', line 559 def autologin=(val) debug "Tried to change the autologin for default bot user, ignoring" return end |
#knows?(user) ⇒ Boolean
default knows everybody
580 581 582 |
# File 'lib/rbot/botuser.rb', line 580 def knows?(user) return true if user.to_irc_user end |
#login(user, password) ⇒ Object
We always allow logging in as the default user
585 586 587 |
# File 'lib/rbot/botuser.rb', line 585 def login(user, password) return true end |
#login_by_mask=(val) ⇒ Object
This method returns without changing anything
546 547 548 549 |
# File 'lib/rbot/botuser.rb', line 546 def login_by_mask=(val) debug "Tried to change the login-by-mask for default bot user, ignoring" return @login_by_mask end |
#permit?(cmd, chan = nil) ⇒ Boolean
DefaultBotUser will check the default_perm after checking the global ones or on all channels if chan is nil
593 594 595 596 597 598 599 |
# File 'lib/rbot/botuser.rb', line 593 def permit?(cmd, chan=nil) allow = super(cmd, chan) if allow.nil? && chan.nil? allow = @default_perm.permit?(cmd) end return allow end |
#reset_autologin ⇒ Object
The default botuser doesn’t allow autologin (meaningless)
566 567 568 |
# File 'lib/rbot/botuser.rb', line 566 def reset_autologin @autologin = false end |
#reset_login_by_mask ⇒ Object
The default botuser allows logins by mask
553 554 555 |
# File 'lib/rbot/botuser.rb', line 553 def reset_login_by_mask @login_by_mask = true end |
#set_default_permission(cmd, val) ⇒ Object
Sets the default permission for the default user (i.e. the ones set by the BotModule writers) on all channels
573 574 575 576 |
# File 'lib/rbot/botuser.rb', line 573 def (cmd, val) @default_perm.(Command.new(cmd), val) debug "Default permissions now: #{@default_perm.pretty_inspect}" end |