Class: Cinch::Plugins::Identify
- Inherits:
-
Object
- Object
- Cinch::Plugins::Identify
- Includes:
- Cinch::Plugin
- Defined in:
- lib/cinch/plugins/identify.rb
Instance Method Summary collapse
- #challengeauth(m) ⇒ Object
- #identified_nickserv(m) ⇒ Object
- #identified_quakenet(m) ⇒ Object
- #identified_userserv(m) ⇒ Object
- #identify(m) ⇒ Object
Instance Method Details
#challengeauth(m) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/cinch/plugins/identify.rb', line 45 def challengeauth(m) return unless m.user && m.user.nick == "Q" return unless [:secure_quakenet, :challengeauth].include?(config[:type]) if match = m..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("[email protected]").send("CHALLENGEAUTH #{username} #{response} HMAC-SHA-256") end end |
#identified_nickserv(m) ⇒ Object
37 38 39 40 41 42 |
# File 'lib/cinch/plugins/identify.rb', line 37 def identified_nickserv(m) if m.user == User("nickserv") && config[:type] == :nickserv debug "Identified with NickServ" @bot.handlers.dispatch :identified, m end end |
#identified_quakenet(m) ⇒ Object
63 64 65 66 67 68 |
# File 'lib/cinch/plugins/identify.rb', line 63 def identified_quakenet(m) if m.user == User("q") && [:quakenet, :secure_quakenet, :challengeauth].include?(config[:type]) debug "Identified with Q" @bot.handlers.dispatch(:identified, m) end end |
#identified_userserv(m) ⇒ Object
71 72 73 74 75 76 77 |
# File 'lib/cinch/plugins/identify.rb', line 71 def identified_userserv(m) service_name = config[:service_name] || "UserServ" if m.user == User(service_name) && config[:type] == :userserv debug "Identified with UserServ" @bot.handlers.dispatch :identified, m end end |
#identify(m) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/cinch/plugins/identify.rb', line 9 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 |