exirc v0.11.0 ExIrc.Client

Maintains the state and behaviour for individual IRC client connections

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

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 IrcMessages 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

Functions

add_handler(client, pid)

Specs

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

Add a new event handler process

add_handler_async(client, pid)

Specs

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

Add a new event handler process, asynchronously

channel_has_user?(client, channel, nick)

Specs

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

Determine if a nick is present in the provided channel

channel_topic(client, channel)

Specs

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

Get the topic of the provided channel

channel_type(client, channel)

Specs

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

Get the channel type of the provided channel

channel_users(client, channel)

Specs

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

Get a list of users in the provided channel

channels(client)

Specs

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

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

cmd(client, raw_cmd)

Specs

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

Send a raw IRC command

code_change(old, state, extra)

Transform state for hot upgrades/downgrades

connect!(client, server, port, options \\ [])

Specs

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

connect_ssl!(client, server, port, options \\ [])

Specs

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

handle_call(msg, from, state)

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

handle_cast(msg, state)

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

handle_data(msg, state)

Handle IrcMessages received from the server.

handle_info(arg1, state)

Handle messages from the SSL socket connection.

init(args)

Specs

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

Called when GenServer initializes the client

invite(client, nick, channel)

Specs

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

Invite a user to a channel

is_connected?(client)

Specs

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

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

is_logged_on?(client)

Specs

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

Determine if the provided client is logged on to a server

join(client, channel, key \\ "")

Specs

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

Join a channel, with an optional password

kick(client, channel, nick, message \\ "")

Specs

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

Kick a user from a channel

logon(client, pass, nick, user, name)

Specs

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”, “username”, “My Name”

me(client, channel, msg)

Specs

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

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

mode(client, channel_or_nick, flags, args \\ "")

Specs

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

Change mode for a user or channel

msg(client, type, nick, msg)

Specs

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

names(client, channel)

Specs

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

Specs

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

Change the client’s nick

part(client, channel)

Specs

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

Leave a channel

quit(client, msg \\ "Leaving..")

Specs

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

Quit the server, with an optional part message

remove_handler(client, pid)

Specs

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

Remove an event handler process

remove_handler_async(client, pid)

Specs

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

Remove an event handler process, asynchronously

start!(options \\ [])

Specs

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

Start a new IRC client process

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

start_link(options \\ [], process_opts \\ [])

Specs

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}

state(client)

Specs

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

Get the current state of the provided client

stop!(client)

Specs

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

Stop the IRC client process

terminate(reason, state)

Handle termination