Module: IIRC::ISupport::Inquiry

Defined in:
lib/iirc/modules/isupport.rb

Overview

Methods for inquiry into a Hash of raw ISUPPORT key=>value pairs. These are mixed in to the Hash returned by #isupport.

The key=>value format returned by #isupport won't change. Rather, methods which process the values can be added here.

Instance Method Summary collapse

Instance Method Details

#bot_modeString?

User mode which can be used to mark clients as bots.

Returns:

  • (String)

    mode char (usually 'B')

  • (nil)

    if mode is not supported



55
56
57
# File 'lib/iirc/modules/isupport.rb', line 55

def bot_mode
  self['BOT']
end

#bot_mode?Boolean

Whether or not the server supports a user mode which lets clients mark themselves as bots.

Returns:

  • (Boolean)


48
49
50
# File 'lib/iirc/modules/isupport.rb', line 48

def bot_mode?
  !!bot_mode
end

#case_mappingString

Note:

IIRC does not currently perform case-insensitive comparisons. This may change in future.

A string indicating the case mapping used by the server to determine case-insensitive equality of channel names and nick names.

Returns:

  • (String)

    the name of the casemapping. e.g. 'ascii', 'rfc1459', 'rfc3454'



64
65
66
# File 'lib/iirc/modules/isupport.rb', line 64

def case_mapping
  self['CASEMAPPING']
end

#channel_prefixesArray

Characters used as channel prefixes by this server.

Returns:

  • (Array)

    prefixes, e.g. ['#', '&']

See Also:



71
72
73
# File 'lib/iirc/modules/isupport.rb', line 71

def channel_prefixes
  (@channel_prefixes ||= self['CHANTYPES']&.chars.freeze) || ['#'].freeze
end

#prefix_modesHash<String,String>

Modes which grant privileges to a user in a channel and their respective prefix characters seen in NAMES, WHO and WHOIS replies.

Examples:

qaohv

isupport.prefix_modes # => {'q'=>'~', 'a'=>'&', 'o'=>'@', 'h'=>'%', 'v'=>'+'}

Returns:

  • (Hash<String,String>)

    channel mode => prefix character

See Also:



81
82
83
84
85
86
87
88
# File 'lib/iirc/modules/isupport.rb', line 81

def prefix_modes
  if self['PREFIX'].is_a? String
    modes, symbols = self['PREFIX'][1..].split(')').map!(&:chars)
    Hash[modes.zip(symbols)].freeze
  else
    {}.freeze
  end
end