Class Autumn::Daemon
In: lib/autumn/daemon.rb
Parent: Object

Describes an IRC server daemon program. Different IRC servers run off of different IRC daemons, each of which has a slightly different implementation of the IRC protocol. To encapsulate this, the Daemon class stores the names of some of the more common IRC server types, as well as the unique information about those daemons, such as supported usermodes, response codes, and supported channel types.

An instance of Daemon is an IRC server type. The Daemon class keeps a catalog of all instances, assigning each a descriptive name (for example, "Unreal" for the UnrealIRCd program, a popular IRC server daemon).

A Daemon instance can be queried for information about the IRC server type, as necessary to parse messages from that IRC server.

A "default" daemon will also be created representing a common denominator of IRC features, which is used in situations where a server‘s exact type is unknown. This daemon will consist of all non-conflicting entries among the defined daemons.

In addition to the methods and attributes below, you can also call predicate methods such as usermode? and channel_prefix? to test if a character is in a set of known modes/privileges/prefixes, or if a number is in the set of known events.

Methods

Public Class methods

Returns a Daemon instance by associated name.

Returns the fallback server type.

Yields the name of each Daemon registered with the class.

Creates a new Daemon instance associated with a given name. You must also pass in the hashes for it to store.

Public Instance methods

Hash of channel mode characters (e.g., m) to their symbol representations (e.g., :moderated).

Hash of channel prefixes (e.g., &) to their symbol representations (e.g., :local).

Hash of numerical event codes (e.g., 372) to their symbol representations (e.g., :motd).

Given a nick, returns that nick stripped of any privilege characters on the left side.

Returns true if the first character(s) of a nick are valid privilege prefixes.

Given a nick, returns the privileges granted to this nick, as indicated by the prefix characters. Returns :unvoiced if no prefix characters are present. Returns an array of privileges if multiple prefix characters are present.

Hash of user privilege characters (e.g., v) to their symbol representations (e.g., :voiced).

Returns true if the mode string (e.g., "+v") appears to be changing a user privilege as opposed to a channel mode.

Hash of server mode characters (e.g., H) to their symbol representations (e.g., :hidden).

Hash of user privilege prefixes (e.g., @) to their symbol representations (e.g., :operator).

Hash of usermode characters (e.g., i) to their symbol representations (e.g., :invisible).

[Validate]