X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=lib%2Frbot%2Firc.rb;h=129f947e61d1d9d906e1b02d7b7e7deb486fd5f3;hb=c986bc82f4b856818e97e24fbf5fc11eef5f25c2;hp=0edfb35a4de903f0bfc57acf72670789d95dd473;hpb=08b62fa4b33ef08ddc2a98651438546529b6c449;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/lib/rbot/irc.rb b/lib/rbot/irc.rb index 0edfb35a..129f947e 100644 --- a/lib/rbot/irc.rb +++ b/lib/rbot/irc.rb @@ -885,6 +885,8 @@ module Irc class User < Netmask alias :to_s :nick + attr_accessor :real_name + # Create a new IRC User from a given Netmask (or anything that can be converted # into a Netmask) provided that the given Netmask does not have globs. # @@ -894,6 +896,7 @@ module Irc raise ArgumentError, "#{str.inspect} must not have globs (unescaped * or ?)" if user.has_irc_glob? && user != "*" raise ArgumentError, "#{str.inspect} must not have globs (unescaped * or ?)" if host.has_irc_glob? && host != "*" @away = false + @real_name = String.new end # The nick of a User may be changed freely, but it must not contain glob patterns. @@ -1272,7 +1275,7 @@ module Irc # Checks if the receiver already has a user with the given _nick_ # def has_user?(nick) - user_nicks.index(nick.irc_downcase(casemap)) + @users.index(nick.to_irc_user(server_and_casemap)) end # Returns the user with nick _nick_, if available @@ -1286,8 +1289,8 @@ module Irc # def add_user(user, opts={}) silent = opts.fetch(:silent, false) - if has_user?(user) && !silent - warn "Trying to add user #{user} to channel #{self} again" + if has_user?(user) + warn "Trying to add user #{user} to channel #{self} again" unless silent else @users << user.to_irc_user(server_and_casemap) end