Software /
code /
prosody-modules
Comparison
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 |
comparison
equal
deleted
inserted
replaced
131:46741fc09091 | 132:d4ff1cd414e5 |
---|---|
78 session.send(":"..session.host.." 353 "..session.nick.." = "..channel.." :"..session.nick); | 78 session.send(":"..session.host.." 353 "..session.nick.." = "..channel.." :"..session.nick); |
79 session.send(":"..session.host.." 366 "..session.nick.." "..channel.." :End of /NAMES list."); | 79 session.send(":"..session.host.." 366 "..session.nick.." "..channel.." :End of /NAMES list."); |
80 end | 80 end |
81 | 81 |
82 function commands.PART(session, channel) | 82 function commands.PART(session, channel) |
83 local channel, part_message = channel:match("^(%S+) :(.+)$"); | 83 local channel, part_message = channel:match("^([^:]+):?(.*)$"); |
84 channel = channel:match("^([%S]*)"); | |
84 core_process_stanza(session, st.presence{ type = "unavailable", from = session.full_jid, | 85 core_process_stanza(session, st.presence{ type = "unavailable", from = session.full_jid, |
85 to = channel:gsub("^#", "").."@"..conference_server.."/"..session.nick }:tag("status"):text(part_message)); | 86 to = channel:gsub("^#", "").."@"..conference_server.."/"..session.nick }:tag("status"):text(part_message)); |
87 session.send(":"..session.nick.." PART :"..channel); | |
86 end | 88 end |
87 | 89 |
88 function commands.PRIVMSG(session, message) | 90 function commands.PRIVMSG(session, message) |
89 local who, message = message:match("^(%S+) :(.+)$"); | 91 local who, message = message:match("^(%S+) :(.+)$"); |
90 if joined_mucs[who] then | 92 if joined_mucs[who] then |
91 core_process_stanza(session, st.message{to=who:gsub("^#", "").."@"..conference_server, type="groupchat"}:tag("body"):text(message)); | 93 core_process_stanza(session, st.message{to=who:gsub("^#", "").."@"..conference_server, type="groupchat"}:tag("body"):text(message)); |
92 end | 94 end |
95 end | |
96 | |
97 function commands.PING(session, server) | |
98 session.send(":"..session.host..": PONG "..server); | |
93 end | 99 end |
94 | 100 |
95 function commands.WHO(session, channel) | 101 function commands.WHO(session, channel) |
96 if joined_mucs[channel] then | 102 if joined_mucs[channel] then |
97 for nick in pairs(joined_mucs[channel].occupants) do | 103 for nick in pairs(joined_mucs[channel].occupants) do |