mirror of
https://github.com/ShadowNinja/LuaIRC.git
synced 2025-01-09 17:40:29 +01:00
Merge branch 'master' of git://github.com/jsimmons/LuaIRC
This commit is contained in:
commit
c4d7278c4b
@ -139,6 +139,7 @@ function irc:shutdown()
|
|||||||
-- <li><code>OnKick(channel, nick, kicker, reason)</code>* (kicker is a <code>user</code> table)</li>
|
-- <li><code>OnKick(channel, nick, kicker, reason)</code>* (kicker is a <code>user</code> table)</li>
|
||||||
-- <li><code>OnUserModeIs(modes)</code></li>
|
-- <li><code>OnUserModeIs(modes)</code></li>
|
||||||
-- <li><code>OnChannelModeIs(user, channel, modes)</code></li>
|
-- <li><code>OnChannelModeIs(user, channel, modes)</code></li>
|
||||||
|
-- <li><code>OnModeChange(user, target, modes)</code>*</li>
|
||||||
-- </ul>
|
-- </ul>
|
||||||
-- * Event also invoked for yourself.
|
-- * Event also invoked for yourself.
|
||||||
-- † Channel passed only when user tracking is enabled
|
-- † Channel passed only when user tracking is enabled
|
||||||
|
20
init.lua
20
init.lua
@ -120,8 +120,8 @@ function meta_preconnect:connect(_host, _port)
|
|||||||
self:send("PASS %s", password)
|
self:send("PASS %s", password)
|
||||||
end
|
end
|
||||||
|
|
||||||
self:send("USER %s 0 * :%s", self.username, self.realname)
|
|
||||||
self:send("NICK %s", self.nick)
|
self:send("NICK %s", self.nick)
|
||||||
|
self:send("USER %s 0 * :%s", self.username, self.realname)
|
||||||
|
|
||||||
self.channels = {}
|
self.channels = {}
|
||||||
|
|
||||||
@ -149,15 +149,13 @@ end
|
|||||||
local function getline(self, errlevel)
|
local function getline(self, errlevel)
|
||||||
local line, err = self.socket:receive("*l")
|
local line, err = self.socket:receive("*l")
|
||||||
|
|
||||||
if line then
|
if not line and err ~= "timeout" and err ~= "wantread" then
|
||||||
return line
|
|
||||||
end
|
|
||||||
|
|
||||||
if err ~= "timeout" and err ~= "wantread" then
|
|
||||||
self:invoke("OnDisconnect", err, true)
|
self:invoke("OnDisconnect", err, true)
|
||||||
self:close()
|
self:shutdown()
|
||||||
error(err, errlevel)
|
error(err, errlevel)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return line
|
||||||
end
|
end
|
||||||
|
|
||||||
function meta:think()
|
function meta:think()
|
||||||
@ -288,14 +286,18 @@ end
|
|||||||
|
|
||||||
--RPL_UMODEIS
|
--RPL_UMODEIS
|
||||||
--To answer a query about a client's own mode, RPL_UMODEIS is sent back
|
--To answer a query about a client's own mode, RPL_UMODEIS is sent back
|
||||||
handlers["221"] = function(o, prefix, modes)
|
handlers["221"] = function(o, prefix, user, modes)
|
||||||
o:invoke("OnUserModeIs", modes)
|
o:invoke("OnUserModeIs", modes)
|
||||||
end
|
end
|
||||||
|
|
||||||
--RPL_CHANNELMODEIS
|
--RPL_CHANNELMODEIS
|
||||||
--The result from common irc servers differs from that defined by the rfc
|
--The result from common irc servers differs from that defined by the rfc
|
||||||
handlers["324"] = function(o, prefix, user, channel, modes)
|
handlers["324"] = function(o, prefix, user, channel, modes)
|
||||||
o:invoke("OnChannelModeIs", user, channel, modes)
|
o:invoke("OnChannelModeIs", channel, modes)
|
||||||
|
end
|
||||||
|
|
||||||
|
handlers["MODE"] = function(o, prefix, target, modes)
|
||||||
|
o:invoke("OnModeChange", parsePrefix(prefix), target, modes)
|
||||||
end
|
end
|
||||||
|
|
||||||
handlers["ERROR"] = function(o, prefix, message)
|
handlers["ERROR"] = function(o, prefix, message)
|
||||||
|
Loading…
Reference in New Issue
Block a user