Mercurial > prosody-modules
comparison mod_muc_limits/mod_muc_limits.lua @ 1058:1255de347dd4
mod_muc_limits: Fix traceback on presence sent to the room's bare JID
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sat, 08 Jun 2013 16:31:13 +0100 |
| parents | 0b41122b19f9 |
| children | 7d2d440e2fa5 |
comparison
equal
deleted
inserted
replaced
| 1057:0b41122b19f9 | 1058:1255de347dd4 |
|---|---|
| 36 local from_jid = stanza.attr.from; | 36 local from_jid = stanza.attr.from; |
| 37 local occupant = room._occupants[room._jid_nick[from_jid]]; | 37 local occupant = room._occupants[room._jid_nick[from_jid]]; |
| 38 if (occupant and occupant.affiliation) or (not(occupant) and room._affiliations[jid_bare(from_jid)]) then | 38 if (occupant and occupant.affiliation) or (not(occupant) and room._affiliations[jid_bare(from_jid)]) then |
| 39 module:log("debug", "Skipping stanza from affiliated user..."); | 39 module:log("debug", "Skipping stanza from affiliated user..."); |
| 40 return; | 40 return; |
| 41 elseif max_nick_length and stanza.name == "presence" and not room._occupants[stanza.attr.to] and #dest_nick > max_nick_length then | 41 elseif dest_nick and max_nick_length and stanza.name == "presence" and not room._occupants[stanza.attr.to] and #dest_nick > max_nick_length then |
| 42 module:log("debug", "Forbidding long (%d bytes) nick in %s", #dest_nick, dest_room) | 42 module:log("debug", "Forbidding long (%d bytes) nick in %s", #dest_nick, dest_room) |
| 43 origin.send(st.error_reply(stanza, "modify", "policy-violation", "Your nick name is too long, please use a shorter one") | 43 origin.send(st.error_reply(stanza, "modify", "policy-violation", "Your nick name is too long, please use a shorter one") |
| 44 :up():tag("x", { xmlns = xmlns_muc })); | 44 :up():tag("x", { xmlns = xmlns_muc })); |
| 45 return true; | 45 return true; |
| 46 end | 46 end |
