Changeset

792:db27f07342d4

mod_pubsub_feeds: Use reference to mod_pubsub from module:depends
author Kim Alvefur <zash@zash.se>
date Wed, 15 Aug 2012 16:31:27 +0200
parents 791:b9d149936764
children 793:9fd30261b0e1
files mod_pubsub_feeds/mod_pubsub_feeds.lua
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mod_pubsub_feeds/mod_pubsub_feeds.lua	Fri Aug 10 21:40:52 2012 +0200
+++ b/mod_pubsub_feeds/mod_pubsub_feeds.lua	Wed Aug 15 16:31:27 2012 +0200
@@ -15,8 +15,7 @@
 -- Reference
 -- http://pubsubhubbub.googlecode.com/svn/trunk/pubsubhubbub-core-0.3.html
 
-local modules = hosts[module.host].modules;
-module:depends"pubsub";
+local pubsub = module:depends"pubsub";
 
 local date, time = os.date, os.time;
 local dt_parse, dt_datetime = require "util.datetime".parse, require "util.datetime".datetime;
@@ -91,16 +90,16 @@
 			-- TODO Put data from /feed into item/source
 
 			--module:log("debug", "publishing to %s, id %s", node, id);
-			local ok, err = modules.pubsub.service:publish(node, true, id, xitem);
+			local ok, err = pubsub.service:publish(node, true, id, xitem);
 			if not ok then
 				if err == "item-not-found" then -- try again
 					--module:log("debug", "got item-not-found, creating %s and trying again", node);
-					local ok, err = modules.pubsub.service:create(node, true);
+					local ok, err = pubsub.service:create(node, true);
 					if not ok then
 						module:log("error", "could not create node %s: %s", node, err);
 						return;
 					end
-					local ok, err = modules.pubsub.service:publish(node, true, id, xitem);
+					local ok, err = pubsub.service:publish(node, true, id, xitem);
 					if not ok then
 						module:log("error", "could not create or publish node %s: %s", node, err);
 						return