Ircxd.ClientCommand (ircxd v1.1.0)

Copy Markdown View Source

Parses and validates a client-to-server IRC command line.

Unlike Ircxd.Message.parse/1, the default contract rejects server source prefixes, numeric replies, and message tags. Callers may opt into those grammar features explicitly, while connection-dependent capability and transport-security checks remain the responsibility of Ircxd.Client.

Summary

Types

A grammar feature policy.

Functions

Converts the message command to uppercase.

Parses and validates one client command line.

Validates a client message with the same options as parse/2.

Types

option()

@type option() ::
  {:tags, :allow | :forbid}
  | {:source, :allow | :forbid}
  | {:numerics, :allow | :forbid}

A grammar feature policy.

Functions

normalize(message)

@spec normalize(Ircxd.Message.t()) :: Ircxd.Message.t()

Converts the message command to uppercase.

parse(line, opts \\ [])

@spec parse(String.t(), [option()]) :: {:ok, Ircxd.Message.t()} | {:error, atom()}

Parses and validates one client command line.

Use :tags, :source, or :numerics with :allow to permit that grammar feature. Each option defaults to :forbid.

validate(message, opts \\ [])

@spec validate(Ircxd.Message.t(), [option()]) :: :ok | {:error, atom()}

Validates a client message with the same options as parse/2.