Class: Cinch::Plugins::Identify

Inherits:
Object
  • Object
show all
Includes:
Cinch::Plugin
Defined in:
lib/cinch/plugins/identify.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) challengeauth(m)



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/cinch/plugins/identify.rb', line 26

def challengeauth(m)
  return unless m.user && m.user.nick == "Q"
  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

- (Object) identify(m)



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/cinch/plugins/identify.rb', line 9

def identify(m)
  case config[:type]
  when :quakenet
    @bot.debug "Identifying with Q"
    identify_quakenet
  when :secure_quakenet, :challengeauth
    @bot.debug "Identifying with Q, using CHALLENGEAUTH"
    identify_secure_quakenet
  when :nickserv
    @bot.debug "Identifying with NickServ"
    identify_nickserv
  end
end