class Atheme::User
Public Instance Methods
Returns the account name of the user as an Atheme::User
object
# File lib/atheme/entities/user.rb, line 14 def account Atheme::User.new(@session, match(/\(account\s([^\(]+)\):/)) end
Returns the user’s email
# File lib/atheme/entities/user.rb, line 54 def email match(/Email\s+:\s+([^\s]+)/) end
Unique entity ID. Available only if the user is currently connected
# File lib/atheme/entities/user.rb, line 24 def entity_id match(/Entity\sID\s+:\s+([A-F0-9]+)$/) end
Forcefully removes the account, including all nicknames, channel access and memos attached to it. Only opers may use this.
# File lib/atheme/entities/user.rb, line 82 def fdrop! @session.nickserv.fdrop(self.name) end
Returns the user’s flags as an array, e.g. HideMail
# File lib/atheme/entities/user.rb, line 64 def flags match(/Flags\s+:\s+(.+)$/).split rescue [] end
freeze allows operators to “freeze” an abusive user’s account. This logs out all sessions logged in to the account and prevents further logins. Thus, users cannot obtain the access associated with the account.
# File lib/atheme/entities/user.rb, line 90 def freeze!(reason) @session.nickserv.freeze(self.name, :on, reason) end
Returns the user’s groups as an array,
# File lib/atheme/entities/user.rb, line 75 def groups match(/Groups\s+:\s+(.+)$/).split rescue [] end
Returns the user’s language
# File lib/atheme/entities/user.rb, line 59 def language match(/Language\s+:\s+([\w]+)$/) end
Date object of the time when the nick was last seen
# File lib/atheme/entities/user.rb, line 39 def last_seen Date.parse(match(/Last\sseen\s+:\s+(\w+ [0-9]{2} [0-9(:?)]+ [0-9]{4})/)) end
mark allows operators to attach a note to an account. For example, an operator could mark the account of a spammer so that others know the user has previously been warned.
# File lib/atheme/entities/user.rb, line 103 def mark!(reason) @session.nickserv.mark(self.name, :on, reason) end
Returns the nickname (not account name) of the user
# File lib/atheme/entities/user.rb, line 9 def name match(/^Information\son\s([^\s]+)/) end
Returns an array of linked nicknames to this nick/account
# File lib/atheme/entities/user.rb, line 49 def nicks match(/Nicks\s+:\s+([^\s]+(?:\s[^\s]+)*)$/).split rescue [] end
Returns true if the user enabled nick protection, false otherwise
# File lib/atheme/entities/user.rb, line 69 def protected match(/has\s(enabled)\snick\sprotection/) ? true : false end
Real address of the user’s connection
# File lib/atheme/entities/user.rb, line 34 def real_address match(/Real\saddr\s+:\s+([^\s]+)$/) end
Date object which is set to the time when the nick was registered
# File lib/atheme/entities/user.rb, line 19 def registered Date.parse(match(/Registered\s+:\s+(\w+ [0-9]{2} [0-9(:?)]+ [0-9]{4})/)) end
Removes a previously added vhost from the account
# File lib/atheme/entities/user.rb, line 122 def remove_vhost! @session.nickserv.vhost(self.name, :off) end
Sets a random password for this account. Only opers may use this.
# File lib/atheme/entities/user.rb, line 128 def reset_password! @session.nickserv.resetpass(self.name) end
Unfreeze an previously frozen account.
# File lib/atheme/entities/user.rb, line 95 def unfreeze! @session.nickserv.freeze(self.name, :off) end
Unmark a previously marked account.
# File lib/atheme/entities/user.rb, line 108 def unmark! @session.nickserv.mark(self.name, :off) end
Date object of the time when the user was last seen
# File lib/atheme/entities/user.rb, line 44 def user_seen Date.parse(match(/User\sseen\s+:\s+(\w+ [0-9]{2} [0-9(:?)]+ [0-9]{4})/)) rescue nil end
Returns the vhost of the nick if set
# File lib/atheme/entities/user.rb, line 29 def vhost match(/vHost\s+:\s+([^\s]+)$/) end
vhost allows operators to set a virtual host (also known as a spoof or cloak) on an account. This vhost will be set on the user immediately and each time they identify If no vhost is given, the current one will be deleted.
# File lib/atheme/entities/user.rb, line 117 def vhost!(vhost=nil) vhost.nil? ? remove_vhost! : @session.nickserv.vhost(self.name, :on, vhost) end