Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.coveralls.yml
.gitignore
.travis.yml
CHANGES.md
Gemfile
LICENSE.txt
README.md
Rakefile
ircsupport.gemspec

README.md

IRCSupport

Gem Version Build Status Code Climate Coverage Status

IRCSupport provides everything you need to work with the IRC protocol and its widely-used extensions. It is meant to be a building block for higher-level libraries that use IRC (clients or servers). There are a bunch of IRC client/bot libraries for Ruby out there, and they all implement their own stuff for dealing with the IRC protocol. Why not keep it in one place?

Features

  • Complete: Includes support for all protocol standards used by modern IRC clients and servers, including:
  • RFC1459
  • RFC2812 & RFC2813
  • CTCP
  • DCC (CHAT, SEND, ACCEPT, RESUME)
  • RPL_ISUPPORT (draft-brocklesby-irc-isupport-03)
  • mIRC/ECMA-48/RGB color and formatting codes
  • IRCv3 standards
  • Tested: A heavy emphasis is placed on testing the code. It generally has 100% test coverage.
  • Flexible: The tools provided by IRCSupport are flexible and modular, and should encourage reuse.

Usage

Here are some examples of using IRCSupport:

require 'ircsupport'

line = ':foo!bar@baz.com PRIVMSG #the_room :Greetings, everyone!'
irc_parser = IRCSupport::Parser.new
msg = irc_parser.parse(line)

msg.channel
# => '#the_room'

msg.sender
# => 'foo!bar@baz'

msg.is_action?
# => false

msg.type
# => :message

IRCSupport::Validations.valid_nick_name?("Foo{}Bar[]")
# => true

IRCSupport::Validations.valid_nick_name?("123FooBar")
# => false

IRCSupport::Numerics.numeric_to_name('005')
# => 'RPL_ISUPPORT'

# any module can also be mixed into your class
include IRCSupport::Numerics
numeric_to_name('001')
# => 'RPL_WELCOME'

See the API documentation for more details.

Components

IRCSupport::Parser

This class is a complete parser for the IRC protocol. It can provide you with rich objects which encapsulate all the information of a message in handy methods.

IRCSupport::Case

A module that provides functions that conversion between various IRC casemappings.

IRCSupport::Encoding

A module that provides functions to encode or decode IRC messages.

IRCSupport::Formatting

A module that provides functions for detecting, stripping, and constructing strings with IRC color and formatting codes.

IRCSupport::Masks

A module that provides functions to deal with IRC masks.

IRCSupport::Modes

A module that provides functions to work with mode strings.

IRCSupport::Numerics

A module that provides functions to look up the names of IRC numerics and vice versa.

IRCSupport::Validations

A module that provides functions to validate various IRC strings.

Contributing

  • Fork this repository on github
  • Make your changes and send me a pull request
  • If I like them I'll merge them
  • If I've accepted a patch, feel free to ask for commit access

Kudos

Those go to the authors of the IRC::Utils Perl module, on which much of this library's functionality is based. Same for the authors of cinch, from which a few functions were borrowed.

License

Copyright (c) 2012 Hinrik Örn Sigurðsson. Distributed under the MIT License. See LICENSE.txt for further details.