mirror of
https://github.com/ShadowNinja/LuaIRC.git
synced 2025-03-27 06:40:34 +01:00
merged with jsimmons/master
This commit is contained in:
commit
2fe692f2ae
@ -23,3 +23,4 @@
|
|||||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
OTHER DEALINGS IN THE SOFTWARE.]]
|
OTHER DEALINGS IN THE SOFTWARE.]]
|
||||||
|
|
||||||
|
@ -8,6 +8,10 @@ Dependencies
|
|||||||
|
|
||||||
* [LuaSocket](http://w3.impa.br/~diego/software/luasocket/)
|
* [LuaSocket](http://w3.impa.br/~diego/software/luasocket/)
|
||||||
|
|
||||||
|
**Only required if you want to make use of the TLS support**
|
||||||
|
|
||||||
|
* [LuaSec](http://www.inf.puc-rio.br/~brunoos/luasec/)
|
||||||
|
|
||||||
Documentation
|
Documentation
|
||||||
-------------
|
-------------
|
||||||
Documentation can be automatically generated from the doc/irc.luadoc file, pre-generated documentation can be found in the gh-branch.
|
Documentation can be automatically generated from the doc/irc.luadoc file, pre-generated documentation can be found in the gh-branch.
|
||||||
|
@ -29,27 +29,27 @@ end
|
|||||||
function meta:sendChat(target, msg)
|
function meta:sendChat(target, msg)
|
||||||
-- Split the message into segments if it includes newlines.
|
-- Split the message into segments if it includes newlines.
|
||||||
for line in msg:gmatch("([^\r\n]+)")
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
function meta:sendNotice(target, msg)
|
function meta:sendNotice(target, msg)
|
||||||
-- Split the message into segments if it includes newlines.
|
-- Split the message into segments if it includes newlines.
|
||||||
for line in msg:gmatch("([^\r\n]+)")
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
function meta:join(channel, key)
|
function meta:join(channel, key)
|
||||||
if key then
|
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
|
else
|
||||||
self:send("JOIN %s", verify(channel, 2))
|
self:send("JOIN %s", verify(channel, 3))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function meta:part(channel)
|
function meta:part(channel)
|
||||||
channel = verify(channel, 2)
|
channel = verify(channel, 3)
|
||||||
self:send("PART %s", channel)
|
self:send("PART %s", channel)
|
||||||
if self.track_users then
|
if self.track_users then
|
||||||
self.channels[channel] = nil
|
self.channels[channel] = nil
|
||||||
@ -80,5 +80,5 @@ function meta:setMode(t)
|
|||||||
mode = table.concat{mode, "-", rem}
|
mode = table.concat{mode, "-", rem}
|
||||||
end
|
end
|
||||||
|
|
||||||
self:send("MODE %s %s", verify(target, 2), verify(mode, 2))
|
self:send("MODE %s %s", verify(target, 3), verify(mode, 3))
|
||||||
end
|
end
|
||||||
|
13
init.lua
13
init.lua
@ -286,6 +286,18 @@ handlers["KICK"] = function(o, prefix, channel, kicked, reason)
|
|||||||
o:invoke("OnKick", channel, kicked, parsePrefix(prefix), reason)
|
o:invoke("OnKick", channel, kicked, parsePrefix(prefix), reason)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--RPL_UMODEIS
|
||||||
|
--To answer a query about a client's own mode, RPL_UMODEIS is sent back
|
||||||
|
handlers["221"] = function(o, prefix, modes)
|
||||||
|
o:invoke("OnUserModeIs", modes)
|
||||||
|
end
|
||||||
|
|
||||||
|
--RPL_CHANNELMODEIS
|
||||||
|
--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
|
||||||
|
|
||||||
handlers["ERROR"] = function(o, prefix, message)
|
handlers["ERROR"] = function(o, prefix, message)
|
||||||
o:invoke("OnDisconnect", message, true)
|
o:invoke("OnDisconnect", message, true)
|
||||||
o:shutdown()
|
o:shutdown()
|
||||||
@ -330,7 +342,6 @@ function meta:whois(nick)
|
|||||||
|
|
||||||
if result.account then
|
if result.account then
|
||||||
result.account = result.account[3]
|
result.account = result.account[3]
|
||||||
|
|
||||||
elseif result.registered then
|
elseif result.registered then
|
||||||
result.account = result.registered[2]
|
result.account = result.registered[2]
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user