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
Logon to a server
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
Specs
add_handler(client :: pid, pid) :: :ok
Add a new event handler process
Specs
add_handler_async(client :: pid, pid) :: :ok
Add a new event handler process, asynchronously
Specs
channel_has_user?(client :: pid, channel :: binary, nick :: binary) ::
true |
false |
{:error, atom}
Determine if a nick is present in the provided channel
Specs
channel_topic(client :: pid, channel :: binary) ::
binary |
{:error, atom}
Get the topic of the provided channel
Specs
channel_type(client :: pid, channel :: binary) ::
atom |
{:error, atom}
Get the channel type of the provided channel
Specs
channel_users(client :: pid, channel :: binary) ::
[binary] |
[] |
{:error, atom}
Get a list of users in the provided channel
Specs
channels(client :: pid) ::
[binary] |
[] |
{:error, atom}
Get details about each of the client’s currently joined channels
Specs
cmd(client :: pid, raw_cmd :: binary) ::
:ok |
{:error, atom}
Send a raw IRC command
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
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 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.
Specs
init([any] | []) :: {:ok, ExIrc.Client.ClientState.t}
Called when GenServer initializes the client
Specs
invite(client :: pid, nick :: binary, channel :: binary) ::
:ok |
{:error, atom}
Invite a user to a channel
Specs
is_connected?(client :: pid) :: true | false
Determine if the provided client process has an open connection to a server
Specs
is_logged_on?(client :: pid) :: true | false
Determine if the provided client is logged on to a server
Specs
join(client :: pid, channel :: binary, key :: binary | nil) ::
:ok |
{:error, atom}
Join a channel, with an optional password
Specs
kick(client :: pid, channel :: binary, nick :: binary, message :: binary | nil) ::
:ok |
{:error, atom}
Kick a user from a channel
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”
Specs
me(client :: pid, channel :: binary, msg :: binary) ::
:ok |
{:error, atom}
Send an action message, i.e. (/me slaps someone with a big trout)
Specs
mode(client :: pid, channel_or_nick :: binary, flags :: binary, args :: binary | nil) ::
:ok |
{:error, atom}
Change mode for a user or channel
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
Specs
nick(client :: pid, new_nick :: binary) ::
:ok |
{:error, atom}
Change the client’s nick
Specs
part(client :: pid, channel :: binary) ::
:ok |
{:error, atom}
Leave a channel
Specs
quit(client :: pid, msg :: binary | nil) ::
:ok |
{:error, atom}
Quit the server, with an optional part message
Specs
remove_handler(client :: pid, pid) :: :ok
Remove an event handler process
Specs
remove_handler_async(client :: pid, pid) :: :ok
Remove an event handler process, asynchronously
Specs
start!(options :: list | nil) ::
{:ok, pid} |
{:error, term}
Start a new IRC client process
Returns either {:ok, pid} or {:error, reason}
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}
Specs
state(client :: pid) :: [{atom, any}]
Get the current state of the provided client
Specs
stop!(client :: pid) :: {:stop, :normal, :ok, ExIrc.Client.ClientState.t}
Stop the IRC client process