changeset 329:febfb59502fc

mod_ircd: Add QUIT command.
author Kim Alvefur <zash@zash.se>
date Thu, 03 Feb 2011 23:57:37 +0100
parents b92c81f8aed4
children 8821a772799a
files mod_ircd/mod_ircd.lua
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_ircd/mod_ircd.lua	Thu Feb 03 18:00:39 2011 +0100
+++ b/mod_ircd/mod_ircd.lua	Thu Feb 03 23:57:37 2011 +0100
@@ -136,6 +136,11 @@
 	session.send(":"..session.host.." 001 "..session.nick.." :Welcome to XMPP via the "..session.host.." gateway "..session.nick);
 end
 
+function commands.USER(session, params)
+	-- FIXME
+	-- Empty command for now
+end
+
 local joined_mucs = {};
 function commands.JOIN(session, channel)
 	if not session.nick then
@@ -165,6 +170,7 @@
 				body = "\1ACTION ".. body:sub(5) .. "\1"
 			end
 			session.send(":"..nick.." PRIVMSG "..channel.." :"..body);
+			--FIXME PM's probably won't work
 		end
 	end);
 end
@@ -226,6 +232,13 @@
 	session.send(":"..session.host.." 324 "..session.nick.." "..channel.." +J"); 
 end
 
+function commands.QUIT(session, message)
+	session.send("ERROR :Closing Link: "..session.nick);
+	for _, room in pairs(session.rooms) do
+		room:leave(message);
+	end
+	session:close();
+end
 
 function commands.RAW(session, data)
 	--c:send(data)