Mercurial > prosody-modules
comparison mod_ircd/mod_ircd.lua @ 329:febfb59502fc
mod_ircd: Add QUIT command.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 03 Feb 2011 23:57:37 +0100 |
| parents | 282abba844e8 |
| children | 8b81257c9dc5 |
comparison
equal
deleted
inserted
replaced
| 327:b92c81f8aed4 | 329:febfb59502fc |
|---|---|
| 134 session.full_jid = full_jid; | 134 session.full_jid = full_jid; |
| 135 session.type = "c2s"; | 135 session.type = "c2s"; |
| 136 session.send(":"..session.host.." 001 "..session.nick.." :Welcome to XMPP via the "..session.host.." gateway "..session.nick); | 136 session.send(":"..session.host.." 001 "..session.nick.." :Welcome to XMPP via the "..session.host.." gateway "..session.nick); |
| 137 end | 137 end |
| 138 | 138 |
| 139 function commands.USER(session, params) | |
| 140 -- FIXME | |
| 141 -- Empty command for now | |
| 142 end | |
| 143 | |
| 139 local joined_mucs = {}; | 144 local joined_mucs = {}; |
| 140 function commands.JOIN(session, channel) | 145 function commands.JOIN(session, channel) |
| 141 if not session.nick then | 146 if not session.nick then |
| 142 return ":"..session.host.." 451 :You have not registered"; | 147 return ":"..session.host.." 451 :You have not registered"; |
| 143 end | 148 end |
| 163 if nick ~= session.nick then | 168 if nick ~= session.nick then |
| 164 if body:sub(1,4) == "/me " then | 169 if body:sub(1,4) == "/me " then |
| 165 body = "\1ACTION ".. body:sub(5) .. "\1" | 170 body = "\1ACTION ".. body:sub(5) .. "\1" |
| 166 end | 171 end |
| 167 session.send(":"..nick.." PRIVMSG "..channel.." :"..body); | 172 session.send(":"..nick.." PRIVMSG "..channel.." :"..body); |
| 173 --FIXME PM's probably won't work | |
| 168 end | 174 end |
| 169 end); | 175 end); |
| 170 end | 176 end |
| 171 | 177 |
| 172 c:hook("groupchat/joined", function(room) | 178 c:hook("groupchat/joined", function(room) |
| 224 | 230 |
| 225 function commands.MODE(session, channel) | 231 function commands.MODE(session, channel) |
| 226 session.send(":"..session.host.." 324 "..session.nick.." "..channel.." +J"); | 232 session.send(":"..session.host.." 324 "..session.nick.." "..channel.." +J"); |
| 227 end | 233 end |
| 228 | 234 |
| 235 function commands.QUIT(session, message) | |
| 236 session.send("ERROR :Closing Link: "..session.nick); | |
| 237 for _, room in pairs(session.rooms) do | |
| 238 room:leave(message); | |
| 239 end | |
| 240 session:close(); | |
| 241 end | |
| 229 | 242 |
| 230 function commands.RAW(session, data) | 243 function commands.RAW(session, data) |
| 231 --c:send(data) | 244 --c:send(data) |
| 232 end | 245 end |
| 233 | 246 |
