Diff

core/presencemanager.lua @ 649:5f8382768530

Delete the offline message store only when offline messages are present
author Waqas Hussain <waqas20@gmail.com>
date Fri, 26 Dec 2008 21:48:08 +0500
parent 641:658a2de74afc
child 758:b1885732e979
line wrap: on
line diff
--- a/core/presencemanager.lua	Fri Dec 26 21:46:05 2008 +0500
+++ b/core/presencemanager.lua	Fri Dec 26 21:48:08 2008 +0500
@@ -95,11 +95,14 @@
 					request.attr.to = jid;
 					core_route_stanza(origin, request);
 				end
+			end
+			local offline = offlinemanager.load(node, host);
+			if offline then
+				for _, msg in ipairs(offline) do
+					origin.send(msg); -- FIXME do we need to modify to/from in any way?
+				end
+				offlinemanager.deleteAll(node, host);
 			end
-			for _, msg in ipairs(offlinemanager.load(node, host) or {}) do
-				origin.send(msg); -- FIXME do we need to modify to/from in any way?
-			end
-			offlinemanager.deleteAll(node, host);
 		end
 		origin.priority = 0;
 		if stanza.attr.type == "unavailable" then