plugins/mod_bosh.lua
changeset 11872 ae093c259da2
parent 11812 c24580a214f3
child 12266 50525021c2c7
equal deleted inserted replaced
11871:bb20cfd4884f 11872:ae093c259da2
   234 	if reason then
   234 	if reason then
   235 		close_reply.attr.condition = "remote-stream-error";
   235 		close_reply.attr.condition = "remote-stream-error";
   236 		if type(reason) == "string" then -- assume stream error
   236 		if type(reason) == "string" then -- assume stream error
   237 			close_reply:tag("stream:error")
   237 			close_reply:tag("stream:error")
   238 				:tag(reason, {xmlns = xmlns_xmpp_streams});
   238 				:tag(reason, {xmlns = xmlns_xmpp_streams});
       
   239 		elseif st.is_stanza(reason) then
       
   240 			close_reply = reason;
   239 		elseif type(reason) == "table" then
   241 		elseif type(reason) == "table" then
   240 			if reason.condition then
   242 			if reason.condition then
   241 				close_reply:tag("stream:error")
   243 				close_reply:tag("stream:error")
   242 					:tag(reason.condition, stream_xmlns_attr):up();
   244 					:tag(reason.condition, stream_xmlns_attr):up();
   243 				if reason.text then
   245 				if reason.text then
   244 					close_reply:tag("text", stream_xmlns_attr):text(reason.text):up();
   246 					close_reply:tag("text", stream_xmlns_attr):text(reason.text):up();
   245 				end
   247 				end
   246 				if reason.extra then
   248 				if reason.extra then
   247 					close_reply:add_child(reason.extra);
   249 					close_reply:add_child(reason.extra);
   248 				end
   250 				end
   249 			elseif reason.name then -- a stanza
       
   250 				close_reply = reason;
       
   251 			end
   251 			end
   252 		end
   252 		end
   253 		log("info", "Disconnecting client, <stream:error> is: %s", close_reply);
   253 		log("info", "Disconnecting client, <stream:error> is: %s", close_reply);
   254 	end
   254 	end
   255 
   255