X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=lib%2Frbot%2Fcore%2Fauth.rb;h=ce21ccc91c8633996345d32357fb48f59b0a4e65;hb=43ebe3abdcb86e0edebb2d581e07064df7fdf467;hp=756fc6d71da18ff36e05aa1df4f16d9e9eb2d186;hpb=f0582b56cdfad1ec450b7f5fe8d0c68fe88b5d7c;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/lib/rbot/core/auth.rb b/lib/rbot/core/auth.rb index 756fc6d7..ce21ccc9 100644 --- a/lib/rbot/core/auth.rb +++ b/lib/rbot/core/auth.rb @@ -175,11 +175,11 @@ class AuthModule < CoreBotModule next if val.perm.empty? case k when :* - str << _("on any channel: ") + str << _("on any channel: ").dup when :"?" - str << _("in private: ") + str << _("in private: ").dup else - str << _("on #{k}: ") + str << _("on #{k}: ").dup end sub = [] val.perm.each { |cmd, bool| @@ -220,8 +220,8 @@ class AuthModule < CoreBotModule auth = nil if cmds.has_key?(k) cmds[k][:botmodule].handler.each do |tmpl| - options, failure = tmpl.recognize(pseudo) - next if options.nil? + options = tmpl.recognize(pseudo) + next if options.kind_of? MessageMapper::Failure auth = tmpl.options[:full_auth_path] break end @@ -401,8 +401,12 @@ class AuthModule < CoreBotModule return _("user list : lists all the botusers") when "destroy" return _("user destroy : destroys . This function %{highlight}must%{highlight} be called in two steps. On the first call is queued for destruction. On the second call, which must be in the form 'user confirm destroy ', the botuser will be destroyed. If you want to cancel the destruction, issue the command 'user cancel destroy '") % {:highlight => Bold} + when "export" + return _("user export [to ]: exports user data to file (default: new-auth.users)") + when "import" + return _("user import [from ]: import user data from file (default: new-auth.users)") else - return _("user topics: show, enable|disable, add|rm netmask, set, reset, tell, create, list, destroy") + return _("user topics: show, enable|disable, add|rm netmask, set, reset, tell, create, list, destroy, import, export") end when "auth" return _("auth : log in as the bot owner; other commands: login, whoami, permissions syntax, permissions [re]set, permissions view, user, meet, hello, allow, deny") @@ -645,7 +649,7 @@ class AuthModule < CoreBotModule if !nick # we are actually responding to a 'hello' command unless m.botuser.transient? - m.reply @bot.lang.get('hello_X') % m.botuser + m.reply @bot.lang.get('hello_X') % m.botuser, :nick => false return end nick = m.sourcenick @@ -664,7 +668,7 @@ class AuthModule < CoreBotModule met = @bot.auth.make_permanent(irc_user, buname) @bot.auth.set_changed call_event(:botuser,:post_perm, {:irc_user => irc_user, :bot_user => buname}) - m.reply @bot.lang.get('hello_X') % met + m.reply @bot.lang.get('hello_X') % met, :nick => false @bot.say nick, _("you are now registered as %{buname}. I created a random password for you : %{pass} and you can change it at any time by telling me 'user set password ' in private" % { :buname => buname, :pass => met.password @@ -709,7 +713,7 @@ class AuthModule < CoreBotModule def auth_list_users(m, params) # TODO name regexp to filter results - list = @bot.auth.save_array.inject([]) { |list, x| ['everyone', 'owner'].include?(x[:username]) ? list : list << x[:username] } + list = @bot.auth.save_array.inject([]) { |lst, x| ['everyone', 'owner'].include?(x[:username]) ? lst : lst << x[:username] } if defined?(@destroy_q) list.map! { |x| @destroy_q.include?(x) ? x + _(" (queued for destruction)") : x @@ -725,7 +729,7 @@ class AuthModule < CoreBotModule buname = params[:name] return m.reply(_("You can't destroy %{user}") % {:user => buname}) if ["everyone", "owner"].include?(buname) - mod = params[:modifier].to_sym rescue nil + mod = params[:modifier].nil_or_empty? ? nil : params[:modifier].to_sym buser_array = @bot.auth.save_array buser_hash = buser_array.inject({}) { |h, u|