def initialize(username, options={})
opts = {:transient => false}.merge(options)
@transient = opts[:transient]
if @transient
@username = "*"
@username << BotUser.sanitize_username(username) if username and not username.to_s.empty?
@username << BotUser.sanitize_username(object_id)
reset_password
@login_by_mask=true
@autologin=true
else
@username = BotUser.sanitize_username(username)
@password = nil
reset_login_by_mask
reset_autologin
end
@netmasks = NetmaskList.new
if opts.key?(:masks) and opts[:masks]
masks = opts[:masks]
masks = [masks] unless masks.respond_to?(:each)
masks.each { |m|
mask = m.to_irc_netmask
if @transient and User === m
mask.nick = "*"
mask.host = m.host.dup
mask.user = "*" + m.user.sub(/^\w?[^\w]+/,'')
end
add_netmask(mask) unless mask.to_s == "*"
}
end
raise "must provide a usable mask for transient BotUser #{@username}" if @transient and @netmasks.empty?
@perm = {}
@perm_temp = {}
end