mod_pep_plus: Add pubsub service objects to an item list
authorKim Alvefur <zash@zash.se>
Sat, 27 Sep 2014 19:00:09 +0200
changeset 6435 388786af0dd2
parent 6434 540f4e33394a
child 6445 0f4025abbe8f
mod_pep_plus: Add pubsub service objects to an item list
plugins/mod_pep_plus.lua
--- a/plugins/mod_pep_plus.lua	Fri Sep 26 17:34:15 2014 +0100
+++ b/plugins/mod_pep_plus.lua	Sat Sep 27 19:00:09 2014 +0200
@@ -55,10 +55,11 @@
 end
 
 function get_pep_service(name)
-	if services[name] then
-		return services[name];
+	local service = services[name];
+	if service then
+		return service;
 	end
-	services[name] = pubsub.new({
+	service = pubsub.new({
 		capabilities = {
 			none = {
 				create = false;
@@ -166,7 +167,9 @@
 
 		normalize_jid = jid_bare;
 	});
-	return services[name];
+	services[name] = service;
+	module:add_item("pep-service", { service = service, jid = name });
+	return service;
 end
 
 function handle_pubsub_iq(event)