class Cinch::Plugins::Identify
Public Instance Methods
challengeauth(m)
click to toggle source
# File lib/cinch/plugins/identify.rb, line 49 def challengeauth(m) return unless m.user && m.user.nick == "Q" return unless %i[secure_quakenet challengeauth].include?(config[:type]) if match = m.message.match(/^CHALLENGE (.+?) (.+)$/) challenge = match[1] @bot.debug "Received challenge '#{challenge}'" username = config[:username].irc_downcase(:rfc1459) password = config[:password][0, 10] key = OpenSSL::Digest::SHA256.hexdigest(username + ":" + OpenSSL::Digest::SHA256.hexdigest(password)) response = OpenSSL::HMAC.hexdigest("SHA256", key, challenge) User("Q@CServe.quakenet.org").send("CHALLENGEAUTH #{username} #{response} HMAC-SHA-256") end end
identified_nickserv(m)
click to toggle source
# File lib/cinch/plugins/identify.rb, line 40 def identified_nickserv(m) service_name = config[:service_name] || "nickserv" if m.user == User(service_name) && config[:type] == :nickserv debug "Identified with NickServ" @bot.handlers.dispatch :identified, m end end
identified_quakenet(m)
click to toggle source
# File lib/cinch/plugins/identify.rb, line 67 def identified_quakenet(m) if m.user == User("q") && %i[quakenet secure_quakenet challengeauth].include?(config[:type]) debug "Identified with Q" @bot.handlers.dispatch(:identified, m) end end
identified_userserv(m)
click to toggle source
# File lib/cinch/plugins/identify.rb, line 75 def identified_userserv(m) service_name = config[:service_name] || "UserServ" service_name = service_name.split("@").first if m.user == User(service_name) && config[:type] == :userserv debug "Identified with UserServ" @bot.handlers.dispatch :identified, m end end
identify(_m)
click to toggle source
# File lib/cinch/plugins/identify.rb, line 11 def identify(_m) case config[:type] when :quakenet debug "Identifying with Q" identify_quakenet when :dalnet debug "Identifying with Nickserv on DALnet" identify_dalnet when :secure_quakenet, :challengeauth debug "Identifying with Q, using CHALLENGEAUTH" identify_secure_quakenet when :nickserv debug "Identifying with NickServ" identify_nickserv when :kreynet debug "Identifying with K on KreyNet" identify_kreynet when :userserv debug "Identifying with UserServ" identify_userserv else debug "Not going to identify with unknown type #{config[:type].inspect}" end end
Private Instance Methods
identify_dalnet()
click to toggle source
# File lib/cinch/plugins/identify.rb, line 86 def identify_dalnet User("Nickserv@services.dal.net").send("identify %s" % [config[:password]]) end
identify_kreynet()
click to toggle source
# File lib/cinch/plugins/identify.rb, line 109 def identify_kreynet User("K!k@krey.net").send("LOGIN %s %s" % [config[:username], config[:password]]) end
identify_nickserv()
click to toggle source
# File lib/cinch/plugins/identify.rb, line 98 def identify_nickserv service_name = config[:service_name] || "nickserv" service_name = service_name.split("@").first cmd = if config[:username] "identify %s %s" % [config[:username], config[:password]] else "identify %s" % [config[:password]] end User(service_name).send(cmd) end
identify_quakenet()
click to toggle source
# File lib/cinch/plugins/identify.rb, line 90 def identify_quakenet User("Q@CServe.quakenet.org").send("auth %s %s" % [config[:username], config[:password]]) end
identify_secure_quakenet()
click to toggle source
# File lib/cinch/plugins/identify.rb, line 94 def identify_secure_quakenet User("Q@CServe.quakenet.org").send("CHALLENGE") end
identify_userserv()
click to toggle source
# File lib/cinch/plugins/identify.rb, line 113 def identify_userserv service_name = config[:service_name] || "UserServ" User(service_name).send("LOGIN %s %s" % [config[:username], config[:password]]) end