Comparison

plugins/mod_pep_plus.lua @ 6432:388786af0dd2

mod_pep_plus: Add pubsub service objects to an item list
author Kim Alvefur <zash@zash.se>
date Sat, 27 Sep 2014 19:00:09 +0200
parent 6305:38d82f8ead25
child 6443:f4403c270ea2
comparison
equal deleted inserted replaced
6431:540f4e33394a 6432:388786af0dd2
53 end 53 end
54 return simple_broadcast; 54 return simple_broadcast;
55 end 55 end
56 56
57 function get_pep_service(name) 57 function get_pep_service(name)
58 if services[name] then 58 local service = services[name];
59 return services[name]; 59 if service then
60 end 60 return service;
61 services[name] = pubsub.new({ 61 end
62 service = pubsub.new({
62 capabilities = { 63 capabilities = {
63 none = { 64 none = {
64 create = false; 65 create = false;
65 publish = false; 66 publish = false;
66 retract = false; 67 retract = false;
164 end 165 end
165 end; 166 end;
166 167
167 normalize_jid = jid_bare; 168 normalize_jid = jid_bare;
168 }); 169 });
169 return services[name]; 170 services[name] = service;
171 module:add_item("pep-service", { service = service, jid = name });
172 return service;
170 end 173 end
171 174
172 function handle_pubsub_iq(event) 175 function handle_pubsub_iq(event)
173 local origin, stanza = event.origin, event.stanza; 176 local origin, stanza = event.origin, event.stanza;
174 local pubsub = stanza.tags[1]; 177 local pubsub = stanza.tags[1];