blob: e9aeab2b169246f1a7f2cd5f424d91156dfa09fe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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[:nick]
@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 'qauth identify', :action => "identify"
|