diff options
Diffstat (limited to 'data/rbot')
-rw-r--r-- | data/rbot/plugins/quakeauth.rb | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/data/rbot/plugins/quakeauth.rb b/data/rbot/plugins/quakeauth.rb new file mode 100644 index 00000000..8f412f1d --- /dev/null +++ b/data/rbot/plugins/quakeauth.rb @@ -0,0 +1,51 @@ +# automatically auths with Q on quakenet servers + +class QPlugin < Plugin + + def help(plugin, topic="") + case topic + when "" + return "quath plugin: handles Q auths. topics set, identify" + when "set" + return "nickserv set <user> <passwd>: set the Q user and password and use it to identify in future" + when "identify" + return "quath identify: identify with Q (if user and auth are set)" + end + end + + def initialize + super + # this plugin only wants to store strings! + class << @registry + def store(val) + val + end + def restore(val) + val + end + end + end + + def set(m, params) + @registry['quakenet.user'] = params[:user] + @registry['quakenet.auth'] = params[:passwd] + m.okay + end + + def connect + identify(nil, nil) + end + def identify(m, params) + if @registry.has_key?('quakenet.user') && @registry.has_key?('quakenet.auth') + debug "authing with Q using #{@registry['quakenet.user']} #{@registry['quakenet.auth']}" + @bot.sendmsg "PRIVMSG", "Q@CServe.quakenet.org", "auth #{@registry['quakenet.user']} #{@registry['quakenet.auth']}" + m.okay if m + else + m.reply "not configured, try 'qauth set :nick :passwd'" if m + end + end + +end +plugin = QPlugin.new +plugin.map 'qauth set :nick :passwd', :action => "set" +plugin.map 'quath identify', :action => "identify" |