auth_copy_ren_user (AuthModule)

    # File lib/rbot/core/auth.rb, line 756
      def auth_copy_ren_user(m, params)
        source = Auth::BotUser.sanitize_username(params[:source])
        dest = Auth::BotUser.sanitize_username(params[:dest])
        return m.reply(_("please don't touch the default users")) unless
          (["everyone", "owner"] & [source, dest]).empty?

        buser_array = @bot.auth.save_array
        buser_hash = buser_array.inject({}) { |h, u|
          h[u[:username]] = u
          h
        }

        return m.reply(_("no such botuser %{source}") % {:source=>source}) unless
               buser_hash.keys.include?(source)
        return m.reply(_("botuser %{dest} exists already") % {:dest=>dest}) if
               buser_hash.keys.include?(dest)

        copying = m.message.split[1] == "copy"
        begin
          if copying
            h = {}
            buser_hash[source].each { |k, val|
              h[k] = val.dup
            }
          else
            h = buser_hash[source]
          end
          h[:username] = dest
          buser_array << h if copying

          @bot.auth.load_array(buser_array, true)
          @bot.auth.set_changed
          call_event(:botuser, copying ? :copy : :rename, :source => source, :dest => dest)
        rescue => e
          return m.reply(_("failed: %{exception}") % {:exception=>e})
        end
        if copying
          m.reply(_("botuser %{source} copied to %{dest}") %
               {:source=>source, :dest=>dest})
        else
          m.reply(_("botuser %{source} renamed to %{dest}") %
               {:source=>source, :dest=>dest})
        end

      end