Changeset

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
parents 131:46741fc09091
children 133:8945153321a1
files mod_ircd/mod_ircd.lua
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
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