]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - lib/rbot/irc.rb
basics botmodule: use #to_s to stringify multiword parameters
[user/henk/code/ruby/rbot.git] / lib / rbot / irc.rb
index 0edfb35a4de903f0bfc57acf72670789d95dd473..129f947e61d1d9d906e1b02d7b7e7deb486fd5f3 100644 (file)
@@ -885,6 +885,8 @@ module Irc
   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
@@ -894,6 +896,7 @@ module Irc
       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
@@ -1272,7 +1275,7 @@ module Irc
     # 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
@@ -1286,8 +1289,8 @@ module Irc
     #\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