MUC: Show error message texts when participants are kicked for stanza errors
authorMatthew Wild <mwild1@gmail.com>
Fri, 29 Jan 2010 14:40:37 +0000 (14:40 +0000)
committerMatthew Wild <mwild1@gmail.com>
Fri, 29 Jan 2010 14:40:37 +0000 (14:40 +0000)
plugins/muc/muc.lib.lua

index 896a977fab76fdae5408232de1cbceac1a69c03c..103227f0966fdf88734f95ed719bff9b40619d55 100644 (file)
@@ -200,9 +200,14 @@ function room_mt:handle_to_occupant(origin, stanza) -- PM, vCards, etc
                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