class Blur::Network::ISupport

ISupport class that enables servers to announce what they support.

@see tools.ietf.org/html/draft-brocklesby-irc-isupport-03

Constants

NumericParams

ISUPPORT parameters which should always be casted to numeric values.

Parsers

Our parsers for parameters that require special treatment.

Attributes

network[RW]

Return the network reference.

Public Class Methods

new(network) click to toggle source

Initialize a new ISupport with a network reference.

@param network [Network] The parent network.

# File library/blur/network/isupport.rb, line 95
def initialize network
  @network = network

  # Set default ISUPPORT values.
  #
  # @see
  # https://tools.ietf.org/html/draft-brocklesby-irc-isupport-03#appendix-A
  self["MODES"]       = 3
  self["PREFIX"]      = { "o" => "@", "v" => "+" }
  self["KICKLEN"]     = 200
  self["NICKLEN"]     = 9
  self["MAXLIST"]     = { "#" => Float::INFINITY, "&" => Float::INFINITY }
  self['TOPICLEN']    = 200
  self["CHANMODES"]   = {}
  self["CHANTYPES"]   = %w{# &}
  self["CHANLIMIT"]   = { "#" => Float::INFINITY, "&" => Float::INFINITY }
  self["CHANNELLEN"]  = 200
  self["CASEMAPPING"] = "rfc1459"
end

Public Instance Methods

parse(*params) click to toggle source

Parse a list of parameters to see what the server supports.

@param parameters [Array] The list of parameters.

# File library/blur/network/isupport.rb, line 118
def parse *params
  params.each do |parameter|
    name, value = parameter.split ?=

    if value
      _, parser = Parsers.find{|key, value| key.include? name }

      self[name] = parser.nil? ? value : parser.(value)
    else
      self[name] = true
    end
  end
end