mirror of
https://github.com/ShadowNinja/LuaIRC.git
synced 2024-11-16 07:20:32 +01:00
Added documentation
This commit is contained in:
parent
20d424c4db
commit
c6c717c375
215
doc/files/irc.html
Normal file
215
doc/files/irc.html
Normal file
|
@ -0,0 +1,215 @@
|
|||
<!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/irc.html">irc</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<!-- File list -->
|
||||
|
||||
<h1>Files</h1>
|
||||
<ul>
|
||||
|
||||
<li><strong>irc.luadoc</strong></li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div> <!-- id="navigation" -->
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h1>File <code>irc.luadoc</code></h1>
|
||||
|
||||
|
||||
<p>LuaIRC is a low-level IRC library for Lua.</p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h2>Functions</h2>
|
||||
<table class="function_list">
|
||||
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#meta:hook">meta:hook</a> (name, id [, f])</td>
|
||||
<td class="summary">Hooks function <code>f</code> to event <code>name</code>, with the unique tag <code>id</code>.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#meta:send">meta:send</a> (fmt, ...)</td>
|
||||
<td class="summary">Sends a line of raw IRC to the server Test Test 2 </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#new">new</a> (user)</td>
|
||||
<td class="summary">Create a new IRC object.</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
|
||||
|
||||
<h2><a name="functions"></a>Functions</h2>
|
||||
<dl class="function">
|
||||
|
||||
|
||||
|
||||
<dt><a name="meta:hook"></a><strong>meta:hook</strong> (name, id [, f])</dt>
|
||||
<dd>
|
||||
Hooks function <code>f</code> to event <code>name</code>, with the unique tag <code>id</code>. If parameter <code>f</code> is absent, <code>id</code> is assumed to be both the callback function and unique tag.
|
||||
|
||||
|
||||
<h3>Parameters</h3>
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
name:
|
||||
</li>
|
||||
|
||||
<li>
|
||||
id [:
|
||||
</li>
|
||||
|
||||
<li>
|
||||
f]:
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
|
||||
<dt><a name="meta:send"></a><strong>meta:send</strong> (fmt, ...)</dt>
|
||||
<dd>
|
||||
Sends a line of raw IRC to the server Test Test 2
|
||||
|
||||
|
||||
<h3>Parameters</h3>
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
fmt:
|
||||
</li>
|
||||
|
||||
<li>
|
||||
...:
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
|
||||
<dt><a name="new"></a><strong>new</strong> (user)</dt>
|
||||
<dd>
|
||||
Create a new IRC object. The <code>user</code> parameter can contain fields <code>nick</code>, <code>username</code> and <code>realname</code>. The <code>nick</code> field is required.
|
||||
|
||||
|
||||
<h3>Parameters</h3>
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
user:
|
||||
</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>
|
84
doc/index.html
Normal file
84
doc/index.html
Normal file
|
@ -0,0 +1,84 @@
|
|||
<!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><strong>Index</strong></li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<!-- Module list -->
|
||||
|
||||
<h1>Modules</h1>
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
<a href="modules/irc.html">irc</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<!-- File list -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div> <!-- id="navigation" -->
|
||||
|
||||
<div id="content">
|
||||
|
||||
|
||||
|
||||
<h2>Modules</h2>
|
||||
<table class="module_list">
|
||||
<!--<tr><td colspan="2">Modules</td></tr>-->
|
||||
|
||||
<tr>
|
||||
<td class="name"><a href="modules/irc.html">irc</a></td>
|
||||
<td class="summary">LuaIRC is a low-level IRC library for Lua.</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</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>
|
131
doc/irc.luadoc
Normal file
131
doc/irc.luadoc
Normal file
|
@ -0,0 +1,131 @@
|
|||
--- LuaIRC is a low-level IRC library for Lua.
|
||||
-- All functions raise Lua exceptions on error.
|
||||
--
|
||||
-- Use <code>new</code> to create a new IRC object.<br/>
|
||||
-- Example:<br/><br/>
|
||||
--<code>
|
||||
--require "irc"<br/>
|
||||
--local sleep = require "socket".sleep<br/>
|
||||
--<br/>
|
||||
--local s = irc.new{nick = "example"}<br/>
|
||||
--<br/>
|
||||
--s:hook("OnChat", function(user, channel, message)<br/>
|
||||
-- print(("[%s] %s: %s"):format(channel, user.nick, message))<br/>
|
||||
--end)<br/>
|
||||
--<br/>
|
||||
--s:connect("irc.example.net")<br/>
|
||||
--s:join("#example")<br/>
|
||||
--<br/>
|
||||
--while true do<br/>
|
||||
-- s:think()<br/>
|
||||
-- sleep(0.5)<br/>
|
||||
--end<br/>
|
||||
--</code>
|
||||
|
||||
module "irc"
|
||||
|
||||
--- Create a new IRC object. Use <code>irc:connect</code> to connect to a server.
|
||||
-- @param user Table with fields <code>nick</code>, <code>username</code> and <code>realname</code>.
|
||||
-- The <code>nick</code> field is required.
|
||||
--
|
||||
-- @return Returns a new <code>irc</code> object.
|
||||
function new(user)
|
||||
|
||||
--- Hook a function to an event.
|
||||
-- @param name Name of event.
|
||||
-- @param id Unique tag.
|
||||
-- @param f Callback function. [defaults to <code>id</code>]
|
||||
-- @see Hooks
|
||||
function irc:hook(name, id, f)
|
||||
|
||||
--- Remove previous hooked callback.
|
||||
-- @param name Name of event.
|
||||
-- @param id Unique tag.
|
||||
function irc:unhook(name, id)
|
||||
|
||||
--- Connect <code>irc</code> to an IRC server.
|
||||
-- @param server Server address.
|
||||
-- @param port Server port. [default 6667]
|
||||
-- @param timeout Connection timeout value in seconds. [default 30]
|
||||
function irc:connect(server, port, timeout)
|
||||
|
||||
--- Disconnect <code>irc</code> from the server.
|
||||
-- @param message Quit message.
|
||||
function irc:disconnect(message)
|
||||
|
||||
--- Handle incoming data for <code>irc</code>, and invoke previously hooked callbacks based on new server input.
|
||||
-- You should call this in some kind of main loop, or at least often enough to not time out.
|
||||
function irc:think()
|
||||
|
||||
--- Look up user info.
|
||||
-- @param nick Nick of user to query.
|
||||
-- @return Table with fields <code>userinfo</code>, <code>node</code>, <code>channels</code> and <code>account</code>.
|
||||
function irc:whois(nick)
|
||||
|
||||
--- Send a raw line of IRC to the server.
|
||||
-- @param fmt Line to be sent, excluding newline characters.
|
||||
-- @param ... Format parameters for <code>fmt</code>, with <code>string.format</code> semantics.
|
||||
function irc:send(fmt, ...)
|
||||
|
||||
--- Send a message to a channel or user.
|
||||
-- @param target Nick or channel to send to.
|
||||
-- @param message Message to send.
|
||||
function irc:sendChat(target, message)
|
||||
|
||||
--- Send a notice to a channel or user.
|
||||
-- @param target Nick or channel to send to.
|
||||
-- @param message Notice to send.
|
||||
function irc:sendNotice(target, message)
|
||||
|
||||
--- Join a channel.
|
||||
-- @param channel Channel to join.
|
||||
-- @param key Channel password. [optional]
|
||||
function irc:join(channel, key)
|
||||
|
||||
--- Leave a channel.
|
||||
-- @param channel Channel to leave.
|
||||
function irc:part(channel)
|
||||
|
||||
--- Turn user information tracking on or off. User tracking is enabled by default.
|
||||
-- @param b Boolean whether or not to track user information.
|
||||
function irc:trackUsers(b)
|
||||
|
||||
--- Add/remove modes for a channel or nick.
|
||||
-- @param t Table with fields <code>target, nick, add</code> and/or <code>rem</code>. <code>target</code> or <code>nick</code>
|
||||
-- specifies the user or channel to add/remove modes. <code>add</code> is a list of modes to add to the user or channel.
|
||||
-- <code>rem</code> is a list of modes to remove from the user or channel.
|
||||
-- @usage Example which sets +m (moderated) for #channel: <br/>
|
||||
-- <code>irc:setMode{target = "#channel", add = "m"}</code>
|
||||
function irc:setMode(t)
|
||||
|
||||
--internal
|
||||
function irc:invoke(name, ...)
|
||||
function irc:handle(prefix, cmd, params)
|
||||
function irc:shutdown()
|
||||
|
||||
--- List of hooks you can use with irc:hook. The parameter list describes the parameters passed to the callback function.
|
||||
-- <ul>
|
||||
-- <li><code>OnDisconnect(message, errorOccurred)</code></li>
|
||||
-- <li><code>OnChat(user, channel, message)</code></li>
|
||||
-- <li><code>OnNotice(user, channel, message)</code></li>
|
||||
-- <li><code>OnJoin(user, channel)</code>*</li>
|
||||
-- <li><code>OnPart(user, channel)</code>*</li>
|
||||
-- <li><code>OnQuit(user, message)</code></li>
|
||||
-- <li><code>NickChange(user, newnick)</code>*</li>
|
||||
-- <li><code>NameList(channel, names)</code></li>
|
||||
-- </ul>
|
||||
-- * Event also invoked for yourself.
|
||||
-- @name Hooks
|
||||
-- @class table
|
||||
|
||||
--- Table with information about a user.
|
||||
-- <ul>
|
||||
-- <li><code>nick</code> - User nickname. Always present.</li>
|
||||
-- <li><code>username</code> - User username.</li>
|
||||
-- <li><code>host</code> - User hostname.</li>
|
||||
-- <li><code>realname</code> - User real name.</li>
|
||||
-- <li><code>access</code> - User access, available in channel-oriented callbacks. Can be '+', '@', and others, depending on the server.</li>
|
||||
-- </ul>
|
||||
-- Apart from <code>nick</code>, fields may be missing. To fill them in, enable user tracking and use irc:whois.
|
||||
-- @name User
|
||||
-- @class table
|
286
doc/luadoc.css
Normal file
286
doc/luadoc.css
Normal file
|
@ -0,0 +1,286 @@
|
|||
body {
|
||||
margin-left: 1em;
|
||||
margin-right: 1em;
|
||||
font-family: arial, helvetica, geneva, sans-serif;
|
||||
background-color:#ffffff; margin:0px;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: "Andale Mono", monospace;
|
||||
}
|
||||
|
||||
tt {
|
||||
font-family: "Andale Mono", monospace;
|
||||
}
|
||||
|
||||
body, td, th { font-size: 11pt; }
|
||||
|
||||
h1, h2, h3, h4 { margin-left: 0em; }
|
||||
|
||||
textarea, pre, tt { font-size:10pt; }
|
||||
body, td, th { color:#000000; }
|
||||
small { font-size:0.85em; }
|
||||
h1 { font-size:1.5em; }
|
||||
h2 { font-size:1.25em; }
|
||||
h3 { font-size:1.15em; }
|
||||
h4 { font-size:1.06em; }
|
||||
|
||||
a:link { font-weight:bold; color: #004080; text-decoration: none; }
|
||||
a:visited { font-weight:bold; color: #006699; text-decoration: none; }
|
||||
a:link:hover { text-decoration:underline; }
|
||||
hr { color:#cccccc }
|
||||
img { border-width: 0px; }
|
||||
|
||||
|
||||
h3 { padding-top: 1em; }
|
||||
|
||||
p { margin-left: 1em; }
|
||||
|
||||
p.name {
|
||||
font-family: "Andale Mono", monospace;
|
||||
padding-top: 1em;
|
||||
margin-left: 0em;
|
||||
}
|
||||
|
||||
blockquote { margin-left: 3em; }
|
||||
|
||||
pre.example {
|
||||
background-color: rgb(245, 245, 245);
|
||||
border-top-width: 1px;
|
||||
border-right-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
border-left-width: 1px;
|
||||
border-top-style: solid;
|
||||
border-right-style: solid;
|
||||
border-bottom-style: solid;
|
||||
border-left-style: solid;
|
||||
border-top-color: silver;
|
||||
border-right-color: silver;
|
||||
border-bottom-color: silver;
|
||||
border-left-color: silver;
|
||||
padding: 1em;
|
||||
margin-left: 1em;
|
||||
margin-right: 1em;
|
||||
font-family: "Andale Mono", monospace;
|
||||
font-size: smaller;
|
||||
}
|
||||
|
||||
|
||||
hr {
|
||||
margin-left: 0em;
|
||||
background: #00007f;
|
||||
border: 0px;
|
||||
height: 1px;
|
||||
}
|
||||
|
||||
ul { list-style-type: disc; }
|
||||
|
||||
table.index { border: 1px #00007f; }
|
||||
table.index td { text-align: left; vertical-align: top; }
|
||||
table.index ul { padding-top: 0em; margin-top: 0em; }
|
||||
|
||||
table {
|
||||
border: 1px solid black;
|
||||
border-collapse: collapse;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
th {
|
||||
border: 1px solid black;
|
||||
padding: 0.5em;
|
||||
}
|
||||
td {
|
||||
border: 1px solid black;
|
||||
padding: 0.5em;
|
||||
}
|
||||
div.header, div.footer { margin-left: 0em; }
|
||||
|
||||
#container
|
||||
{
|
||||
margin-left: 1em;
|
||||
margin-right: 1em;
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
|
||||
#product
|
||||
{
|
||||
text-align: center;
|
||||
border-bottom: 1px solid #cccccc;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
#product big {
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
#product_logo
|
||||
{
|
||||
}
|
||||
|
||||
#product_name
|
||||
{
|
||||
}
|
||||
|
||||
#product_description
|
||||
{
|
||||
}
|
||||
|
||||
#main
|
||||
{
|
||||
background-color: #f0f0f0;
|
||||
border-left: 2px solid #cccccc;
|
||||
}
|
||||
|
||||
#navigation
|
||||
{
|
||||
float: left;
|
||||
width: 18em;
|
||||
margin: 0;
|
||||
vertical-align: top;
|
||||
background-color: #f0f0f0;
|
||||
overflow:visible;
|
||||
}
|
||||
|
||||
#navigation h1 {
|
||||
background-color:#e7e7e7;
|
||||
font-size:1.1em;
|
||||
color:#000000;
|
||||
text-align:left;
|
||||
margin:0px;
|
||||
padding:0.2em;
|
||||
border-top:1px solid #dddddd;
|
||||
border-bottom:1px solid #dddddd;
|
||||
}
|
||||
|
||||
#navigation ul
|
||||
{
|
||||
font-size:1em;
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
margin: 1px;
|
||||
}
|
||||
|
||||
#navigation li
|
||||
{
|
||||
text-indent: -1em;
|
||||
margin: 0em 0em 0em 0.5em;
|
||||
display: block;
|
||||
padding: 3px 0px 0px 12px;
|
||||
}
|
||||
|
||||
#navigation li li a
|
||||
{
|
||||
padding: 0px 3px 0px -1em;
|
||||
}
|
||||
|
||||
#content
|
||||
{
|
||||
margin-left: 18em;
|
||||
padding: 1em;
|
||||
border-left: 2px solid #cccccc;
|
||||
border-right: 2px solid #cccccc;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
#about
|
||||
{
|
||||
clear: both;
|
||||
margin: 0;
|
||||
padding: 5px;
|
||||
border-top: 2px solid #cccccc;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
@media print {
|
||||
body {
|
||||
font: 12pt "Times New Roman", "TimeNR", Times, serif;
|
||||
}
|
||||
a { font-weight:bold; color: #004080; text-decoration: underline; }
|
||||
|
||||
#main
{
background-color: #ffffff;
border-left: 0px;
}
|
||||
#container
{
margin-left: 2%;
margin-right: 2%;
background-color: #ffffff;
}
|
||||
|
||||
#content
{
margin-left: 0px;
padding: 1em;
border-left: 0px;
border-right: 0px;
background-color: #ffffff;
}
|
||||
|
||||
#navigation
{
display: none;
|
||||
}
|
||||
pre.example {
|
||||
font-family: "Andale Mono", monospace;
|
||||
font-size: 10pt;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
}
|
||||
|
||||
table.module_list td
|
||||
{
|
||||
border-width: 1px;
|
||||
padding: 3px;
|
||||
border-style: solid;
|
||||
border-color: #cccccc;
|
||||
}
|
||||
table.module_list td.name { background-color: #f0f0f0; }
|
||||
table.module_list td.summary { width: 100%; }
|
||||
|
||||
table.file_list
|
||||
{
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: #cccccc;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table.file_list td
|
||||
{
|
||||
border-width: 1px;
|
||||
padding: 3px;
|
||||
border-style: solid;
|
||||
border-color: #cccccc;
|
||||
}
|
||||
table.file_list td.name { background-color: #f0f0f0; }
|
||||
table.file_list td.summary { width: 100%; }
|
||||
|
||||
|
||||
table.function_list
|
||||
{
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: #cccccc;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table.function_list td
|
||||
{
|
||||
border-width: 1px;
|
||||
padding: 3px;
|
||||
border-style: solid;
|
||||
border-color: #cccccc;
|
||||
}
|
||||
table.function_list td.name { background-color: #f0f0f0; }
|
||||
table.function_list td.summary { width: 100%; }
|
||||
|
||||
|
||||
table.table_list
|
||||
{
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: #cccccc;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table.table_list td
|
||||
{
|
||||
border-width: 1px;
|
||||
padding: 3px;
|
||||
border-style: solid;
|
||||
border-color: #cccccc;
|
||||
}
|
||||
table.table_list td.name { background-color: #f0f0f0; }
|
||||
table.table_list td.summary { width: 100%; }
|
||||
|
||||
dl.function dt {border-top: 1px solid #ccc; padding-top: 1em;}
|
||||
dl.function dd {padding-bottom: 1em;}
|
||||
dl.function h3 {padding: 0; margin: 0; font-size: medium;}
|
||||
|
||||
dl.table dt {border-top: 1px solid #ccc; padding-top: 1em;}
|
||||
dl.table dd {padding-bottom: 1em;}
|
||||
dl.table h3 {padding: 0; margin: 0; font-size: medium;}
|
||||
|
||||
#TODO: make module_list, file_list, function_list, table_list inherit from a list
|
||||
|
612
doc/modules/irc.html
Normal file
612
doc/modules/irc.html
Normal file
|
@ -0,0 +1,612 @@
|
|||
<!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><strong>irc</strong></li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<!-- File list -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div><!-- id="navigation" -->
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h1>Module <code>irc</code></h1>
|
||||
|
||||
<p>LuaIRC is a low-level IRC library for Lua. All functions raise Lua exceptions on error. Use <code>new</code> to create a new IRC object.<br/> Example:<br/><br/> <code> require "irc"<br/> local sleep = require "socket".sleep<br/> <br/> local s = irc.new{nick = "example"}<br/> <br/> s:hook("OnChat", function(user, channel, message)<br/> print(("[%s] %s: %s"):format(channel, user.nick, message))<br/> end)<br/> <br/> s:connect("irc.example.net")<br/> s:join("#example")<br/> <br/> while true do<br/> s:think()<br/> sleep(0.5)<br/> end<br/> </code></p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h2>Functions</h2>
|
||||
<table class="function_list">
|
||||
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#irc:connect">irc:connect</a> (server, port, timeout)</td>
|
||||
<td class="summary">Connect <code>irc</code> to an IRC server.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#irc:disconnect">irc:disconnect</a> (message)</td>
|
||||
<td class="summary">Disconnect <code>irc</code> from the server.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#irc:hook">irc:hook</a> (name, id, f)</td>
|
||||
<td class="summary">Hook a function to an event.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#irc:join">irc:join</a> (channel, key)</td>
|
||||
<td class="summary">Join a channel.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#irc:part">irc:part</a> (channel)</td>
|
||||
<td class="summary">Leave a channel.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#irc:send">irc:send</a> (fmt, ...)</td>
|
||||
<td class="summary">Send a raw line of IRC to the server.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#irc:sendChat">irc:sendChat</a> (target, message)</td>
|
||||
<td class="summary">Send a message to a channel or user.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#irc:sendNotice">irc:sendNotice</a> (target, message)</td>
|
||||
<td class="summary">Send a notice to a channel or user.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#irc:setMode">irc:setMode</a> (t)</td>
|
||||
<td class="summary">Add/remove modes for a channel or nick.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#irc:think">irc:think</a> ()</td>
|
||||
<td class="summary">Handle incoming data for <code>irc</code>, and invoke previously hooked callbacks based on new server input.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#irc:trackUsers">irc:trackUsers</a> (b)</td>
|
||||
<td class="summary">Turn user information tracking on or off.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#irc:unhook">irc:unhook</a> (name, id)</td>
|
||||
<td class="summary">Remove previous hooked callback.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#irc:whois">irc:whois</a> (nick)</td>
|
||||
<td class="summary">Look up user info.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#new">new</a> (user)</td>
|
||||
<td class="summary">Create a new IRC object.</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
<h2>Tables</h2>
|
||||
<table class="table_list">
|
||||
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Hooks">Hooks</a></td>
|
||||
<td class="summary">List of hooks you can use with irc:hook.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#User">User</a></td>
|
||||
<td class="summary">Table with information about a user.</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
|
||||
<h2><a name="functions"></a>Functions</h2>
|
||||
<dl class="function">
|
||||
|
||||
|
||||
|
||||
<dt><a name="irc:connect"></a><strong>irc:connect</strong> (server, port, timeout)</dt>
|
||||
<dd>
|
||||
Connect <code>irc</code> to an IRC server.
|
||||
|
||||
|
||||
<h3>Parameters</h3>
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
server: Server address.
|
||||
</li>
|
||||
|
||||
<li>
|
||||
port: Server port. [default 6667]
|
||||
</li>
|
||||
|
||||
<li>
|
||||
timeout: Connection timeout value in seconds. [default 30]
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
|
||||
<dt><a name="irc:disconnect"></a><strong>irc:disconnect</strong> (message)</dt>
|
||||
<dd>
|
||||
Disconnect <code>irc</code> from the server.
|
||||
|
||||
|
||||
<h3>Parameters</h3>
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
message: Quit message.
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
|
||||
<dt><a name="irc:hook"></a><strong>irc:hook</strong> (name, id, f)</dt>
|
||||
<dd>
|
||||
Hook a function to an event.
|
||||
|
||||
|
||||
<h3>Parameters</h3>
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
name: Name of event.
|
||||
</li>
|
||||
|
||||
<li>
|
||||
id: Unique tag.
|
||||
</li>
|
||||
|
||||
<li>
|
||||
f: Callback function. [defaults to <code>id</code>]
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>See also:</h3>
|
||||
<ul>
|
||||
|
||||
<li><a href="../modules/irc.html#Hooks">
|
||||
Hooks
|
||||
</a>
|
||||
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
|
||||
<dt><a name="irc:join"></a><strong>irc:join</strong> (channel, key)</dt>
|
||||
<dd>
|
||||
Join a channel.
|
||||
|
||||
|
||||
<h3>Parameters</h3>
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
channel: Channel to join.
|
||||
</li>
|
||||
|
||||
<li>
|
||||
key: Channel password. [optional]
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
|
||||
<dt><a name="irc:part"></a><strong>irc:part</strong> (channel)</dt>
|
||||
<dd>
|
||||
Leave a channel.
|
||||
|
||||
|
||||
<h3>Parameters</h3>
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
channel: Channel to leave.
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
|
||||
<dt><a name="irc:send"></a><strong>irc:send</strong> (fmt, ...)</dt>
|
||||
<dd>
|
||||
Send a raw line of IRC to the server.
|
||||
|
||||
|
||||
<h3>Parameters</h3>
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
fmt: Line to be sent, excluding newline characters.
|
||||
</li>
|
||||
|
||||
<li>
|
||||
...: Format parameters for <code>fmt</code>, with <code>string.format</code> semantics.
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
|
||||
<dt><a name="irc:sendChat"></a><strong>irc:sendChat</strong> (target, message)</dt>
|
||||
<dd>
|
||||
Send a message to a channel or user.
|
||||
|
||||
|
||||
<h3>Parameters</h3>
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
target: Nick or channel to send to.
|
||||
</li>
|
||||
|
||||
<li>
|
||||
message: Message to send.
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
|
||||
<dt><a name="irc:sendNotice"></a><strong>irc:sendNotice</strong> (target, message)</dt>
|
||||
<dd>
|
||||
Send a notice to a channel or user.
|
||||
|
||||
|
||||
<h3>Parameters</h3>
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
target: Nick or channel to send to.
|
||||
</li>
|
||||
|
||||
<li>
|
||||
message: Notice to send.
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
|
||||
<dt><a name="irc:setMode"></a><strong>irc:setMode</strong> (t)</dt>
|
||||
<dd>
|
||||
Add/remove modes for a channel or nick.
|
||||
|
||||
|
||||
<h3>Parameters</h3>
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
t: Table with fields <code>target, nick, add</code> and/or <code>rem</code>. <code>target</code> or <code>nick</code> specifies the user or channel to add/remove modes. <code>add</code> is a list of modes to add to the user or channel. <code>rem</code> is a list of modes to remove from the user or channel.
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
Example which sets +m (moderated) for #channel: <br/> <code>irc:setMode{target = "#channel", add = "m"}</code>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
|
||||
<dt><a name="irc:think"></a><strong>irc:think</strong> ()</dt>
|
||||
<dd>
|
||||
Handle incoming data for <code>irc</code>, and invoke previously hooked callbacks based on new server input. You should call this in some kind of main loop, or at least often enough to not time out.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
|
||||
<dt><a name="irc:trackUsers"></a><strong>irc:trackUsers</strong> (b)</dt>
|
||||
<dd>
|
||||
Turn user information tracking on or off. User tracking is enabled by default.
|
||||
|
||||
|
||||
<h3>Parameters</h3>
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
b: Boolean whether or not to track user information.
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
|
||||
<dt><a name="irc:unhook"></a><strong>irc:unhook</strong> (name, id)</dt>
|
||||
<dd>
|
||||
Remove previous hooked callback.
|
||||
|
||||
|
||||
<h3>Parameters</h3>
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
name: Name of event.
|
||||
</li>
|
||||
|
||||
<li>
|
||||
id: Unique tag.
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
|
||||
<dt><a name="irc:whois"></a><strong>irc:whois</strong> (nick)</dt>
|
||||
<dd>
|
||||
Look up user info.
|
||||
|
||||
|
||||
<h3>Parameters</h3>
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
nick: Nick of user to query.
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Return value:</h3>
|
||||
Table with fields <code>userinfo</code>, <code>node</code>, <code>channels</code> and <code>account</code>.
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
|
||||
<dt><a name="new"></a><strong>new</strong> (user)</dt>
|
||||
<dd>
|
||||
Create a new IRC object. Use <code>irc:connect</code> to connect to a server.
|
||||
|
||||
|
||||
<h3>Parameters</h3>
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
user: Table with fields <code>nick</code>, <code>username</code> and <code>realname</code>. The <code>nick</code> field is required.
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Return value:</h3>
|
||||
Returns a new <code>irc</code> object.
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
<h2><a name="tables"></a>Tables</h2>
|
||||
<dl class="table">
|
||||
|
||||
<dt><a name="Hooks"></a><strong>Hooks</strong></dt>
|
||||
<dd>List of hooks you can use with irc:hook. The parameter list describes the parameters passed to the callback function. <ul> <li><code>OnDisconnect(message, errorOccurred)</code></li> <li><code>OnChat(user, channel, message)</code></li> <li><code>OnNotice(user, channel, message)</code></li> <li><code>OnJoin(user, channel)</code>*</li> <li><code>OnPart(user, channel)</code>*</li> <li><code>OnQuit(user, message)</code></li> <li><code>NickChange(user, newnick)</code>*</li> <li><code>NameList(channel, names)</code></li> </ul> * Event also invoked for yourself.
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
<dt><a name="User"></a><strong>User</strong></dt>
|
||||
<dd>Table with information about a user. <ul> <li><code>nick</code> - User nickname. Always present.</li> <li><code>username</code> - User username.</li> <li><code>host</code> - User hostname.</li> <li><code>realname</code> - User real name.</li> <li><code>access</code> - User access, available in channel-oriented callbacks. Can be '+', '@', and others, depending on the server.</li> </ul> Apart from <code>nick</code>, fields may be missing. To fill them in, enable user tracking and use irc:whois.
|
||||
|
||||
|
||||
|
||||
</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>
|
Loading…
Reference in New Issue
Block a user