Module: RFlow::Components::IRC

Defined in:
lib/rflow/components/irc.rb,
lib/rflow/components/irc/client.rb,
lib/rflow/components/irc/version.rb,
lib/rflow/components/irc/extensions.rb

Defined Under Namespace

Modules: Extensions Classes: Client

Constant Summary collapse

SCHEMA_DIRECTORY =

Load the schemas

::File.expand_path(::File.join(::File.dirname(__FILE__), '..', '..', '..', 'schema'))
SCHEMA_FILES =
{
  'irc_message.avsc'  => 'RFlow::Message::Data::IRC::Message',
}
IRC_LINE_REGEX =

Some useful IRC parsing methods

/^(?::(\S+) )?(\S+)(?: (.+))?$/
IRC_PREFIX_REGEX =
/^([^!]+)(?:!([^@]+))?(?:@(.*)+)?$/
VERSION =
"1.0.0"

Class Method Summary collapse

Class Method Details

.parse_irc_line(line) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/rflow/components/irc.rb', line 27

def self.parse_irc_line(line)
  match = IRC_LINE_REGEX.match(line)
  unless match
    RFlow.logger.error "Error parsing IRC line '#{line}'"
    return
  end

  prefix, cmd, param_string = match[1..3]

  param_string, trailing_param = param_string.split(' :', 1)
  params = param_string.split(' ')
  params << trailing_param if trailing_param

  [prefix, cmd, params]
end

.parse_irc_prefix(prefix) ⇒ Object



43
44
45
46
47
48
49
50
51
52
# File 'lib/rflow/components/irc.rb', line 43

def self.parse_irc_prefix(prefix)
  match = IRC_PREFIX_REGEX.match(prefix)
  unless match
    RFlow.logger.error "Error parsing IRC prefix '#{prefix}'"
    return
  end

  # nick/server, user, host
  match[1..3]
end