def load_array(key=:default, forced=false)
debug "loading botusers (#{key}): #{@registry[key].pretty_inspect}"
@bot.auth.load_array(@registry[key], forced) if @registry.has_key?(key)
+ if @bot.auth.botowner.password != @bot.config['auth.password']
+ error "Master password is out of sync!"
+ debug " db password: #{@bot.auth.botowner.password}"
+ debug "conf password: #{@bot.config['auth.password']}"
+ error "Using conf password"
+ @bot.auth.botowner.password = @bot.config['auth.password']
+ end
end
# The permission parameters accept arguments with the following syntax:
def auth_view_perm(m, params)
begin
if params[:user].nil?
- user = get_botusername_for(m.source)
+ user = get_botuser_for(m.source)
return m.reply(_("you are owner, you can do anything")) if user.owner?
else
user = @bot.auth.get_botuser(params[:user].sub(/^all$/,"everyone"))
where = m.parse_channel_list(p[:where].to_s).first # should only be one anyway
end
- # pseudo-message to find the template. The source is ignored, and the
- # target is set according to where the template should be checked
- # (public or private)
- # This might still fail in the case of 'everywhere' for commands there are
- # really only private
- case where
- when :"?"
- pseudo_target = @bot.myself
- when :*
- pseudo_target = m.channel
+ if p.has_key? :auth_path
+ auth_path = p[:auth_path]
else
- pseudo_target = m.server.channel(where)
- end
+ # pseudo-message to find the template. The source is ignored, and the
+ # target is set according to where the template should be checked
+ # (public or private)
+ # This might still fail in the case of 'everywhere' for commands there are
+ # really only private
+ case where
+ when :"?"
+ pseudo_target = @bot.myself
+ when :*
+ pseudo_target = m.channel
+ else
+ pseudo_target = m.server.channel(where)
+ end
- pseudo = PrivMessage.new(bot, m.server, m.source, pseudo_target, p[:stuff].to_s)
+ pseudo = PrivMessage.new(bot, m.server, m.source, pseudo_target, p[:stuff].to_s)
- auth_path = find_auth(pseudo)
+ auth_path = find_auth(pseudo)
+ end
debug auth_path
if auth_path
return _("user topics: show, enable|disable, add|rm netmask, set, reset, tell, create, list, destroy")
end
when "auth"
- return _("auth <masterpassword>: log in as the bot owner; other commands: login, whoami, permission syntax, permissions [re]set, permissions view, user, meet, hello, allow, prevent")
+ return _("auth <masterpassword>: log in as the bot owner; other commands: login, whoami, permissions syntax, permissions [re]set, permissions view, user, meet, hello, allow, prevent")
when "meet"
return _("meet <nick> [as <user>]: creates a bot user for nick, calling it user (defaults to the nick itself)")
when "hello"
return _("hello: creates a bot user for the person issuing the command")
when "allow"
- return _("allow <user> to do <sample command> [<where>]: gives botuser <user> the permissions to execute a command such as the provided sample command (in private or in channel, according to the optional <where>)")
+ return [
+ _("allow <user> to do <sample command> [<where>]: gives botuser <user> the permissions to execute a command such as the provided sample command"),
+ _("(in private or in channel, according to the optional <where>)."),
+ _("<sample command> should be a full command, not just the command keyword --"),
+ _("correct: allow user to do addquote stuff --"),
+ _("wrong: allow user to do addquote.")
+ ].join(" ")
when "deny"
- return _("deny <user> from doing <sample command> [<where>]: removes from botuser <user> the permissions to execute a command such as the provided sample command (in private or in channel, according to the optional <where>)")
+ return [
+ _("deny <user> from doing <sample command> [<where>]: removes from botuser <user> the permissions to execute a command such as the provided sample command"),
+ _("(in private or in channel, according to the optional <where>)."),
+ _("<sample command> should be a full command, not just the command keyword --"),
+ _("correct: deny user from doing addquote stuff --"),
+ _("wrong: deny user from doing addquote.")
+ ].join(" ")
else
return _("auth commands: auth, login, whoami, who, permission[s], user, meet, hello, allow, deny")
end