Mercurial > prosody-modules
comparison mod_ircd/mod_ircd.lua @ 154:1849614af19a
mod_ircd: Log error when receiving a message without a valid nick
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Wed, 19 May 2010 14:11:34 +0100 |
| parents | 5abf15351b9a |
| children | 35314bf3410a |
comparison
equal
deleted
inserted
replaced
| 153:31e24026e4fd | 154:1849614af19a |
|---|---|
| 152 end | 152 end |
| 153 elseif stanza.name == "message" then | 153 elseif stanza.name == "message" then |
| 154 local body = stanza:get_child("body"); | 154 local body = stanza:get_child("body"); |
| 155 body = body and body:get_text() or ""; | 155 body = body and body:get_text() or ""; |
| 156 local hasdelay = stanza:get_child("delay", "urn:xmpp:delay"); | 156 local hasdelay = stanza:get_child("delay", "urn:xmpp:delay"); |
| 157 if body ~= "" then | 157 if body ~= "" and nick then |
| 158 for session in pairs(joined_muc.sessions) do | 158 for session in pairs(joined_muc.sessions) do |
| 159 if nick ~= session.nick or hasdelay then | 159 if nick ~= session.nick or hasdelay then |
| 160 session.send(":"..nick.." PRIVMSG "..from_node.." :"..body); | 160 session.send(":"..nick.." PRIVMSG "..from_node.." :"..body); |
| 161 end | 161 end |
| 162 end | 162 end |
| 163 end | |
| 164 if not nick then | |
| 165 module:log("error", "Invalid nick from JID: %s", from); | |
| 163 end | 166 end |
| 164 end | 167 end |
| 165 end | 168 end |
| 166 end | 169 end |
| 167 | 170 |
