Report abuse

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
  # Register a new user.
  def cmd_register(irc, password)
    if irc.channel
      irc.reply 'This command can only be used in private.'
    elsif !password or password.length == 0
      irc.reply 'Empty password given. USAGE: register <password>.'
    else
      from = irc.from
      map = $config.ensure("servers/#{irc.server.name}/users/#{from.nnick}")
      if map.empty?
        map['password'] = Digest::SHA1.hexdigest(password)
        irc.reply "Ok, you've been registrated with password '#{password}'. Default authentication mode is 'trusted'."
      else
        irc.reply "You're already registrated, or someone else is with YOUR nick! *gasp*"
      end
    end
  end
  help :register, "Use 'register <password>' in a private message, to register yourself as a user with your current nick and hostmask."