Class: Autumn::Authentication::RegisteredNick

Inherits:
Base
  • Object
show all
Defined in:
lib/autumn/authentication.rb

Overview

Works just like nick authentication, the only difference is that one has to be identified to the nickserver.

This currently will only work on ircd, dancer and dalnet servers.

Instance Method Summary collapse

Methods inherited from Base

#unauthorized

Constructor Details

#initialize(options = {}) ⇒ RegisteredNick

Returns a new instance of RegisteredNick.



123
124
125
126
127
128
129
130
131
132
# File 'lib/autumn/authentication.rb', line 123

def initialize(options={})
  puts "RegisterNick initialization"
  @nicks = options[:nick]
  @nicks ||= options[:nicks]
  raise "You must must the nick of an administrator to use nick-based authentication." if @nicks.nil?
  @nicks = [ @nicks ] if @nicks.kind_of? String
  @identified = {}
  @whois_lock = Mutex.new
  @identification_lock = Mutex.new
end

Instance Method Details

#authenticate(stem, channel, sender, leaf) ⇒ Object

:nodoc:



134
135
136
137
# File 'lib/autumn/authentication.rb', line 134

def authenticate(stem, channel, sender, leaf) # :nodoc:
  nick = sender[:nick]
  @nicks.include?(nick) && is_identified?(stem,nick)
end

#irc_rpl_endofwhois_response(stem, sender, recipient, arguments, msg) ⇒ Object

Respnse code that comes at the end of whois message



140
141
142
# File 'lib/autumn/authentication.rb', line 140

def irc_rpl_endofwhois_response(stem, sender, recipient, arguments, msg)
  @whois_lock.unlock
end

#irc_rpl_whois_hidden_response(stem, sender, recipient, arguments, msg) ⇒ Object

Dancer and ircd response code including line with identification information



145
146
147
# File 'lib/autumn/authentication.rb', line 145

def irc_rpl_whois_hidden_response(stem, sender, recipient, arguments, msg)
  @identified[arguments.first] = true if msg.strip == "is identified to services"
end

#irc_rpl_whoisregnick_response(stem, sender, recipient, arguments, msg) ⇒ Object

DALnet response code including line with identification information



150
151
152
# File 'lib/autumn/authentication.rb', line 150

def irc_rpl_whoisregnick_response(stem, sender, recipient, arguments, msg)
  @identified[arguments.first] = true if msg.strip == "has identified for this nick"
end