From eac1f0d66812ac8b87bbe9f3e6a6b61564acd200 Mon Sep 17 00:00:00 2001 From: Joshua Simmons Date: Sat, 17 Jul 2010 23:12:42 +1000 Subject: [PATCH 01/14] Adding TLS/SSL support via LuaSec --- asyncoperations.lua | 7 +++- init.lua | 89 ++++++++++++++++++++++++++++++++++----------- 2 files changed, 72 insertions(+), 24 deletions(-) diff --git a/asyncoperations.lua b/asyncoperations.lua index 7aff528..f678d38 100644 --- a/asyncoperations.lua +++ b/asyncoperations.lua @@ -5,8 +5,11 @@ module "irc" local meta = _META function meta:send(fmt, ...) - self.socket:send(fmt:format(...) .. "\r\n") -end + local bytes, err = self.socket:send(fmt:format(...) .. "\r\n") + + if bytes then + return + end local function sendByMethod(self, method, target, msg) local toChannel = table.concat({method, target, ":"}, " ") diff --git a/init.lua b/init.lua index 55570f0..eb92aea 100644 --- a/init.lua +++ b/init.lua @@ -6,8 +6,10 @@ local rawget = rawget local unpack = unpack local pairs = pairs local assert = assert -local require = require +local require = require local tonumber = tonumber +local type = type +local pcall = pcall module "irc" @@ -62,28 +64,69 @@ function meta:invoke(name, ...) local hooks = self.hooks[name] if hooks then for id,f in pairs(hooks) do - f(...) + if f(...) then + return true + end end end end -function meta_preconnect:connect(server, port, timeout) +function meta_preconnect:connect(_host, _port) + local host, port, password, secure, timeout + + if type(_host) == "table" then + host = _host.host + port = _host.port + timeout = _host.timeout + password = _host.password + secure = _host.secure + else + host = _host + port = _port + end + + host = host or error("host name required to connect", 2) port = port or 6667 local s = socket.tcp() - self.socket = s + s:settimeout(timeout or 30) - assert(s:connect(server, port)) - + assert(s:connect(host, port)) + + if secure then + local work, ssl = pcall(require, "ssl") + if not work then + error("LuaSec required for secure connections", 2) + end + + local params + if type(secure) == "table" then + params = secure + else + params = {mode="client", protocol="tlsv1"} + end + + s = ssl.wrap(s, params) + success, errmsg = s:dohandshake() + if not success then + error(("could not make secure connection %s"):format(errmsg), 2) + end + end + + self.socket = s setmetatable(self, meta) + if password then + self:send("PASS %s", password) + end + self:send("USER %s 0 * :%s", self.username, self.realname) self:send("NICK %s", self.nick) self.channels = {} - s:settimeout(0) - + s:settimeout(0) + repeat self:think() until self.authed @@ -99,21 +142,22 @@ function meta:disconnect(message) end function meta:shutdown() - self.socket:shutdown() self.socket:close() setmetatable(self, nil) end local function getline(self, errlevel) - line, err = self.socket:receive("*l") - - if not line and err ~= "timeout" then - self:invoke("OnDisconnect", err, true) - self:shutdown() + local line, err = self.socket:receive("*l") + + if line then + return line + end + + if err ~= "timeout" and err ~= "wantread" then + self:invoke("OnDisconnect", err, true) + self:close() error(err, errlevel) end - - return line end function meta:think() @@ -255,7 +299,7 @@ local whoisHandlers = { ["330"] = "account"; -- Freenode ["307"] = "registered"; -- Unreal } - + function meta:whois(nick) self:send("WHOIS %s", nick) @@ -278,7 +322,7 @@ function meta:whois(nick) end if result.account then - result.account = result.account[3] + result.account = result.account[3] elseif result.registered then result.account = result.registered[2] @@ -286,7 +330,8 @@ function meta:whois(nick) return result end -function meta:topic(channel) - self:send("TOPIC %s", channel) -end - + +function meta:topic(channel) + self:send("TOPIC %s", channel) +end + From bb020fdad443521dd1c3ac4c74da4cf51e097145 Mon Sep 17 00:00:00 2001 From: Joshua Simmons Date: Sat, 17 Jul 2010 23:16:01 +1000 Subject: [PATCH 02/14] Refactoring nasty send methods. Adding a local clean method to sanitise strings for sending. Removing sendByMethod, made obsolete by changes to send calls. --- asyncoperations.lua | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/asyncoperations.lua b/asyncoperations.lua index f678d38..8d5827c 100644 --- a/asyncoperations.lua +++ b/asyncoperations.lua @@ -11,30 +11,35 @@ function meta:send(fmt, ...) return end -local function sendByMethod(self, method, target, msg) - local toChannel = table.concat({method, target, ":"}, " ") - for line in msg:gmatch("[^\r\n]+") do - self.socket:send(table.concat{toChannel, line, "\r\n"}) + if err ~= "timeout" and err ~= "wantwrite" then + self:invoke("OnDisconnect", err, true) + self:shutdown() + error(err, errlevel) end end - + +local function clean(str) + return str:gsub("[\r\n:]", "") +end + function meta:sendChat(target, msg) - sendByMethod(self, "PRIVMSG", target, msg) + self:send("PRIVMSG %s :%s", clean(target), clean(msg)) end function meta:sendNotice(target, msg) - sendByMethod(self, "NOTICE", target, msg) + self:send("NOTICE %s :%s", clean(target), clean(msg)) end function meta:join(channel, key) if key then - self:send("JOIN %s :%s", channel, key) + self:send("JOIN %s :%s", clean(channel), clean(key)) else - self:send("JOIN %s", channel) + self:send("JOIN %s", clean(channel)) end end function meta:part(channel) + channel = clean(channel) self:send("PART %s", channel) if self.track_users then self.channels[channel] = nil @@ -65,5 +70,5 @@ function meta:setMode(t) mode = table.concat{mode, "-", rem} end - self:send("MODE %s %s", target, mode) + self:send("MODE %s %s", clean(target), clean(mode)) end From 9977943966abbc7d1daa32046c25a9e4554e6da4 Mon Sep 17 00:00:00 2001 From: Joshua Simmons Date: Sat, 17 Jul 2010 23:19:07 +1000 Subject: [PATCH 03/14] Adding ability for hooks to return, and OnRaw hook By adding the ability for hooks to return, we can stop the processing of a line at any point. This is used by the OnRaw hook such that any non-nil return value will cause the irc library to assume that line has been handled. --- init.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index eb92aea..a480e85 100644 --- a/init.lua +++ b/init.lua @@ -163,7 +163,10 @@ end function meta:think() while true do local line = getline(self, 3) - if line then self:handle(parse(line)) + if line then + if not self:invoke("OnRaw", line) then + self:handle(parse(line)) + end else break end @@ -288,7 +291,7 @@ end function meta:handle(prefix, cmd, params) local handler = handlers[cmd] if handler then - handler(self, prefix, unpack(params)) + return handler(self, prefix, unpack(params)) end end From ecafce9f0c4e41a4a0a3e35393c5478966b76635 Mon Sep 17 00:00:00 2001 From: Joshua Simmons Date: Sat, 17 Jul 2010 23:21:50 +1000 Subject: [PATCH 04/14] Adding handlers: RPL_UMODEIS and RPL_CHANNELMODEIS --- init.lua | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/init.lua b/init.lua index a480e85..e3c41c5 100644 --- a/init.lua +++ b/init.lua @@ -262,24 +262,36 @@ handlers["366"] = function(o, prefix, me, channel, msg) o:invoke("NameList", channel, msg) end end - ---no topic -handlers["331"] = function(o, prefix, me, channel) - o:invoke("OnTopic", channel, nil) -end - + +--no topic +handlers["331"] = function(o, prefix, me, channel) + o:invoke("OnTopic", channel, nil) +end + --new topic handlers["TOPIC"] = function(o, prefix, channel, topic) o:invoke("OnTopic", channel, topic) -end - +end + handlers["332"] = function(o, prefix, me, channel, topic) o:invoke("OnTopic", channel, topic) -end - ---topic creation info -handlers["333"] = function(o, prefix, me, channel, nick, time) - o:invoke("OnTopicInfo", channel, nick, tonumber(time)) +end + +--topic creation info +handlers["333"] = function(o, prefix, me, channel, nick, time) + o:invoke("OnTopicInfo", channel, nick, tonumber(time)) +end + +--RPL_UMODEIS +--To answer a query about a client's own mode, RPL_UMODEIS is sent back +handlers["221"] = function(o, modes) + o:invoke("OnUserModeIs", modes) +end + +--RPL_CHANNELMODEIS +--user seems to be just a repeat of the user's nick +handlers["324"] = function(o, user, channel, modes) + o.invoke("OnChannelModeIs", user, channel, modes) end handlers["ERROR"] = function(o, prefix, message) From b370d8bfe7adb3e1b7669d3341dedfa552931257 Mon Sep 17 00:00:00 2001 From: Joshua Simmons Date: Sat, 17 Jul 2010 23:28:13 +1000 Subject: [PATCH 05/14] Updating readme to include LuaSec dependency --- README.markdown | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.markdown b/README.markdown index d88dd8c..5c6ac2e 100644 --- a/README.markdown +++ b/README.markdown @@ -8,6 +8,10 @@ Dependencies * [LuaSocket](http://w3.impa.br/~diego/software/luasocket/) +**Required for TLS/SSL support** + + * [LuaSec](http://www.inf.puc-rio.br/~brunoos/luasec/) + Documentation ------------- Automatically generated documentation can be found in the doc/ directory, or browsed [online](http://jakobovrum.github.com/LuaIRC/doc/modules/irc.html). From 8114c5b7f8ebaa7492f087555dd1f0476e10da63 Mon Sep 17 00:00:00 2001 From: Joshua Simmons Date: Sun, 18 Jul 2010 17:24:13 +1000 Subject: [PATCH 06/14] Fixing regressions in sendChat and sendNotice. Fixing: Incorrect handling of newlines in message. Fixing: Cleaning ':' from message. --- asyncoperations.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/asyncoperations.lua b/asyncoperations.lua index 8d5827c..fc6f746 100644 --- a/asyncoperations.lua +++ b/asyncoperations.lua @@ -23,11 +23,17 @@ local function clean(str) end function meta:sendChat(target, msg) - self:send("PRIVMSG %s :%s", clean(target), clean(msg)) + -- Split the message into segments if it includes newlines. + for line in msg:gmatch("([^\r\n]+)") + self:send("PRIVMSG %s :%s", clean(target), msg) + end end function meta:sendNotice(target, msg) - self:send("NOTICE %s :%s", clean(target), clean(msg)) + -- Split the message into segments if it includes newlines. + for line in msg:gmatch("([^\r\n]+)") + self:send("NOTICE %s :%s", clean(target), msg) + end end function meta:join(channel, key) From 7d891b2380f44683706ca99d5fb7fa790a90fd79 Mon Sep 17 00:00:00 2001 From: Joshua Simmons Date: Sun, 18 Jul 2010 18:26:04 +1000 Subject: [PATCH 07/14] Changing clean to verify for sending of parameters Send methods will now error if you pass invalid characters --- asyncoperations.lua | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/asyncoperations.lua b/asyncoperations.lua index fc6f746..dfcde18 100644 --- a/asyncoperations.lua +++ b/asyncoperations.lua @@ -18,34 +18,38 @@ function meta:send(fmt, ...) end end -local function clean(str) - return str:gsub("[\r\n:]", "") +local function verify(str, errLevel) + if str:find("^:") or find("%s%z") then + error(("bad characters in '%s'"):format(str), errLevel) + end + + return str end function meta:sendChat(target, msg) -- Split the message into segments if it includes newlines. for line in msg:gmatch("([^\r\n]+)") - self:send("PRIVMSG %s :%s", clean(target), msg) + self:send("PRIVMSG %s :%s", verify(target, 2), msg) end end function meta:sendNotice(target, msg) -- Split the message into segments if it includes newlines. for line in msg:gmatch("([^\r\n]+)") - self:send("NOTICE %s :%s", clean(target), msg) + self:send("NOTICE %s :%s", verify(target, 2), msg) end end function meta:join(channel, key) if key then - self:send("JOIN %s :%s", clean(channel), clean(key)) + self:send("JOIN %s :%s", verify(channel, 2), verify(key, 2)) else - self:send("JOIN %s", clean(channel)) + self:send("JOIN %s", verify(channel, 2)) end end function meta:part(channel) - channel = clean(channel) + channel = verify(channel, 2) self:send("PART %s", channel) if self.track_users then self.channels[channel] = nil @@ -76,5 +80,5 @@ function meta:setMode(t) mode = table.concat{mode, "-", rem} end - self:send("MODE %s %s", clean(target), clean(mode)) + self:send("MODE %s %s", verify(target, 2), verify(mode, 2)) end From 339d3c9d8d6e1871ea4d1cd609f6ffb08ae3f561 Mon Sep 17 00:00:00 2001 From: Joshua Simmons Date: Sun, 18 Jul 2010 19:05:14 +1000 Subject: [PATCH 08/14] Passing prefix to mode handlers --- init.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/init.lua b/init.lua index e3c41c5..e2296ec 100644 --- a/init.lua +++ b/init.lua @@ -29,7 +29,7 @@ function meta_preconnect.__index(o, k) end return v end - + function new(user) local o = { nick = assert(user.nick, "Field 'nick' is required"); @@ -55,7 +55,7 @@ function meta:unhook(name, id) assert(hooks, "no hooks exist for this event") assert(hooks[id], "hook ID not found") - + hooks[id] = nil end meta_preconnect.unhook = meta.unhook @@ -284,14 +284,14 @@ end --RPL_UMODEIS --To answer a query about a client's own mode, RPL_UMODEIS is sent back -handlers["221"] = function(o, modes) - o:invoke("OnUserModeIs", modes) +handlers["221"] = function(o, prefix, modes) + o:invoke("OnUserModeIs", parsePrefix(prefix), modes) end --RPL_CHANNELMODEIS --user seems to be just a repeat of the user's nick -handlers["324"] = function(o, user, channel, modes) - o.invoke("OnChannelModeIs", user, channel, modes) +handlers["324"] = function(o, prefix, user, channel, modes) + o.invoke("OnChannelModeIs", parsePrefix(prefix), user, channel, modes) end handlers["ERROR"] = function(o, prefix, message) From 50f223fe66fdc0464aa58feac1da91cbe30688de Mon Sep 17 00:00:00 2001 From: Joshua Simmons Date: Sun, 18 Jul 2010 19:43:50 +1000 Subject: [PATCH 09/14] Fixing some whitespace, and line endings. --- LICENSE.txt | 5 +++-- asyncoperations.lua | 4 ++-- doc/luadoc.css | 8 ++++---- init.lua | 11 +++++------ util.lua | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index bd1b7dd..0a68ca1 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ ---[[ +--[[ Lua IRC library Copyright (c) 2010 Jakob Ovrum @@ -22,4 +22,5 @@ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE.]] \ No newline at end of file + OTHER DEALINGS IN THE SOFTWARE.]] + diff --git a/asyncoperations.lua b/asyncoperations.lua index dfcde18..36dbe81 100644 --- a/asyncoperations.lua +++ b/asyncoperations.lua @@ -71,7 +71,7 @@ function meta:setMode(t) local add, rem = t.add, t.remove assert(add or rem, "table contains neither 'add' nor 'remove'") - + if add then mode = table.concat{"+", add} end @@ -79,6 +79,6 @@ function meta:setMode(t) if rem then mode = table.concat{mode, "-", rem} end - + self:send("MODE %s %s", verify(target, 2), verify(mode, 2)) end diff --git a/doc/luadoc.css b/doc/luadoc.css index afc0063..7fdfd20 100644 --- a/doc/luadoc.css +++ b/doc/luadoc.css @@ -197,12 +197,12 @@ div.header, div.footer { margin-left: 0em; } } 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; } + #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; } + #content { margin-left: 0px; padding: 1em; border-left: 0px; border-right: 0px; background-color: #ffffff; } - #navigation { display: none; + #navigation { display: none; } pre.example { font-family: "Andale Mono", monospace; diff --git a/init.lua b/init.lua index e2296ec..9d1d0a1 100644 --- a/init.lua +++ b/init.lua @@ -23,7 +23,7 @@ require "irc.asyncoperations" local meta_preconnect = {} function meta_preconnect.__index(o, k) local v = rawget(meta_preconnect, k) - + if not v and meta[k] then error("field '"..k.."' is not accessible before connecting", 2) end @@ -134,7 +134,7 @@ end function meta:disconnect(message) local message = message or "Bye!" - + self:invoke("OnDisconnect", message, false) self:send("QUIT :%s", message) @@ -200,7 +200,7 @@ handlers["JOIN"] = function(o, prefix, channel) o.channels[channel].users[user.nick] = user end end - + o:invoke("OnJoin", user, channel) end @@ -247,7 +247,7 @@ end handlers["353"] = function(o, prefix, me, chanType, channel, names) if o.track_users then o.channels[channel] = o.channels[channel] or {users = {}, type = chanType} - + local users = o.channels[channel].users for nick in names:gmatch("(%S+)") do local access, name = parseNick(nick) @@ -319,7 +319,7 @@ function meta:whois(nick) self:send("WHOIS %s", nick) local result = {} - + while true do local line = getline(self, 3) if line then @@ -338,7 +338,6 @@ function meta:whois(nick) if result.account then result.account = result.account[3] - elseif result.registered then result.account = result.registered[2] end diff --git a/util.lua b/util.lua index 0c15eaa..1a8aeed 100644 --- a/util.lua +++ b/util.lua @@ -16,7 +16,7 @@ function parse(line) prefix = line:sub(2, space-1) lineStart = space end - + local trailToken = line:find(":", lineStart) local lineStop = line:len() local trailing From 9c5a2c82e708557e9eb371e77c0ed2b7ed6becba Mon Sep 17 00:00:00 2001 From: Joshua Simmons Date: Sun, 18 Jul 2010 21:08:33 +1000 Subject: [PATCH 10/14] Fixing error level for verify call --- asyncoperations.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/asyncoperations.lua b/asyncoperations.lua index 36dbe81..e9434df 100644 --- a/asyncoperations.lua +++ b/asyncoperations.lua @@ -29,27 +29,27 @@ end function meta:sendChat(target, msg) -- Split the message into segments if it includes newlines. for line in msg:gmatch("([^\r\n]+)") - self:send("PRIVMSG %s :%s", verify(target, 2), msg) + self:send("PRIVMSG %s :%s", verify(target, 3), msg) end end function meta:sendNotice(target, msg) -- Split the message into segments if it includes newlines. for line in msg:gmatch("([^\r\n]+)") - self:send("NOTICE %s :%s", verify(target, 2), msg) + self:send("NOTICE %s :%s", verify(target, 3), msg) end end function meta:join(channel, key) if key then - self:send("JOIN %s :%s", verify(channel, 2), verify(key, 2)) + self:send("JOIN %s :%s", verify(channel, 3), verify(key, 3)) else - self:send("JOIN %s", verify(channel, 2)) + self:send("JOIN %s", verify(channel, 3)) end end function meta:part(channel) - channel = verify(channel, 2) + channel = verify(channel, 3) self:send("PART %s", channel) if self.track_users then self.channels[channel] = nil @@ -80,5 +80,5 @@ function meta:setMode(t) mode = table.concat{mode, "-", rem} end - self:send("MODE %s %s", verify(target, 2), verify(mode, 2)) + self:send("MODE %s %s", verify(target, 3), verify(mode, 3)) end From b53cd265ae5bd8dcfd6fa4b7fc77efade0480327 Mon Sep 17 00:00:00 2001 From: Joshua Simmons Date: Sun, 18 Jul 2010 21:13:38 +1000 Subject: [PATCH 11/14] Changing verify error message --- asyncoperations.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asyncoperations.lua b/asyncoperations.lua index e9434df..2b51224 100644 --- a/asyncoperations.lua +++ b/asyncoperations.lua @@ -20,7 +20,7 @@ end local function verify(str, errLevel) if str:find("^:") or find("%s%z") then - error(("bad characters in '%s'"):format(str), errLevel) + error(("malformed parameter '%s' to irc command"):format(str), errLevel) end return str From 96c2fd3ac09f7ebb235b003b4a43d73c7b8a0478 Mon Sep 17 00:00:00 2001 From: Joshua Simmons Date: Sun, 18 Jul 2010 21:21:55 +1000 Subject: [PATCH 12/14] Fixing small typo and clarifying arguments --- init.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/init.lua b/init.lua index 80554a3..5d2da2b 100644 --- a/init.lua +++ b/init.lua @@ -281,10 +281,10 @@ end handlers["333"] = function(o, prefix, me, channel, nick, time) o:invoke("OnTopicInfo", channel, nick, tonumber(time)) end - -handlers["KICK"] = function(o, prefix, channel, kicked, reason) - o:invoke("OnKick", channel, kicked, parsePrefix(prefix), reason) -end + +handlers["KICK"] = function(o, prefix, channel, kicked, reason) + o:invoke("OnKick", channel, kicked, parsePrefix(prefix), reason) +end --RPL_UMODEIS --To answer a query about a client's own mode, RPL_UMODEIS is sent back @@ -293,10 +293,10 @@ handlers["221"] = function(o, prefix, modes) end --RPL_CHANNELMODEIS ---user seems to be just a repeat of the user's nick +--The result from common irc servers differs from that defined by the rfc handlers["324"] = function(o, prefix, user, channel, modes) - o.invoke("OnChannelModeIs", user, channel, modes) -end + o:invoke("OnChannelModeIs", user, channel, modes) +end handlers["ERROR"] = function(o, prefix, message) o:invoke("OnDisconnect", message, true) From 676a00aa2ac9ebf3f244b769746b1c00cb9a3898 Mon Sep 17 00:00:00 2001 From: Joshua Simmons Date: Sun, 18 Jul 2010 21:55:02 +1000 Subject: [PATCH 13/14] Updating documentation Adding TLS/SSL documentation Adding OnUserModeIs documentation Adding OnChannelModeIs documentation Adding OnRaw documentation --- doc/irc.luadoc | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/doc/irc.luadoc b/doc/irc.luadoc index ddd7b76..1a98b88 100644 --- a/doc/irc.luadoc +++ b/doc/irc.luadoc @@ -44,10 +44,13 @@ function irc:hook(name, id, f) function irc:unhook(name, id) --- Connect irc to an IRC server. --- @param server Server address. +-- @param host Host address. -- @param port Server port. [default 6667] --- @param timeout Connection timeout value in seconds. [default 30] -function irc:connect(server, port, timeout) +function irc:connect(server, port) + +-- @param table Table of connection details +-- @see Connection +function irc:connect(table) --- Disconnect irc from the server. -- @param message Quit message. @@ -108,8 +111,21 @@ function irc:invoke(name, ...) function irc:handle(prefix, cmd, params) function irc:shutdown() +--- Table with connection information. +--
    +--
  • host - Server host name.
  • +--
  • port - Server port. [defaults to 6667]
  • +--
  • timeout - Connect timeout. [defaults to 30]
  • +--
  • password - Server password.
  • +--
  • secure - Boolean to enable TLS connection, pass a params table (described, [luasec]) to control
  • +--
+-- [luasec]: http://www.inf.puc-rio.br/~brunoos/luasec/reference.html +-- @name Connection +-- @class table + --- List of hooks you can use with irc:hook. The parameter list describes the parameters passed to the callback function. --
    +--
  • OnRaw(line) - (any non false/nil return value assumes line handled and will not be further processed)
  • --
  • OnDisconnect(message, errorOccurred)
  • --
  • OnChat(user, channel, message)
  • --
  • OnNotice(user, channel, message)
  • @@ -121,6 +137,8 @@ function irc:shutdown() --
  • OnTopic(channel, topic)
  • --
  • OnTopicInfo(channel, creator, timeCreated)
  • --
  • OnKick(channel, nick, kicker, reason)* (kicker is a user table)
  • +--
  • OnUserModeIs(modes)
  • +--
  • OnChannelModeIs(user, channel, modes)
  • --
-- * Event also invoked for yourself. -- † Channel passed only when user tracking is enabled From 1bc4395d461d043b388d2e8c97ea8f359b0f1842 Mon Sep 17 00:00:00 2001 From: Joshua Simmons Date: Sun, 18 Jul 2010 22:13:37 +1000 Subject: [PATCH 14/14] Updating readme to make LuaSec dependency more clear --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index 5c6ac2e..c57ebcf 100644 --- a/README.markdown +++ b/README.markdown @@ -8,7 +8,7 @@ Dependencies * [LuaSocket](http://w3.impa.br/~diego/software/luasocket/) -**Required for TLS/SSL support** +**Only required if you want to make use of the TLS support** * [LuaSec](http://www.inf.puc-rio.br/~brunoos/luasec/)