class User < Netmask\r
alias :to_s :nick\r
\r
+ attr_accessor :real_name\r
+\r
# Create a new IRC User from a given Netmask (or anything that can be converted\r
# into a Netmask) provided that the given Netmask does not have globs.\r
#\r
raise ArgumentError, "#{str.inspect} must not have globs (unescaped * or ?)" if user.has_irc_glob? && user != "*"\r
raise ArgumentError, "#{str.inspect} must not have globs (unescaped * or ?)" if host.has_irc_glob? && host != "*"\r
@away = false\r
+ @real_name = String.new\r
end\r
\r
# The nick of a User may be changed freely, but it must not contain glob patterns.\r
# Checks if the receiver already has a user with the given _nick_\r
#\r
def has_user?(nick)\r
- user_nicks.index(nick.irc_downcase(casemap))\r
+ @users.index(nick.to_irc_user(server_and_casemap))\r
end\r
\r
# Returns the user with nick _nick_, if available\r
#\r
def add_user(user, opts={})\r
silent = opts.fetch(:silent, false) \r
- if has_user?(user) && !silent\r
- warn "Trying to add user #{user} to channel #{self} again"\r
+ if has_user?(user)\r
+ warn "Trying to add user #{user} to channel #{self} again" unless silent\r
else\r
@users << user.to_irc_user(server_and_casemap)\r
end\r