X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=lib%2Frbot%2Fcore%2Fauth.rb;h=eee500456c241e135fb919018c572d98bc359cd8;hb=12906a51f698aebe1c9a5e19b15555ebbbcc4368;hp=7feba4daf1b0bf072fcdd2d549cdd18d777cdd85;hpb=3462b9d3909635affe9561b476fd7a5326d53709;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/lib/rbot/core/auth.rb b/lib/rbot/core/auth.rb index 7feba4da..eee50045 100644 --- a/lib/rbot/core/auth.rb +++ b/lib/rbot/core/auth.rb @@ -1,6 +1,11 @@ #-- vim:sw=2:et #++ - +# +# :title: rbot auth management from IRC +# +# Author:: Giuseppe "Oblomov" Bilotta +# Copyright:: (C) 2006,2007 Giuseppe Bilotta +# License:: GPL v2 class AuthModule < CoreBotModule @@ -89,7 +94,7 @@ class AuthModule < CoreBotModule splits = params[:args] has_for = splits[-2] == "for" - return usage unless has_for + return usage(m) unless has_for begin user = @bot.auth.get_botuser(splits[-1].sub(/^all$/,"everyone")) @@ -188,6 +193,11 @@ class AuthModule < CoreBotModule "welcome, #{get_botusername_for(user)}" end + def auth_auth(m, params) + params[:botuser] = 'owner' + auth_login(m,params) + end + def auth_login(m, params) begin case @bot.auth.login(m.source, params[:botuser], params[:password]) @@ -241,6 +251,8 @@ class AuthModule < CoreBotModule return "permissions [re]set [in ] for : sets or resets the permissions for botuser in channel (use ? to change the permissions for private addressing)" when "view" return "permissions view [for ]: display the permissions for user " + else + return "topics: syntax, (re)set, view" end when "user" case topic @@ -779,6 +791,11 @@ auth.map "whoami", :action => 'auth_whoami', :auth_path => '!*!' +auth.map "auth :password", + :action => 'auth_auth', + :public => false, + :auth_path => '!login!' + auth.map "login :botuser :password", :action => 'auth_login', :public => false,