auth_import (AuthModule)

    # File lib/rbot/core/auth.rb, line 874
      def auth_import(m, params)

        importfile = "#{@bot.botclass}/new-auth.users"

        what = params[:things]

        has_from = what[-2] == "from"
        if has_from
          importfile = "#{@bot.botclass}/#{what[-1]}"
          what.slice!(-2,2)
        end

        what.delete("all")

        m.reply _("reading %{file} ...") % {:file=>importfile}
        begin
          yaml_hash = YAML::load_file(importfile)
        rescue => e
          m.reply _("failed to import from: %{exception}") % {:exception=>e}
          debug e.backtrace.dup.unshift(e.inspect).join("\n")
          return
        end

        # m.reply yaml_hash.inspect

        m.reply _("selecting data to import ...")

        if what.empty?
          we_want = yaml_hash
        else
          we_want = yaml_hash.delete_if { |key, val|
            not what.include?(key)
          }
        end

        m.reply _("parsing data from import ...")

        buser_hash = {}

        begin
          yaml_hash.each { |k, val|
            buser_hash[k] = { :username => k }
            val.each { |kk, v|
              case kk
              when :netmasks
                buser_hash[k][kk] = []
                v.each { |nm|
                  buser_hash[k][kk] << nm[:fullform].to_irc_netmask(:casemap => nm[:casemap].to_irc_casemap).to_irc_netmask(:server => @bot.server)
                }
              else
                buser_hash[k][kk] = v
              end
            }
          }
        rescue => e
          m.reply _("failed to parse data: %{exception}") % {:exception=>e}
          debug e.backtrace.dup.unshift(e.inspect).join("\n")
          return
        end

        # m.reply buser_hash.inspect

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

        # TODO we may want to do a(n optional) key-by-key merge
        #
        org_buser_hash.merge!(buser_hash)
        new_buser_array = org_buser_hash.values
        @bot.auth.load_array(new_buser_array, true)
        @bot.auth.set_changed

        m.reply _("done")
      end