Changeset

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
parents 648:3f34b83771eb
children 650:674531bcb5c4
files core/presencemanager.lua
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
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