Comparison

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
comparison
equal deleted inserted replaced
2527:3fe3dbb27b6f 2528:3365ed0ed5bd
198 if stanza.name == "presence" then 198 if stanza.name == "presence" then
199 local pr = get_filtered_presence(stanza); 199 local pr = get_filtered_presence(stanza);
200 pr.attr.from = current_nick; 200 pr.attr.from = current_nick;
201 if type == "error" then -- error, kick em out! 201 if type == "error" then -- error, kick em out!
202 if current_nick then 202 if current_nick then
203 log("debug", "kicking %s from %s", current_nick, room); 203 local type, condition, text = stanza:get_error();
204 local error_message = "Kicked: "..condition:gsub("%-", " ");
205 if text then
206 error_message = error_message..": "..text;
207 end
208 log("debug", "kicking %s from %s for %s", current_nick, room, condition);
204 self:handle_to_occupant(origin, st.presence({type='unavailable', from=from, to=to}) 209 self:handle_to_occupant(origin, st.presence({type='unavailable', from=from, to=to})
205 :tag('status'):text('Kicked: '..get_error_condition(stanza))); -- send unavailable 210 :tag('status'):text(error_message)); -- send unavailable
206 end 211 end
207 elseif type == "unavailable" then -- unavailable 212 elseif type == "unavailable" then -- unavailable
208 if current_nick then 213 if current_nick then
209 log("debug", "%s leaving %s", current_nick, room); 214 log("debug", "%s leaving %s", current_nick, room);
210 local occupant = self._occupants[current_nick]; 215 local occupant = self._occupants[current_nick];