class Atheme::User

Public Instance Methods

account() click to toggle source

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
email() click to toggle source

Returns the user’s email

# File lib/atheme/entities/user.rb, line 54
def email
  match(/Email\s+:\s+([^\s]+)/)
end
entity_id() click to toggle source

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
fdrop!() click to toggle source

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
flags() click to toggle source

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!(reason) click to toggle source

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
groups() click to toggle source

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
language() click to toggle source

Returns the user’s language

# File lib/atheme/entities/user.rb, line 59
def language
  match(/Language\s+:\s+([\w]+)$/)
end
last_seen() click to toggle source

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!(reason) click to toggle source

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
name() click to toggle source

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
nicks() click to toggle source

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
protected() click to toggle source

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
Also aliased as: protected?
protected?()
Alias for: protected
real_address() click to toggle source

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
registered() click to toggle source

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
remove_vhost!() click to toggle source

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
reset_password!() click to toggle source

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!() click to toggle source

Unfreeze an previously frozen account.

# File lib/atheme/entities/user.rb, line 95
def unfreeze!
  @session.nickserv.freeze(self.name, :off)
end
unmark!() click to toggle source

Unmark a previously marked account.

# File lib/atheme/entities/user.rb, line 108
def unmark!
  @session.nickserv.mark(self.name, :off)
end
user_seen() click to toggle source

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
vhost() click to toggle source

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!(vhost=nil) click to toggle source

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