Diff

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
parent 1057:0b41122b19f9
child 1205:7d2d440e2fa5
line wrap: on
line diff
--- a/mod_muc_limits/mod_muc_limits.lua	Fri Jun 07 14:29:01 2013 +0100
+++ b/mod_muc_limits/mod_muc_limits.lua	Sat Jun 08 16:31:13 2013 +0100
@@ -38,7 +38,7 @@
 	if (occupant and occupant.affiliation) or (not(occupant) and room._affiliations[jid_bare(from_jid)]) then
 		module:log("debug", "Skipping stanza from affiliated user...");
 		return;
-	elseif max_nick_length and stanza.name == "presence" and not room._occupants[stanza.attr.to] and #dest_nick > max_nick_length then
+	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
 		module:log("debug", "Forbidding long (%d bytes) nick in %s", #dest_nick, dest_room)
 		origin.send(st.error_reply(stanza, "modify", "policy-violation", "Your nick name is too long, please use a shorter one")
 			:up():tag("x", { xmlns = xmlns_muc }));