plugins/mod_mam/mod_mam.lua
changeset 13361 f424c9f1460b
parent 13234 26c30844cac6
equal deleted inserted replaced
13360:bbbda8819331 13361:f424c9f1460b
   247 		if not first then
   247 		if not first then
   248 			origin.send(st.error_reply(stanza, "cancel", "internal-server-error"));
   248 			origin.send(st.error_reply(stanza, "cancel", "internal-server-error"));
   249 			return true;
   249 			return true;
   250 		end
   250 		end
   251 
   251 
   252 		local id, _, when = first();
   252 		for id, _, when in first do
   253 		if id then
       
   254 			reply:tag("start", { id = id, timestamp = timestamp(when) }):up();
   253 			reply:tag("start", { id = id, timestamp = timestamp(when) }):up();
   255 		end
   254 		end
   256 	end
   255 	end
   257 
   256 
   258 	do
   257 	do
   260 		if not last then
   259 		if not last then
   261 			origin.send(st.error_reply(stanza, "cancel", "internal-server-error"));
   260 			origin.send(st.error_reply(stanza, "cancel", "internal-server-error"));
   262 			return true;
   261 			return true;
   263 		end
   262 		end
   264 
   263 
   265 		local id, _, when = last();
   264 		for id, _, when in last do
   266 		if id then
       
   267 			reply:tag("end", { id = id, timestamp = timestamp(when) }):up();
   265 			reply:tag("end", { id = id, timestamp = timestamp(when) }):up();
   268 		end
   266 		end
   269 	end
   267 	end
   270 
   268 
   271 	origin.send(reply);
   269 	origin.send(reply);