Software /
code /
prosody-modules
Diff
mod_ircd/mod_ircd.lua @ 132:d4ff1cd414e5
mod_ircd: Add PING command / Echo PART back
author | Florian Zeitz <florob@babelmonkeys.de> |
---|---|
date | Mon, 22 Feb 2010 22:33:25 +0100 |
parent | 111:3de60860adca |
child | 150:fd7f7ebf257e |
line wrap: on
line diff
--- a/mod_ircd/mod_ircd.lua Fri Feb 19 09:20:50 2010 +0500 +++ b/mod_ircd/mod_ircd.lua Mon Feb 22 22:33:25 2010 +0100 @@ -80,9 +80,11 @@ end function commands.PART(session, channel) - local channel, part_message = channel:match("^(%S+) :(.+)$"); + local channel, part_message = channel:match("^([^:]+):?(.*)$"); + channel = channel:match("^([%S]*)"); core_process_stanza(session, st.presence{ type = "unavailable", from = session.full_jid, to = channel:gsub("^#", "").."@"..conference_server.."/"..session.nick }:tag("status"):text(part_message)); + session.send(":"..session.nick.." PART :"..channel); end function commands.PRIVMSG(session, message) @@ -92,6 +94,10 @@ end end +function commands.PING(session, server) + session.send(":"..session.host..": PONG "..server); +end + function commands.WHO(session, channel) if joined_mucs[channel] then for nick in pairs(joined_mucs[channel].occupants) do