Diff

plugins/muc/muc.lib.lua @ 2528:3365ed0ed5bd

MUC: Show error message texts when participants are kicked for stanza errors
author Matthew Wild <mwild1@gmail.com>
date Fri, 29 Jan 2010 14:40:37 +0000
parent 2527:3fe3dbb27b6f
child 2529:7968e8b3ecf9
line wrap: on
line diff
--- a/plugins/muc/muc.lib.lua	Fri Jan 29 14:26:54 2010 +0000
+++ b/plugins/muc/muc.lib.lua	Fri Jan 29 14:40:37 2010 +0000
@@ -200,9 +200,14 @@
 		pr.attr.from = current_nick;
 		if type == "error" then -- error, kick em out!
 			if current_nick then
-				log("debug", "kicking %s from %s", current_nick, room);
+				local type, condition, text = stanza:get_error();
+				local error_message = "Kicked: "..condition:gsub("%-", " ");
+				if text then
+					error_message = error_message..": "..text;
+				end
+				log("debug", "kicking %s from %s for %s", current_nick, room, condition);
 				self:handle_to_occupant(origin, st.presence({type='unavailable', from=from, to=to})
-					:tag('status'):text('Kicked: '..get_error_condition(stanza))); -- send unavailable
+					:tag('status'):text(error_message)); -- send unavailable
 			end
 		elseif type == "unavailable" then -- unavailable
 			if current_nick then