exirc v1.1.0 ExIRC.Client

Maintains the state and behaviour for individual IRC client connections

Link to this section Summary

Functions

Add a new event handler process

Add a new event handler process, asynchronously

Determine if a nick is present in the provided channel

Get the topic of the provided channel

Get the channel type of the provided channel

Get a list of users in the provided channel

Get details about each of the client's currently joined channels

Returns a specification to start this module under a supervisor

Send a raw IRC command

Transform state for hot upgrades/downgrades

Connect to a server with the provided server and port

Connect to a server with the provided server and port via SSL

Handle calls from the external API. It is not recommended to call these directly

Handles asynchronous messages from the external API. Not recommended to call these directly

Handle ExIRC.Messages received from the server

Handle messages from the SSL socket connection

Called when GenServer initializes the client

Invite a user to a channel

Determine if the provided client process has an open connection to a server

Determine if the provided client is logged on to a server

Join a channel, with an optional password

Kick a user from a channel

Send an action message, i.e. (/me slaps someone with a big trout)

Change mode for a user or channel

Send a message to a nick or channel Message types are: :privmsg :notice :ctcp

Change the client's nick

Leave a channel

Quit the server, with an optional part message

Remove an event handler process

Remove an event handler process, asynchronously

Start a new IRC client process

Start a new IRC client process

Get the current state of the provided client

Stop the IRC client process

Handle termination

Ask the server for the channel's users

Ask the server for the user's informations

Link to this section Functions

Link to this function

add_handler(client, pid)
add_handler(client :: pid(), pid()) :: :ok

Add a new event handler process

Link to this function

add_handler_async(client, pid)
add_handler_async(client :: pid(), pid()) :: :ok

Add a new event handler process, asynchronously

Link to this function

channel_has_user?(client, channel, nick)
channel_has_user?(client :: pid(), channel :: binary(), nick :: binary()) ::
  true | false | {:error, atom()}

Determine if a nick is present in the provided channel

Link to this function

channel_topic(client, channel)
channel_topic(client :: pid(), channel :: binary()) ::
  binary() | {:error, atom()}

Get the topic of the provided channel

Link to this function

channel_type(client, channel)
channel_type(client :: pid(), channel :: binary()) :: atom() | {:error, atom()}

Get the channel type of the provided channel

Link to this function

channel_users(client, channel)
channel_users(client :: pid(), channel :: binary()) ::
  [binary()] | [] | {:error, atom()}

Get a list of users in the provided channel

Link to this function

channels(client)
channels(client :: pid()) :: [binary()] | [] | {:error, atom()}

Get details about each of the client's currently joined channels

Link to this function

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

cmd(client, raw_cmd)
cmd(client :: pid(), raw_cmd :: binary()) :: :ok | {:error, atom()}

Send a raw IRC command

Link to this function

code_change(old, state, extra)

Transform state for hot upgrades/downgrades

Link to this function

connect!(client, server, port, options \\ [])
connect!(
  client :: pid(),
  server :: binary(),
  port :: non_neg_integer(),
  options :: list() | nil
) :: :ok

Connect to a server with the provided server and port

Example: Client.connect! pid, "localhost", 6667

Link to this function

connect_ssl!(client, server, port, options \\ [])
connect_ssl!(
  client :: pid(),
  server :: binary(),
  port :: non_neg_integer(),
  options :: list() | nil
) :: :ok

Connect to a server with the provided server and port via SSL

Example: Client.connect! pid, "localhost", 6697

Link to this function

handle_call(msg, from, state)

Handle calls from the external API. It is not recommended to call these directly.

Link to this function

handle_cast(msg, state)

Handles asynchronous messages from the external API. Not recommended to call these directly.

Link to this function

handle_data(msg, state)

Handle ExIRC.Messages received from the server.

Link to this function

handle_info(msg, state)

Handle messages from the SSL socket connection.

Link to this function

init(options \\ [])
init([any()] | []) :: {:ok, ExIRC.Client.ClientState.t()}

Called when GenServer initializes the client

Link to this function

invite(client, nick, channel)
invite(client :: pid(), nick :: binary(), channel :: binary()) ::
  :ok | {:error, atom()}

Invite a user to a channel

Link to this function

is_connected?(client)
is_connected?(client :: pid()) :: true | false

Determine if the provided client process has an open connection to a server

Link to this function

is_logged_on?(client)
is_logged_on?(client :: pid()) :: true | false

Determine if the provided client is logged on to a server

Link to this function

join(client, channel, key \\ "")
join(client :: pid(), channel :: binary(), key :: binary() | nil) ::
  :ok | {:error, atom()}

Join a channel, with an optional password

Link to this function

kick(client, channel, nick, message \\ "")
kick(
  client :: pid(),
  channel :: binary(),
  nick :: binary(),
  message :: binary() | nil
) :: :ok | {:error, atom()}

Kick a user from a channel

Link to this function

logon(client, pass, nick, user, name)
logon(
  client :: pid(),
  pass :: binary(),
  nick :: binary(),
  user :: binary(),
  name :: binary()
) :: :ok | {:error, :not_connected}

Logon to a server

Example: Client.logon pid, "password", "mynick", "user", "My Name"

Link to this function

me(client, channel, msg)
me(client :: pid(), channel :: binary(), msg :: binary()) ::
  :ok | {:error, atom()}

Send an action message, i.e. (/me slaps someone with a big trout)

Link to this function

mode(client, channel_or_nick, flags, args \\ "")
mode(
  client :: pid(),
  channel_or_nick :: binary(),
  flags :: binary(),
  args :: binary() | nil
) :: :ok | {:error, atom()}

Change mode for a user or channel

Link to this function

msg(client, type, nick, msg)
msg(client :: pid(), type :: atom(), nick :: binary(), msg :: binary()) ::
  :ok | {:error, atom()}

Send a message to a nick or channel Message types are: :privmsg :notice :ctcp

Link to this function

names(client, channel)
names(client :: pid(), channel :: binary()) :: :ok | {:error, atom()}

Link to this function

nick(client, new_nick)
nick(client :: pid(), new_nick :: binary()) :: :ok | {:error, atom()}

Change the client's nick

Link to this function

part(client, channel)
part(client :: pid(), channel :: binary()) :: :ok | {:error, atom()}

Leave a channel

Link to this function

quit(client, msg \\ "Leaving..")
quit(client :: pid(), msg :: binary() | nil) :: :ok | {:error, atom()}

Quit the server, with an optional part message

Link to this function

remove_handler(client, pid)
remove_handler(client :: pid(), pid()) :: :ok

Remove an event handler process

Link to this function

remove_handler_async(client, pid)
remove_handler_async(client :: pid(), pid()) :: :ok

Remove an event handler process, asynchronously

Link to this function

start!(options \\ [])
start!(options :: list() | nil) :: {:ok, pid()} | {:error, term()}

Start a new IRC client process

Returns either {:ok, pid} or {:error, reason}

Link to this function

start_link(options \\ [], process_opts \\ [])
start_link(options :: list() | nil, process_opts :: list() | nil) ::
  {:ok, pid()} | {:error, term()}

Start a new IRC client process.

Returns either {:ok, pid} or {:error, reason}

Link to this function

state(client)
state(client :: pid()) :: [{atom(), any()}]

Get the current state of the provided client

Link to this function

stop!(client)
stop!(client :: pid()) :: {:stop, :normal, :ok, ExIRC.Client.ClientState.t()}

Stop the IRC client process

Link to this function

terminate(reason, state)

Handle termination

Link to this function

who(client, channel)
who(client :: pid(), channel :: binary()) :: :ok | {:error, atom()}

Ask the server for the channel's users

Link to this function

whois(client, user)
whois(client :: pid(), user :: binary()) :: :ok | {:error, atom()}

Ask the server for the user's informations.