1
0
mirror of https://github.com/minetest-mods/irc.git synced 2024-11-05 09:40:20 +01:00
irc/doc/luairc/modules/irc.html
2012-12-01 01:06:15 -02:00

684 lines
12 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Reference</title>
<link rel="stylesheet" href="../luadoc.css" type="text/css" />
<!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/-->
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<div id="navigation">
<h1>LuaDoc</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<!-- Module list -->
<h1>Modules</h1>
<ul>
<li>
<a href="../modules/callbacks.html">callbacks</a>
</li>
<li><strong>irc</strong></li>
<li>
<a href="../modules/irc.channel.html">irc.channel</a>
</li>
<li>
<a href="../modules/irc.constants.html">irc.constants</a>
</li>
<li>
<a href="../modules/irc.ctcp.html">irc.ctcp</a>
</li>
<li>
<a href="../modules/irc.dcc.html">irc.dcc</a>
</li>
<li>
<a href="../modules/irc.debug.html">irc.debug</a>
</li>
<li>
<a href="../modules/irc.message.html">irc.message</a>
</li>
<li>
<a href="../modules/irc.misc.html">irc.misc</a>
</li>
</ul>
<!-- File list -->
</div><!-- id="navigation" -->
<div id="content">
<h1>Module <code>irc</code></h1>
<p>LuaIRC - IRC framework written in Lua</p>
<p><small><b>Release:</b> 0.3</small></p>
<h2>Functions</h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#act">act</a>&nbsp;(name, action)</td>
<td class="summary">Perform a /me action.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#channels">channels</a>&nbsp;()</td>
<td class="summary">Iterate over currently joined channels.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#connect">connect</a>&nbsp;(args)</td>
<td class="summary">Start a connection to the irc server.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#ctcp_ping">ctcp_ping</a>&nbsp;(cb, nick)</td>
<td class="summary">Send a CTCP ping request.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#ctcp_time">ctcp_time</a>&nbsp;(cb, nick)</td>
<td class="summary">Send a localtime request.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#ctcp_version">ctcp_version</a>&nbsp;(cb, nick)</td>
<td class="summary">Send a client version request.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_ip">get_ip</a>&nbsp;()</td>
<td class="summary">Get the local IP address for the server connection.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#join">join</a>&nbsp;(channel)</td>
<td class="summary">Join a channel.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#notice">notice</a>&nbsp;(name, message)</td>
<td class="summary">Send a notice to a user or channel.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#part">part</a>&nbsp;(channel)</td>
<td class="summary">Leave a channel.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#quit">quit</a>&nbsp;(message)</td>
<td class="summary">Close the connection to the irc server.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#register_callback">register_callback</a>&nbsp;(name, fn)</td>
<td class="summary">Register a user function to be called when a specific event occurs.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#say">say</a>&nbsp;(name, message)</td>
<td class="summary">Send a message to a user or channel.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#send">send</a>&nbsp;(command, ...)</td>
<td class="summary">Send a raw IRC command.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#server_time">server_time</a>&nbsp;(cb)</td>
<td class="summary">Request the current time of the server you are connected to.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#server_version">server_version</a>&nbsp;(cb)</td>
<td class="summary">Request the version of the IRC server you are currently connected to.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_ip">set_ip</a>&nbsp;(new_ip)</td>
<td class="summary">Set the local IP manually (to allow for NAT workarounds) </td>
</tr>
<tr>
<td class="name" nowrap><a href="#whois">whois</a>&nbsp;(cb, nick)</td>
<td class="summary">Request WHOIS information about a given user.</td>
</tr>
</table>
<br/>
<br/>
<h2><a name="functions"></a>Functions</h2>
<dl class="function">
<dt><a name="act"></a><strong>act</strong>&nbsp;(name, action)</dt>
<dd>
Perform a /me action.
<h3>Parameters</h3>
<ul>
<li>
name: User or channel to send the action to
</li>
<li>
action: Action to send
</li>
</ul>
</dd>
<dt><a name="channels"></a><strong>channels</strong>&nbsp;()</dt>
<dd>
Iterate over currently joined channels. channels() is an iterator function for use in for loops. For example, <pre>for chan in irc.channels() do print(chan:name) end</pre>
<em>See also:</em>
<a href="../modules/irc.channel.html">
irc.channel
</a>
</dd>
<dt><a name="connect"></a><strong>connect</strong>&nbsp;(args)</dt>
<dd>
Start a connection to the irc server.
<h3>Parameters</h3>
<ul>
<li>
args: Table of named arguments containing connection parameters. Defaults are the all-caps versions of these parameters given at the top of the file, and are overridable by setting them as well, i.e. <pre>irc.NETWORK = irc.freenode.net</pre> Possible options are: <ul> <li><i>network:</i> address of the irc network to connect to (default: 'localhost')</li> <li><i>port:</i> port to connect to (default: '6667')</li> <li><i>pass:</i> irc server password (default: don't send)</li> <li><i>nick:</i> nickname to connect as (default: 'luabot')</li> <li><i>username:</i> username to connect with (default: 'LuaIRC')</li> <li><i>realname:</i> realname to connect with (default: 'LuaIRC')</li> <li><i>timeout:</i> amount of time in seconds to wait before dropping an idle connection (default: '60')</li> </ul>
</li>
</ul>
</dd>
<dt><a name="ctcp_ping"></a><strong>ctcp_ping</strong>&nbsp;(cb, nick)</dt>
<dd>
Send a CTCP ping request.
<h3>Parameters</h3>
<ul>
<li>
cb: Callback to call when the information is available. The single table parameter to this callback will contain the fields: <ul> <li><i>nick:</i> the nick which responded to the request</li> <li><i>time:</i> the roundtrip ping time, in seconds</li> </ul>
</li>
<li>
nick: User to ping
</li>
</ul>
</dd>
<dt><a name="ctcp_time"></a><strong>ctcp_time</strong>&nbsp;(cb, nick)</dt>
<dd>
Send a localtime request.
<h3>Parameters</h3>
<ul>
<li>
cb: Callback to call when the information is available. The single table parameter to this callback will contain the fields: <ul> <li><i>nick:</i> the nick which responded to the request</li> <li><i>time:</i> the localtime reported by the remote client</li> </ul>
</li>
<li>
nick: User to request the localtime from
</li>
</ul>
</dd>
<dt><a name="ctcp_version"></a><strong>ctcp_version</strong>&nbsp;(cb, nick)</dt>
<dd>
Send a client version request.
<h3>Parameters</h3>
<ul>
<li>
cb: Callback to call when the information is available. The single table parameter to this callback will contain the fields: <ul> <li><i>nick:</i> the nick which responded to the request</li> <li><i>version:</i> the version reported by the remote client</li> </ul>
</li>
<li>
nick: User to request the client version from
</li>
</ul>
</dd>
<dt><a name="get_ip"></a><strong>get_ip</strong>&nbsp;()</dt>
<dd>
Get the local IP address for the server connection.
<h3>Return value:</h3>
A string representation of the local IP address that the IRC server connection is communicating on
</dd>
<dt><a name="join"></a><strong>join</strong>&nbsp;(channel)</dt>
<dd>
Join a channel.
<h3>Parameters</h3>
<ul>
<li>
channel: Channel to join
</li>
</ul>
</dd>
<dt><a name="notice"></a><strong>notice</strong>&nbsp;(name, message)</dt>
<dd>
Send a notice to a user or channel.
<h3>Parameters</h3>
<ul>
<li>
name: User or channel to send the notice to
</li>
<li>
message: Message to send
</li>
</ul>
</dd>
<dt><a name="part"></a><strong>part</strong>&nbsp;(channel)</dt>
<dd>
Leave a channel.
<h3>Parameters</h3>
<ul>
<li>
channel: Channel to leave
</li>
</ul>
</dd>
<dt><a name="quit"></a><strong>quit</strong>&nbsp;(message)</dt>
<dd>
Close the connection to the irc server.
<h3>Parameters</h3>
<ul>
<li>
message: Quit message (optional, defaults to 'Leaving')
</li>
</ul>
</dd>
<dt><a name="register_callback"></a><strong>register_callback</strong>&nbsp;(name, fn)</dt>
<dd>
Register a user function to be called when a specific event occurs.
<h3>Parameters</h3>
<ul>
<li>
name: Name of the event
</li>
<li>
fn: Function to call when the event occurs, or nil to clear the callback for this event
</li>
</ul>
<h3>Return value:</h3>
Value of the original callback for this event (or nil if no previous callback had been set)
</dd>
<dt><a name="say"></a><strong>say</strong>&nbsp;(name, message)</dt>
<dd>
Send a message to a user or channel.
<h3>Parameters</h3>
<ul>
<li>
name: User or channel to send the message to
</li>
<li>
message: Message to send
</li>
</ul>
</dd>
<dt><a name="send"></a><strong>send</strong>&nbsp;(command, ...)</dt>
<dd>
Send a raw IRC command.
<h3>Parameters</h3>
<ul>
<li>
command: String containing the raw IRC command
</li>
<li>
...: Arguments to the command. Each argument is either a string or an array. Strings are sent literally, arrays are CTCP quoted as a group. The last argument (if it exists) is preceded by a : (so it may contain spaces).
</li>
</ul>
</dd>
<dt><a name="server_time"></a><strong>server_time</strong>&nbsp;(cb)</dt>
<dd>
Request the current time of the server you are connected to.
<h3>Parameters</h3>
<ul>
<li>
cb: Callback to call when the information is available. The single table parameter to this callback will contain the fields: <ul> <li><i>server:</i> the server which responded to the request</li> <li><i>time:</i> the time reported by the server</li> </ul>
</li>
</ul>
</dd>
<dt><a name="server_version"></a><strong>server_version</strong>&nbsp;(cb)</dt>
<dd>
Request the version of the IRC server you are currently connected to.
<h3>Parameters</h3>
<ul>
<li>
cb: Callback to call when the information is available. The single table parameter to this callback will contain the fields: <ul> <li><i>server:</i> the server which responded to the request</li> <li><i>version:</i> the server version</li> <li><i>comments:</i> other data provided by the server</li> </ul>
</li>
</ul>
</dd>
<dt><a name="set_ip"></a><strong>set_ip</strong>&nbsp;(new_ip)</dt>
<dd>
Set the local IP manually (to allow for NAT workarounds)
<h3>Parameters</h3>
<ul>
<li>
new_ip: IP address to set
</li>
</ul>
</dd>
<dt><a name="whois"></a><strong>whois</strong>&nbsp;(cb, nick)</dt>
<dd>
Request WHOIS information about a given user.
<h3>Parameters</h3>
<ul>
<li>
cb: Callback to call when the information is available. The single table parameter to this callback may contain any or all of the fields: <ul> <li><i>nick:</i> the nick that was passed to this function (this field will always be here)</li> <li><i>user:</i> the IRC username of the user</li> <li><i>host:</i> the user's hostname</li> <li><i>realname:</i> the IRC realname of the user</li> <li><i>server:</i> the IRC server the user is connected to</li> <li><i>serverinfo:</i> arbitrary information about the above server</li> <li><i>awaymsg:</i> set to the user's away message if they are away</li> <li><i>is_oper:</i> true if the user is an IRCop</li> <li><i>idle_time:</i> amount of time the user has been idle</li> <li><i>channels:</i> array containing the channels the user has joined</li> </ul>
</li>
<li>
nick: User to request WHOIS information about
</li>
</ul>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>